summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSai Praveen Bangaru <31557731+saipraveenb25@users.noreply.github.com>2023-04-26 15:46:24 -0400
committerGitHub <noreply@github.com>2023-04-26 15:46:24 -0400
commite1940e53c0f76e91a2616693b261beb9190015be (patch)
tree2ef14f1e81eb1cf0b003cf93102afdbd542f4750
parenta1739e87b5fb90b0a39c583f8d2468f851869c9f (diff)
For C-like targets, emit resource declarations before other globals (#2843)
* For C-like targets, emit resource declarations before other globals * Remove unused tests
-rw-r--r--source/slang/slang-emit-c-like.cpp16
-rw-r--r--tests/autodiff/inout-custom-derivative.slang35
-rw-r--r--tests/autodiff/inout-custom-derivative.slang.expected.txt8
-rw-r--r--tests/experimental/liveness/liveness-2.slang.expected12
-rw-r--r--tests/experimental/liveness/liveness-3.slang.expected80
-rw-r--r--tests/experimental/liveness/liveness-4.slang.expected10
-rw-r--r--tests/experimental/liveness/liveness-5.slang.expected14
-rw-r--r--tests/experimental/liveness/liveness-6.slang.expected22
-rw-r--r--tests/experimental/liveness/liveness.slang.expected38
-rw-r--r--tests/hlsl-intrinsic/debug-break.slang.expected6
-rw-r--r--tests/hlsl-intrinsic/shader-execution-reordering/hit-object-make-hit.slang.1.expected30
-rw-r--r--tests/hlsl-intrinsic/shader-execution-reordering/hit-object-reorder-thread.slang.1.expected16
-rw-r--r--tests/hlsl-intrinsic/shader-execution-reordering/hit-object-trace-motion-ray.slang.1.expected16
-rw-r--r--tests/hlsl-intrinsic/shader-execution-reordering/hit-object-trace-ray.slang.1.expected16
-rw-r--r--tests/nv-extensions/nv-ray-tracing-motion-blur.slang.glsl8
-rw-r--r--tests/spirv/spirv-debug-break.slang.expected12
-rw-r--r--tests/vkray/raygen.slang.glsl8
17 files changed, 204 insertions, 143 deletions
diff --git a/source/slang/slang-emit-c-like.cpp b/source/slang/slang-emit-c-like.cpp
index c122c13f2..34467d25d 100644
--- a/source/slang/slang-emit-c-like.cpp
+++ b/source/slang/slang-emit-c-like.cpp
@@ -3771,6 +3771,18 @@ void CLikeSourceEmitter::computeEmitActions(IRModule* module, List<EmitAction>&
for(auto inst : module->getGlobalInsts())
{
+ // Emit all resource-typed objects first. This is to avoid an odd scenario in HLSL
+ // where not using a resource type in a resource definition before the same type
+ // is used for a function parameter causes HLSL to complain about an 'incomplete type'
+ //
+ if ( isResourceType(inst->getDataType()) )
+ {
+ ensureGlobalInst(&ctx, inst, EmitAction::Level::Definition);
+ }
+ }
+
+ for(auto inst : module->getGlobalInsts())
+ {
if( as<IRType>(inst) )
{
// Don't emit a type unless it is actually used or is marked public.
@@ -3778,6 +3790,10 @@ void CLikeSourceEmitter::computeEmitActions(IRModule* module, List<EmitAction>&
continue;
}
+ // Skip resource types in this pass.
+ if ( isResourceType(inst->getDataType()) )
+ continue;
+
ensureGlobalInst(&ctx, inst, EmitAction::Level::Definition);
}
}
diff --git a/tests/autodiff/inout-custom-derivative.slang b/tests/autodiff/inout-custom-derivative.slang
new file mode 100644
index 000000000..76c9cb74f
--- /dev/null
+++ b/tests/autodiff/inout-custom-derivative.slang
@@ -0,0 +1,35 @@
+//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -shaderobj -output-using-type
+//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -shaderobj -output-using-type
+
+//TEST_INPUT:ubuffer(data=[0 0 0 0 0 0 0], stride=4):out,name=outputBuffer
+RWStructuredBuffer<float> outputBuffer;
+
+typedef DifferentialPair<float> dpfloat;
+typedef float.Differential dfloat;
+
+[BackwardDerivative(bwd_f)]
+void f(float x, out float y)
+{
+ y = x * x;
+}
+
+void bwd_f(inout DifferentialPair<float> dpx, in float.Differential dy)
+{
+ dpx = DifferentialPair<float>(dpx.p, 2.0 * dpx.p * dy);
+}
+
+[numthreads(1, 1, 1)]
+void computeMain(uint3 dispatchThreadID : SV_DispatchThreadID)
+{
+ {
+ float o;
+ f(3.0, o);
+
+ dpfloat dpa = dpfloat(2.0, 1.0);
+ dpfloat dpo = dpfloat(2.0, 1.0);
+ __bwd_diff(f)(dpa, o);
+
+ outputBuffer[0] = o; // Expect: 9
+ outputBuffer[1] = dpa.d; // Expect: 36
+ }
+}
diff --git a/tests/autodiff/inout-custom-derivative.slang.expected.txt b/tests/autodiff/inout-custom-derivative.slang.expected.txt
new file mode 100644
index 000000000..07757c1f5
--- /dev/null
+++ b/tests/autodiff/inout-custom-derivative.slang.expected.txt
@@ -0,0 +1,8 @@
+type: float
+9.000000
+36.000000
+0.000000
+0.000000
+0.000000
+0.000000
+0.000000
diff --git a/tests/experimental/liveness/liveness-2.slang.expected b/tests/experimental/liveness/liveness-2.slang.expected
index e0486f8da..3ae6d3875 100644
--- a/tests/experimental/liveness/liveness-2.slang.expected
+++ b/tests/experimental/liveness/liveness-2.slang.expected
@@ -6,6 +6,9 @@ standard output = {
#extension GL_EXT_spirv_intrinsics : require
layout(row_major) uniform;
layout(row_major) buffer;
+layout(std430, binding = 0) buffer _S1 {
+ int _data[];
+} outputBuffer_0;
spirv_instruction(id = 256)
void livenessStart_0(spirv_by_reference int _0[3], spirv_literal int _1);
@@ -38,15 +41,12 @@ int calcThing_0(int offset_0)
idx_0[i_0] = offset_0 + i_0;
i_0 = i_0 + 1;
}
- int _S1 = idx_0[0] + idx_0[1];
- int _S2 = idx_0[2];
+ int _S2 = idx_0[0] + idx_0[1];
+ int _S3 = idx_0[2];
livenessEnd_1(idx_0, 0);
- return _S1 + _S2;
+ return _S2 + _S3;
}
-layout(std430, binding = 0) buffer _S3 {
- int _data[];
-} outputBuffer_0;
layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in;
void main()
{
diff --git a/tests/experimental/liveness/liveness-3.slang.expected b/tests/experimental/liveness/liveness-3.slang.expected
index 7719c6bb1..78e80d7b5 100644
--- a/tests/experimental/liveness/liveness-3.slang.expected
+++ b/tests/experimental/liveness/liveness-3.slang.expected
@@ -6,6 +6,9 @@ standard output = {
#extension GL_EXT_spirv_intrinsics : require
layout(row_major) uniform;
layout(row_major) buffer;
+layout(std430, binding = 0) buffer _S1 {
+ int _data[];
+} outputBuffer_0;
spirv_instruction(id = 256)
void livenessStart_0(spirv_by_reference int _0[2], spirv_literal int _1);
@@ -33,9 +36,9 @@ int calcThing_0(int offset_0)
int k_0;
livenessStart_1(k_0, 0);
k_0 = 0;
- int _S1;
- livenessStart_1(_S1, 0);
- _S1 = offset_0;
+ int _S2;
+ livenessStart_1(_S2, 0);
+ _S2 = offset_0;
int total_0;
livenessStart_1(total_0, 0);
total_0 = 0;
@@ -46,7 +49,7 @@ int calcThing_0(int offset_0)
}
else
{
- livenessEnd_0(_S1, 0);
+ livenessEnd_0(_S2, 0);
livenessEnd_0(k_0, 0);
break;
}
@@ -55,14 +58,14 @@ int calcThing_0(int offset_0)
idx_0[0] = 0;
idx_0[1] = 0;
idx_0[2] = 0;
- bool _S2 = (k_0 + 7) % 5 == 4;
+ bool _S3 = (k_0 + 7) % 5 == 4;
int k_1 = k_0 + 1;
int i_0;
livenessStart_1(i_0, 0);
i_0 = 0;
- int _S3;
- livenessStart_1(_S3, 0);
- _S3 = _S1;
+ int _S4;
+ livenessStart_1(_S4, 0);
+ _S4 = _S2;
for(;;)
{
if(i_0 < 17)
@@ -75,63 +78,60 @@ int calcThing_0(int offset_0)
}
int modRange_0 = i_0 % 3;
another_0[i_0 & 1] = another_0[i_0 & 1] + modRange_0;
- int _S4;
+ int _S5;
if(modRange_0 != 0)
{
- int _S5 = _S3;
- livenessEnd_0(_S3, 0);
- int _S6 = _S5 + 1;
- livenessStart_1(_S4, 0);
- _S4 = _S6;
+ int _S6 = _S4;
+ livenessEnd_0(_S4, 0);
+ int _S7 = _S6 + 1;
+ livenessStart_1(_S5, 0);
+ _S5 = _S7;
}
else
{
- int _S7 = _S3;
- livenessEnd_0(_S3, 0);
- livenessStart_1(_S4, 0);
- _S4 = _S7;
+ int _S8 = _S4;
+ livenessEnd_0(_S4, 0);
+ livenessStart_1(_S5, 0);
+ _S5 = _S8;
}
- idx_0[modRange_0] = idx_0[modRange_0] + (_S4 + i_0);
+ idx_0[modRange_0] = idx_0[modRange_0] + (_S5 + i_0);
i_0 = i_0 + 1;
- livenessStart_1(_S3, 0);
- int _S8 = _S4;
- livenessEnd_0(_S4, 0);
- _S3 = _S8;
+ livenessStart_1(_S4, 0);
+ int _S9 = _S5;
+ livenessEnd_0(_S5, 0);
+ _S4 = _S9;
}
- livenessEnd_0(_S1, 0);
+ livenessEnd_0(_S2, 0);
livenessEnd_0(k_0, 0);
- if(_S2)
+ if(_S3)
{
- livenessEnd_0(_S3, 0);
+ livenessEnd_0(_S4, 0);
livenessEnd_1(idx_0, 0);
livenessEnd_2(another_0, 0);
return total_0;
}
- int _S9 = idx_0[0] + idx_0[1];
- int _S10 = idx_0[2];
+ int _S10 = idx_0[0] + idx_0[1];
+ int _S11 = idx_0[2];
livenessEnd_1(idx_0, 0);
- int _S11 = _S9 + _S10;
- int _S12 = total_0;
+ int _S12 = _S10 + _S11;
+ int _S13 = total_0;
livenessEnd_0(total_0, 0);
- int total_1 = _S12 + _S11;
+ int total_1 = _S13 + _S12;
livenessStart_1(k_0, 0);
k_0 = k_1;
- livenessStart_1(_S1, 0);
- int _S13 = _S3;
- livenessEnd_0(_S3, 0);
- _S1 = _S13;
+ livenessStart_1(_S2, 0);
+ int _S14 = _S4;
+ livenessEnd_0(_S4, 0);
+ _S2 = _S14;
livenessStart_1(total_0, 0);
total_0 = total_1;
}
livenessEnd_2(another_0, 0);
- int _S14 = total_0;
+ int _S15 = total_0;
livenessEnd_0(total_0, 0);
- return - _S14;
+ return - _S15;
}
-layout(std430, binding = 0) buffer _S15 {
- int _data[];
-} outputBuffer_0;
layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in;
void main()
{
diff --git a/tests/experimental/liveness/liveness-4.slang.expected b/tests/experimental/liveness/liveness-4.slang.expected
index d6662c6a3..802388e40 100644
--- a/tests/experimental/liveness/liveness-4.slang.expected
+++ b/tests/experimental/liveness/liveness-4.slang.expected
@@ -6,6 +6,9 @@ standard output = {
#extension GL_EXT_spirv_intrinsics : require
layout(row_major) uniform;
layout(row_major) buffer;
+layout(std430, binding = 0) buffer _S1 {
+ int _data[];
+} outputBuffer_0;
spirv_instruction(id = 256)
void livenessStart_0(spirv_by_reference int _0[2], spirv_literal int _1);
@@ -37,7 +40,7 @@ int calcThing_0(int offset_0)
livenessEnd_0(k_0, 0);
break;
}
- bool _S1 = (k_0 + 7) % 5 == 4;
+ bool _S2 = (k_0 + 7) % 5 == 4;
int k_1 = k_0 + 1;
int i_0;
livenessStart_1(i_0, 0);
@@ -56,7 +59,7 @@ int calcThing_0(int offset_0)
i_0 = i_0 + 1;
}
livenessEnd_0(k_0, 0);
- if(_S1)
+ if(_S2)
{
livenessEnd_1(another_0, 0);
return 1;
@@ -68,9 +71,6 @@ int calcThing_0(int offset_0)
return -2;
}
-layout(std430, binding = 0) buffer _S2 {
- int _data[];
-} outputBuffer_0;
layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in;
void main()
{
diff --git a/tests/experimental/liveness/liveness-5.slang.expected b/tests/experimental/liveness/liveness-5.slang.expected
index c2ce1d741..901b93bc6 100644
--- a/tests/experimental/liveness/liveness-5.slang.expected
+++ b/tests/experimental/liveness/liveness-5.slang.expected
@@ -6,6 +6,9 @@ standard output = {
#extension GL_EXT_spirv_intrinsics : require
layout(row_major) uniform;
layout(row_major) buffer;
+layout(std430, binding = 0) buffer _S1 {
+ int _data[];
+} outputBuffer_0;
spirv_instruction(id = 256)
void livenessStart_0(spirv_by_reference int _0[2], spirv_literal int _1);
@@ -40,7 +43,7 @@ int calcThing_0(int offset_0)
livenessEnd_0(k_0, 0);
break;
}
- bool _S1 = (k_0 + 7) % 5 == 4;
+ bool _S2 = (k_0 + 7) % 5 == 4;
int k_1 = k_0 + 1;
int i_0;
livenessStart_1(i_0, 0);
@@ -59,10 +62,10 @@ int calcThing_0(int offset_0)
i_0 = i_0 + 1;
}
livenessEnd_0(k_0, 0);
- int _S2 = total_0;
+ int _S3 = total_0;
livenessEnd_0(total_0, 0);
- int total_1 = _S2 + another_0[k_0 & 1];
- if(_S1)
+ int total_1 = _S3 + another_0[k_0 & 1];
+ if(_S2)
{
livenessEnd_1(another_0, 0);
return 1;
@@ -83,9 +86,6 @@ int calcThing_0(int offset_0)
return total_0;
}
-layout(std430, binding = 0) buffer _S3 {
- int _data[];
-} outputBuffer_0;
layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in;
void main()
{
diff --git a/tests/experimental/liveness/liveness-6.slang.expected b/tests/experimental/liveness/liveness-6.slang.expected
index 45e94a242..1fe9408c8 100644
--- a/tests/experimental/liveness/liveness-6.slang.expected
+++ b/tests/experimental/liveness/liveness-6.slang.expected
@@ -6,6 +6,9 @@ standard output = {
#extension GL_EXT_spirv_intrinsics : require
layout(row_major) uniform;
layout(row_major) buffer;
+layout(std430, binding = 0) buffer _S1 {
+ int _data[];
+} outputBuffer_0;
spirv_instruction(id = 256)
void livenessStart_0(spirv_by_reference int _0[2], spirv_literal int _1);
@@ -44,8 +47,8 @@ int calcThing_0(int offset_0)
livenessStart_0(arr_0, 0);
arr_0[0] = 2;
arr_0[1] = 3;
- int _S1 = k_0 & 1;
- bool _S2 = (k_0 + 7) % 5 == 4;
+ int _S2 = k_0 & 1;
+ bool _S3 = (k_0 + 7) % 5 == 4;
int k_1 = k_0 + 1;
int i_0;
livenessStart_1(i_0, 0);
@@ -61,17 +64,17 @@ int calcThing_0(int offset_0)
break;
}
another_0[i_0 & 1] = another_0[i_0 & 1] + (k_0 + i_0);
- arr_0[_S1] = arr_0[_S1] + i_0;
+ arr_0[_S2] = arr_0[_S2] + i_0;
i_0 = i_0 + 1;
}
livenessEnd_0(k_0, 0);
- int _S3 = total_0;
+ int _S4 = total_0;
livenessEnd_0(total_0, 0);
- int total_1 = _S3 + another_0[_S1];
- int _S4 = arr_0[_S1];
+ int total_1 = _S4 + another_0[_S2];
+ int _S5 = arr_0[_S2];
livenessEnd_1(arr_0, 0);
- int total_2 = total_1 + _S4;
- if(_S2)
+ int total_2 = total_1 + _S5;
+ if(_S3)
{
livenessEnd_1(another_0, 0);
return 1;
@@ -92,9 +95,6 @@ int calcThing_0(int offset_0)
return total_0;
}
-layout(std430, binding = 0) buffer _S5 {
- int _data[];
-} outputBuffer_0;
layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in;
void main()
{
diff --git a/tests/experimental/liveness/liveness.slang.expected b/tests/experimental/liveness/liveness.slang.expected
index 46b8f0922..aadc15d90 100644
--- a/tests/experimental/liveness/liveness.slang.expected
+++ b/tests/experimental/liveness/liveness.slang.expected
@@ -6,6 +6,12 @@ standard output = {
#extension GL_EXT_spirv_intrinsics : require
layout(row_major) uniform;
layout(row_major) buffer;
+layout(std430, binding = 1) buffer _S1 {
+ int _data[];
+} anotherBuffer_0;
+layout(std430, binding = 0) buffer _S2 {
+ int _data[];
+} outputBuffer_0;
spirv_instruction(id = 256)
void livenessStart_0(spirv_by_reference uint _0, spirv_literal int _1);
@@ -20,17 +26,17 @@ void livenessEnd_1(spirv_by_reference uint _0, spirv_literal int _1);
int someSlowFunc_0(int a_0)
{
- uint _S1 = uint(a_0);
- int _S2 = a_0 * 20;
+ uint _S3 = uint(a_0);
+ int _S4 = a_0 * 20;
uint v_0;
livenessStart_0(v_0, 0);
- v_0 = _S1;
+ v_0 = _S3;
int i_0;
livenessStart_1(i_0, 0);
i_0 = 0;
for(;;)
{
- if(i_0 < _S2)
+ if(i_0 < _S4)
{
}
else
@@ -38,13 +44,13 @@ int someSlowFunc_0(int a_0)
livenessEnd_0(i_0, 0);
break;
}
- uint _S3 = v_0 >> 1;
- uint _S4 = v_0;
+ uint _S5 = v_0 >> 1;
+ uint _S6 = v_0;
livenessEnd_1(v_0, 0);
- uint _S5 = (_S3 | _S4 << 31) * uint(i_0);
+ uint _S7 = (_S5 | _S6 << 31) * uint(i_0);
int i_1 = i_0 + 1;
livenessStart_0(v_0, 0);
- v_0 = _S5;
+ v_0 = _S7;
i_0 = i_1;
}
return int(v_0);
@@ -59,14 +65,11 @@ struct SomeStruct_0
SomeStruct_0 makeSomeStruct_0()
{
- const int _S6[100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
- SomeStruct_0 s_0 = { 0, 0, _S6 };
+ const int _S8[100] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
+ SomeStruct_0 s_0 = { 0, 0, _S8 };
return s_0;
}
-layout(std430, binding = 1) buffer _S7 {
- int _data[];
-} anotherBuffer_0;
int doThing_0(SomeStruct_0 s_1)
{
return s_1.x_0 * 2 + 1;
@@ -74,14 +77,11 @@ int doThing_0(SomeStruct_0 s_1)
int somethingElse_0(inout SomeStruct_0 s_2)
{
- int _S8 = s_2.x_0 + 1;
- s_2.x_0 = _S8;
- return _S8;
+ int _S9 = s_2.x_0 + 1;
+ s_2.x_0 = _S9;
+ return _S9;
}
-layout(std430, binding = 0) buffer _S9 {
- int _data[];
-} outputBuffer_0;
spirv_instruction(id = 256)
void livenessStart_2(spirv_by_reference SomeStruct_0 _0, spirv_literal int _1);
diff --git a/tests/hlsl-intrinsic/debug-break.slang.expected b/tests/hlsl-intrinsic/debug-break.slang.expected
index fbd1faa9b..503cdfd72 100644
--- a/tests/hlsl-intrinsic/debug-break.slang.expected
+++ b/tests/hlsl-intrinsic/debug-break.slang.expected
@@ -6,12 +6,12 @@ standard output = {
#extension GL_EXT_spirv_intrinsics : require
layout(row_major) uniform;
layout(row_major) buffer;
-spirv_instruction(id = 1, set = "NonSemantic.DebugBreak")
-void debugBreak_0();
-
layout(std430, binding = 0) buffer _S1 {
int _data[];
} outputBuffer_0;
+spirv_instruction(id = 1, set = "NonSemantic.DebugBreak")
+void debugBreak_0();
+
layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in;
void main()
{
diff --git a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-make-hit.slang.1.expected b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-make-hit.slang.1.expected
index 09c026980..81ceff87f 100644
--- a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-make-hit.slang.1.expected
+++ b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-make-hit.slang.1.expected
@@ -7,6 +7,12 @@ standard output = {
#extension GL_NV_shader_invocation_reorder : require
layout(row_major) uniform;
layout(row_major) buffer;
+layout(binding = 0)
+uniform accelerationStructureEXT scene_0;
+
+layout(std430, binding = 1) buffer _S1 {
+ uint _data[];
+} outputBuffer_0;
struct SomeValues_0
{
int a_0;
@@ -17,9 +23,6 @@ layout(location = 0)
hitObjectAttributeNV
SomeValues_0 t_0;
-layout(binding = 0)
-uniform accelerationStructureEXT scene_0;
-
struct RayDesc_0
{
vec3 Origin_0;
@@ -30,11 +33,11 @@ struct RayDesc_0
RayDesc_0 HitObject_GetRayDesc_0(hitObjectNV this_0)
{
- vec3 _S1 = (hitObjectGetWorldRayOriginNV((this_0)));
- float _S2 = (hitObjectGetRayTMinNV((this_0)));
- vec3 _S3 = (hitObjectGetObjectRayDirectionNV((this_0)));
- float _S4 = (hitObjectGetRayTMaxNV((this_0)));
- RayDesc_0 ray_0 = { _S1, _S2, _S3, _S4 };
+ vec3 _S2 = (hitObjectGetWorldRayOriginNV((this_0)));
+ float _S3 = (hitObjectGetRayTMinNV((this_0)));
+ vec3 _S4 = (hitObjectGetObjectRayDirectionNV((this_0)));
+ float _S5 = (hitObjectGetRayTMaxNV((this_0)));
+ RayDesc_0 ray_0 = { _S2, _S3, _S4, _S5 };
return ray_0;
}
@@ -46,9 +49,9 @@ SomeValues_0 HitObject_GetAttributes_0(hitObjectNV this_1)
uint calcValue_0(hitObjectNV hit_0)
{
- bool _S5 = (hitObjectIsHitNV((hit_0)));
+ bool _S6 = (hitObjectIsHitNV((hit_0)));
uint r_0;
- if(_S5)
+ if(_S6)
{
uint instanceIndex_0 = (hitObjectGetInstanceCustomIndexNV((hit_0)));
uint instanceID_0 = (hitObjectGetInstanceIdNV((hit_0)));
@@ -63,8 +66,8 @@ uint calcValue_0(hitObjectNV hit_0)
}
else
{
- bool _S6 = (hitObjectIsMissNV((hit_0)));
- if(_S6)
+ bool _S7 = (hitObjectIsMissNV((hit_0)));
+ if(_S7)
{
r_0 = 1U;
}
@@ -76,9 +79,6 @@ uint calcValue_0(hitObjectNV hit_0)
return r_0;
}
-layout(std430, binding = 1) buffer _S7 {
- uint _data[];
-} outputBuffer_0;
void main()
{
uvec3 _S8 = ((gl_LaunchIDEXT));
diff --git a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-reorder-thread.slang.1.expected b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-reorder-thread.slang.1.expected
index 6e3e5d5d8..1d3bcc227 100644
--- a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-reorder-thread.slang.1.expected
+++ b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-reorder-thread.slang.1.expected
@@ -7,6 +7,12 @@ standard output = {
#extension GL_NV_shader_invocation_reorder : require
layout(row_major) uniform;
layout(row_major) buffer;
+layout(binding = 0)
+uniform accelerationStructureEXT scene_0;
+
+layout(std430, binding = 1) buffer _S1 {
+ uint _data[];
+} outputBuffer_0;
struct SomeValues_0
{
int a_0;
@@ -25,9 +31,6 @@ layout(location = 1)
rayPayloadEXT
SomeValues_0 p_1;
-layout(binding = 0)
-uniform accelerationStructureEXT scene_0;
-
SomeValues_0 HitObject_GetAttributes_0(hitObjectNV this_0)
{
hitObjectGetAttributesNV((this_0), ((0)));
@@ -36,9 +39,9 @@ SomeValues_0 HitObject_GetAttributes_0(hitObjectNV this_0)
uint calcValue_0(hitObjectNV hit_0)
{
- bool _S1 = (hitObjectIsHitNV((hit_0)));
+ bool _S2 = (hitObjectIsHitNV((hit_0)));
uint r_0;
- if(_S1)
+ if(_S2)
{
uint instanceIndex_0 = (hitObjectGetInstanceCustomIndexNV((hit_0)));
uint instanceID_0 = (hitObjectGetInstanceIdNV((hit_0)));
@@ -62,9 +65,6 @@ void HitObject_Invoke_0(accelerationStructureEXT AccelerationStructure_0, hitObj
return;
}
-layout(std430, binding = 1) buffer _S2 {
- uint _data[];
-} outputBuffer_0;
struct RayDesc_0
{
vec3 Origin_0;
diff --git a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-trace-motion-ray.slang.1.expected b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-trace-motion-ray.slang.1.expected
index 4aa4c95c2..ccd693835 100644
--- a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-trace-motion-ray.slang.1.expected
+++ b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-trace-motion-ray.slang.1.expected
@@ -8,6 +8,12 @@ standard output = {
#extension GL_NV_ray_tracing_motion_blur : require
layout(row_major) uniform;
layout(row_major) buffer;
+layout(binding = 0)
+uniform accelerationStructureEXT scene_0;
+
+layout(std430, binding = 1) buffer _S1 {
+ uint _data[];
+} outputBuffer_0;
struct SomeValues_0
{
int a_0;
@@ -22,9 +28,6 @@ layout(location = 0)
rayPayloadEXT
SomeValues_0 p_0;
-layout(binding = 0)
-uniform accelerationStructureEXT scene_0;
-
SomeValues_0 HitObject_GetAttributes_0(hitObjectNV this_0)
{
hitObjectGetAttributesNV((this_0), ((0)));
@@ -33,9 +36,9 @@ SomeValues_0 HitObject_GetAttributes_0(hitObjectNV this_0)
uint calcValue_0(hitObjectNV hit_0)
{
- bool _S1 = (hitObjectIsHitNV((hit_0)));
+ bool _S2 = (hitObjectIsHitNV((hit_0)));
uint r_0;
- if(_S1)
+ if(_S2)
{
uint instanceIndex_0 = (hitObjectGetInstanceCustomIndexNV((hit_0)));
uint instanceID_0 = (hitObjectGetInstanceIdNV((hit_0)));
@@ -51,9 +54,6 @@ uint calcValue_0(hitObjectNV hit_0)
return r_0;
}
-layout(std430, binding = 1) buffer _S2 {
- uint _data[];
-} outputBuffer_0;
struct RayDesc_0
{
vec3 Origin_0;
diff --git a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-trace-ray.slang.1.expected b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-trace-ray.slang.1.expected
index ac4d78234..cf36e4623 100644
--- a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-trace-ray.slang.1.expected
+++ b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-trace-ray.slang.1.expected
@@ -7,6 +7,12 @@ standard output = {
#extension GL_NV_shader_invocation_reorder : require
layout(row_major) uniform;
layout(row_major) buffer;
+layout(binding = 0)
+uniform accelerationStructureEXT scene_0;
+
+layout(std430, binding = 1) buffer _S1 {
+ uint _data[];
+} outputBuffer_0;
struct SomeValues_0
{
int a_0;
@@ -21,9 +27,6 @@ layout(location = 0)
rayPayloadEXT
SomeValues_0 p_0;
-layout(binding = 0)
-uniform accelerationStructureEXT scene_0;
-
SomeValues_0 HitObject_GetAttributes_0(hitObjectNV this_0)
{
hitObjectGetAttributesNV((this_0), ((0)));
@@ -32,9 +35,9 @@ SomeValues_0 HitObject_GetAttributes_0(hitObjectNV this_0)
uint calcValue_0(hitObjectNV hit_0)
{
- bool _S1 = (hitObjectIsHitNV((hit_0)));
+ bool _S2 = (hitObjectIsHitNV((hit_0)));
uint r_0;
- if(_S1)
+ if(_S2)
{
uint instanceIndex_0 = (hitObjectGetInstanceCustomIndexNV((hit_0)));
uint instanceID_0 = (hitObjectGetInstanceIdNV((hit_0)));
@@ -50,9 +53,6 @@ uint calcValue_0(hitObjectNV hit_0)
return r_0;
}
-layout(std430, binding = 1) buffer _S2 {
- uint _data[];
-} outputBuffer_0;
struct RayDesc_0
{
vec3 Origin_0;
diff --git a/tests/nv-extensions/nv-ray-tracing-motion-blur.slang.glsl b/tests/nv-extensions/nv-ray-tracing-motion-blur.slang.glsl
index d58b07ffa..ec635a083 100644
--- a/tests/nv-extensions/nv-ray-tracing-motion-blur.slang.glsl
+++ b/tests/nv-extensions/nv-ray-tracing-motion-blur.slang.glsl
@@ -5,7 +5,7 @@ layout(row_major) uniform;
layout(row_major) buffer;
struct ReflectionRay_0
{
- float color_0;
+ float color_1;
};
layout(location = 0)
@@ -32,7 +32,7 @@ uniform texture2D samplerNormal_0;
struct Light_0
{
vec4 position_0;
- vec4 color_1;
+ vec4 color_0;
};
struct Uniforms_0
@@ -119,10 +119,10 @@ void main()
{
atten_0 = _S6;
}
- vec3 color_2 = ubo_0._data.light_0.color_1.xyz * saturate_0(dot(N_0, L_0)) * atten_0;
+ vec3 color_2 = ubo_0._data.light_0.color_0.xyz * saturate_0(dot(N_0, L_0)) * atten_0;
ReflectionRay_0 reflectionRay_0;
TraceRay_0(as_0, 1U, 255U, 0U, 0U, 2U, ray_0, reflectionRay_0);
- imageStore((outputImage_0), ivec2((uvec2(launchID_0))), vec4(color_2 + reflectionRay_0.color_0, 1.0));
+ imageStore((outputImage_0), ivec2((uvec2(launchID_0))), vec4(color_2 + reflectionRay_0.color_1, 1.0));
return;
}
diff --git a/tests/spirv/spirv-debug-break.slang.expected b/tests/spirv/spirv-debug-break.slang.expected
index d8ac8e010..219aab7d2 100644
--- a/tests/spirv/spirv-debug-break.slang.expected
+++ b/tests/spirv/spirv-debug-break.slang.expected
@@ -7,15 +7,17 @@ standard output = {
layout(row_major) uniform;
layout(row_major) buffer;
-#line 5 0
+#line 12 0
+layout(std430, binding = 0) buffer _S1 {
+ uint _data[];
+} resultBuffer_0;
+
+#line 5
spirv_instruction(id = 1, set = "NonSemantic.DebugBreak")
void _spvDebugBreak_0(int _0);
-#line 12
-layout(std430, binding = 0) buffer _S1 {
- uint _data[];
-} resultBuffer_0;
+#line 15
layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in;
void main()
{
diff --git a/tests/vkray/raygen.slang.glsl b/tests/vkray/raygen.slang.glsl
index 5c609f795..8bc9356a2 100644
--- a/tests/vkray/raygen.slang.glsl
+++ b/tests/vkray/raygen.slang.glsl
@@ -4,7 +4,7 @@ layout(row_major) uniform;
layout(row_major) buffer;
struct ReflectionRay_0
{
- float color_0;
+ float color_1;
};
layout(location = 0)
@@ -31,7 +31,7 @@ uniform texture2D samplerNormal_0;
struct Light_0
{
vec4 position_0;
- vec4 color_1;
+ vec4 color_0;
};
struct Uniforms_0
@@ -121,11 +121,11 @@ void main()
{
atten_0 = _S11;
}
- vec3 color_2 = ubo_0._data.light_0.color_1.xyz * saturate_0(dot(N_0, L_0)) * atten_0;
+ vec3 color_2 = ubo_0._data.light_0.color_0.xyz * saturate_0(dot(N_0, L_0)) * atten_0;
ReflectionRay_0 reflectionRay_0;
TraceRay_1(as_0, 1U, 255U, 0U, 0U, 2U, ray_0, reflectionRay_0);
- vec3 color_3 = color_2 + reflectionRay_0.color_0;
+ vec3 color_3 = color_2 + reflectionRay_0.color_1;
uvec3 _S12 = ((gl_LaunchIDEXT));
imageStore((outputImage_0), ivec2((uvec2(ivec2(_S12.xy)))), vec4(color_3, 1.0));
return;