summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineD3D12
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2021-02-25 03:23:36 +0000
committerassiduous <assiduous@diligentgraphics.com>2021-03-19 00:38:11 +0000
commitd40df7d9e6b15c3aac87fe78d2bafd3f868c5352 (patch)
treeb882e513037a33569eb3fe82d247d77c2151db45 /Graphics/GraphicsEngineD3D12
parentSome updates to ShaderVariableD3D12 (diff)
downloadDiligentCore-d40df7d9e6b15c3aac87fe78d2bafd3f868c5352.tar.gz
DiligentCore-d40df7d9e6b15c3aac87fe78d2bafd3f868c5352.zip
Reworked ShaderVariableVkImpl and ShaderVariableD3D12Impl: removed some duplicate code
Diffstat (limited to 'Graphics/GraphicsEngineD3D12')
-rw-r--r--Graphics/GraphicsEngineD3D12/include/ShaderVariableD3D12.hpp110
-rw-r--r--Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.hpp2
-rw-r--r--Graphics/GraphicsEngineD3D12/src/ShaderVariableD3D12.cpp79
-rw-r--r--Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp3
-rw-r--r--Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp4
-rw-r--r--Graphics/GraphicsEngineD3D12/src/TextureViewD3D12Impl.cpp4
-rw-r--r--Graphics/GraphicsEngineD3D12/src/TopLevelASD3D12Impl.cpp36
7 files changed, 82 insertions, 156 deletions
diff --git a/Graphics/GraphicsEngineD3D12/include/ShaderVariableD3D12.hpp b/Graphics/GraphicsEngineD3D12/include/ShaderVariableD3D12.hpp
index 6448ebd1..5923c5b8 100644
--- a/Graphics/GraphicsEngineD3D12/include/ShaderVariableD3D12.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/ShaderVariableD3D12.hpp
@@ -37,29 +37,27 @@
// * ShaderVariableManagerD3D12 is used by PipelineResourceSignatureD3D12Impl to manage static resources and by
// ShaderResourceBindingD3D12Impl to manage mutable and dynamic resources
//
-// _____________________________ ________________________________________________________________________________
-// | | | | | |
-// .----| ShaderVariableManagerD3D12 |---------------->| ShaderVariableD3D12Impl[0] | ShaderVariableD3D12Impl[1] | ... |
-// | |_____________________________| |______________________________|_______________________________|_________________|
-// | | | |
-// | | m_ResIndex m_ResIndex
-// | | | |
-// | _____________V____________________ __________V_______________________________V_________________________________
-// | | | m_pResourceAttribs | | | | |
-// | |PipelineResourceSignatureD3D12Impl|------------------->| Resource[0] | Resource[1] | ... | Resource[s+m+d-1] |
-// | |__________________________________| |__________________|__________________|_____________|________________________|
-// | | |
-// | | |
-// | | (RootTable, Offset) / (RootTable, Offset)
-// | \ /
-// | __________________________ _______________V________________________________________________V_______
-// | | | | |
-// '--->| ShaderResourceCacheD3D12 |---------------->| Resources |
-// |__________________________| |________________________________________________________________________|
+// _____________________________ ________________________________________________________________________________
+// | | | | | |
+// .----| ShaderVariableManagerD3D12 |---------------->| ShaderVariableD3D12Impl[0] | ShaderVariableD3D12Impl[1] | ... |
+// | |_____________________________| |______________________________|_______________________________|_________________|
+// | | | |
+// | m_pSignature m_ResIndex m_ResIndex
+// | | | |
+// | _____________V____________________ __________V_______________________________V_________________________________
+// | | | m_pResourceAttribs | | | | |
+// | |PipelineResourceSignatureD3D12Impl|------------------->| Resource[0] | Resource[1] | ... | Resource[s+m+d-1] |
+// | |__________________________________| |__________________|__________________|_____________|________________________|
+// | | |
+// m_ResourceCache | |
+// | | (RootTable, Offset) / (RootTable, Offset)
+// | \ /
+// | __________________________ _______________V________________________________________________V_______
+// | | | | |
+// '--->| ShaderResourceCacheD3D12 |---------------->| Resources |
+// |__________________________| |________________________________________________________________________|
//
-#include <memory>
-
#include "ShaderResourceVariableD3D.h"
#include "ShaderResourceVariableBase.hpp"
#include "ShaderResourceCacheD3D12.hpp"
@@ -109,6 +107,8 @@ public:
Uint32 GetVariableCount() const { return m_NumVariables; }
+ IObject& GetOwner() { return m_Owner; }
+
private:
friend ShaderVariableD3D12Impl;
using ResourceAttribs = PipelineResourceSignatureD3D12Impl::ResourceAttribs;
@@ -117,12 +117,12 @@ private:
const PipelineResourceDesc& GetResourceDesc(Uint32 Index) const
{
- VERIFY_EXPR(m_pSignature);
+ VERIFY_EXPR(m_pSignature != nullptr);
return m_pSignature->GetResourceDesc(Index);
}
const ResourceAttribs& GetResourceAttribs(Uint32 Index) const
{
- VERIFY_EXPR(m_pSignature);
+ VERIFY_EXPR(m_pSignature != nullptr);
return m_pSignature->GetResourceAttribs(Index);
}
@@ -138,9 +138,9 @@ private:
IObject& m_Owner;
- // Variable mgr is owned by either Pipeline Resource Signature (in which case m_ResourceCache references
+ // Variable manager is owned by either Pipeline Resource Signature (in which case m_ResourceCache references
// static resource cache owned by the same signature object), or by SRB object (in which case
- // m_ResourceCache references the cache in the SRB). Thus the cache and the resource layout
+ // m_ResourceCache references the cache in the SRB). Thus the cache and the signature
// (which the variables reference) are guaranteed to be alive while the manager is alive.
ShaderResourceCacheD3D12& m_ResourceCache;
@@ -156,12 +156,13 @@ private:
};
// sizeof(ShaderVariableD3D12Impl) == 24 (x64)
-class ShaderVariableD3D12Impl final : public IShaderResourceVariableD3D
+class ShaderVariableD3D12Impl final : public ShaderVariableBase<ShaderVariableManagerD3D12, IShaderResourceVariableD3D>
{
public:
+ using TBase = ShaderVariableBase<ShaderVariableManagerD3D12, IShaderResourceVariableD3D>;
ShaderVariableD3D12Impl(ShaderVariableManagerD3D12& ParentManager,
Uint32 ResIndex) :
- m_ParentManager{ParentManager},
+ TBase{ParentManager},
m_ResIndex{ResIndex}
{}
@@ -172,21 +173,6 @@ public:
ShaderVariableD3D12Impl& operator= (ShaderVariableD3D12Impl&&) = delete;
// clang-format on
- virtual IReferenceCounters* DILIGENT_CALL_TYPE GetReferenceCounters() const override final
- {
- return m_ParentManager.m_Owner.GetReferenceCounters();
- }
-
- virtual Atomics::Long DILIGENT_CALL_TYPE AddRef() override final
- {
- return m_ParentManager.m_Owner.AddRef();
- }
-
- virtual Atomics::Long DILIGENT_CALL_TYPE Release() override final
- {
- return m_ParentManager.m_Owner.Release();
- }
-
virtual void DILIGENT_CALL_TYPE QueryInterface(const INTERFACE_ID& IID, IObject** ppInterface) override final
{
if (ppInterface == nullptr)
@@ -205,7 +191,10 @@ public:
return GetDesc().VarType;
}
- virtual void DILIGENT_CALL_TYPE Set(IDeviceObject* pObject) override final;
+ virtual void DILIGENT_CALL_TYPE Set(IDeviceObject* pObject) override final
+ {
+ BindResource(pObject, 0);
+ }
virtual void DILIGENT_CALL_TYPE SetArray(IDeviceObject* const* ppObjects, Uint32 FirstElement, Uint32 NumElements) override final;
@@ -222,33 +211,30 @@ public:
return m_ParentManager.GetVariableIndex(*this);
}
- virtual bool DILIGENT_CALL_TYPE IsBound(Uint32 ArrayIndex) const override final;
-
- virtual HLSLShaderResourceDesc DILIGENT_CALL_TYPE GetHLSLResourceDesc() const override final
+ virtual bool DILIGENT_CALL_TYPE IsBound(Uint32 ArrayIndex) const override final
{
- const auto& ResDesc = GetDesc();
- const auto& ResAttribs = GetAttribs();
-
- HLSLShaderResourceDesc HLSLResDesc;
- HLSLResDesc.Name = ResDesc.Name;
- HLSLResDesc.Type = ResDesc.ResourceType;
- HLSLResDesc.ArraySize = ResDesc.ArraySize;
- HLSLResDesc.ShaderRegister = ResAttribs.Register;
- return HLSLResDesc;
+ return m_ParentManager.m_pSignature->IsBound(ArrayIndex, m_ResIndex, m_ParentManager.m_ResourceCache);
}
-private:
- friend ShaderVariableManagerD3D12;
- using ResourceAttribs = PipelineResourceSignatureD3D12Impl::ResourceAttribs;
+ virtual void DILIGENT_CALL_TYPE GetHLSLResourceDesc(HLSLShaderResourceDesc& HLSLResDesc) const override final
+ {
+ GetResourceDesc(HLSLResDesc);
+ HLSLResDesc.ShaderRegister = GetAttribs().Register;
+ }
const PipelineResourceDesc& GetDesc() const { return m_ParentManager.GetResourceDesc(m_ResIndex); }
- const ResourceAttribs& GetAttribs() const { return m_ParentManager.GetResourceAttribs(m_ResIndex); }
- void BindResource(IDeviceObject* pObj, Uint32 ArrayIndex) const;
+ void BindResource(IDeviceObject* pObj, Uint32 ArrayIndex) const
+ {
+ m_ParentManager.m_pSignature->BindResource(pObj, ArrayIndex, m_ResIndex, m_ParentManager.m_ResourceCache);
+ }
+
+private:
+ using ResourceAttribs = PipelineResourceSignatureD3D12Impl::ResourceAttribs;
+ const ResourceAttribs& GetAttribs() const { return m_ParentManager.GetResourceAttribs(m_ResIndex); }
private:
- ShaderVariableManagerD3D12& m_ParentManager;
- const Uint32 m_ResIndex;
+ const Uint32 m_ResIndex;
};
} // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.hpp b/Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.hpp
index 475c9661..203af1fe 100644
--- a/Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.hpp
+++ b/Graphics/GraphicsEngineD3D12/include/TextureD3D12Impl.hpp
@@ -98,8 +98,6 @@ protected:
void CreateUAV(TextureViewDesc& UAVDesc, D3D12_CPU_DESCRIPTOR_HANDLE UAVHandle);
D3D12_PLACED_SUBRESOURCE_FOOTPRINT* m_StagingFootprints = nullptr;
-
- friend class RenderDeviceD3D12Impl;
};
} // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D12/src/ShaderVariableD3D12.cpp b/Graphics/GraphicsEngineD3D12/src/ShaderVariableD3D12.cpp
index d106388e..c7ee4cdc 100644
--- a/Graphics/GraphicsEngineD3D12/src/ShaderVariableD3D12.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/ShaderVariableD3D12.cpp
@@ -28,7 +28,6 @@
#include "pch.h"
#include "ShaderVariableD3D12.hpp"
-#include "ShaderResourceVariableBase.hpp"
#include "RenderDeviceD3D12Impl.hpp"
namespace Diligent
@@ -42,7 +41,7 @@ void ShaderVariableManagerD3D12::ProcessSignatureResources(const PipelineResourc
HandlerType Handler)
{
const Uint32 AllowedTypeBits = GetAllowedTypeBits(AllowedVarTypes, NumAllowedTypes);
- const bool UsingSeparateSamplers = Signature.IsUsingSeparateSamplers();
+ const bool UsingCombinedSamplers = Signature.IsUsingCombinedSamplers();
for (SHADER_RESOURCE_VARIABLE_TYPE VarType = SHADER_RESOURCE_VARIABLE_TYPE_STATIC; VarType < SHADER_RESOURCE_VARIABLE_TYPE_NUM_TYPES; VarType = static_cast<SHADER_RESOURCE_VARIABLE_TYPE>(VarType + 1))
{
@@ -59,7 +58,7 @@ void ShaderVariableManagerD3D12::ProcessSignatureResources(const PipelineResourc
continue;
if (Res.ResourceType == SHADER_RESOURCE_TYPE_SAMPLER &&
- (!UsingSeparateSamplers || Attr.IsImmutableSamplerAssigned()))
+ (UsingCombinedSamplers || Attr.IsImmutableSamplerAssigned()))
continue;
Handler(r);
@@ -137,18 +136,13 @@ void ShaderVariableManagerD3D12::Destroy(IMemoryAllocator& Allocator)
ShaderVariableD3D12Impl* ShaderVariableManagerD3D12::GetVariable(const Char* Name) const
{
- ShaderVariableD3D12Impl* pVar = nullptr;
for (Uint32 v = 0; v < m_NumVariables; ++v)
{
- auto& Var = m_pVariables[v];
- const auto& Res = Var.GetDesc();
- if (strcmp(Res.Name, Name) == 0)
- {
- pVar = &Var;
- break;
- }
+ auto& Var = m_pVariables[v];
+ if (strcmp(Var.GetDesc().Name, Name) == 0)
+ return &Var;
}
- return pVar;
+ return nullptr;
}
@@ -168,18 +162,18 @@ Uint32 ShaderVariableManagerD3D12::GetVariableIndex(const ShaderVariableD3D12Imp
if (m_pVariables == nullptr)
{
LOG_ERROR("This shader variable manager has no variables");
- return static_cast<Uint32>(-1);
+ return ~0u;
}
- auto Offset = reinterpret_cast<const Uint8*>(&Variable) - reinterpret_cast<Uint8*>(m_pVariables);
- VERIFY(Offset % sizeof(ShaderVariableD3D12Impl) == 0, "Offset is not multiple of ShaderVariableD3D12Impl class size");
+ const auto Offset = reinterpret_cast<const Uint8*>(&Variable) - reinterpret_cast<Uint8*>(m_pVariables);
+ DEV_CHECK_ERR(Offset % sizeof(ShaderVariableD3D12Impl) == 0, "Offset is not multiple of ShaderVariableD3D12Impl class size");
auto Index = static_cast<Uint32>(Offset / sizeof(ShaderVariableD3D12Impl));
if (Index < m_NumVariables)
return Index;
else
{
LOG_ERROR("Failed to get variable index. The variable ", &Variable, " does not belong to this shader variable manager");
- return static_cast<Uint32>(-1);
+ return ~0u;
}
}
@@ -192,45 +186,10 @@ void ShaderVariableManagerD3D12::BindResources(IResourceMapping* pResourceMappin
for (Uint32 v = 0; v < m_NumVariables; ++v)
{
- auto& Var = m_pVariables[v];
- const auto& Res = Var.GetDesc();
-
- if ((Flags & (1u << Res.VarType)) == 0)
- continue;
-
- for (Uint32 ArrInd = 0; ArrInd < Res.ArraySize; ++ArrInd)
- {
- if ((Flags & BIND_SHADER_RESOURCES_KEEP_EXISTING) && Var.IsBound(ArrInd))
- continue;
-
- const auto* VarName = Res.Name;
- RefCntAutoPtr<IDeviceObject> pObj;
- pResourceMapping->GetResource(VarName, &pObj, ArrInd);
- if (pObj)
- {
- Var.BindResource(pObj, ArrInd);
- }
- else
- {
- if ((Flags & BIND_SHADER_RESOURCES_VERIFY_ALL_RESOLVED) && !Var.IsBound(ArrInd))
- {
- LOG_ERROR_MESSAGE("Unable to bind resource to shader variable '",
- GetShaderResourcePrintName(Res, ArrInd),
- "': resource is not found in the resource mapping. "
- "Do not use BIND_SHADER_RESOURCES_VERIFY_ALL_RESOLVED flag to suppress the message if this is not an issue.");
- }
- }
- }
+ m_pVariables[v].BindResources<ShaderVariableD3D12Impl>(pResourceMapping, Flags);
}
}
-
-
-void ShaderVariableD3D12Impl::Set(IDeviceObject* pObject)
-{
- BindResource(pObject, 0);
-}
-
void ShaderVariableD3D12Impl::SetArray(IDeviceObject* const* ppObjects, Uint32 FirstElement, Uint32 NumElements)
{
const auto& ResDesc = GetDesc();
@@ -240,20 +199,4 @@ void ShaderVariableD3D12Impl::SetArray(IDeviceObject* const* ppObjects, Uint32 F
BindResource(ppObjects[Elem], FirstElement + Elem);
}
-bool ShaderVariableD3D12Impl::IsBound(Uint32 ArrayIndex) const
-{
- auto* pSignature = m_ParentManager.m_pSignature;
- auto& ResourceCache = m_ParentManager.m_ResourceCache;
-
- return pSignature->IsBound(ArrayIndex, m_ResIndex, ResourceCache);
-}
-
-void ShaderVariableD3D12Impl::BindResource(IDeviceObject* pObj, Uint32 ArrayIndex) const
-{
- auto* pSignature = m_ParentManager.m_pSignature;
- auto& ResourceCache = m_ParentManager.m_ResourceCache;
-
- pSignature->BindResource(pObj, ArrayIndex, m_ResIndex, ResourceCache);
-}
-
} // namespace Diligent
diff --git a/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp
index 6781b091..279acf70 100644
--- a/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/SwapChainD3D12Impl.cpp
@@ -75,7 +75,8 @@ void SwapChainD3D12Impl::InitBuffersAndViews()
for (Uint32 backbuff = 0; backbuff < m_SwapChainDesc.BufferCount; ++backbuff)
{
CComPtr<ID3D12Resource> pBackBuffer;
- auto hr = m_pSwapChain->GetBuffer(backbuff, __uuidof(pBackBuffer), reinterpret_cast<void**>(static_cast<ID3D12Resource**>(&pBackBuffer)));
+
+ auto hr = m_pSwapChain->GetBuffer(backbuff, __uuidof(pBackBuffer), reinterpret_cast<void**>(static_cast<ID3D12Resource**>(&pBackBuffer)));
if (FAILED(hr))
LOG_ERROR_AND_THROW("Failed to get back buffer ", backbuff, " from the swap chain");
diff --git a/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp
index 3a75df4c..ce8b702f 100644
--- a/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/TextureD3D12Impl.cpp
@@ -36,12 +36,10 @@
#include "EngineMemory.h"
#include "StringTools.hpp"
-using namespace Diligent;
-
namespace Diligent
{
-DXGI_FORMAT GetClearFormat(DXGI_FORMAT Fmt, D3D12_RESOURCE_FLAGS Flags)
+static DXGI_FORMAT GetClearFormat(DXGI_FORMAT Fmt, D3D12_RESOURCE_FLAGS Flags)
{
if (Flags & D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL)
{
diff --git a/Graphics/GraphicsEngineD3D12/src/TextureViewD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/TextureViewD3D12Impl.cpp
index 78115a70..78b519ba 100644
--- a/Graphics/GraphicsEngineD3D12/src/TextureViewD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/TextureViewD3D12Impl.cpp
@@ -55,8 +55,8 @@ TextureViewD3D12Impl::TextureViewD3D12Impl(IReferenceCounters* pRefCounte
if (!TexArraySRVDescriptor.IsNull() && !MipLevelUAVDescriptors.IsNull())
{
m_MipGenerationDescriptors = ALLOCATE(GetRawAllocator(), "Raw memory for DescriptorHeapAllocation", DescriptorHeapAllocation, 2);
- new (&m_MipGenerationDescriptors[0]) DescriptorHeapAllocation(std::move(TexArraySRVDescriptor));
- new (&m_MipGenerationDescriptors[1]) DescriptorHeapAllocation(std::move(MipLevelUAVDescriptors));
+ new (&m_MipGenerationDescriptors[0]) DescriptorHeapAllocation{std::move(TexArraySRVDescriptor)};
+ new (&m_MipGenerationDescriptors[1]) DescriptorHeapAllocation{std::move(MipLevelUAVDescriptors)};
}
}
diff --git a/Graphics/GraphicsEngineD3D12/src/TopLevelASD3D12Impl.cpp b/Graphics/GraphicsEngineD3D12/src/TopLevelASD3D12Impl.cpp
index 3a9ae5d7..9ee26ff4 100644
--- a/Graphics/GraphicsEngineD3D12/src/TopLevelASD3D12Impl.cpp
+++ b/Graphics/GraphicsEngineD3D12/src/TopLevelASD3D12Impl.cpp
@@ -41,10 +41,10 @@ TopLevelASD3D12Impl::TopLevelASD3D12Impl(IReferenceCounters* pRefCounters,
const TopLevelASDesc& Desc) :
TTopLevelASBase{pRefCounters, pDeviceD3D12, Desc}
{
- auto* pd3d12Device = pDeviceD3D12->GetD3D12Device5();
- const auto& Limits = pDeviceD3D12->GetProperties();
- UINT64 ResultDataMaxSizeInBytes = 0;
+ auto* const pd3d12Device = pDeviceD3D12->GetD3D12Device5();
+ const auto& Limits = pDeviceD3D12->GetProperties();
+ UINT64 ResultDataMaxSizeInBytes = 0;
if (m_Desc.CompactedSize > 0)
{
ResultDataMaxSizeInBytes = m_Desc.CompactedSize;
@@ -64,7 +64,7 @@ TopLevelASD3D12Impl::TopLevelASD3D12Impl(IReferenceCounters* pRefCounters,
pd3d12Device->GetRaytracingAccelerationStructurePrebuildInfo(&d3d12TopLevelInputs, &d3d12TopLevelPrebuildInfo);
if (d3d12TopLevelPrebuildInfo.ResultDataMaxSizeInBytes == 0)
- LOG_ERROR_AND_THROW("Failed to get ray tracing acceleration structure prebuild info");
+ LOG_ERROR_AND_THROW("Failed to get ray tracing acceleration structure prebuild info.");
ResultDataMaxSizeInBytes = d3d12TopLevelPrebuildInfo.ResultDataMaxSizeInBytes;
@@ -72,25 +72,25 @@ TopLevelASD3D12Impl::TopLevelASD3D12Impl(IReferenceCounters* pRefCounters,
m_ScratchSize.Update = static_cast<Uint32>(d3d12TopLevelPrebuildInfo.UpdateScratchDataSizeInBytes);
}
- D3D12_HEAP_PROPERTIES HeapProps;
+ D3D12_HEAP_PROPERTIES HeapProps{};
HeapProps.Type = D3D12_HEAP_TYPE_DEFAULT;
HeapProps.CPUPageProperty = D3D12_CPU_PAGE_PROPERTY_UNKNOWN;
HeapProps.MemoryPoolPreference = D3D12_MEMORY_POOL_UNKNOWN;
HeapProps.CreationNodeMask = 1;
HeapProps.VisibleNodeMask = 1;
- D3D12_RESOURCE_DESC d3d12ASDesc = {};
- d3d12ASDesc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
- d3d12ASDesc.Alignment = 0;
- d3d12ASDesc.Width = ResultDataMaxSizeInBytes;
- d3d12ASDesc.Height = 1;
- d3d12ASDesc.DepthOrArraySize = 1;
- d3d12ASDesc.MipLevels = 1;
- d3d12ASDesc.Format = DXGI_FORMAT_UNKNOWN;
- d3d12ASDesc.SampleDesc.Count = 1;
- d3d12ASDesc.SampleDesc.Quality = 0;
- d3d12ASDesc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR;
- d3d12ASDesc.Flags = D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
+ D3D12_RESOURCE_DESC d3d12ASDesc{};
+ d3d12ASDesc.Dimension = D3D12_RESOURCE_DIMENSION_BUFFER;
+ d3d12ASDesc.Alignment = 0;
+ d3d12ASDesc.Width = ResultDataMaxSizeInBytes;
+ d3d12ASDesc.Height = 1;
+ d3d12ASDesc.DepthOrArraySize = 1;
+ d3d12ASDesc.MipLevels = 1;
+ d3d12ASDesc.Format = DXGI_FORMAT_UNKNOWN;
+ d3d12ASDesc.SampleDesc.Count = 1;
+ d3d12ASDesc.SampleDesc.Quality = 0;
+ d3d12ASDesc.Layout = D3D12_TEXTURE_LAYOUT_ROW_MAJOR;
+ d3d12ASDesc.Flags = D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS;
auto hr = pd3d12Device->CreateCommittedResource(&HeapProps, D3D12_HEAP_FLAG_NONE,
&d3d12ASDesc, D3D12_RESOURCE_STATE_RAYTRACING_ACCELERATION_STRUCTURE, nullptr,
@@ -104,7 +104,7 @@ TopLevelASD3D12Impl::TopLevelASD3D12Impl(IReferenceCounters* pRefCounters,
m_DescriptorHandle = pDeviceD3D12->AllocateDescriptors(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);
- D3D12_SHADER_RESOURCE_VIEW_DESC d3d12SRVDesc;
+ D3D12_SHADER_RESOURCE_VIEW_DESC d3d12SRVDesc{};
d3d12SRVDesc.ViewDimension = D3D12_SRV_DIMENSION_RAYTRACING_ACCELERATION_STRUCTURE;
d3d12SRVDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
d3d12SRVDesc.Format = DXGI_FORMAT_UNKNOWN;