diff options
| author | Egor Yusov <egor.yusov@gmail.com> | 2018-12-05 04:28:04 +0000 |
|---|---|---|
| committer | Egor Yusov <egor.yusov@gmail.com> | 2018-12-05 04:28:04 +0000 |
| commit | bc034568a62b12a813c0f7445cd85d00fdeda390 (patch) | |
| tree | 1de0b9c9a6a8cf0c500a8ca3409c4b9d2f44f410 /Graphics/GraphicsEngineD3D12 | |
| parent | Minor code improvements in Vk backend (diff) | |
| download | DiligentCore-bc034568a62b12a813c0f7445cd85d00fdeda390.tar.gz DiligentCore-bc034568a62b12a813c0f7445cd85d00fdeda390.zip | |
Added ITextureD3D12::GetD3D12ResourceState(), IBufferD3D12::GetD3D12ResourceState(),
and IBufferVk::GetAccessFlags() methods
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
7 files changed, 26 insertions, 2 deletions
diff --git a/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.h index 6d187b53..7dfe70d3 100644 --- a/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.h +++ b/Graphics/GraphicsEngineD3D12/include/BufferD3D12Impl.h @@ -77,6 +77,8 @@ public: virtual void SetD3D12ResourceState(D3D12_RESOURCE_STATES state)override final; + virtual D3D12_RESOURCE_STATES GetD3D12ResourceState()const override final; + D3D12_GPU_VIRTUAL_ADDRESS GetGPUAddress(class DeviceContextD3D12Impl* pCtx); D3D12_CPU_DESCRIPTOR_HANDLE GetCBVHandle(){return m_CBVDescriptorAllocation.GetCpuHandle();} diff --git a/Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.h b/Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.h index ba1c94c5..d1bf9ec6 100644 --- a/Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.h +++ b/Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.h @@ -68,6 +68,8 @@ public: virtual void SetD3D12ResourceState(D3D12_RESOURCE_STATES state)override final; + virtual D3D12_RESOURCE_STATES GetD3D12ResourceState()const override final; + D3D12_CPU_DESCRIPTOR_HANDLE GetMipLevelUAV(Uint32 Mip) { return m_MipUAVs.GetCpuHandle(Mip); diff --git a/Graphics/GraphicsEngineD3D12/interface/BufferD3D12.h b/Graphics/GraphicsEngineD3D12/interface/BufferD3D12.h index cd33e740..71880f38 100644 --- a/Graphics/GraphicsEngineD3D12/interface/BufferD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/BufferD3D12.h @@ -57,6 +57,11 @@ public: /// \param [in] state - D3D12 resource state to be set for this buffer virtual void SetD3D12ResourceState(D3D12_RESOURCE_STATES state) = 0; + + /// Returns current D3D12 buffer state. + /// If the state is unknown to the engine (Diligent::RESOURCE_STATE_UNKNOWN), + /// returns D3D12_RESOURCE_STATE_COMMON (0). + virtual D3D12_RESOURCE_STATES GetD3D12ResourceState()const = 0; }; } diff --git a/Graphics/GraphicsEngineD3D12/interface/TextureD3D12.h b/Graphics/GraphicsEngineD3D12/interface/TextureD3D12.h index cb3b5dfa..611ac528 100644 --- a/Graphics/GraphicsEngineD3D12/interface/TextureD3D12.h +++ b/Graphics/GraphicsEngineD3D12/interface/TextureD3D12.h @@ -50,6 +50,11 @@ public: /// \param [in] state - D3D12 resource state to be set for this texture virtual void SetD3D12ResourceState(D3D12_RESOURCE_STATES state) = 0; + + /// Returns current D3D12 texture state. + /// If the state is unknown to the engine (Diligent::RESOURCE_STATE_UNKNOWN), + /// returns D3D12_RESOURCE_STATE_COMMON (0). + virtual D3D12_RESOURCE_STATES GetD3D12ResourceState()const = 0; }; } diff --git a/Graphics/GraphicsEngineD3D12/src/BufferD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/BufferD3D12Impl.cpp index af521f11..e59ac73a 100644 --- a/Graphics/GraphicsEngineD3D12/src/BufferD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/BufferD3D12Impl.cpp @@ -420,4 +420,9 @@ void BufferD3D12Impl::SetD3D12ResourceState(D3D12_RESOURCE_STATES state) SetState(D3D12ResourceStatesToResourceStateFlags(state)); } +D3D12_RESOURCE_STATES BufferD3D12Impl::GetD3D12ResourceState()const +{ + return ResourceStateFlagsToD3D12ResourceStates(GetState()); +} + } diff --git a/Graphics/GraphicsEngineD3D12/src/D3D12TypeConversions.cpp b/Graphics/GraphicsEngineD3D12/src/D3D12TypeConversions.cpp index 0f1c2867..e90f5a72 100644 --- a/Graphics/GraphicsEngineD3D12/src/D3D12TypeConversions.cpp +++ b/Graphics/GraphicsEngineD3D12/src/D3D12TypeConversions.cpp @@ -363,7 +363,7 @@ D3D12_RESOURCE_STATES ResourceStateFlagsToD3D12ResourceStates(RESOURCE_STATE Sta { VERIFY(StateFlags < (RESOURCE_STATE_MAX_BIT<<1), "Resource state flags are out of range"); static const StateFlagBitPosToD3D12ResourceState BitPosToD3D12ResState; - Uint32 D3D12ResourceStates = 0; + D3D12_RESOURCE_STATES D3D12ResourceStates = static_cast<D3D12_RESOURCE_STATES>(0); Uint32 Bits = StateFlags; while(Bits != 0) { @@ -371,7 +371,7 @@ D3D12_RESOURCE_STATES ResourceStateFlagsToD3D12ResourceStates(RESOURCE_STATE Sta D3D12ResourceStates |= BitPosToD3D12ResState(lsb); Bits &= ~(1<<lsb); } - return static_cast<D3D12_RESOURCE_STATES>(D3D12ResourceStates); + return D3D12ResourceStates; } diff --git a/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp index 173049cc..71e6be01 100644 --- a/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp @@ -488,4 +488,9 @@ void TextureD3D12Impl::SetD3D12ResourceState(D3D12_RESOURCE_STATES state) SetState(D3D12ResourceStatesToResourceStateFlags(state)); } +D3D12_RESOURCE_STATES TextureD3D12Impl::GetD3D12ResourceState()const +{ + return ResourceStateFlagsToD3D12ResourceStates(GetState()); +} + } |
