From 2586d407886bb3ee178c69a9a62f58c9a123b4c0 Mon Sep 17 00:00:00 2001 From: Zhirnov Andrey <2104977+azhirnov@users.noreply.github.com> Date: Wed, 30 Dec 2020 01:36:30 +0300 Subject: Improvements for mesh shader & ray tracing (#180) * remove GLSL from mesh shader tests * small improvements for ray tracing --- .../GraphicsEngineD3D12/src/BottomLevelASD3D12Impl.cpp | 17 +++++++++-------- .../GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp | 2 +- .../GraphicsEngineD3D12/src/TopLevelASD3D12Impl.cpp | 9 +++++---- 3 files changed, 15 insertions(+), 13 deletions(-) (limited to 'Graphics/GraphicsEngineD3D12') diff --git a/Graphics/GraphicsEngineD3D12/src/BottomLevelASD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/BottomLevelASD3D12Impl.cpp index 39c52e68..a7f20c09 100644 --- a/Graphics/GraphicsEngineD3D12/src/BottomLevelASD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/BottomLevelASD3D12Impl.cpp @@ -41,8 +41,9 @@ BottomLevelASD3D12Impl::BottomLevelASD3D12Impl(IReferenceCounters* pRefCoun const BottomLevelASDesc& Desc) : TBottomLevelASBase{pRefCounters, pDeviceD3D12, Desc} { - auto* pd3d12Device = pDeviceD3D12->GetD3D12Device5(); - UINT64 ResultDataMaxSizeInBytes = 0; + auto* pd3d12Device = pDeviceD3D12->GetD3D12Device5(); + const auto& Limits = pDeviceD3D12->GetProperties(); + UINT64 ResultDataMaxSizeInBytes = 0; if (m_Desc.CompactedSize) { @@ -77,8 +78,8 @@ BottomLevelASD3D12Impl::BottomLevelASD3D12Impl(IReferenceCounters* pRefCoun MaxPrimitiveCount += src.MaxPrimitiveCount; } - DEV_CHECK_ERR(MaxPrimitiveCount <= pDeviceD3D12->GetProperties().MaxPrimitivesPerBLAS, - "Max primitive count (", MaxPrimitiveCount, ") exceeds device limit"); + DEV_CHECK_ERR(MaxPrimitiveCount <= Limits.MaxPrimitivesPerBLAS, + "Max primitive count (", MaxPrimitiveCount, ") exceeds device limit (", Limits.MaxPrimitivesPerBLAS, ")"); } else if (m_Desc.pBoxes != nullptr) { @@ -97,16 +98,16 @@ BottomLevelASD3D12Impl::BottomLevelASD3D12Impl(IReferenceCounters* pRefCoun MaxBoxCount += src.MaxBoxCount; } - DEV_CHECK_ERR(MaxBoxCount <= pDeviceD3D12->GetProperties().MaxPrimitivesPerBLAS, - "Max box count (", MaxBoxCount, ") exceeds device limit"); + DEV_CHECK_ERR(MaxBoxCount <= Limits.MaxPrimitivesPerBLAS, + "Max box count (", MaxBoxCount, ") exceeds device limit (", Limits.MaxPrimitivesPerBLAS, ")"); } else { UNEXPECTED("Either pTriangles or pBoxes must not be null"); } - DEV_CHECK_ERR(d3d12Geometries.size() <= pDeviceD3D12->GetProperties().MaxGeometriesPerBLAS, - "The number of geometries (", d3d12Geometries.size(), ") exceeds device limit"); + DEV_CHECK_ERR(d3d12Geometries.size() <= Limits.MaxGeometriesPerBLAS, + "The number of geometries (", d3d12Geometries.size(), ") exceeds device limit (", Limits.MaxGeometriesPerBLAS, ")"); d3d12BottomLevelInputs.Type = D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL; d3d12BottomLevelInputs.Flags = BuildASFlagsToD3D12ASBuildFlags(m_Desc.Flags); diff --git a/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp index 2f577bf9..c8927541 100644 --- a/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp @@ -111,7 +111,7 @@ void BuildRTPipelineDescription(const RayTracingPipelineStateCreateInfo& CreateI IDXCompiler* compiler, const TBindingMapPerStage& BindingMapPerStage) noexcept(false) { -#define LOG_PSO_ERROR_AND_THROW(...) LOG_ERROR_AND_THROW("Description of ray tracing PSO '", CreateInfo.PSODesc.Name, "' is invalid: ", ##__VA_ARGS__) +#define LOG_PSO_ERROR_AND_THROW(...) LOG_ERROR_AND_THROW("Description of ray tracing PSO '", (CreateInfo.PSODesc.Name ? CreateInfo.PSODesc.Name : ""), "' is invalid: ", ##__VA_ARGS__) Uint32 UnnamedExportIndex = 0; diff --git a/Graphics/GraphicsEngineD3D12/src/TopLevelASD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/TopLevelASD3D12Impl.cpp index cce9d2f6..39b2d2aa 100644 --- a/Graphics/GraphicsEngineD3D12/src/TopLevelASD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/TopLevelASD3D12Impl.cpp @@ -41,8 +41,9 @@ TopLevelASD3D12Impl::TopLevelASD3D12Impl(IReferenceCounters* pRefCounters, const TopLevelASDesc& Desc) : TTopLevelASBase{pRefCounters, pDeviceD3D12, Desc} { - auto* pd3d12Device = pDeviceD3D12->GetD3D12Device5(); - UINT64 ResultDataMaxSizeInBytes = 0; + auto* pd3d12Device = pDeviceD3D12->GetD3D12Device5(); + const auto& Limits = pDeviceD3D12->GetProperties(); + UINT64 ResultDataMaxSizeInBytes = 0; if (m_Desc.CompactedSize > 0) { @@ -58,8 +59,8 @@ TopLevelASD3D12Impl::TopLevelASD3D12Impl(IReferenceCounters* pRefCounters, d3d12TopLevelInputs.DescsLayout = D3D12_ELEMENTS_LAYOUT_ARRAY; d3d12TopLevelInputs.NumDescs = m_Desc.MaxInstanceCount; - DEV_CHECK_ERR(m_Desc.MaxInstanceCount <= pDeviceD3D12->GetProperties().MaxInstancesPerTLAS, - "Max instance count (", m_Desc.MaxInstanceCount, ") exceeds device limit."); + DEV_CHECK_ERR(m_Desc.MaxInstanceCount <= Limits.MaxInstancesPerTLAS, + "Max instance count (", m_Desc.MaxInstanceCount, ") exceeds device limit (", Limits.MaxInstancesPerTLAS, ")."); pd3d12Device->GetRaytracingAccelerationStructurePrebuildInfo(&d3d12TopLevelInputs, &d3d12TopLevelPrebuildInfo); if (d3d12TopLevelPrebuildInfo.ResultDataMaxSizeInBytes == 0) -- cgit v1.2.3