diff options
Diffstat (limited to '3rdparty/bgfx/src/renderer_d3d11.h')
-rw-r--r-- | 3rdparty/bgfx/src/renderer_d3d11.h | 52 |
1 files changed, 40 insertions, 12 deletions
diff --git a/3rdparty/bgfx/src/renderer_d3d11.h b/3rdparty/bgfx/src/renderer_d3d11.h index 852a69e11c0..699352d98e5 100644 --- a/3rdparty/bgfx/src/renderer_d3d11.h +++ b/3rdparty/bgfx/src/renderer_d3d11.h @@ -6,7 +6,8 @@ #ifndef BGFX_RENDERER_D3D11_H_HEADER_GUARD #define BGFX_RENDERER_D3D11_H_HEADER_GUARD -#define USE_D3D11_DYNAMIC_LIB BX_PLATFORM_WINDOWS +#define USE_D3D11_DYNAMIC_LIB BX_PLATFORM_WINDOWS +#define USE_D3D11_STAGING_BUFFER 0 #if !USE_D3D11_DYNAMIC_LIB # undef BGFX_CONFIG_DEBUG_PIX @@ -35,6 +36,7 @@ BX_PRAGMA_DIAGNOSTIC_POP() #include "hmd.h" #include "hmd_openvr.h" #include "debug_renderdoc.h" +#include "nvapi.h" #ifndef D3DCOLOR_ARGB # define D3DCOLOR_ARGB(_a, _r, _g, _b) ( (DWORD)( ( ( (_a)&0xff)<<24)|( ( (_r)&0xff)<<16)|( ( (_g)&0xff)<<8)|( (_b)&0xff) ) ) @@ -64,6 +66,9 @@ namespace bgfx { namespace d3d11 { BufferD3D11() : m_ptr(NULL) +#if USE_D3D11_STAGING_BUFFER + , m_staging(NULL) +#endif // USE_D3D11_STAGING_BUFFER , m_srv(NULL) , m_uav(NULL) , m_flags(BGFX_BUFFER_NONE) @@ -82,11 +87,18 @@ namespace bgfx { namespace d3d11 m_dynamic = false; } +#if USE_D3D11_STAGING_BUFFER + DX_RELEASE(m_staging, 0); +#endif // USE_D3D11_STAGING_BUFFER + DX_RELEASE(m_srv, 0); DX_RELEASE(m_uav, 0); } ID3D11Buffer* m_ptr; +#if USE_D3D11_STAGING_BUFFER + ID3D11Buffer* m_staging; +#endif // USE_D3D11_STAGING_BUFFER ID3D11ShaderResourceView* m_srv; ID3D11UnorderedAccessView* m_uav; uint32_t m_size; @@ -154,7 +166,7 @@ namespace bgfx { namespace d3d11 ID3D11ComputeShader* m_computeShader; ID3D11PixelShader* m_pixelShader; ID3D11VertexShader* m_vertexShader; - IUnknown* m_ptr; + ID3D11DeviceChild* m_ptr; }; const Memory* m_code; ID3D11Buffer* m_buffer; @@ -233,6 +245,7 @@ namespace bgfx { namespace d3d11 void commit(uint8_t _stage, uint32_t _flags, const float _palette[][4]); void resolve() const; TextureHandle getHandle() const; + DXGI_FORMAT getSrvFormat() const; union { @@ -300,29 +313,44 @@ namespace bgfx { namespace d3d11 struct TimerQueryD3D11 { TimerQueryD3D11() - : m_control(BX_COUNTOF(m_frame) ) + : m_control(BX_COUNTOF(m_query) ) { } void postReset(); void preReset(); - void begin(); - void end(); - bool get(); + uint32_t begin(uint32_t _resultIdx); + void end(uint32_t _idx); + bool update(); - struct Frame + struct Query { ID3D11Query* m_disjoint; ID3D11Query* m_begin; ID3D11Query* m_end; + uint32_t m_resultIdx; + bool m_ready; + }; + + struct Result + { + void reset() + { + m_begin = 0; + m_end = 0; + m_frequency = 1; + m_pending = 0; + } + + uint64_t m_begin; + uint64_t m_end; + uint64_t m_frequency; + uint32_t m_pending; }; - uint64_t m_begin; - uint64_t m_end; - uint64_t m_elapsed; - uint64_t m_frequency; + Result m_result[BGFX_CONFIG_MAX_VIEWS+1]; - Frame m_frame[4]; + Query m_query[BGFX_CONFIG_MAX_VIEWS*4]; bx::RingBufferControl m_control; }; |