* fix mip level computation for asmjs and add support for srgb textures in es2/webgl
* fix BX_TRACE in glcontext_html5.cpp
* fix wrong logic in texture validation
Co-authored-by: Sebastian Marketsmueller <sebastianm@hq.unity3d.com>
Co-authored-by: Vladimir Vukicevic <vladimir@pobox.com>
* Cleanup
* Request host-cached memory for readback
* Request device-visible memory for the uniform buffer
* Use more fine-grained image memory barrier stages
* Don't rebind vertex and index buffers if not necessary
* Timer queries
* Don't transition images during a renderpass
* Cache descriptor sets
* Trigger RenderDoc capture if requested
* Fix invalid command buffer after surface recreation
* Perform clear and blit before compute
* Use init.debug to enable validation layers
...instead of always enabling them in debug config
* Only resolve framebuffer once
* Report number of primitives without index buffer
* Minimize state changes
* Occlusion queries
* Transition swapchain image from undefined layout
* Make sure we have a combined graphics and compute queue family
Existing code already makes that assumption, otherwise we'd need different command queues and explicit resource queue transitions. The spec also guarantees that a device with such a queue family should exist.
* Release cached image views on texture destruction
* Fix stencil-only clear
* Fix non-zero integer format clear
* Annotate all optional functions with their extensions
* Support for BGFX_SAMPLER_SAMPLE_STENCIL
* Remove unused extension functions
* Support for BGFX_SAMPLER_BORDER_COLOR
* Undo descriptor set cache
Try this again in another PR... the hashing doesn't quite work with some bind combinations, and the cache needs a better eviction strategy
* Don't start renderpass for empty draw calls
* Advertize graphics debugger, if present
ie. RenderDoc
* Cleanup
* Only enable required features and extensions
* Don't spam warning about swapchain format fallback
* Cleanup
* Cleanup
* Request host-cached memory for readback
* Request device-visible memory for the uniform buffer
* Use more fine-grained image memory barrier stages
* Don't rebind vertex and index buffers if not necessary
* Timer queries
* Don't transition images during a renderpass
* Cache descriptor sets
* Trigger RenderDoc capture if requested
* Fix invalid command buffer after surface recreation
* Perform clear and blit before compute
* Use init.debug to enable validation layers
...instead of always enabling them in debug config
* Only resolve framebuffer once
* Report number of primitives without index buffer
* Minimize state changes
* Occlusion queries
* Transition swapchain image from undefined layout
* Make sure we have a combined graphics and compute queue family
Existing code already makes that assumption, otherwise we'd need different command queues and explicit resource queue transitions. The spec also guarantees that a device with such a queue family should exist.
* Release cached image views on texture destruction
* Fix stencil-only clear
* Fix non-zero integer format clear
* Annotate all optional functions with their extensions
* Support for BGFX_SAMPLER_SAMPLE_STENCIL
* Remove unused extension functions
* Support for BGFX_SAMPLER_BORDER_COLOR
* Undo descriptor set cache
Try this again in another PR... the hashing doesn't quite work with some bind combinations, and the cache needs a better eviction strategy
* Don't start renderpass for empty draw calls
* Advertize graphics debugger, if present
ie. RenderDoc
* Cleanup
* Only enable required features and extensions
* Don't spam warning about swapchain format fallback
* Cleanup
* Use correct aspect masks for stencil-only textures
* Make vkEnumerateInstanceVersion optional
This makes init not abort on Vulkan 1.0
* Move swapchain into FrameBufferVK
* Remove duplicate render pass creation code
* Manually resolve MSAA backbuffer
not guaranteed to be supported, but reduces resolve operations from 2 * (num views using backbuffer) to 1
* Support for multiple windows (BGFX_CAPS_SWAP_CHAIN)
* Capture support (BGFX_RESET_CAPTURE)
* Display present timings
* Recreate surface if native window handle changed
* Delayed swapchain deletion on resize
no more vkDeviceWaitIdle
* Recreate surface if BGFX_RESET_HIDPI is toggled
* Don't recreate swapchain if only the MSAA sample count changed
* Some extra caps checks
* Configurable backbuffer depth format
* Configurable backbuffer color format
* WebGPU: Add texture format (shaderc bin version 10)
* WebGPU: Simplify storage images + Fix format decorations
* Shaderc: Cleanup Texture name assumption in textures
* Swapchain class
* Headless support
* MSAA backbuffer
* Fix framebuffer resolve
layout transitions were missing and framebuffer mips and layers weren't used
* Fix blit with MSAA resolve source
only the main texture layout was transitioned
* Fix pipeline hash
* Vulkan: calculate vertex count from all streams, not just the first
...which might not exist in the first place
* Vulkan: use correct vertex stream offsets and handles
* D3D11: remember stream vertex count when no index buffer is bound
* Don't enable optional extensions if BGFX_CONFIG_RENDERER_USE_EXTENSIONS is 0
* Support rendering to slices of 3D textures
* Create transient command pool
* Blit array layers for non-cube textures
* Clean up destroy and release functions
Simplifies CommandQueueVK code, automatically sets handles to NULL after release(), removes the need for explicit StateCacheT instantiations, and enables usage of StateCacheLru
* Fix renderpass hash calculation
* Allow sampling cube array textures
* Make StateCacheLru work with types overloading the address-of operator
* Alias textures to shader sampler type
Requires shaders with shaderc binary version 8 or higher
* Fix 32-bit compilation
If you do
```
bgfx::setIndexBuffer()
bgfx::submit(BGFX_DISCARD_NONE)
bgfx::submit()
```
then the second submit will be broken because even though it still uses the correct index buffer it will lose the BGFX_SUBMIT_INTERNAL_INDEX32 state.
Basically all multi-pass calls involving a 32index buffer are broken currently in bgfx master.
This fixes bug introduced by 5c304dad3b
* Fix variable naming
* Check if VK_KHR_get_physical_device_properties2 is actually supported
* Fix extension detection logic
Device extension data wasn't cleared after enumerating each physical device, essentially checking if ANY device supports that extensions, not just the selected device
* Vulkan: add conservative rasterization
* Vulkan: check device features for caps and state
* Vulkan: add line AA
* Don't assert in init()
* Vulkan: fix swapchain reset logic and handle lost surface
* Vulkan: report dedicated memory info in Stats
* Vulkan: fix sRGB backbuffer pipeline hash
* Vulkan: check BGFX_RESET_SUSPEND
* Fix typo in SPIR-V id
* Use backend-agnostic shaderc output
...as opposed to directly storing and comparing against Vulkan and WebGPU enums. This is backwards-compatible with existing code and shaders.
* Remove comments and Undefined value
* Vulkan: query max anisotropy
...instead of hardcoding it to 4
* Vulkan: use BGFX_CONFIG_MIP_LOD_BIAS
* Vulkan: consider BGFX_CONFIG_PREFER_DISCRETE_GPU at device selection
* Vulkan: implement resizing for textures with backbuffer ratio size
* Vulkan: use correct framebuffer attachment layer and mip
* Vulkan: bind correct image mip
* Cleanup
* Vulkan: add indirect draw support
* Vulkan: add support for BGFX_DEBUG_WIREFRAME
* Vulkan: check all extensions and layers
... not just the first 64
* Vulkan: add support for VPRT
https://github.com/bkaradzic/bgfx/issues/2320
* Vulkan: allow setting image debug name
* Vulkan: record multiple frames ahead of the GPU
...instead of stalling on the CPU after each submit. Controllable with init.resolution.maxFrameLatency, same as the D3D11/12 backends.
* Vulkan: some additional checks at swapchain creation
* Vulkan: stall for screenshot
* Vulkan: move blit out of render pass
* Vulkan: deferred framebuffer deletion
* Vulkan: fix cubemap blit
* Cleanup
* Vulkan: storage image must have GENERAL layout and has no sampler
* Vulkan: use slightly more fine-grained barriers
* Vulkan: readTexture should stall, too
* Cleanup
* Vulkan: selective acquire
Don't acquire a swapchain image if no view renders to the backbuffer, avoiding stalls due to vsync or reaching the backbuffer limit
* Vulkan: deferred program and state cache deletion
* Vulkan: fix debug blit
* fix resize buffer with compute read/write flag error
* only update dynamic buffer with compute read flag
Co-authored-by: chenjunjie <junjie020@163.com>
* Fix out of bounds index for unknown device types
* Vulkan: Insert barrier before image host reads
* Vulkan: Make commands wait for the wait semaphore
Making commands wait at BOTTOM_OF_PIPE is a no-op, resulting in instant execution
* Vulkan: Insert barrier between views/dispatches instead of waiting on the host
* Vulkan: Fix determination of access flag from image layout
This fixes two write-after-write races with copy commands after a layout transition to VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL
* Add BGFX_MAX_FRAME_LATENCY define
Affected backends either used a magic value of 3 or defined their own XX_MAX_FRAMES_IN_FLIGHT to be 3
* Vulkan: Include indirect draw in pipeline barrier
* Vulkan: honor init.resolution.numBackBuffers for swapchain size
* Make max frame latency configurable at compile time
When using this compute shader, the following validation errors appear.
This patch fixes the issue.
BUFFER_WR(cBuffer, uint, 1);
NUM_THREADS(1u, 1u, 1u)
void main()
{
cBuffer[0] = 0u;
}
../../../src/renderer_vk.cpp (628): BGFX ---E- CommandBuffer,
Validation, 0: Validation Error: [
VUID-vkCmdBindDescriptorSets-dynamicOffsetCount-00359 ] Object 0: handle =
0x7fffe453ec88, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID =
0x82756c54 | vkCmdBindDescriptorSets(): Attempting to bind 1 descriptorSets
with 0 dynamic descriptors, but dynamicOffsetCount is 1. It should exactly
match the number of dynamic descriptors. The Vulkan spec states:
dynamicOffsetCount must be equal to the total number of dynamic descriptors
in pDescriptorSets
(https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/
vkspec.html#VUID-vkCmdBindDescriptorSets-dynamicOffsetCount-00359)
../../../src/renderer_vk.cpp (628): BGFX ---E- Pipeline,
Validation, 0: Validation Error: [ VUID-vkCmdDispatch-None-02697 ] Object 0:
handle = 0xcd00000000cd, type = VK_OBJECT_TYPE_PIPELINE; Object 1: handle =
0x630000000063, type = VK_OBJECT_TYPE_PIPELINE_LAYOUT; Object 2:
VK_NULL_HANDLE, type = VK_OBJECT_TYPE_PIPELINE_LAYOUT; | MessageID =
0xfd9e3152 | vkCmdDispatch(): VkPipeline 0xcd00000000cd[] defined with
VkPipelineLayout 0x630000000063[] is not compatible for maximum set
statically used 0 with bound descriptor sets, last bound with
VkPipelineLayout 0x0[] The Vulkan spec states: For each set n that is
statically used by the VkPipeline bound to the pipeline bind point used by
this command, a descriptor set must have been bound to n at the same
pipeline bind point, with a VkPipelineLayout that is compatible for set n,
with the VkPipelineLayout used to create the current VkPipeline, as
described in Pipeline Layout Compatibility
(https://www.khronos.org/registry/vulkan/specs/1.2-extensions/html/
vkspec.html#VUID-vkCmdDispatch-None-02697)
../../../src/renderer_vk.cpp (628): BGFX ---E- CommandBuffer,
Validation, 0: Validation Error: [
UNASSIGNED-CoreValidation-DrawState-DescriptorSetNotBound ] Object 0: handle
= 0x7fffe453ec88, type = VK_OBJECT_TYPE_COMMAND_BUFFER; | MessageID =
0xcde11083 | VkPipeline 0xcd00000000cd[] uses set #0 but that set is not
bound.
The default provoking vertex on OpenGL is the last of a triangle, but
on D3D and Vulkan it is the first.
This patch sets the provoking vertex to the first vertex on OpenGL.
* [vulkan] Vulkan API auto-selection for latest available.
- Selects for the maximum vulkan API version available on the host's vulkan driver for a created instance.
- Stores the created instance's vulkan API version on RendererContextVK.
- Created instance's vulkan API version dumped using BX_TRACE in MAJOR.MINOR.PATCH format.
- Physical Device's vulkan API version dumped in MAJOR.MINOR.PATCH format.
* Address code review notes.
- Actually use `vkEnumerateInstanceVersion` if it exists.
- Remove "bgfx supported" vulkan api static array.
* D3D12: Fix readback for non-zero mip
* Fix blit with non-zero mip
This required clamping the blit extents to the mip size, which is moved out of the renderers now
* Assert formatting
* Adds UAV support for D3D12, Vulkan and reworked support for OpenGL, D3D11
UAV support is now uniform across compute and draw.
To set a UAV you just use bgfx::setImage() and IMAGE2D in the shader, just like in compute.
Due to these changes shaders will have to be recompiled.
The changes include:
- D3D11 requires patching of the UAV slot number (which is now done by modifying the DXBC instead of using a macro)
- If the DXBC binary includes a debug chunk, that is also patched to match the new slot number
- All the other renderers don't need any kind of patching
- There are some shader annotations to better convert the UAV format used in hlsl to spirv
Possibility of further enhancements:
- bgfx::setViewFrameBuffer() only supports binding to a framebuffer or, using BGFX_INVALID_HANDLE, to bind the default backbuffer. This doesn't allow for the case where there is no need to bind to either one of them, for example when using a fragment shader only to read and write to an UAV.
* Bump shader version, because they need to be recompiled.
* WGL support for passing a context when using renderFrame on non main thread
* NSGL support for passing a context when using renderFrame on non main thread
* WGL: Moved no window warning and added check prior to calling GetDC
When resizing the window, there's a race condition between the
validation of vkCreateSwapchainKHR's arguments and the actual
size of the window.
This ignores the validation warning when vkCreateSwapchainKHR succeeds.
On some graphic drivers vkAcquireNextImage and vkQueuePresentKHR
may return VK_SUBOPTIMAL_KHR. This is being handled as an error, which
leads to those frames being unnecessarily skipped.