summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsricker-nvidia <115114531+sricker-nvidia@users.noreply.github.com>2025-05-15 17:01:08 -0700
committerGitHub <noreply@github.com>2025-05-16 00:01:08 +0000
commitb39ec87cccaadebbb9325dd2adb8c0b13b364805 (patch)
tree322660b9f058b1d0e2d9b990573332848529a3b0
parentfba75a6f3f3c26b05cf4c826bff4a102972d348c (diff)
Fix broken -emit-spirv-via-glsl test option (#7091)
Fixes issue #6898 The -emit-spirv-via-glsl slang-test option has been broken for some amount of time. Tests that were using it were operating as if using -emit-spirv-directly, leading to many duplicated tests. After fixing the test option, there were an number of errors that appeared as a result. This change fixes the broken test option and the resulting test errors. Some of the test errors revealed some legitimate issues, such as: -The GLSL bitCount instrinsic only supports 32-bit integers and requires emulation for other bit widths. -Emitting GLSL 8-bit and 16-bit glsl integer types did not emit the proper extension requirements -Emitting GLSL and casting for 16-bit integers was missing a closing parenthesis. -Missing profile for GL_EXT_shader_explicit_arithmetic_types -Missing toType cases for UInt8/Int8 for the kIROp_BitCast case in tryEmitInstExprImpl.
-rw-r--r--docs/command-line-slangc-reference.md1
-rw-r--r--source/slang/hlsl.meta.slang27
-rw-r--r--source/slang/slang-capabilities.capdef5
-rw-r--r--source/slang/slang-emit-glsl.cpp18
-rw-r--r--tests/bugs/gh-4305.slang5
-rw-r--r--tests/cooperative-matrix/return.slang2
-rw-r--r--tests/cooperative-vector/atan.slang2
-rw-r--r--tests/cooperative-vector/clamp.slang2
-rw-r--r--tests/cooperative-vector/conversion.slang2
-rw-r--r--tests/cooperative-vector/exp.slang2
-rw-r--r--tests/cooperative-vector/fma.slang2
-rw-r--r--tests/cooperative-vector/log.slang2
-rw-r--r--tests/cooperative-vector/matrix-mul-bias-packed-mut.slang2
-rw-r--r--tests/cooperative-vector/matrix-mul-bias-packed.slang2
-rw-r--r--tests/cooperative-vector/max.slang2
-rw-r--r--tests/cooperative-vector/min.slang2
-rw-r--r--tests/cooperative-vector/scalar-mul.slang2
-rw-r--r--tests/cooperative-vector/step.slang2
-rw-r--r--tests/cooperative-vector/tanh.slang2
-rw-r--r--tests/glsl/integer_pack.slang (renamed from tests/glsl/interger_pack.slang)0
-rw-r--r--tests/hlsl-intrinsic/countbits.slang2
-rw-r--r--tests/hlsl-intrinsic/countbits16.slang2
-rw-r--r--tests/hlsl-intrinsic/countbits64.slang6
-rw-r--r--tests/hlsl-intrinsic/countbits8.slang2
-rw-r--r--tests/hlsl-intrinsic/wave-rotate/wave-rotate-clustered.slang5
-rw-r--r--tests/hlsl-intrinsic/wave-rotate/wave-rotate.slang4
-rw-r--r--tests/language-feature/bit-cast/struct-bit-cast-2.slang2
-rw-r--r--tests/language-feature/bit-cast/struct-reinterpret.slang2
-rw-r--r--tests/language-feature/bitfield/bitfield-insert-extract-non32bit.slang2
-rw-r--r--tests/spirv/spec-constant-generic.slang2
-rw-r--r--tests/spirv/spec-constant-sized-array-1.slang2
-rw-r--r--tests/spirv/spec-constant-sized-array-2.slang2
-rw-r--r--tests/spirv/spec-constant-sized-array-3.slang2
-rw-r--r--tests/spirv/spec-constant-sized-array-4.slang2
-rw-r--r--tools/render-test/slang-support.cpp16
35 files changed, 95 insertions, 42 deletions
diff --git a/docs/command-line-slangc-reference.md b/docs/command-line-slangc-reference.md
index 1562ce02f..296441a2e 100644
--- a/docs/command-line-slangc-reference.md
+++ b/docs/command-line-slangc-reference.md
@@ -1226,6 +1226,7 @@ A capability describes an optional feature that a target may or may not support.
* `GL_EXT_shader_atomic_float_min_max` : enables the GL_EXT_shader_atomic_float_min_max extension
* `GL_EXT_shader_atomic_float2` : enables the GL_EXT_shader_atomic_float2 extension
* `GL_EXT_shader_atomic_int64` : enables the GL_EXT_shader_atomic_int64 extension
+* `GL_EXT_shader_explicit_arithmetic_types` : enables the GL_EXT_shader_explicit_arithmetic_types extension
* `GL_EXT_shader_explicit_arithmetic_types_int64` : enables the GL_EXT_shader_explicit_arithmetic_types_int64 extension
* `GL_EXT_shader_image_load_store` : enables the GL_EXT_shader_image_load_store extension
* `GL_EXT_shader_realtime_clock` : enables the GL_EXT_shader_realtime_clock extension
diff --git a/source/slang/hlsl.meta.slang b/source/slang/hlsl.meta.slang
index d7a65c031..6fb3af7fd 100644
--- a/source/slang/hlsl.meta.slang
+++ b/source/slang/hlsl.meta.slang
@@ -8084,9 +8084,20 @@ uint countbits(T value)
// 16-bit support dependent on SM6.2 and dxil
__intrinsic_asm "countbits";
case glsl:
- // 64-bit support dependent on GL_ARB_gpu_shader_int64
- // 16-bit support dependent on GL_EXT_shader_16bit_storage
- __intrinsic_asm "bitCount";
+ if(T is int64_t || T is uint64_t)
+ {
+ return __emulatedCountbits64(__intCast<uint64_t>(value));
+ }
+ else if (T is int16_t || T is uint16_t)
+ {
+ // emulate 16-bit
+ return countbits(__intCast<uint32_t>(value));
+ }
+ else
+ {
+ // bitCount only supports 32-bit
+ __intrinsic_asm "bitCount";
+ }
case metal:
if (T is int64_t || T is uint64_t)
{
@@ -8150,7 +8161,15 @@ vector<uint, N> countbits(vector<T, N> value)
case hlsl:
__intrinsic_asm "countbits";
case glsl:
- __intrinsic_asm "bitCount";
+ if(T is int64_t || T is uint64_t || T is int16_t || T is uint16_t)
+ {
+ // Emulate 64-bit and 16-bit
+ VECTOR_MAP_UNARY(uint, N, countbits, value);
+ }
+ else
+ {
+ __intrinsic_asm "bitCount";
+ }
case metal:
if(T is int64_t || T is uint64_t || T is int16_t || T is uint16_t)
{
diff --git a/source/slang/slang-capabilities.capdef b/source/slang/slang-capabilities.capdef
index 937584908..9a1a89bfe 100644
--- a/source/slang/slang-capabilities.capdef
+++ b/source/slang/slang-capabilities.capdef
@@ -813,6 +813,7 @@ def _GL_EXT_shader_atomic_float : glsl;
def _GL_EXT_shader_atomic_float_min_max : glsl;
def _GL_EXT_shader_atomic_float2 : glsl;
def _GL_EXT_shader_atomic_int64 : glsl;
+def _GL_EXT_shader_explicit_arithmetic_types : _GLSL_140;
def _GL_EXT_shader_explicit_arithmetic_types_int64 : _GLSL_140;
def _GL_EXT_shader_image_load_store : _GLSL_130;
def _GL_EXT_shader_realtime_clock : glsl;
@@ -937,6 +938,10 @@ alias GL_EXT_shader_atomic_float2 = _GL_EXT_shader_atomic_float2 | spvAtomicFloa
/// [EXT]
alias GL_EXT_shader_atomic_int64 = _GL_EXT_shader_atomic_int64 | spvInt64Atomics;
+/// Represents the GL_EXT_shader_explicit_arithmetic_types extension.
+/// [EXT]
+alias GL_EXT_shader_explicit_arithmetic_types = _GL_EXT_shader_explicit_arithmetic_types | _spirv_1_0;
+
/// Represents the GL_EXT_shader_explicit_arithmetic_types_int64 extension.
/// [EXT]
alias GL_EXT_shader_explicit_arithmetic_types_int64 = _GL_EXT_shader_explicit_arithmetic_types_int64 | _spirv_1_0;
diff --git a/source/slang/slang-emit-glsl.cpp b/source/slang/slang-emit-glsl.cpp
index 39b318ff3..116d9b1d6 100644
--- a/source/slang/slang-emit-glsl.cpp
+++ b/source/slang/slang-emit-glsl.cpp
@@ -1080,9 +1080,11 @@ void GLSLSourceEmitter::_emitGLSLTypePrefix(IRType* type, bool promoteHalfToFloa
break;
case kIROp_Int8Type:
+ _requireBaseType(cast<IRBasicType>(type)->getBaseType());
m_writer->emit("i8");
break;
case kIROp_Int16Type:
+ _requireBaseType(cast<IRBasicType>(type)->getBaseType());
m_writer->emit("i16");
break;
case kIROp_IntType:
@@ -1106,9 +1108,11 @@ void GLSLSourceEmitter::_emitGLSLTypePrefix(IRType* type, bool promoteHalfToFloa
}
case kIROp_UInt8Type:
+ _requireBaseType(cast<IRBasicType>(type)->getBaseType());
m_writer->emit("u8");
break;
case kIROp_UInt16Type:
+ _requireBaseType(cast<IRBasicType>(type)->getBaseType());
m_writer->emit("u16");
break;
case kIROp_UIntType:
@@ -1327,8 +1331,10 @@ void GLSLSourceEmitter::emitSimpleValueImpl(IRInst* inst)
}
case BaseType::Int16:
{
+ emitType(type);
+ m_writer->emit("(");
m_writer->emit(int16_t(litInst->value.intVal));
- m_writer->emit("S");
+ m_writer->emit("S)");
return;
}
case BaseType::Int:
@@ -1346,8 +1352,10 @@ void GLSLSourceEmitter::emitSimpleValueImpl(IRInst* inst)
}
case BaseType::UInt16:
{
+ emitType(type);
+ m_writer->emit("(");
m_writer->emit(UInt(uint16_t(litInst->value.intVal)));
- m_writer->emit("US");
+ m_writer->emit("US)");
return;
}
case BaseType::UInt:
@@ -2289,6 +2297,12 @@ bool GLSLSourceEmitter::tryEmitInstExprImpl(IRInst* inst, const EmitOpInfo& inOu
emitType(inst->getDataType());
}
break;
+ case BaseType::UInt8:
+ emitType(inst->getDataType());
+ break;
+ case BaseType::Int8:
+ emitType(inst->getDataType());
+ break;
case BaseType::UInt16:
if (fromType == BaseType::Half)
{
diff --git a/tests/bugs/gh-4305.slang b/tests/bugs/gh-4305.slang
index dd09bda1e..29d61f787 100644
--- a/tests/bugs/gh-4305.slang
+++ b/tests/bugs/gh-4305.slang
@@ -32,9 +32,10 @@ layout(local_size_x = 2, local_size_y = 2, local_size_z = 1) in;
[DerivativeGroupLinear]
#endif // #ifdef QUAD
[numthreads(2, 2, 1)]
-#endif //#ifndef MODIFIER
+#endif // #ifndef MODIFIER
+[shader("compute")]
void computeMain()
{
//BUF:1
outputBuffer[0] = t2D.Sample(samplerState, float2(0.5, 0.5));
-} \ No newline at end of file
+}
diff --git a/tests/cooperative-matrix/return.slang b/tests/cooperative-matrix/return.slang
index b67117892..2da0c81ad 100644
--- a/tests/cooperative-matrix/return.slang
+++ b/tests/cooperative-matrix/return.slang
@@ -1,4 +1,4 @@
-//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -skip-spirv-validation
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -output-using-type -skip-spirv-validation -emit-spirv-directly
// CHECK: type: float
// CHECK-NEXT: 3.000000
diff --git a/tests/cooperative-vector/atan.slang b/tests/cooperative-vector/atan.slang
index 4ae135dcd..83c4da5ab 100644
--- a/tests/cooperative-vector/atan.slang
+++ b/tests/cooperative-vector/atan.slang
@@ -1,4 +1,4 @@
-//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type
diff --git a/tests/cooperative-vector/clamp.slang b/tests/cooperative-vector/clamp.slang
index 1250aaae0..72202ee98 100644
--- a/tests/cooperative-vector/clamp.slang
+++ b/tests/cooperative-vector/clamp.slang
@@ -1,4 +1,4 @@
-//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type
diff --git a/tests/cooperative-vector/conversion.slang b/tests/cooperative-vector/conversion.slang
index 5bba7961b..c0f8f788a 100644
--- a/tests/cooperative-vector/conversion.slang
+++ b/tests/cooperative-vector/conversion.slang
@@ -1,4 +1,4 @@
-//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type
diff --git a/tests/cooperative-vector/exp.slang b/tests/cooperative-vector/exp.slang
index 82c43c900..18e41b1b9 100644
--- a/tests/cooperative-vector/exp.slang
+++ b/tests/cooperative-vector/exp.slang
@@ -1,4 +1,4 @@
-//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type
diff --git a/tests/cooperative-vector/fma.slang b/tests/cooperative-vector/fma.slang
index 9f0e194aa..cddf91ad2 100644
--- a/tests/cooperative-vector/fma.slang
+++ b/tests/cooperative-vector/fma.slang
@@ -1,4 +1,4 @@
-//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type
diff --git a/tests/cooperative-vector/log.slang b/tests/cooperative-vector/log.slang
index 3e5cd32cf..99a5e1c49 100644
--- a/tests/cooperative-vector/log.slang
+++ b/tests/cooperative-vector/log.slang
@@ -1,4 +1,4 @@
-//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type
diff --git a/tests/cooperative-vector/matrix-mul-bias-packed-mut.slang b/tests/cooperative-vector/matrix-mul-bias-packed-mut.slang
index 29038c83d..4abaaec8c 100644
--- a/tests/cooperative-vector/matrix-mul-bias-packed-mut.slang
+++ b/tests/cooperative-vector/matrix-mul-bias-packed-mut.slang
@@ -1,4 +1,4 @@
-//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type
diff --git a/tests/cooperative-vector/matrix-mul-bias-packed.slang b/tests/cooperative-vector/matrix-mul-bias-packed.slang
index 16975cd09..c1f87b65c 100644
--- a/tests/cooperative-vector/matrix-mul-bias-packed.slang
+++ b/tests/cooperative-vector/matrix-mul-bias-packed.slang
@@ -1,4 +1,4 @@
-//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type
diff --git a/tests/cooperative-vector/max.slang b/tests/cooperative-vector/max.slang
index 09eff40d7..55091127b 100644
--- a/tests/cooperative-vector/max.slang
+++ b/tests/cooperative-vector/max.slang
@@ -1,4 +1,4 @@
-//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type
diff --git a/tests/cooperative-vector/min.slang b/tests/cooperative-vector/min.slang
index 25c363133..825891f6f 100644
--- a/tests/cooperative-vector/min.slang
+++ b/tests/cooperative-vector/min.slang
@@ -1,4 +1,4 @@
-//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type
diff --git a/tests/cooperative-vector/scalar-mul.slang b/tests/cooperative-vector/scalar-mul.slang
index f9fed6d7d..bbb560daa 100644
--- a/tests/cooperative-vector/scalar-mul.slang
+++ b/tests/cooperative-vector/scalar-mul.slang
@@ -1,4 +1,4 @@
-//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type
diff --git a/tests/cooperative-vector/step.slang b/tests/cooperative-vector/step.slang
index 620ad3398..4e6235f51 100644
--- a/tests/cooperative-vector/step.slang
+++ b/tests/cooperative-vector/step.slang
@@ -1,4 +1,4 @@
-//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type
diff --git a/tests/cooperative-vector/tanh.slang b/tests/cooperative-vector/tanh.slang
index 15fecbfa5..69334762e 100644
--- a/tests/cooperative-vector/tanh.slang
+++ b/tests/cooperative-vector/tanh.slang
@@ -1,4 +1,4 @@
-//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-vk -render-feature cooperative-vector -output-using-type -emit-spirv-directly
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-dx12 -render-feature cooperative-vector -dx12-experimental -use-dxil -output-using-type -profile cs_6_8 -Xslang... -Xdxc -Vd -X. -capability hlsl_coopvec_poc
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK):-cpu -output-using-type
diff --git a/tests/glsl/interger_pack.slang b/tests/glsl/integer_pack.slang
index cf2c49f9c..cf2c49f9c 100644
--- a/tests/glsl/interger_pack.slang
+++ b/tests/glsl/integer_pack.slang
diff --git a/tests/hlsl-intrinsic/countbits.slang b/tests/hlsl-intrinsic/countbits.slang
index 060ad98f4..689a58f7f 100644
--- a/tests/hlsl-intrinsic/countbits.slang
+++ b/tests/hlsl-intrinsic/countbits.slang
@@ -5,7 +5,7 @@
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -cuda -compute
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -mtl -compute
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -wgpu -compute
-// TODO: test GLSL pathway once emit-spirv-via-glsl is fixed and shader output reading is fixed for GLSL
+//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -vk -compute -emit-spirv-via-glsl
//CHK:1
diff --git a/tests/hlsl-intrinsic/countbits16.slang b/tests/hlsl-intrinsic/countbits16.slang
index dbfdc9217..fbdb48a83 100644
--- a/tests/hlsl-intrinsic/countbits16.slang
+++ b/tests/hlsl-intrinsic/countbits16.slang
@@ -7,7 +7,7 @@
// https://docs.microsoft.com/en-us/windows/win32/direct3dhlsl/hlsl-shader-model-6-0-features-for-direct3d-12
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -compute -dx12 -profile cs_6_2 -use-dxil -shaderobj -render-feature hardware-device
// wgpu only has 32-bit support, so we do not try and test it here
-// TODO: test GLSL pathway once emit-spirv-via-glsl is fixed and shader output reading is fixed for GLSL
+//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -vk -compute -emit-spirv-via-glsl
//CHK:1
diff --git a/tests/hlsl-intrinsic/countbits64.slang b/tests/hlsl-intrinsic/countbits64.slang
index 90799e411..ac2902108 100644
--- a/tests/hlsl-intrinsic/countbits64.slang
+++ b/tests/hlsl-intrinsic/countbits64.slang
@@ -1,8 +1,6 @@
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -compute -cpu
-//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -vk -compute -render-feature int64
-// emit-spirv-via-glsl is currently ignored, but even working around this, output does not appear to be captured for GLSL
-// No support for uint64_t in GLSL without an extension like GL_EXT_shader_explicit_arithmetic_types_int64
-//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-slang -vk -compute -render-feature int64 -emit-spirv-via-glsl -profile GLSL_400 -Xslang... -capability GL_EXT_shader_explicit_arithmetic_types_int64.
+//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -vk -compute
+//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -vk -compute -emit-spirv-via-glsl
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -cuda -compute
//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -mtl -compute
// No support for uint64_t on fxc - we need SM6.0 and dxil to use uint64_t with d3d12
diff --git a/tests/hlsl-intrinsic/countbits8.slang b/tests/hlsl-intrinsic/countbits8.slang
index 1db8e805c..0426b5682 100644
--- a/tests/hlsl-intrinsic/countbits8.slang
+++ b/tests/hlsl-intrinsic/countbits8.slang
@@ -6,7 +6,7 @@
// Not testing the following:
// -dx12/hlsl, No support for uint8_t with hlsl
// -wgpu, only has 32-bit support
-// -vk/glsl, No support for uint8_t with glsl
+//TEST(compute):COMPARE_COMPUTE_EX(filecheck-buffer=CHK):-slang -vk -compute -emit-spirv-via-glsl
//CHK:1
diff --git a/tests/hlsl-intrinsic/wave-rotate/wave-rotate-clustered.slang b/tests/hlsl-intrinsic/wave-rotate/wave-rotate-clustered.slang
index d52384c15..a8ca2d66f 100644
--- a/tests/hlsl-intrinsic/wave-rotate/wave-rotate-clustered.slang
+++ b/tests/hlsl-intrinsic/wave-rotate/wave-rotate-clustered.slang
@@ -1,9 +1,8 @@
//TEST_CATEGORY(wave, compute)
//TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -shaderobj -emit-spirv-directly
-//TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -shaderobj -emit-spirv-via-glsl
-
+//TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -shaderobj -emit-spirv-via-glsl -Xslang... -capability GL_KHR_shader_subgroup_rotate -X.
//TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -shaderobj -emit-spirv-directly -xslang -DUSE_GLSL_SYNTAX -allow-glsl
-//TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -shaderobj -emit-spirv-via-glsl -xslang -DUSE_GLSL_SYNTAX -allow-glsl
+//TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -shaderobj -emit-spirv-via-glsl -allow-glsl -Xslang... -DUSE_GLSL_SYNTAX -capability GL_KHR_shader_subgroup_rotate -X.
#if defined(USE_GLSL_SYNTAX)
#define __clusteredRotate subgroupClusteredRotate
diff --git a/tests/hlsl-intrinsic/wave-rotate/wave-rotate.slang b/tests/hlsl-intrinsic/wave-rotate/wave-rotate.slang
index 4b815c265..5dc319254 100644
--- a/tests/hlsl-intrinsic/wave-rotate/wave-rotate.slang
+++ b/tests/hlsl-intrinsic/wave-rotate/wave-rotate.slang
@@ -1,11 +1,11 @@
//TEST_CATEGORY(wave, compute)
//TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -shaderobj -emit-spirv-directly
-//TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -shaderobj -emit-spirv-via-glsl
+//TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -shaderobj -emit-spirv-via-glsl -Xslang... -capability GL_KHR_shader_subgroup_rotate -X.
//TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-metal -compute -shaderobj -xslang -DMETAL
//TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -shaderobj -emit-spirv-directly -xslang -DUSE_GLSL_SYNTAX -allow-glsl
-//TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -shaderobj -emit-spirv-via-glsl -xslang -DUSE_GLSL_SYNTAX -allow-glsl
+//TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-vk -compute -shaderobj -emit-spirv-via-glsl -allow-glsl -Xslang... -DUSE_GLSL_SYNTAX -capability GL_KHR_shader_subgroup_rotate -X.
//TEST:COMPARE_COMPUTE_EX(filecheck-buffer=CHECK):-metal -compute -shaderobj -xslang -DMETAL -xslang -DUSE_GLSL_SYNTAX -allow-glsl
diff --git a/tests/language-feature/bit-cast/struct-bit-cast-2.slang b/tests/language-feature/bit-cast/struct-bit-cast-2.slang
index edf91e00b..dd9922ee8 100644
--- a/tests/language-feature/bit-cast/struct-bit-cast-2.slang
+++ b/tests/language-feature/bit-cast/struct-bit-cast-2.slang
@@ -1,7 +1,7 @@
// struct-bit-cast-2.slang
// Test bit casts for read across boundaries of scalar types.
-//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -vk -shaderobj
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -vk -shaderobj -emit-spirv-directly
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -cpu -shaderobj
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -cuda -shaderobj
diff --git a/tests/language-feature/bit-cast/struct-reinterpret.slang b/tests/language-feature/bit-cast/struct-reinterpret.slang
index 6be359d79..4b9518a4b 100644
--- a/tests/language-feature/bit-cast/struct-reinterpret.slang
+++ b/tests/language-feature/bit-cast/struct-reinterpret.slang
@@ -1,7 +1,7 @@
// struct-bit-cast-2.slang
// Test bit casts for read across boundaries of scalar types.
-//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -vk -shaderobj
+//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -vk -shaderobj -emit-spirv-directly
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -cpu -shaderobj
//TEST(compute):COMPARE_COMPUTE(filecheck-buffer=CHECK): -cuda -shaderobj
diff --git a/tests/language-feature/bitfield/bitfield-insert-extract-non32bit.slang b/tests/language-feature/bitfield/bitfield-insert-extract-non32bit.slang
index 0edbb049a..ded0baed4 100644
--- a/tests/language-feature/bitfield/bitfield-insert-extract-non32bit.slang
+++ b/tests/language-feature/bitfield/bitfield-insert-extract-non32bit.slang
@@ -1,4 +1,4 @@
-//TEST:COMPARE_COMPUTE(filecheck-buffer=BUF): -vk -output-using-type
+//TEST:COMPARE_COMPUTE(filecheck-buffer=BUF): -vk -output-using-type -emit-spirv-directly
//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0 0], stride=4):out,name=outputBuffer
RWStructuredBuffer<int32_t> outputBuffer;
diff --git a/tests/spirv/spec-constant-generic.slang b/tests/spirv/spec-constant-generic.slang
index 65eed2810..9a9f7006f 100644
--- a/tests/spirv/spec-constant-generic.slang
+++ b/tests/spirv/spec-constant-generic.slang
@@ -1,5 +1,5 @@
//TEST:SIMPLE(filecheck=CHECK): -target spirv
-//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -output-using-type
+//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -output-using-type -emit-spirv-directly
// CHECK: %[[C0:[0-9A-Za-z_]+]] = OpSpecConstant %int 32
// CHECK: %[[C1:[0-9A-Za-z_]+]] = OpSpecConstant %int 2
diff --git a/tests/spirv/spec-constant-sized-array-1.slang b/tests/spirv/spec-constant-sized-array-1.slang
index e974fc37e..ea9081fbf 100644
--- a/tests/spirv/spec-constant-sized-array-1.slang
+++ b/tests/spirv/spec-constant-sized-array-1.slang
@@ -1,5 +1,5 @@
//TEST:SIMPLE(filecheck=CHECK): -target spirv
-//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -output-using-type
+//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -output-using-type -emit-spirv-directly
// CHECK: %[[C0:[0-9A-Za-z_]+]] = OpSpecConstant %int 5
// CHECK: %[[I3:[0-9A-Za-z_]+]] = OpConstant %int 3
diff --git a/tests/spirv/spec-constant-sized-array-2.slang b/tests/spirv/spec-constant-sized-array-2.slang
index 95d2f4aee..0a4dea994 100644
--- a/tests/spirv/spec-constant-sized-array-2.slang
+++ b/tests/spirv/spec-constant-sized-array-2.slang
@@ -1,5 +1,5 @@
//TEST:SIMPLE(filecheck=CHECK): -target spirv
-//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -output-using-type
+//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -output-using-type -emit-spirv-directly
// CHECK: %[[C0:[0-9A-Za-z_]+]] = OpSpecConstant %int 32
// CHECK: %[[I2:[0-9A-Za-z_]+]] = OpConstant %int 2
diff --git a/tests/spirv/spec-constant-sized-array-3.slang b/tests/spirv/spec-constant-sized-array-3.slang
index 39106aa5b..45c11edde 100644
--- a/tests/spirv/spec-constant-sized-array-3.slang
+++ b/tests/spirv/spec-constant-sized-array-3.slang
@@ -1,5 +1,5 @@
//TEST:SIMPLE(filecheck=CHECK): -target spirv
-//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -output-using-type
+//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -output-using-type -emit-spirv-directly
// CHECK: %[[C0:[0-9A-Za-z_]+]] = OpSpecConstant %int 4
// CHECK: %[[I1:[0-9A-Za-z_]+]] = OpConstant %int 1
diff --git a/tests/spirv/spec-constant-sized-array-4.slang b/tests/spirv/spec-constant-sized-array-4.slang
index 0c511bc01..a1f44abf4 100644
--- a/tests/spirv/spec-constant-sized-array-4.slang
+++ b/tests/spirv/spec-constant-sized-array-4.slang
@@ -1,5 +1,5 @@
//TEST:SIMPLE(filecheck=CHECK): -target spirv
-//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -output-using-type
+//TEST(compute, vulkan):COMPARE_COMPUTE(filecheck-buffer=BUF):-vk -output-using-type -emit-spirv-directly
// CHECK: %[[C0:[0-9A-Za-z_]+]] = OpSpecConstant %int 32
// CHECK: %[[C1:[0-9A-Za-z_]+]] = OpSpecConstant %int 2
diff --git a/tools/render-test/slang-support.cpp b/tools/render-test/slang-support.cpp
index 2f39ed078..f98372330 100644
--- a/tools/render-test/slang-support.cpp
+++ b/tools/render-test/slang-support.cpp
@@ -194,6 +194,22 @@ static SlangResult _compileProgramImpl(
else
sessionTargetDesc.flags = 0;
+ {
+ slang::CompilerOptionEntry entry;
+ entry.value.kind = slang::CompilerOptionValueKind::Int;
+ if (options.generateSPIRVDirectly)
+ {
+ entry.name = slang::CompilerOptionName::EmitSpirvDirectly;
+ entry.value.intValue0 = int(options.generateSPIRVDirectly);
+ }
+ else
+ {
+ entry.name = slang::CompilerOptionName::EmitSpirvViaGLSL;
+ entry.value.intValue0 = int(!options.generateSPIRVDirectly);
+ }
+ sessionOptionEntries.add(entry);
+ }
+
// Not expecting argument parsing to have added any targets
SLANG_ASSERT(sessionDesc.targetCount == 0);
sessionDesc.targetCount = 1;