summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2022-10-26 08:28:51 -0700
committerGitHub <noreply@github.com>2022-10-26 08:28:51 -0700
commit072bd7f7de2c5c41defb73ef8e755ffae2d4837c (patch)
treef925bd6edd61dcd5a9d737be4930da78308fac4e
parent26e622245b930f973963fa3200ab8dc0aadc3b1f (diff)
Fix d3d debug layer error on setting clear value. (#2458)
-rw-r--r--tools/gfx/d3d12/d3d12-device.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/gfx/d3d12/d3d12-device.cpp b/tools/gfx/d3d12/d3d12-device.cpp
index dbc2a18d9..c87e6b4ca 100644
--- a/tools/gfx/d3d12/d3d12-device.cpp
+++ b/tools/gfx/d3d12/d3d12-device.cpp
@@ -942,6 +942,14 @@ Result DeviceImpl::createTextureResource(
D3D12_CLEAR_VALUE clearValue;
D3D12_CLEAR_VALUE* clearValuePtr = nullptr;
+ clearValue.Format = resourceDesc.Format;
+ if (descIn.optimalClearValue)
+ {
+ memcpy(clearValue.Color, &descIn.optimalClearValue->color, sizeof(clearValue.Color));
+ clearValue.DepthStencil.Depth = descIn.optimalClearValue->depthStencil.depth;
+ clearValue.DepthStencil.Stencil = descIn.optimalClearValue->depthStencil.stencil;
+ clearValuePtr = &clearValue;
+ }
if ((resourceDesc.Flags & (D3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET |
D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL)) == 0)
{
@@ -951,14 +959,6 @@ Result DeviceImpl::createTextureResource(
{
clearValuePtr = nullptr;
}
- clearValue.Format = resourceDesc.Format;
- if (descIn.optimalClearValue)
- {
- memcpy(clearValue.Color, &descIn.optimalClearValue->color, sizeof(clearValue.Color));
- clearValue.DepthStencil.Depth = descIn.optimalClearValue->depthStencil.depth;
- clearValue.DepthStencil.Stencil = descIn.optimalClearValue->depthStencil.stencil;
- clearValuePtr = &clearValue;
- }
SLANG_RETURN_ON_FAIL(texture->m_resource.initCommitted(
m_device,
heapProps,