From e3019c64cc94d68e5924b024e4073d60cc6dfed6 Mon Sep 17 00:00:00 2001 From: assiduous Date: Thu, 4 Mar 2021 08:33:14 -0800 Subject: Minor updates to ValidatePipelineResourceSignatureDesc --- .../GraphicsEngine/include/PipelineResourceSignatureBase.hpp | 7 ++----- Graphics/GraphicsEngine/src/PipelineResourceSignatureBase.cpp | 9 ++++----- 2 files changed, 6 insertions(+), 10 deletions(-) (limited to 'Graphics/GraphicsEngine') diff --git a/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp b/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp index 457fc7bd..9311a4c0 100644 --- a/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp +++ b/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp @@ -48,8 +48,7 @@ namespace Diligent /// Validates pipeline resource signature description and throws an exception in case of an error. void ValidatePipelineResourceSignatureDesc(const PipelineResourceSignatureDesc& Desc, - bool ShaderResourceRuntimeArraySupported, - bool AccelStructSupported) noexcept(false); + const DeviceFeatures& Features) noexcept(false); static constexpr Uint32 InvalidImmutableSamplerIndex = ~0u; /// Finds an immutable sampler for the resource name 'ResourceName' that is defined in shader stages 'ShaderStages'. @@ -96,9 +95,7 @@ public: this->m_Desc.ImmutableSamplers = nullptr; this->m_Desc.CombinedSamplerSuffix = nullptr; - ValidatePipelineResourceSignatureDesc(Desc, - pDevice->GetDeviceCaps().Features.ShaderResourceRuntimeArray, - pDevice->GetDeviceCaps().Features.RayTracing); + ValidatePipelineResourceSignatureDesc(Desc, pDevice->GetDeviceCaps().Features); // Determine shader stages that have any resources as well as // shader stages that have static resources. diff --git a/Graphics/GraphicsEngine/src/PipelineResourceSignatureBase.cpp b/Graphics/GraphicsEngine/src/PipelineResourceSignatureBase.cpp index dff3fa0a..ae41e2ba 100644 --- a/Graphics/GraphicsEngine/src/PipelineResourceSignatureBase.cpp +++ b/Graphics/GraphicsEngine/src/PipelineResourceSignatureBase.cpp @@ -38,8 +38,7 @@ namespace Diligent #define LOG_PRS_ERROR_AND_THROW(...) LOG_ERROR_AND_THROW("Description of a pipeline resource signature '", (Desc.Name ? Desc.Name : ""), "' is invalid: ", ##__VA_ARGS__) void ValidatePipelineResourceSignatureDesc(const PipelineResourceSignatureDesc& Desc, - bool ShaderResourceRuntimeArraySupported, - bool AccelStructSupported) noexcept(false) + const DeviceFeatures& Features) noexcept(false) { if (Desc.BindingIndex >= MAX_RESOURCE_SIGNATURES) LOG_PRS_ERROR_AND_THROW("Desc.BindingIndex (", Uint32{Desc.BindingIndex}, ") exceeds the maximum allowed value (", MAX_RESOURCE_SIGNATURES - 1, ")."); @@ -85,14 +84,14 @@ void ValidatePipelineResourceSignatureDesc(const PipelineResourceSignatureDesc& } UsedStages |= Res.ShaderStages; - if ((Res.Flags & PIPELINE_RESOURCE_FLAG_RUNTIME_ARRAY) != 0 && !ShaderResourceRuntimeArraySupported) + if ((Res.Flags & PIPELINE_RESOURCE_FLAG_RUNTIME_ARRAY) != 0 && !Features.ShaderResourceRuntimeArray) { LOG_PRS_ERROR_AND_THROW("Incorrect Desc.Resources[", i, "].Flags (RUNTIME_ARRAY) can only be used if ShaderResourceRuntimeArray device feature is enabled."); } - if (Res.ResourceType == SHADER_RESOURCE_TYPE_ACCEL_STRUCT && !AccelStructSupported) + if (Res.ResourceType == SHADER_RESOURCE_TYPE_ACCEL_STRUCT && !Features.RayTracing) { - LOG_PRS_ERROR_AND_THROW("Incorrect Desc.Resources[", i, "].ResourceType (ACCEL_STRUCT): acceleration structure is not supported by device."); + LOG_PRS_ERROR_AND_THROW("Incorrect Desc.Resources[", i, "].ResourceType (ACCEL_STRUCT): ray tracing is not supported by device."); } static_assert(SHADER_RESOURCE_TYPE_LAST == 8, "Please add the new resource type to the switch below"); -- cgit v1.2.3