mirror of
https://github.com/bkaradzic/bgfx.git
synced 2026-02-17 20:52:36 +01:00
Adds UAV support for D3D12, Vulkan and reworked for OpenGL, D3D11 (#2119)
* 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.
This commit is contained in:
@@ -13,13 +13,13 @@ extern "C"
|
||||
#include <fpp.h>
|
||||
} // extern "C"
|
||||
|
||||
#define BGFX_SHADER_BIN_VERSION 8
|
||||
#define BGFX_SHADER_BIN_VERSION 9
|
||||
#define BGFX_CHUNK_MAGIC_CSH BX_MAKEFOURCC('C', 'S', 'H', BGFX_SHADER_BIN_VERSION)
|
||||
#define BGFX_CHUNK_MAGIC_FSH BX_MAKEFOURCC('F', 'S', 'H', BGFX_SHADER_BIN_VERSION)
|
||||
#define BGFX_CHUNK_MAGIC_VSH BX_MAKEFOURCC('V', 'S', 'H', BGFX_SHADER_BIN_VERSION)
|
||||
|
||||
#define BGFX_SHADERC_VERSION_MAJOR 1
|
||||
#define BGFX_SHADERC_VERSION_MINOR 16
|
||||
#define BGFX_SHADERC_VERSION_MINOR 17
|
||||
|
||||
namespace bgfx
|
||||
{
|
||||
|
||||
@@ -1023,7 +1023,7 @@ namespace bgfx { namespace spirv
|
||||
}
|
||||
}
|
||||
|
||||
// Loop through the separate_images, and extract the uniform names:
|
||||
// Loop through the storage_images, and extract the uniform names:
|
||||
for (auto &resource : resourcesrefl.storage_images)
|
||||
{
|
||||
std::string name = refl.get_name(resource.id);
|
||||
|
||||
Reference in New Issue
Block a user