diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2020-12-16 00:02:00 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2020-12-16 00:02:00 +0000 |
| commit | 4168efa038f857978a7fbb797d01fd40b968094e (patch) | |
| tree | 9a1a0b2640a0833d171ebbd11b482f3c793ec04f /Graphics/GraphicsEngineD3D12 | |
| parent | Fixed Win SDK 17763 build issues (diff) | |
| download | DiligentCore-4168efa038f857978a7fbb797d01fd40b968094e.tar.gz DiligentCore-4168efa038f857978a7fbb797d01fd40b968094e.zip | |
D3D12: moved ray tracing constants to RenderDeviceD3D12Impl::Properties
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
3 files changed, 26 insertions, 23 deletions
diff --git a/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.hpp index 7af858db..5859fbe7 100644 --- a/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.hpp +++ b/Graphics/GraphicsEngineD3D12/include/RenderDeviceD3D12Impl.hpp @@ -42,12 +42,23 @@ #include "QueryManagerD3D12.hpp" #include "DXCompiler.hpp" -#ifndef D3D12_RAYTRACING_MAX_RAY_GENERATION_SHADER_THREADS // Defined in Win SDK 19041+ +// The macros below are only defined in Win SDK 19041+ and are missing in 17763 +#ifndef D3D12_RAYTRACING_MAX_RAY_GENERATION_SHADER_THREADS # define D3D12_RAYTRACING_MAX_RAY_GENERATION_SHADER_THREADS (1073741824) #endif -#ifndef D3D12_RAYTRACING_MAX_SHADER_RECORD_STRIDE // Defined in Win SDK 19041+ +#ifndef D3D12_RAYTRACING_MAX_SHADER_RECORD_STRIDE # define D3D12_RAYTRACING_MAX_SHADER_RECORD_STRIDE (4096) #endif +#ifndef D3D12_RAYTRACING_MAX_INSTANCES_PER_TOP_LEVEL_ACCELERATION_STRUCTURE +# define D3D12_RAYTRACING_MAX_INSTANCES_PER_TOP_LEVEL_ACCELERATION_STRUCTURE (16777216) +#endif +#ifndef D3D12_RAYTRACING_MAX_PRIMITIVES_PER_BOTTOM_LEVEL_ACCELERATION_STRUCTURE +# define D3D12_RAYTRACING_MAX_PRIMITIVES_PER_BOTTOM_LEVEL_ACCELERATION_STRUCTURE (536870912) +#endif +#ifndef D3D12_RAYTRACING_MAX_GEOMETRIES_PER_BOTTOM_LEVEL_ACCELERATION_STRUCTURE +# define D3D12_RAYTRACING_MAX_GEOMETRIES_PER_BOTTOM_LEVEL_ACCELERATION_STRUCTURE (16777216) +#endif + namespace Diligent { @@ -202,6 +213,9 @@ public: const Uint32 MaxDrawMeshTasksCount = 64000; // from specs: https://microsoft.github.io/DirectX-Specs/d3d/MeshShader.html#dispatchmesh-api const Uint32 MaxRayTracingRecursionDepth = D3D12_RAYTRACING_MAX_DECLARABLE_TRACE_RECURSION_DEPTH; const Uint32 MaxRayGenThreads = D3D12_RAYTRACING_MAX_RAY_GENERATION_SHADER_THREADS; + const Uint32 MaxInstancesPerTLAS = D3D12_RAYTRACING_MAX_INSTANCES_PER_TOP_LEVEL_ACCELERATION_STRUCTURE; + const Uint32 MaxPrimitivesPerBLAS = D3D12_RAYTRACING_MAX_PRIMITIVES_PER_BOTTOM_LEVEL_ACCELERATION_STRUCTURE; + const Uint32 MaxGeometriesPerBLAS = D3D12_RAYTRACING_MAX_GEOMETRIES_PER_BOTTOM_LEVEL_ACCELERATION_STRUCTURE; ShaderVersion MaxShaderVersion; }; diff --git a/Graphics/GraphicsEngineD3D12/src/BottomLevelASD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/BottomLevelASD3D12Impl.cpp index bb1e9ccd..6d59f331 100644 --- a/Graphics/GraphicsEngineD3D12/src/BottomLevelASD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/BottomLevelASD3D12Impl.cpp @@ -33,19 +33,12 @@ #include "DXGITypeConversions.hpp" #include "StringTools.hpp" -#ifndef D3D12_RAYTRACING_MAX_PRIMITIVES_PER_BOTTOM_LEVEL_ACCELERATION_STRUCTURE // Defined in Win SDK 19041+ -# define D3D12_RAYTRACING_MAX_PRIMITIVES_PER_BOTTOM_LEVEL_ACCELERATION_STRUCTURE (536870912) -#endif -#ifndef D3D12_RAYTRACING_MAX_GEOMETRIES_PER_BOTTOM_LEVEL_ACCELERATION_STRUCTURE // Defined in Win SDK 19041+ -# define D3D12_RAYTRACING_MAX_GEOMETRIES_PER_BOTTOM_LEVEL_ACCELERATION_STRUCTURE (16777216) -#endif - namespace Diligent { -BottomLevelASD3D12Impl::BottomLevelASD3D12Impl(IReferenceCounters* pRefCounters, - class RenderDeviceD3D12Impl* pDeviceD3D12, - const BottomLevelASDesc& Desc) : +BottomLevelASD3D12Impl::BottomLevelASD3D12Impl(IReferenceCounters* pRefCounters, + RenderDeviceD3D12Impl* pDeviceD3D12, + const BottomLevelASDesc& Desc) : TBottomLevelASBase{pRefCounters, pDeviceD3D12, Desc} { auto* pd3d12Device = pDeviceD3D12->GetD3D12Device5(); @@ -84,7 +77,7 @@ BottomLevelASD3D12Impl::BottomLevelASD3D12Impl(IReferenceCounters* pRef MaxPrimitiveCount += src.MaxPrimitiveCount; } - VERIFY_EXPR(MaxPrimitiveCount <= D3D12_RAYTRACING_MAX_PRIMITIVES_PER_BOTTOM_LEVEL_ACCELERATION_STRUCTURE); + VERIFY_EXPR(MaxPrimitiveCount <= pDeviceD3D12->GetProperties().MaxPrimitivesPerBLAS); } else if (m_Desc.pBoxes != nullptr) { @@ -103,14 +96,14 @@ BottomLevelASD3D12Impl::BottomLevelASD3D12Impl(IReferenceCounters* pRef MaxBoxCount += src.MaxBoxCount; } - VERIFY_EXPR(MaxBoxCount <= D3D12_RAYTRACING_MAX_PRIMITIVES_PER_BOTTOM_LEVEL_ACCELERATION_STRUCTURE); + VERIFY_EXPR(MaxBoxCount <= pDeviceD3D12->GetProperties().MaxPrimitivesPerBLAS); } else { UNEXPECTED("Either pTriangles or pBoxes must not be null"); } - VERIFY_EXPR(d3d12Geometries.size() <= D3D12_RAYTRACING_MAX_GEOMETRIES_PER_BOTTOM_LEVEL_ACCELERATION_STRUCTURE); + VERIFY_EXPR(d3d12Geometries.size() <= pDeviceD3D12->GetProperties().MaxGeometriesPerBLAS); d3d12BottomLevelInputs.Type = D3D12_RAYTRACING_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL; d3d12BottomLevelInputs.Flags = BuildASFlagsToD3D12ASBuildFlags(m_Desc.Flags); diff --git a/Graphics/GraphicsEngineD3D12/src/TopLevelASD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/TopLevelASD3D12Impl.cpp index 84b45527..8202c418 100644 --- a/Graphics/GraphicsEngineD3D12/src/TopLevelASD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/TopLevelASD3D12Impl.cpp @@ -33,16 +33,12 @@ #include "DXGITypeConversions.hpp" #include "StringTools.hpp" -#ifndef D3D12_RAYTRACING_MAX_INSTANCES_PER_TOP_LEVEL_ACCELERATION_STRUCTURE // Defined in Win SDK 19041+ -# define D3D12_RAYTRACING_MAX_INSTANCES_PER_TOP_LEVEL_ACCELERATION_STRUCTURE (16777216) -#endif - namespace Diligent { -TopLevelASD3D12Impl::TopLevelASD3D12Impl(IReferenceCounters* pRefCounters, - class RenderDeviceD3D12Impl* pDeviceD3D12, - const TopLevelASDesc& Desc) : +TopLevelASD3D12Impl::TopLevelASD3D12Impl(IReferenceCounters* pRefCounters, + RenderDeviceD3D12Impl* pDeviceD3D12, + const TopLevelASDesc& Desc) : TTopLevelASBase{pRefCounters, pDeviceD3D12, Desc} { auto* pd3d12Device = pDeviceD3D12->GetD3D12Device5(); @@ -62,7 +58,7 @@ TopLevelASD3D12Impl::TopLevelASD3D12Impl(IReferenceCounters* pRefCounte d3d12TopLevelInputs.DescsLayout = D3D12_ELEMENTS_LAYOUT_ARRAY; d3d12TopLevelInputs.NumDescs = m_Desc.MaxInstanceCount; - VERIFY_EXPR(m_Desc.MaxInstanceCount <= D3D12_RAYTRACING_MAX_INSTANCES_PER_TOP_LEVEL_ACCELERATION_STRUCTURE); + VERIFY_EXPR(m_Desc.MaxInstanceCount <= pDeviceD3D12->GetProperties().MaxInstancesPerTLAS); pd3d12Device->GetRaytracingAccelerationStructurePrebuildInfo(&d3d12TopLevelInputs, &d3d12TopLevelPrebuildInfo); if (d3d12TopLevelPrebuildInfo.ResultDataMaxSizeInBytes == 0) |
