From 1a698128c15bce0c05b0664bb1458842e1e55511 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Tue, 5 Jun 2018 21:35:48 -0700 Subject: Fix atomic operations on RWBuffer (#593) * Fix atomic operations on RWBuffer An earlier change added support for passing true pointers to `__ref` parameters to fix the global `Interlocked*()` functions when applied to `groupshared` variables or `RWStructureBuffer` elements. That change didn't apply to `RWBuffer` or `RWTexture2D`, etc. because those types had so far only declared `get` and `set` accessors, but not any `ref` accessors (which return a pointer). The main fixes here are: * Add `ref` accessors to the subscript oeprations on the `RW*` resource types * Adjust the logic for emitting calls to subscript accessors so that we don't get quite as eager about invoking a `ref` accessor, and instead try to invoke just a `get` or `set` accessor when these will suffice. This is important for Vulkan cross-compilation, where we don't yet support the semantics of our `ref` accessors. * Add a test case for atomics on a `RWBuffer` * Fix up `render-test` so that we can specify a format for a buffer resource, which allows us to use things other than `*StructuredBuffer` and `*ByteAddressBuffer`. The work there is probably not complete; I just did what I could to get the test working. * A bunch of files got whitespace edits thanks to the fact that I'm using editorconfig and others on the project seemingly arent... * fixup: remove ifdefed-out code --- tools/render-test/d3d-util.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tools/render-test/d3d-util.cpp') diff --git a/tools/render-test/d3d-util.cpp b/tools/render-test/d3d-util.cpp index fb3cb49bf..bef0e6baa 100644 --- a/tools/render-test/d3d-util.cpp +++ b/tools/render-test/d3d-util.cpp @@ -31,6 +31,7 @@ using namespace Slang; case Format::RG_Float32: return DXGI_FORMAT_R32G32_FLOAT; case Format::R_Float32: return DXGI_FORMAT_R32_FLOAT; case Format::RGBA_Unorm_UInt8: return DXGI_FORMAT_R8G8B8A8_UNORM; + case Format::R_UInt32: return DXGI_FORMAT_R32_UINT; case Format::D_Float32: return DXGI_FORMAT_D32_FLOAT; case Format::D_Unorm24_S8: return DXGI_FORMAT_D24_UNORM_S8_UINT; @@ -47,7 +48,8 @@ using namespace Slang; switch (format) { case DXGI_FORMAT_R32_FLOAT: /* fallthru */ - case DXGI_FORMAT_D32_FLOAT: + case DXGI_FORMAT_R32_UINT: + case DXGI_FORMAT_D32_FLOAT: { return DXGI_FORMAT_R32_TYPELESS; } @@ -73,7 +75,7 @@ using namespace Slang; switch (format) { case DXGI_FORMAT_D32_FLOAT: /* fallthru */ - case DXGI_FORMAT_R32_TYPELESS: + case DXGI_FORMAT_R32_TYPELESS: { return DXGI_FORMAT_D32_FLOAT; } @@ -88,7 +90,7 @@ using namespace Slang; switch (format) { case DXGI_FORMAT_D32_FLOAT: /* fallthru */ - case DXGI_FORMAT_D24_UNORM_S8_UINT: + case DXGI_FORMAT_D24_UNORM_S8_UINT: { return DXGI_FORMAT_UNKNOWN; } @@ -102,7 +104,7 @@ using namespace Slang; switch (format) { case DXGI_FORMAT_D32_FLOAT: /* fallthru */ - case DXGI_FORMAT_R32_TYPELESS: + case DXGI_FORMAT_R32_TYPELESS: { return DXGI_FORMAT_R32_FLOAT; } -- cgit v1.2.3