diff options
| author | azhirnov <zh1dron@gmail.com> | 2021-03-04 13:23:50 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2021-03-19 00:38:14 +0000 |
| commit | 44fe2cc66cdc8d81f8e1595689ed1ec7ffea56b6 (patch) | |
| tree | 2859d94f4f907c744e95c5ffdbb91788125ca682 /Graphics/GraphicsEngine | |
| parent | Vulkan: update for new Vulkan SDK (diff) | |
| download | DiligentCore-44fe2cc66cdc8d81f8e1595689ed1ec7ffea56b6.tar.gz DiligentCore-44fe2cc66cdc8d81f8e1595689ed1ec7ffea56b6.zip | |
OpenGL: added SRB memory allocator, some minor improvements
Diffstat (limited to 'Graphics/GraphicsEngine')
3 files changed, 28 insertions, 5 deletions
diff --git a/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp b/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp index cf4e7458..457fc7bd 100644 --- a/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp +++ b/Graphics/GraphicsEngine/include/PipelineResourceSignatureBase.hpp @@ -47,7 +47,9 @@ namespace Diligent { /// Validates pipeline resource signature description and throws an exception in case of an error. -void ValidatePipelineResourceSignatureDesc(const PipelineResourceSignatureDesc& Desc, bool ShaderResourceRuntimeArraySupported) noexcept(false); +void ValidatePipelineResourceSignatureDesc(const PipelineResourceSignatureDesc& Desc, + bool ShaderResourceRuntimeArraySupported, + bool AccelStructSupported) noexcept(false); static constexpr Uint32 InvalidImmutableSamplerIndex = ~0u; /// Finds an immutable sampler for the resource name 'ResourceName' that is defined in shader stages 'ShaderStages'. @@ -94,7 +96,9 @@ public: this->m_Desc.ImmutableSamplers = nullptr; this->m_Desc.CombinedSamplerSuffix = nullptr; - ValidatePipelineResourceSignatureDesc(Desc, pDevice->GetDeviceCaps().Features.ShaderResourceRuntimeArray); + ValidatePipelineResourceSignatureDesc(Desc, + pDevice->GetDeviceCaps().Features.ShaderResourceRuntimeArray, + pDevice->GetDeviceCaps().Features.RayTracing); // Determine shader stages that have any resources as well as // shader stages that have static resources. @@ -214,6 +218,19 @@ public: return this->m_Desc.ImmutableSamplers[SampIndex]; } + static Uint32 CalcMaxSignatureBindIndex(const Uint32 SignatureCount, + IPipelineResourceSignature* ppResourceSignatures[]) + { + Uint32 MaxSignatureBindingIndex = 0; + for (Uint32 i = 0; i < SignatureCount; ++i) + { + const auto* pSignature = ppResourceSignatures[i]; + VERIFY(pSignature != nullptr, "Pipeline resource signature at index ", i, " is null. This error should've been caught by ValidatePipelineResourceSignatures."); + MaxSignatureBindingIndex = std::max(MaxSignatureBindingIndex, Uint32{pSignature->GetDesc().BindingIndex}); + } + return MaxSignatureBindingIndex; + } + template <typename TPipelineResourceSignature> static Uint32 CopyResourceSignatures(PIPELINE_TYPE PipelineType, const Uint32 SignatureCount, diff --git a/Graphics/GraphicsEngine/include/PipelineStateBase.hpp b/Graphics/GraphicsEngine/include/PipelineStateBase.hpp index 573dca44..57359d37 100644 --- a/Graphics/GraphicsEngine/include/PipelineStateBase.hpp +++ b/Graphics/GraphicsEngine/include/PipelineStateBase.hpp @@ -471,7 +471,7 @@ protected: m_ActiveShaderStages |= ShaderType; #ifdef DILIGENT_DEBUG for (Uint32 i = 0; i + 1 < ShaderStages.size(); ++i) - VERIFY_EXPR(ShaderStages[i].Type != ShaderType); + VERIFY_EXPR(GetShaderStageType(ShaderStages[i]) != ShaderType); #endif } }; diff --git a/Graphics/GraphicsEngine/src/PipelineResourceSignatureBase.cpp b/Graphics/GraphicsEngine/src/PipelineResourceSignatureBase.cpp index 4fa3029d..dff3fa0a 100644 --- a/Graphics/GraphicsEngine/src/PipelineResourceSignatureBase.cpp +++ b/Graphics/GraphicsEngine/src/PipelineResourceSignatureBase.cpp @@ -37,7 +37,9 @@ 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) noexcept(false) +void ValidatePipelineResourceSignatureDesc(const PipelineResourceSignatureDesc& Desc, + bool ShaderResourceRuntimeArraySupported, + bool AccelStructSupported) 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,9 +87,13 @@ void ValidatePipelineResourceSignatureDesc(const PipelineResourceSignatureDesc& if ((Res.Flags & PIPELINE_RESOURCE_FLAG_RUNTIME_ARRAY) != 0 && !ShaderResourceRuntimeArraySupported) { - LOG_PRS_ERROR_AND_THROW("Incorrect Desc.Resources[", i, "].Flags: RUNTIME_ARRAY can only be used if ShaderResourceRuntimeArray device feature is enabled."); + 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) + { + LOG_PRS_ERROR_AND_THROW("Incorrect Desc.Resources[", i, "].ResourceType (ACCEL_STRUCT): acceleration structure is not supported by device."); + } static_assert(SHADER_RESOURCE_TYPE_LAST == 8, "Please add the new resource type to the switch below"); auto AllowedResourceFlags = GetValidPipelineResourceFlags(Res.ResourceType); |
