summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-type-layout.cpp
diff options
context:
space:
mode:
authorArielG-NV <159081215+ArielG-NV@users.noreply.github.com>2024-03-13 15:03:16 -0400
committerGitHub <noreply@github.com>2024-03-13 15:03:16 -0400
commit9fd74379c22af14f794d48fdc22e772d47f61ca3 (patch)
tree9d15b4139d8fdaa335197617b0bc6cab14ed42a3 /source/slang/slang-type-layout.cpp
parent6f7c8271710b43349d34b8f7569ceb6957400548 (diff)
Implement glsl atomic's [non image or memory scope] with optional extension(s); resolves #3587 for GLSL & SPIR-V targets (#3755)
The following commit implements atomic operations & types associated with OpenGL 4.6, GL_EXT_vulkan_glsl_relaxed, GLSL_EXT_shader_atomic_float, GLSL_EXT_shader_atomic_float2, for GLSL & SPIR-V targets. Fully implements all functions, and built-in type's, resolves https://github.com/shader-slang/slang/issues/3560 for GLSL & SPRI-V targets. [Atomic extensions for GLSL can be found here](https://github.com/KhronosGroup/GLSL/tree/main) Notes of worth: * atomic_uint is well defined in GLSL->OpenGL, although was removed in GLSL->VK unless a compiler extension is supported (GL_EXT_vulkan_glsl_relaxed). This support entails transforming all atomic_uint operations and references into a storage buffer. SPIR-V has AtomicCounter+AtomicStorage (atomic_uint parallel) but does not implement these capabilities for SPIR-V->VK in any scenario. Due to the case we transform atomic_uint ourselves (GLSL_Syntax->Slang_IR) to accommodate transforming atomic_uint into valid syntax. * GLSL_EXT_shader_atomic_float2 (all float16_t & some float/double operations) support is minimal and worth watching out for if enabling the tests.
Diffstat (limited to 'source/slang/slang-type-layout.cpp')
-rw-r--r--source/slang/slang-type-layout.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/slang/slang-type-layout.cpp b/source/slang/slang-type-layout.cpp
index 3f49d62d2..f7efd4ee4 100644
--- a/source/slang/slang-type-layout.cpp
+++ b/source/slang/slang-type-layout.cpp
@@ -3858,6 +3858,14 @@ static TypeLayoutResult _createTypeLayout(
type,
rules);
}
+ else if (auto atomicType = as<GLSLAtomicUintType>(type))
+ {
+ ShaderParameterKind kind = ShaderParameterKind::AtomicUint;
+ return createSimpleTypeLayout(
+ rules->GetObjectLayout(kind, context.objectLayoutOptions),
+ type,
+ rules);
+ }
// TODO: need a better way to handle this stuff...
#define CASE(TYPE, KIND) \