diff options
| author | assiduous <assiduous@diligentgraphics.com> | 2021-03-01 19:45:04 +0000 |
|---|---|---|
| committer | assiduous <assiduous@diligentgraphics.com> | 2021-03-19 00:38:13 +0000 |
| commit | a5aa4f7f3b82a097c73712cade508cf7a9274e67 (patch) | |
| tree | 9b78f0493e38f047ec69687f0eba2fb8f5790c7a /Graphics/GraphicsEngineVulkan | |
| parent | Added test for input attachments in the resource signature; fixed few issues ... (diff) | |
| download | DiligentCore-a5aa4f7f3b82a097c73712cade508cf7a9274e67.tar.gz DiligentCore-a5aa4f7f3b82a097c73712cade508cf7a9274e67.zip | |
Added resource signature creation failure test; fxied validation of resource flags.
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
| -rw-r--r-- | Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp | 27 |
1 files changed, 3 insertions, 24 deletions
diff --git a/Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp b/Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp index 0cebc25a..5651cbbc 100644 --- a/Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp +++ b/Graphics/GraphicsEngineVulkan/src/PipelineResourceSignatureVkImpl.cpp @@ -85,6 +85,9 @@ inline VkDescriptorType GetVkDescriptorType(DescriptorType Type) DescriptorType GetDescriptorType(const PipelineResourceDesc& Res) { + VERIFY((Res.Flags & ~GetValidPipelineResourceFlags(Res.ResourceType)) == 0, + "Invalid resource flags. This error should've been caught by ValidatePipelineResourceSignatureDesc."); + const bool WithDynamicOffset = (Res.Flags & PIPELINE_RESOURCE_FLAG_NO_DYNAMIC_BUFFERS) == 0; const bool CombinedSampler = (Res.Flags & PIPELINE_RESOURCE_FLAG_COMBINED_SAMPLER) != 0; const bool UseTexelBuffer = (Res.Flags & PIPELINE_RESOURCE_FLAG_FORMATTED_BUFFER) != 0; @@ -93,53 +96,29 @@ DescriptorType GetDescriptorType(const PipelineResourceDesc& Res) switch (Res.ResourceType) { case SHADER_RESOURCE_TYPE_CONSTANT_BUFFER: - VERIFY((Res.Flags & ~PIPELINE_RESOURCE_FLAG_NO_DYNAMIC_BUFFERS) == 0, - "NO_DYNAMIC_BUFFERS is the only valid flag allowed for constant buffers. " - "This error should've been caught by ValidatePipelineResourceSignatureDesc."); return WithDynamicOffset ? DescriptorType::UniformBufferDynamic : DescriptorType::UniformBuffer; case SHADER_RESOURCE_TYPE_TEXTURE_SRV: - VERIFY((Res.Flags & ~PIPELINE_RESOURCE_FLAG_COMBINED_SAMPLER) == 0, - "COMBINED_SAMPLER is the only valid flag for a texture SRV. " - "This error should've been caught by ValidatePipelineResourceSignatureDesc."); return CombinedSampler ? DescriptorType::CombinedImageSampler : DescriptorType::SeparateImage; case SHADER_RESOURCE_TYPE_BUFFER_SRV: - VERIFY((Res.Flags & ~(PIPELINE_RESOURCE_FLAG_NO_DYNAMIC_BUFFERS | PIPELINE_RESOURCE_FLAG_FORMATTED_BUFFER)) == 0, - "NO_DYNAMIC_BUFFERS and FORMATTED_BUFFER are the only valid flags for a buffer SRV. " - "This error should've been caught by ValidatePipelineResourceSignatureDesc."); return UseTexelBuffer ? DescriptorType::UniformTexelBuffer : (WithDynamicOffset ? DescriptorType::StorageBufferDynamic_ReadOnly : DescriptorType::StorageBuffer_ReadOnly); case SHADER_RESOURCE_TYPE_TEXTURE_UAV: - VERIFY(Res.Flags == PIPELINE_RESOURCE_FLAG_UNKNOWN, - "UNKNOWN is the only valid flag for a texture UAV. " - "This error should've been caught by ValidatePipelineResourceSignatureDesc."); return DescriptorType::StorageImage; case SHADER_RESOURCE_TYPE_BUFFER_UAV: - VERIFY((Res.Flags & ~(PIPELINE_RESOURCE_FLAG_NO_DYNAMIC_BUFFERS | PIPELINE_RESOURCE_FLAG_FORMATTED_BUFFER)) == 0, - "NO_DYNAMIC_BUFFERS and FORMATTED_BUFFER are the only valid flags for a buffer UAV. " - "This should've been caught by ValidatePipelineResourceSignatureDesc."); return UseTexelBuffer ? DescriptorType::StorageTexelBuffer : (WithDynamicOffset ? DescriptorType::StorageBufferDynamic : DescriptorType::StorageBuffer); case SHADER_RESOURCE_TYPE_SAMPLER: - VERIFY(Res.Flags == PIPELINE_RESOURCE_FLAG_UNKNOWN, - "UNKNOWN is the only valid flag for a sampler. " - "This error should've been caught by ValidatePipelineResourceSignatureDesc."); return DescriptorType::Sampler; case SHADER_RESOURCE_TYPE_INPUT_ATTACHMENT: - VERIFY(Res.Flags == PIPELINE_RESOURCE_FLAG_UNKNOWN, - "UNKNOWN is the only valid flag for an input attachment. " - "This error should've been caught by ValidatePipelineResourceSignatureDesc."); return DescriptorType::InputAttachment; case SHADER_RESOURCE_TYPE_ACCEL_STRUCT: - VERIFY(Res.Flags == PIPELINE_RESOURCE_FLAG_UNKNOWN, - "UNKNOWN is the only valid flag for an acceleration structure. " - "This error should've been caught by ValidatePipelineResourceSignatureDesc."); return DescriptorType::AccelerationStructure; default: |
