From 4583e395ad503b63343a14adaeb621dee8a8da71 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Thu, 1 Feb 2018 12:06:06 -0800 Subject: Implement type splitting for raw buffers (#393) * Fix render-test to handle raw buffers I don't know if this fix will work for UAVs that are neither structured nor raw, but it fixes the code that currently only really works if every UAV is structured (since it doesn't set a format). * Make type legalization consider raw buffer types The type layout logic was already handling these, but the type splitting logic in legalization was failing to split structure types that contain, e.g., `RWByteAddressBuffer`. A compute test case has been added to confirm the fix. --- tools/render-test/render-d3d11.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tools/render-test/render-d3d11.cpp') diff --git a/tools/render-test/render-d3d11.cpp b/tools/render-test/render-d3d11.cpp index d0280a770..7d5c79b19 100644 --- a/tools/render-test/render-d3d11.cpp +++ b/tools/render-test/render-d3d11.cpp @@ -815,6 +815,16 @@ public: viewDesc.Buffer.Flags = 0; viewDesc.ViewDimension = D3D11_UAV_DIMENSION_BUFFER; viewDesc.Format = DXGI_FORMAT_UNKNOWN; + + if( bufferDesc.stride == 0 ) + { + // TODO: are there UAV cases we need to handle that are neither + // raw nor structured? RWBuffer would be one... + + viewDesc.Buffer.Flags |= D3D11_BUFFER_UAV_FLAG_RAW; + viewDesc.Format = DXGI_FORMAT_R32_TYPELESS; + } + dxDevice->CreateUnorderedAccessView(bufferOut, &viewDesc, &viewOut); } if (bufferDesc.type != InputBufferType::ConstantBuffer) -- cgit v1.2.3