From 3a1957035682ca100699894b5fc0bdf18916437d Mon Sep 17 00:00:00 2001 From: assiduous Date: Sun, 28 Feb 2021 22:50:05 -0800 Subject: Added test for input attachments in the resource signature; fixed few issues in D3D12 --- Graphics/GraphicsEngineD3D12/src/D3D12TypeConversions.cpp | 2 +- .../GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp | 1 + Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp | 5 ++++- Graphics/GraphicsEngineD3D12/src/ShaderResourceCacheD3D12.cpp | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) (limited to 'Graphics/GraphicsEngineD3D12') diff --git a/Graphics/GraphicsEngineD3D12/src/D3D12TypeConversions.cpp b/Graphics/GraphicsEngineD3D12/src/D3D12TypeConversions.cpp index ee6669ea..a11b6339 100644 --- a/Graphics/GraphicsEngineD3D12/src/D3D12TypeConversions.cpp +++ b/Graphics/GraphicsEngineD3D12/src/D3D12TypeConversions.cpp @@ -767,8 +767,8 @@ D3D12_DESCRIPTOR_RANGE_TYPE ResourceTypeToD3D12DescriptorRangeType(SHADER_RESOUR case SHADER_RESOURCE_TYPE_BUFFER_UAV: return D3D12_DESCRIPTOR_RANGE_TYPE_UAV; case SHADER_RESOURCE_TYPE_SAMPLER: return D3D12_DESCRIPTOR_RANGE_TYPE_SAMPLER; case SHADER_RESOURCE_TYPE_ACCEL_STRUCT: return D3D12_DESCRIPTOR_RANGE_TYPE_SRV; + case SHADER_RESOURCE_TYPE_INPUT_ATTACHMENT:return D3D12_DESCRIPTOR_RANGE_TYPE_SRV; // clang-format on - case SHADER_RESOURCE_TYPE_INPUT_ATTACHMENT: default: UNEXPECTED("Unknown resource type"); return static_cast(-1); diff --git a/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp index 650226f6..acbda862 100644 --- a/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/PipelineResourceSignatureD3D12Impl.cpp @@ -1180,6 +1180,7 @@ void BindResourceHelper::operator()(IDeviceObject* pObj) const break; case SHADER_RESOURCE_TYPE_TEXTURE_SRV: + case SHADER_RESOURCE_TYPE_INPUT_ATTACHMENT: CacheResourceView(pObj, TEXTURE_VIEW_SHADER_RESOURCE); break; diff --git a/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp index f89a64a0..0db2d4ac 100644 --- a/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp +++ b/Graphics/GraphicsEngineD3D12/src/PipelineStateD3D12Impl.cpp @@ -725,7 +725,10 @@ void PipelineStateD3D12Impl::DvpValidateShaderResources(const ShaderD3D12Impl* p { const auto& ResDesc = pSignature->GetResourceDesc(ResAttribution.ResourceIndex); - if (Type != ResDesc.ResourceType) + auto ResourceType = ResDesc.ResourceType; + if (ResourceType == SHADER_RESOURCE_TYPE_INPUT_ATTACHMENT) + ResourceType = SHADER_RESOURCE_TYPE_TEXTURE_SRV; + if (Type != ResourceType) { LOG_ERROR_AND_THROW("Shader '", pShader->GetDesc().Name, "' contains resource with name '", Attribs.Name, "' and type '", GetShaderResourceTypeLiteralName(Type), "' that is not compatible with type '", diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderResourceCacheD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderResourceCacheD3D12.cpp index 0fb0def1..073fbdc9 100644 --- a/Graphics/GraphicsEngineD3D12/src/ShaderResourceCacheD3D12.cpp +++ b/Graphics/GraphicsEngineD3D12/src/ShaderResourceCacheD3D12.cpp @@ -461,6 +461,7 @@ void ShaderResourceCacheD3D12::Resource::TransitionResource(CommandContext& Ctx) break; case SHADER_RESOURCE_TYPE_TEXTURE_SRV: + case SHADER_RESOURCE_TYPE_INPUT_ATTACHMENT: { auto* pTexViewD3D12 = pObject.RawPtr(); auto* pTexToTransition = pTexViewD3D12->GetTexture(); @@ -558,6 +559,7 @@ void ShaderResourceCacheD3D12::Resource::DvpVerifyResourceState() break; case SHADER_RESOURCE_TYPE_TEXTURE_SRV: + case SHADER_RESOURCE_TYPE_INPUT_ATTACHMENT: { const auto* pTexViewD3D12 = pObject.RawPtr(); const auto* pTexD3D12 = pTexViewD3D12->GetTexture(); -- cgit v1.2.3