From 0837e7451a84f95c29dbdb9bd6b8b931fee1635d Mon Sep 17 00:00:00 2001 From: Julian Sikorski Date: Sun, 13 Oct 2019 13:50:38 +0200 Subject: WIP: sync bgfx, bx and bimg with latest upstream (#5723) * Sync with bgfx upstream revision b91d0b6 * Sync with bx upstream revision d60912b * Sync with bimg upstream revision bd81f60 * Add astc-codec decoder * Rename VertexDecl to VertexLayout * Rename UniformType enum Int1 to Sampler. * Add NVN stub * Fix unused-const-variable error on macOS * Drop redundant explicit language parameters buildoptions_cpp are only applied to c++ files and buildoptions_objcpp are only applied to objective c++ files. As such, hardcoding -x offers no benefit while preventing overrides (such as one needed by 3rdparty/bgfx/src/renderer_vk.cpp on macOS) from working. * Re-introduce -x c++ in places where C code is compiled as C++ to prevent clang from throwing a warning * Build bgfx as Objective-C++ on macOS It is needed due to included headers * Enable Direct3D12 and Vulkan bgfx rendering backends * Enable building of spirv shaders * Properly escape /c in cmd call * Comment out dx12 bgfx renderer * Honor VERBOSE setting during shaders build * Only invert hlsl shader XYZ_TO_sRGB matrix for opengl * Add spirv shaders * OpenGL ES needs transposed matrix too * Metal needs transposed matrix as well --- 3rdparty/bgfx/src/renderer_d3d11.h | 60 ++++++++++++++++++++++++++------------ 1 file changed, 41 insertions(+), 19 deletions(-) (limited to '3rdparty/bgfx/src/renderer_d3d11.h') diff --git a/3rdparty/bgfx/src/renderer_d3d11.h b/3rdparty/bgfx/src/renderer_d3d11.h index 2e021c4aa2f..a6efe141f05 100644 --- a/3rdparty/bgfx/src/renderer_d3d11.h +++ b/3rdparty/bgfx/src/renderer_d3d11.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2018 Branimir Karadzic. All rights reserved. + * Copyright 2011-2019 Branimir Karadzic. All rights reserved. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause */ @@ -10,8 +10,8 @@ #define USE_D3D11_STAGING_BUFFER 0 #if !USE_D3D11_DYNAMIC_LIB -# undef BGFX_CONFIG_DEBUG_PIX -# define BGFX_CONFIG_DEBUG_PIX 0 +# undef BGFX_CONFIG_DEBUG_ANNOTATION +# define BGFX_CONFIG_DEBUG_ANNOTATION 0 #endif // !USE_D3D11_DYNAMIC_LIB BX_PRAGMA_DIAGNOSTIC_PUSH(); @@ -40,19 +40,37 @@ BX_PRAGMA_DIAGNOSTIC_POP() #include "nvapi.h" #include "dxgi.h" -#define BGFX_D3D11_BLEND_STATE_MASK (0 \ - | BGFX_STATE_BLEND_MASK \ - | BGFX_STATE_BLEND_EQUATION_MASK \ - | BGFX_STATE_BLEND_INDEPENDENT \ - | BGFX_STATE_BLEND_ALPHA_TO_COVERAGE \ - | BGFX_STATE_WRITE_A \ - | BGFX_STATE_WRITE_RGB \ - ) +#define BGFX_D3D11_BLEND_STATE_MASK (0 \ + | BGFX_STATE_BLEND_MASK \ + | BGFX_STATE_BLEND_EQUATION_MASK \ + | BGFX_STATE_BLEND_INDEPENDENT \ + | BGFX_STATE_BLEND_ALPHA_TO_COVERAGE \ + | BGFX_STATE_WRITE_A \ + | BGFX_STATE_WRITE_RGB \ + ) #define BGFX_D3D11_DEPTH_STENCIL_MASK (0 \ - | BGFX_STATE_WRITE_Z \ - | BGFX_STATE_DEPTH_TEST_MASK \ - ) + | BGFX_STATE_WRITE_Z \ + | BGFX_STATE_DEPTH_TEST_MASK \ + ) + +#define BGFX_D3D11_PROFILER_BEGIN(_view, _abgr) \ + BX_MACRO_BLOCK_BEGIN \ + PIX_BEGINEVENT(_abgr, s_viewNameW[_view]); \ + BGFX_PROFILER_BEGIN(s_viewName[view], _abgr); \ + BX_MACRO_BLOCK_END + +#define BGFX_D3D11_PROFILER_BEGIN_LITERAL(_name, _abgr) \ + BX_MACRO_BLOCK_BEGIN \ + PIX_BEGINEVENT(_abgr, L"" # _name); \ + BGFX_PROFILER_BEGIN_LITERAL("" # _name, _abgr); \ + BX_MACRO_BLOCK_END + +#define BGFX_D3D11_PROFILER_END() \ + BX_MACRO_BLOCK_BEGIN \ + BGFX_PROFILER_END(); \ + PIX_ENDEVENT(); \ + BX_MACRO_BLOCK_END namespace bgfx { namespace d3d11 { @@ -109,9 +127,9 @@ namespace bgfx { namespace d3d11 { } - void create(uint32_t _size, void* _data, VertexDeclHandle _declHandle, uint16_t _flags); + void create(uint32_t _size, void* _data, VertexLayoutHandle _layoutHandle, uint16_t _flags); - VertexDeclHandle m_decl; + VertexLayoutHandle m_layoutHandle; }; struct ShaderD3D11 @@ -294,6 +312,7 @@ namespace bgfx { namespace d3d11 uint32_t m_width; uint32_t m_height; uint32_t m_depth; + uint32_t m_numLayers; uint8_t m_type; uint8_t m_requestedFormat; uint8_t m_textureFormat; @@ -311,6 +330,7 @@ namespace bgfx { namespace d3d11 , m_denseIdx(UINT16_MAX) , m_num(0) , m_numTh(0) + , m_numUav(0) , m_needPresent(false) { } @@ -325,9 +345,10 @@ namespace bgfx { namespace d3d11 void set(); HRESULT present(uint32_t _syncInterval); - ID3D11RenderTargetView* m_rtv[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS-1]; - ID3D11ShaderResourceView* m_srv[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS-1]; - ID3D11DepthStencilView* m_dsv; + ID3D11RenderTargetView* m_rtv[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS-1]; + ID3D11UnorderedAccessView* m_uav[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS-1]; + ID3D11ShaderResourceView* m_srv[BGFX_CONFIG_MAX_FRAME_BUFFER_ATTACHMENTS-1]; + ID3D11DepthStencilView* m_dsv; Dxgi::SwapChainI* m_swapChain; void* m_nwh; uint32_t m_width; @@ -337,6 +358,7 @@ namespace bgfx { namespace d3d11 uint16_t m_denseIdx; uint8_t m_num; uint8_t m_numTh; + uint8_t m_numUav; bool m_needPresent; }; -- cgit v1.2.3-70-g09d2