summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-rw-r--r--source/slang/glsl.meta.slang13
-rw-r--r--source/slang/hlsl.meta.slang17
2 files changed, 20 insertions, 10 deletions
diff --git a/source/slang/glsl.meta.slang b/source/slang/glsl.meta.slang
index b3323a327..dfa858eca 100644
--- a/source/slang/glsl.meta.slang
+++ b/source/slang/glsl.meta.slang
@@ -141,25 +141,18 @@ public property int gl_DeviceIndex
public property uint3 gl_NumWorkGroups
{
[require(glsl_spirv, GLSL_430_SPIRV_1_0_compute)]
+ [require(glsl_spirv, meshshading)]
get
{
- __target_switch
- {
- case glsl:
- __intrinsic_asm "(gl_NumWorkGroups)";
- case spirv:
- return spirv_asm {
- result:$$uint3 = OpLoad builtin(NumWorkgroups:uint3);
- };
- }
+ return WorkgroupCount();
}
}
-[require(compute)]
public property uint3 gl_WorkGroupSize
{
[__unsafeForceInlineEarly]
[require(compute)]
+ [require(meshshading)]
get
{
return WorkgroupSize();
diff --git a/source/slang/hlsl.meta.slang b/source/slang/hlsl.meta.slang
index c1449f3cb..f7efc3a51 100644
--- a/source/slang/hlsl.meta.slang
+++ b/source/slang/hlsl.meta.slang
@@ -6619,9 +6619,26 @@ void AllMemoryBarrierWithGroupSync()
// Returns the workgroup size of the calling entry point.
[require(compute)]
+[require(meshshading)]
__intrinsic_op($(kIROp_GetWorkGroupSize))
int3 WorkgroupSize();
+// Returns number of workgroups that have been dispatched to a GLSL or SPIR-V compute shader
+[require(glsl_spirv, GLSL_430_SPIRV_1_0_compute)]
+[require(glsl_spirv, meshshading)]
+uint3 WorkgroupCount()
+{
+ __target_switch
+ {
+ case glsl:
+ __intrinsic_asm "(gl_NumWorkGroups)";
+ case spirv:
+ return spirv_asm {
+ result:$$uint3 = OpLoad builtin(NumWorkgroups:uint3);
+ };
+ }
+}
+
// Test if any components is non-zero.
__generic<T : __BuiltinType>