From 7f26e40e0898391a32e6a05d91ef1a217d885668 Mon Sep 17 00:00:00 2001 From: azhirnov Date: Sun, 25 Oct 2020 15:53:05 +0300 Subject: PSO refactoring for ray tracing --- .../GraphicsEngineD3D11/include/PipelineStateD3D11Impl.hpp | 2 +- .../GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.hpp | 4 ++++ .../include/ShaderResourceBindingD3D11Impl.hpp | 2 +- Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp | 2 ++ Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp | 13 ++++++++++++- .../GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp | 5 +++++ Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp | 10 ++++++++++ 7 files changed, 35 insertions(+), 3 deletions(-) (limited to 'Graphics/GraphicsEngineD3D11') diff --git a/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.hpp b/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.hpp index 520e9bb0..77b68360 100644 --- a/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.hpp +++ b/Graphics/GraphicsEngineD3D11/include/PipelineStateD3D11Impl.hpp @@ -166,7 +166,7 @@ private: // Resource layout index in m_pStaticResourceLayouts array for every shader stage, // indexed by the shader type pipeline index (returned by GetShaderTypePipelineIndex) - std::array m_ResourceLayoutIndex = {-1, -1, -1, -1, -1}; + std::array m_ResourceLayoutIndex = {-1, -1, -1, -1, -1, -1}; std::array m_ImmutableSamplerOffsets = {}; struct ImmutableSamplerInfo diff --git a/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.hpp b/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.hpp index 8565935d..3e5ef8f1 100644 --- a/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.hpp +++ b/Graphics/GraphicsEngineD3D11/include/RenderDeviceD3D11Impl.hpp @@ -77,6 +77,10 @@ public: virtual void DILIGENT_CALL_TYPE CreateComputePipelineState(const ComputePipelineStateCreateInfo& PSOCreateInfo, IPipelineState** ppPipelineState) override final; + /// Implementation of IRenderDevice::CreateRayTracingPipelineState() in Direct3D11 backend. + virtual void DILIGENT_CALL_TYPE CreateRayTracingPipelineState(const RayTracingPipelineStateCreateInfo& PSOCreateInfo, + IPipelineState** ppPipelineState) override final; + /// Implementation of IRenderDevice::CreateFence() in Direct3D11 backend. virtual void DILIGENT_CALL_TYPE CreateFence(const FenceDesc& Desc, IFence** ppFence) override final; diff --git a/Graphics/GraphicsEngineD3D11/include/ShaderResourceBindingD3D11Impl.hpp b/Graphics/GraphicsEngineD3D11/include/ShaderResourceBindingD3D11Impl.hpp index 21437e0f..1e7fd160 100644 --- a/Graphics/GraphicsEngineD3D11/include/ShaderResourceBindingD3D11Impl.hpp +++ b/Graphics/GraphicsEngineD3D11/include/ShaderResourceBindingD3D11Impl.hpp @@ -110,7 +110,7 @@ private: // Resource layout index in m_pResourceLayouts array for every shader stage, // indexed by the shader type pipeline index (returned by GetShaderTypePipelineIndex) - std::array m_ResourceLayoutIndex = {-1, -1, -1, -1, -1}; + std::array m_ResourceLayoutIndex = {-1, -1, -1, -1, -1, -1}; Uint8 m_NumActiveShaders = 0; diff --git a/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp index 108f149c..1c03690e 100644 --- a/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/PipelineStateD3D11Impl.cpp @@ -203,6 +203,8 @@ PipelineStateD3D11Impl::~PipelineStateD3D11Impl() void PipelineStateD3D11Impl::Destruct() { + TPipelineStateBase::Destruct(); + if (m_pStaticResourceLayouts != nullptr) { for (Uint32 l = 0; l < GetNumShaderStages(); ++l) diff --git a/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp b/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp index 06cda6ad..4453b598 100644 --- a/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp +++ b/Graphics/GraphicsEngineD3D11/src/RenderDeviceD3D11Impl.cpp @@ -101,13 +101,18 @@ RenderDeviceD3D11Impl::RenderDeviceD3D11Impl(IReferenceCounters* pRefCo sizeof(FenceD3D11Impl), sizeof(QueryD3D11Impl), sizeof(RenderPassD3D11Impl), - sizeof(FramebufferD3D11Impl) + sizeof(FramebufferD3D11Impl), + 0, + 0, + 0 } }, m_EngineAttribs{EngineAttribs}, m_pd3d11Device {pd3d11Device } // clang-format on { + static_assert(sizeof(DeviceObjectSizes) == sizeof(size_t) * 15, "Please add new objects to DeviceObjectSizes constructor"); + m_DeviceCaps.DevType = RENDER_DEVICE_TYPE_D3D11; auto FeatureLevel = m_pd3d11Device->GetFeatureLevel(); switch (FeatureLevel) @@ -409,6 +414,12 @@ void RenderDeviceD3D11Impl::CreateComputePipelineState(const ComputePipelineStat CreatePipelineState(PSOCreateInfo, ppPipelineState); } +void RenderDeviceD3D11Impl::CreateRayTracingPipelineState(const RayTracingPipelineStateCreateInfo& PSOCreateInfo, IPipelineState** ppPipelineState) +{ + UNSUPPORTED("CreateRayTracingPipelineState is not supported in DirectX 11"); + *ppPipelineState = nullptr; +} + void RenderDeviceD3D11Impl::CreateFence(const FenceDesc& Desc, IFence** ppFence) { CreateDeviceObject("Fence", Desc, ppFence, diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp index f7c1958d..0c4c38c7 100755 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourceLayoutD3D11.cpp @@ -292,6 +292,11 @@ void ShaderResourceLayoutD3D11::Initialize(std::shared_ptr(bufUav++)) BuffUAVBindInfo(BuffUAV, *this, VarType); NumUAVSlots = std::max(NumUAVSlots, Uint32{BuffUAV.BindPoint} + Uint32{BuffUAV.BindCount}); } + }, + + [&](const D3DShaderResourceAttribs&, Uint32) // + { + UNEXPECTED("acceleration structure is not supported in DirectX 11"); }); // clang-format off diff --git a/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp b/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp index 21a65108..b6430c04 100755 --- a/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp +++ b/Graphics/GraphicsEngineD3D11/src/ShaderResourcesD3D11.cpp @@ -94,6 +94,11 @@ ShaderResourcesD3D11::ShaderResourcesD3D11(RenderDeviceD3D11Impl* pDeviceD3D11Im Resources.m_MaxSRVBindPoint = std::max(Resources.m_MaxSRVBindPoint, static_cast(TexAttribs.BindPoint + TexAttribs.BindCount - 1)); } + void OnNewAccelStruct(const D3DShaderResourceAttribs& ASAttribs) + { + UNEXPECTED("Acceleration structure is not supported in DirectX 11"); + } + ~NewResourceHandler() { } @@ -439,6 +444,11 @@ void ShaderResourcesD3D11::dvpVerifyCommittedResources(ID3D11Buffer* return; } } + }, + + [&](const D3DShaderResourceAttribs&, Uint32) // + { + UNEXPECTED("acceleration structure is not supported in DirectX 11"); } // clang-format off ); // clang-format on } -- cgit v1.2.3