summaryrefslogtreecommitdiff
path: root/source/slang/core.meta.slang
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2018-09-24 19:17:12 -0700
committerGitHub <noreply@github.com>2018-09-24 19:17:12 -0700
commit4f979d74acf2800d7bd2b38155d2bdc47b57d54b (patch)
tree0aba87d2213fc5e6023a8b331c80756559b5f593 /source/slang/core.meta.slang
parent32c8479fb964b1936564ef9cf68e434500d7b7df (diff)
Fixes around atomic operations (#652)
* Fixes around atomic operations Work on #651 The existing handling of atomic operations had a few issues: * The HLSL atomic functions (`Interlocked*`) didn't have mappings to GLSL * Atomic operations on images weren't supported at all because the subscript operation on `RWTexture*` types didn't provide a `ref` acessor * The HLSL atomic functions were only providing the overloads that return the previous value through an `out` parameter, and not the ones that ignore the previous value. This change fixes these issues with the following changes: * `RWTexture*` types now have a `ref` accessor on their subscript operation which maps to a new `imageSubscript` operation in the IR. By default this translates back to `tex[idx]` in output HLSL, but it makes a custom mapping possible for GLSL * The `Interlocked*` function definitions were expanded to include the overloads without the `out` parameter * GLSL translations were added for the `Interlocked*` functions. These mappings use some new customization points in the intrinsic operation emit logic to support outputting calls to either `atomic*` or `imageAtomic*` as required, and to expand an argument that is a subscript into an image as multiple arguments. This whole approach is quite hacky, and it doesn't seem like the approach we should take in the long run. * Fix: typo in InterlockedAnd lowering One of the cases of `InterlockedAnd` was lowering to `atomicAnd` with a `$0` where we wanted the `$A` substitution to handle the possibility of an image.
Diffstat (limited to 'source/slang/core.meta.slang')
-rw-r--r--source/slang/core.meta.slang6
1 files changed, 1 insertions, 5 deletions
diff --git a/source/slang/core.meta.slang b/source/slang/core.meta.slang
index 56f5d8d1f..aa93863df 100644
--- a/source/slang/core.meta.slang
+++ b/source/slang/core.meta.slang
@@ -784,11 +784,7 @@ for (int tt = 0; tt < kBaseTextureTypeCount; ++tt)
default:
sb << "__target_intrinsic(glsl, \"imageStore($0, " << ivecN << "($1), $V2)\") set;\n";
- // Note: HLSL doesn't support component-granularity access into typed UAVs,
- // and also doesn't support atomic operations on them. As such, there should
- // be no reason why a `ref` accessor is required here.
- //
- // sb << "ref;\n";
+ sb << "__intrinsic_op(" << int(kIROp_ImageSubscript) << ") ref;\n";
break;
}