summaryrefslogtreecommitdiff
path: root/source/slang/core.meta.slang
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2018-06-05 21:35:48 -0700
committerGitHub <noreply@github.com>2018-06-05 21:35:48 -0700
commit1a698128c15bce0c05b0664bb1458842e1e55511 (patch)
treede4b65733737b1002168084e0b579843be761c3e /source/slang/core.meta.slang
parent8b16bbf64a082d30d496453f948f65605e58a014 (diff)
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<T>` elements. That change didn't apply to `RWBuffer<T>` or `RWTexture2D<T>`, 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
Diffstat (limited to 'source/slang/core.meta.slang')
-rw-r--r--source/slang/core.meta.slang9
1 files changed, 7 insertions, 2 deletions
diff --git a/source/slang/core.meta.slang b/source/slang/core.meta.slang
index 00afde2ac..507ae014e 100644
--- a/source/slang/core.meta.slang
+++ b/source/slang/core.meta.slang
@@ -326,7 +326,7 @@ for( int C = 2; C <= 4; ++C )
sb << "__magic_type(SamplerState," << int(SamplerStateFlavor::SamplerState) << ")\n";
sb << "__intrinsic_type(" << kIROp_SamplerStateType << ")\n";
sb << "struct SamplerState {};";
-
+
sb << "__magic_type(SamplerState," << int(SamplerStateFlavor::SamplerComparisonState) << ")\n";
sb << "__intrinsic_type(" << kIROp_SamplerComparisonStateType << ")\n";
sb << "struct SamplerComparisonState {};";
@@ -688,6 +688,11 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt)
default:
sb << "__target_intrinsic(glsl, \"imageStore($0, " << ivecN << "($1), $2)\") set;\n";
+
+ // TODO: really need a way to map access through `ref` accessor (e.g., when
+ // used with an atomic operation) over to GLSL equivalent.
+ //
+ sb << "ref;\n";
break;
}
@@ -911,7 +916,7 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt)
auto componentName = kk.componentName;
EMIT_LINE_DIRECTIVE();
-
+
sb << "__target_intrinsic(glsl, \"textureGather($p, $2, " << componentIndex << ")\")\n";
sb << "vector<T, 4> Gather" << componentName << "(SamplerState s, ";
sb << "float" << kBaseTextureTypes[tt].coordCount << " location);\n";