This extension is used to detect support for gl_InstanceID and gl_VertexID. However, in more recent
versions of OpenGL, this is built-in functionality. On my system, it does not list that extension,
even though it supports those features, but BGFX was not detecting that.
Updated detection to look for GL>=3.1.
Note 1: even with this change, you do need to compile BGFX with the appropriate
BGFX_CONFIG_RENDERER_OPENGL value (>=31). The default of 21 is not high enough.
Note 2: Even with all of the above, you will likely hit issues with duplicate '#version' lines in
the generated shader code. For that, see issue #xxxx.
fixes issue #2570
* Weird fix for frame rate doubling after second created window.
* Don't double buffer with vsync in metal to prevent 2x fps instead.
* Setting number of back buffers in metal if available.
* Better function call syntax.
* Matching maxFrameLatency to maximumDrawableCount in Metal backend.
* Use already injected RenderDoc dll, or load it from default location
- on Windows, if the process was launched from RenderDoc and the dll is already injected, use it
- otherwise try to load the dll from the default installation path in Program Files
- doesn't need the dll to be copied next to the exe or in the system PATH, which is not the supported way to do it according to BaldurK - see https://github.com/baldurk/renderdoc/issues/2279#issuecomment-844588691
* Restore previous implementation of findModule
* Address PR feedback
Co-authored-by: Nathan Reed <nareed@adobe.com>
Adds support on tools.mk for the msys2 environment. The OS is still
considered windows but the command line tools for mkdir and rmdir
behave as if on linux.
The variable SHADER_TMP on the makefiles also had to be quoted to make
it work on msys2.
This echo command on the makefile behaves differently between linux and gnuwin32:
```
-@echo extern const uint8_t* $(basename $(<))_pssl;>> $(@)
```
On linux the semicolon immediately ends the echo command and its output is never piped to the embedded shader's header.
If you try to fix it by quoting the string:
```
-@echo "extern const uint8_t* $(basename $(<))_pssl;" >> $(@)
```
It will work on linux but not on gnuwin32 because the quotes will appear on the outputted string.
The solution was to use printf which works consistently between the two.
Also on gnuwin32 the outputted string has 'CRLF' line endings, which clashes with the rest of the 'LF' line endings
of the embedded shaders header which were produced by shaderc.
The solution was to remove the 'CR' from the outputted string by using the tr command.
In non-embedded shaders there is a separation between essl binaries (examples/runtime/shaders/essl)
and glsl binaries (examples/runtime/shaders/glsl). On embedded shaders there is no such separation
and by default essl shaders are being used by the OpenGL runtime. This usually doesn't cause any
issues but in the case of the debugdraw shaders, that started using uvec4, this now leads to a
runtime error. This patch fixes this by splitting the embedded shaders into essl and glsl.
As asked, this is the first part of the change.
To be able to compile the 'examples/common/debugdraw' shaders, pull
request #2362 is needed.
* 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.