diff options
| author | Yong He <yonghe@outlook.com> | 2023-02-07 18:36:35 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-07 18:36:35 -0800 |
| commit | 4be623c52a6518eb86756a0369706c1d6670f6bb (patch) | |
| tree | c24f54e34db9f1f02c2d51808b15121eba9195a9 /tests | |
| parent | 101f164b036d0c1c012243df69179559b6f40fb8 (diff) | |
Arithmetic simplifications and more IR clean up logic. (#2632)
Diffstat (limited to 'tests')
25 files changed, 353 insertions, 358 deletions
diff --git a/tests/compute/unbounded-array-of-array-syntax.slang.glsl b/tests/compute/unbounded-array-of-array-syntax.slang.glsl index 6ee5d1c6b..b71b0cd7c 100644 --- a/tests/compute/unbounded-array-of-array-syntax.slang.glsl +++ b/tests/compute/unbounded-array-of-array-syntax.slang.glsl @@ -1,9 +1,9 @@ //TEST_IGNORE_FILE: #version 450 +#extension GL_EXT_nonuniform_qualifier : require layout(row_major) uniform; layout(row_major) buffer; -#extension GL_EXT_nonuniform_qualifier : require layout(std430, binding = 1) buffer _S1 { int _data[]; @@ -18,21 +18,21 @@ void main() int index_0 = int(gl_GlobalInvocationID.x); int innerIndex_0 = index_0 & 3; + int _S3 = nonuniformEXT(index_0 >> 2); uint bufferCount_0; uint bufferStride_0; - (bufferCount_0) = (g_aoa_0[nonuniformEXT(index_0 >> 2)])._data.length(); - (bufferStride_0) = 0; + (bufferCount_0) = (g_aoa_0[_S3])._data.length(); (bufferStride_0) = 0; int innerIndex_1; if(uint(innerIndex_0) >= bufferCount_0) { - innerIndex_1 = int(bufferCount_0 - uint(1)); + innerIndex_1 = int(bufferCount_0 - 1U); } else { innerIndex_1 = innerIndex_0; } - uint _S3 = uint(innerIndex_1); - ((outputBuffer_0)._data[(uint(index_0))]) = ((g_aoa_0[nonuniformEXT(index_0 >> 2)])._data[(_S3)]); + uint _S4 = uint(innerIndex_1); + ((outputBuffer_0)._data[(uint(index_0))]) = ((g_aoa_0[_S3])._data[(_S4)]); return; } diff --git a/tests/cross-compile/array-of-buffers.slang.glsl b/tests/cross-compile/array-of-buffers.slang.glsl index 3dfe31d8d..1f436fad0 100644 --- a/tests/cross-compile/array-of-buffers.slang.glsl +++ b/tests/cross-compile/array-of-buffers.slang.glsl @@ -1,5 +1,7 @@ //TEST_IGNORE_FILE: #version 450 +layout(row_major) uniform; +layout(row_major) buffer; struct SLANG_ParameterGroup_C_0 { @@ -23,19 +25,15 @@ layout(std140) uniform _S2 S_0 _data; } cb_0[3]; - -layout(std430, binding = 2) -readonly buffer _S3 { +layout(std430, binding = 2) readonly buffer _S3 { S_0 _data[]; } sb1_0[4]; -layout(std430, binding = 3) -buffer _S4 { +layout(std430, binding = 3) buffer _S4 { vec4 _data[]; } sb2_0[5]; -layout(std430, binding = 4) -readonly buffer _S5 +layout(std430, binding = 4) readonly buffer _S5 { uint _data[]; } bb_0[6]; @@ -45,13 +43,12 @@ out vec4 _S6; void main() { - vec4 _S7 = cb_0[C_0._data.index_0]._data.f_0; + S_0 _S7 = ((sb1_0[C_0._data.index_0])._data[(C_0._data.index_0)]); + vec4 _S8 = cb_0[C_0._data.index_0]._data.f_0 + _S7.f_0; + vec4 _S9 = _S8 + ((sb2_0[C_0._data.index_0])._data[(C_0._data.index_0)]); + uint _S10 = ((bb_0[C_0._data.index_0])._data[(int(C_0._data.index_0 * 4U))/4]); - S_0 _S8 = sb1_0[C_0._data.index_0]._data[C_0._data.index_0]; + _S6 = _S9 + vec4(float(_S10)); - vec4 _S9 = _S7 + _S8.f_0; - vec4 _S10 = _S9 + sb2_0[C_0._data.index_0]._data[C_0._data.index_0]; - uint _S11 = bb_0[C_0._data.index_0]._data[int(C_0._data.index_0 * uint(4))/4]; - _S6 = _S10 + vec4(_S11); return; } diff --git a/tests/cross-compile/array-of-buffers.slang.hlsl b/tests/cross-compile/array-of-buffers.slang.hlsl index 37f4639a7..501b9c6db 100644 --- a/tests/cross-compile/array-of-buffers.slang.hlsl +++ b/tests/cross-compile/array-of-buffers.slang.hlsl @@ -1,5 +1,11 @@ //TEST_IGNORE_FILE: +#pragma pack_matrix(column_major) +#ifdef SLANG_HLSL_ENABLE_NVAPI +#include "nvHLSLExtns.h" +#endif +#pragma warning(disable: 3557) + struct SLANG_ParameterGroup_C_0 { uint index_0; @@ -15,21 +21,18 @@ struct S_0 float4 f_0; }; -ConstantBuffer<S_0> cb_0 [3] : register(b1); -StructuredBuffer<S_0> sb1_0[4] : register(t0); -RWStructuredBuffer<float4> sb2_0[5] : register(u0); -ByteAddressBuffer bb_0[6] : register(t4); +ConstantBuffer<S_0 > cb_0[int(3)] : register(b1); +StructuredBuffer<S_0 > sb1_0[int(4)] : register(t0); +RWStructuredBuffer<float4 > sb2_0[int(5)] : register(u0); +ByteAddressBuffer bb_0[int(6)] : register(t4); float4 main() : SV_TARGET { - float4 _S1 = cb_0[C_0.index_0].f_0; - - S_0 _S2 = sb1_0[C_0.index_0][C_0.index_0]; + S_0 _S1 = sb1_0[C_0.index_0][C_0.index_0]; - float4 _S3 = _S1 + _S2.f_0; - float4 _S4 = _S3 + sb2_0[C_0.index_0][C_0.index_0]; - uint _S5 = bb_0[C_0.index_0].Load( - (int) (C_0.index_0 * (uint) 4)); + float4 _S2 = cb_0[C_0.index_0].f_0 + _S1.f_0; + float4 _S3 = _S2 + sb2_0[C_0.index_0][C_0.index_0]; + uint _S4 = bb_0[C_0.index_0].Load(int(C_0.index_0 * 4U)); - return _S4 + (float4) _S5; + return _S3 + (float4)float(_S4); } diff --git a/tests/cross-compile/dual-source-blending.slang.glsl b/tests/cross-compile/dual-source-blending.slang.glsl index f10eb77a0..aa550b451 100644 --- a/tests/cross-compile/dual-source-blending.slang.glsl +++ b/tests/cross-compile/dual-source-blending.slang.glsl @@ -21,16 +21,16 @@ struct FragmentOutput_0 void main() { + const vec4 _S4 = vec4(0.0, 0.0, 0.0, 0.0); FragmentOutput_0 f_0; - FragmentOutput_0 _S4 = { vec4(0.0, 0.0, 0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0) }; - f_0 = _S4; + f_0.a_0 = _S4; + f_0.b_0 = _S4; f_0.a_0 = _S3; f_0.b_0 = _S3; - FragmentOutput_0 _S5 = f_0; - _S1 = _S5.a_0; + _S1 = f_0.a_0; _S2 = _S5.b_0; return; diff --git a/tests/cross-compile/geometry-shader.slang.glsl b/tests/cross-compile/geometry-shader.slang.glsl index 1664e8468..38dbd72ba 100644 --- a/tests/cross-compile/geometry-shader.slang.glsl +++ b/tests/cross-compile/geometry-shader.slang.glsl @@ -64,8 +64,8 @@ void main() CoarseVertex_0 _S10[3] = { _S7, _S8, _S9 }; - int ii_0; - ii_0 = 0; + int ii_0 = 0; + for(;;) { if(ii_0 < 3) @@ -75,17 +75,14 @@ void main() break; } - CoarseVertex_0 coarseVertex_0 = _S10[ii_0]; - RasterVertex_0 rasterVertex_0; - rasterVertex_0.position_0 = coarseVertex_0.position_1; - rasterVertex_0.color_0 = coarseVertex_0.color_1; - rasterVertex_0.id_0 = coarseVertex_0.id_1 + _S6; - + rasterVertex_0.position_0 = _S10[ii_0].position_1; + rasterVertex_0.color_0 = _S10[ii_0].color_1; + rasterVertex_0.id_0 = _S10[ii_0].id_1 + _S6; RasterVertex_0 _S11 = rasterVertex_0; + _S4 = rasterVertex_0.position_0; + _S5 = _S11.color_0; - output_position = _S11.position_0; - output_color = _S11.color_0; gl_Layer = int(_S11.id_0); EmitVertex(); diff --git a/tests/cross-compile/unknown-image-format.slang.glsl b/tests/cross-compile/unknown-image-format.slang.glsl index 329405ab6..5ccc30767 100644 --- a/tests/cross-compile/unknown-image-format.slang.glsl +++ b/tests/cross-compile/unknown-image-format.slang.glsl @@ -3,6 +3,8 @@ #version 450 #extension GL_EXT_shader_image_load_formatted : require +layout(row_major) uniform; +layout(row_major) buffer; struct SLANG_ParameterGroup_C_0 { @@ -41,25 +43,24 @@ out vec4 _S2; void main() { - const vec4 result_0 = vec4(0); float _S3 = (imageLoad((gNoFormat_0), ivec2((C_0._data.index_0))).x); - vec4 result_1 = result_0 + _S3; + vec4 _S4 = vec4(_S3); - float _S4 = (imageLoad((gExplicitFormat_0), ivec2((C_0._data.index_0))).x); - vec4 result_2 = result_1 + _S4; + float _S5 = (imageLoad((gExplicitFormat_0), ivec2((C_0._data.index_0))).x); + vec4 result_0 = _S4 + _S5; - vec4 _S5 = (imageLoad((gBlock_noFormat_0), ivec2((C_0._data.index_0)))); - vec4 result_3 = result_2 + _S5; + vec4 _S6 = (imageLoad((gBlock_noFormat_0), ivec2((C_0._data.index_0)))); + vec4 result_1 = result_0 + _S6; - vec4 _S6 = (imageLoad((gBlock_explicitFormat_0), ivec2((C_0._data.index_0)))); - vec4 result_4 = result_3 + _S6; + vec4 _S7 = (imageLoad((gBlock_explicitFormat_0), ivec2((C_0._data.index_0)))); + vec4 result_2 = result_1 + _S7; - vec4 _S7 = (imageLoad((entryPointParams_noFormat_0), ivec2((C_0._data.index_0)))); - vec4 result_5 = result_4 + _S7; + vec4 _S8 = (imageLoad((entryPointParams_noFormat_0), ivec2((C_0._data.index_0)))); + vec4 result_3 = result_2 + _S8; - vec4 _S8 = (imageLoad((entryPointParams_explicitFormat_0), ivec2((C_0._data.index_0)))); - _S2 = result_5 + _S8; + vec4 _S9 = (imageLoad((entryPointParams_explicitFormat_0), ivec2((C_0._data.index_0)))); + _S2 = result_3 + _S9; return; } diff --git a/tests/cross-compile/vector-comparison.slang.glsl b/tests/cross-compile/vector-comparison.slang.glsl index 77578a368..2497055a0 100644 --- a/tests/cross-compile/vector-comparison.slang.glsl +++ b/tests/cross-compile/vector-comparison.slang.glsl @@ -19,8 +19,6 @@ out vec4 _S2; void main() { - vec4 v0_0 = params_0._data.a_0; - vec4 v1_0 = params_0._data.b_0; - _S2 = mix(vec4(3.00000000000000000000), vec4(2.00000000000000000000), equal(v0_0,v1_0)) + mix(vec4(3.00000000000000000000), vec4(2.00000000000000000000), lessThan(v0_0,v1_0)) + mix(vec4(3.00000000000000000000), vec4(2.00000000000000000000), greaterThan(v0_0,v1_0)) + mix(vec4(3.00000000000000000000), vec4(2.00000000000000000000), lessThanEqual(v0_0,v1_0)) + mix(vec4(3.00000000000000000000), vec4(2.00000000000000000000), greaterThanEqual(v0_0,v1_0)) + mix(vec4(3.00000000000000000000), vec4(2.00000000000000000000), notEqual(v0_0,v1_0)); + _S2 = mix(vec4(3.0), vec4(2.0), (equal(params_0._data.a_0,params_0._data.b_0))) + mix(vec4(3.0), vec4(2.0), (lessThan(params_0._data.a_0,params_0._data.b_0))) + mix(vec4(3.0), vec4(2.0), (greaterThan(params_0._data.a_0,params_0._data.b_0))) + mix(vec4(3.0), vec4(2.0), (lessThanEqual(params_0._data.a_0,params_0._data.b_0))) + mix(vec4(3.0), vec4(2.0), (greaterThanEqual(params_0._data.a_0,params_0._data.b_0))) + mix(vec4(3.0), vec4(2.0), (notEqual(params_0._data.a_0,params_0._data.b_0))); return; } diff --git a/tests/experimental/liveness/liveness-3.slang.expected b/tests/experimental/liveness/liveness-3.slang.expected index dac9ff1bd..4dff6b37a 100644 --- a/tests/experimental/liveness/liveness-3.slang.expected +++ b/tests/experimental/liveness/liveness-3.slang.expected @@ -28,15 +28,15 @@ int calcThing_0(int offset_0) { int another_0[2]; livenessStart_0(another_0, 0); - const int _S1[2] = { 1, 2 }; - another_0 = _S1; + another_0[0] = 1; + another_0[1] = 2; int k_0; - int _S2; - int total_0; livenessStart_1(k_0, 0); k_0 = 0; - livenessStart_1(_S2, 0); - _S2 = offset_0; + int _S1; + livenessStart_1(_S1, 0); + _S1 = offset_0; + int total_0; livenessStart_1(total_0, 0); total_0 = 0; for(;;) @@ -50,15 +50,15 @@ int calcThing_0(int offset_0) } int idx_0[3]; livenessStart_2(idx_0, 0); - const int _S3[3] = { 0, 0, 0 }; - idx_0 = _S3; + idx_0[0] = 0; + idx_0[1] = 0; + idx_0[2] = 0; int i_0; - int _S4; - int _S5 = _S2; livenessStart_1(i_0, 0); i_0 = 0; - livenessStart_1(_S4, 0); - _S4 = _S5; + int _S2; + livenessStart_1(_S2, 0); + _S2 = _S1; for(;;) { if(i_0 < 17) @@ -70,74 +70,74 @@ 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 _S6 = i_0 % 3; - int _S7; - if(_S6 != 0) + int _S3 = i_0 % 3; + int _S4; + if(_S3 != 0) { - int _S8 = _S4; - livenessEnd_0(_S4, 0); - int _S9 = _S8 + 1; - livenessStart_1(_S7, 0); - _S7 = _S9; + int _S5 = _S2; + livenessEnd_0(_S2, 0); + int _S6 = _S5 + 1; + livenessStart_1(_S4, 0); + _S4 = _S6; } else { - int _S10 = _S4; - livenessEnd_0(_S4, 0); - livenessStart_1(_S7, 0); - _S7 = _S10; + int _S7 = _S2; + livenessEnd_0(_S2, 0); + livenessStart_1(_S4, 0); + _S4 = _S7; } - idx_0[modRange_0] = idx_0[modRange_0] + (_S7 + i_0); + idx_0[modRange_0] = idx_0[modRange_0] + (_S4 + i_0); i_0 = i_0 + 1; - livenessStart_1(_S4, 0); - int _S11 = _S7; - livenessEnd_0(_S7, 0); - _S4 = _S11; + livenessStart_1(_S2, 0); + int _S8 = _S4; + livenessEnd_0(_S4, 0); + _S2 = _S8; } livenessEnd_0(i_0, 0); - livenessEnd_0(_S2, 0); - int _S12 = (k_0 + 7) % 5; - if(_S12 == 4) + livenessEnd_0(_S1, 0); + int _S9 = (k_0 + 7) % 5; + if(_S9 == 4) { - livenessEnd_0(_S4, 0); + livenessEnd_0(_S2, 0); livenessEnd_1(idx_0, 0); livenessEnd_0(k_0, 0); livenessEnd_2(another_0, 0); return total_0; } - int _S13 = idx_0[0] + idx_0[1]; - int _S14 = idx_0[2]; + int _S10 = idx_0[0] + idx_0[1]; + int _S11 = idx_0[2]; livenessEnd_1(idx_0, 0); - int _S15 = _S13 + _S14; - int _S16 = total_0; + int _S12 = _S10 + _S11; + int _S13 = total_0; livenessEnd_0(total_0, 0); - int total_1 = _S16 + _S15; + int total_1 = _S13 + _S12; k_0 = k_0 + 1; - livenessStart_1(_S2, 0); - int _S17 = _S4; - livenessEnd_0(_S4, 0); - _S2 = _S17; + livenessStart_1(_S1, 0); + int _S14 = _S2; + livenessEnd_0(_S2, 0); + _S1 = _S14; livenessStart_1(total_0, 0); total_0 = total_1; } - livenessEnd_0(_S2, 0); + livenessEnd_0(_S1, 0); livenessEnd_0(k_0, 0); livenessEnd_2(another_0, 0); - int _S18 = total_0; + int _S15 = total_0; livenessEnd_0(total_0, 0); - return - _S18; + return - _S15; } -layout(std430, binding = 0) buffer _S19 { +layout(std430, binding = 0) buffer _S16 { int _data[]; } outputBuffer_0; layout(local_size_x = 4, local_size_y = 1, local_size_z = 1) in; void main() { int index_0 = int(gl_GlobalInvocationID.x); - uint _S20 = uint(index_0); - int _S21 = calcThing_0(index_0); - ((outputBuffer_0)._data[(_S20)]) = _S21; + uint _S17 = uint(index_0); + int _S18 = calcThing_0(index_0); + ((outputBuffer_0)._data[(_S17)]) = _S18; return; } diff --git a/tests/experimental/liveness/liveness-4.slang.expected b/tests/experimental/liveness/liveness-4.slang.expected index 52c6ebb32..cd97f8057 100644 --- a/tests/experimental/liveness/liveness-4.slang.expected +++ b/tests/experimental/liveness/liveness-4.slang.expected @@ -22,8 +22,8 @@ int calcThing_0(int offset_0) { int another_0[2]; livenessStart_0(another_0, 0); - const int _S1[2] = { 1, 2 }; - another_0 = _S1; + another_0[0] = 1; + another_0[1] = 2; int k_0; livenessStart_1(k_0, 0); k_0 = 0; @@ -52,8 +52,8 @@ int calcThing_0(int offset_0) i_0 = i_0 + 1; } livenessEnd_0(i_0, 0); - int _S2 = (k_0 + 7) % 5; - if(_S2 == 4) + int _S1 = (k_0 + 7) % 5; + if(_S1 == 4) { livenessEnd_0(k_0, 0); livenessEnd_1(another_0, 0); @@ -66,16 +66,16 @@ int calcThing_0(int offset_0) return -2; } -layout(std430, binding = 0) buffer _S3 { +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() { int index_0 = int(gl_GlobalInvocationID.x); - uint _S4 = uint(index_0); - int _S5 = calcThing_0(index_0); - ((outputBuffer_0)._data[(_S4)]) = _S5; + uint _S3 = uint(index_0); + int _S4 = calcThing_0(index_0); + ((outputBuffer_0)._data[(_S3)]) = _S4; return; } diff --git a/tests/experimental/liveness/liveness-5.slang.expected b/tests/experimental/liveness/liveness-5.slang.expected index a8a9707d7..3693d3fde 100644 --- a/tests/experimental/liveness/liveness-5.slang.expected +++ b/tests/experimental/liveness/liveness-5.slang.expected @@ -22,12 +22,12 @@ int calcThing_0(int offset_0) { int another_0[2]; livenessStart_0(another_0, 0); - const int _S1[2] = { 1, 2 }; - another_0 = _S1; + another_0[0] = 1; + another_0[1] = 2; int k_0; - int total_0; livenessStart_1(k_0, 0); k_0 = 0; + int total_0; livenessStart_1(total_0, 0); total_0 = 0; for(;;) @@ -55,12 +55,11 @@ int calcThing_0(int offset_0) i_0 = i_0 + 1; } livenessEnd_0(i_0, 0); - int _S2 = another_0[k_0 & 1]; - int _S3 = total_0; + int _S1 = total_0; livenessEnd_0(total_0, 0); - int total_1 = _S3 + _S2; - int _S4 = (k_0 + 7) % 5; - if(_S4 == 4) + int total_1 = _S1 + another_0[k_0 & 1]; + int _S2 = (k_0 + 7) % 5; + if(_S2 == 4) { livenessEnd_0(k_0, 0); livenessEnd_1(another_0, 0); @@ -82,16 +81,16 @@ int calcThing_0(int offset_0) return total_0; } -layout(std430, binding = 0) buffer _S5 { +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() { int index_0 = int(gl_GlobalInvocationID.x); - uint _S6 = uint(index_0); - int _S7 = calcThing_0(index_0); - ((outputBuffer_0)._data[(_S6)]) = _S7; + uint _S4 = uint(index_0); + int _S5 = calcThing_0(index_0); + ((outputBuffer_0)._data[(_S4)]) = _S5; return; } diff --git a/tests/experimental/liveness/liveness-6.slang.expected b/tests/experimental/liveness/liveness-6.slang.expected index 402e19886..9c3bae815 100644 --- a/tests/experimental/liveness/liveness-6.slang.expected +++ b/tests/experimental/liveness/liveness-6.slang.expected @@ -22,12 +22,12 @@ int calcThing_0(int offset_0) { int another_0[2]; livenessStart_0(another_0, 0); - const int _S1[2] = { 1, 2 }; - another_0 = _S1; + another_0[0] = 1; + another_0[1] = 2; int k_0; - int total_0; livenessStart_1(k_0, 0); k_0 = 0; + int total_0; livenessStart_1(total_0, 0); total_0 = 0; for(;;) @@ -41,8 +41,8 @@ int calcThing_0(int offset_0) } int arr_0[2]; livenessStart_0(arr_0, 0); - const int _S2[2] = { 2, 3 }; - arr_0 = _S2; + arr_0[0] = 2; + arr_0[1] = 3; int i_0; livenessStart_1(i_0, 0); i_0 = 0; @@ -60,16 +60,15 @@ int calcThing_0(int offset_0) i_0 = i_0 + 1; } livenessEnd_0(i_0, 0); - int _S3 = k_0 & 1; - int _S4 = another_0[_S3]; - int _S5 = total_0; + int _S1 = k_0 & 1; + int _S2 = total_0; livenessEnd_0(total_0, 0); - int total_1 = _S5 + _S4; - int _S6 = arr_0[_S3]; + int total_1 = _S2 + another_0[_S1]; + int _S3 = arr_0[_S1]; livenessEnd_1(arr_0, 0); - int total_2 = total_1 + _S6; - int _S7 = (k_0 + 7) % 5; - if(_S7 == 4) + int total_2 = total_1 + _S3; + int _S4 = (k_0 + 7) % 5; + if(_S4 == 4) { livenessEnd_0(k_0, 0); livenessEnd_1(another_0, 0); @@ -91,16 +90,16 @@ int calcThing_0(int offset_0) return total_0; } -layout(std430, binding = 0) buffer _S8 { +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() { int index_0 = int(gl_GlobalInvocationID.x); - uint _S9 = uint(index_0); - int _S10 = calcThing_0(index_0); - ((outputBuffer_0)._data[(_S9)]) = _S10; + uint _S6 = uint(index_0); + int _S7 = calcThing_0(index_0); + ((outputBuffer_0)._data[(_S6)]) = _S7; return; } diff --git a/tests/experimental/liveness/liveness.slang.expected b/tests/experimental/liveness/liveness.slang.expected index e50ecac5a..4a81b8855 100644 --- a/tests/experimental/liveness/liveness.slang.expected +++ b/tests/experimental/liveness/liveness.slang.expected @@ -22,9 +22,9 @@ int someSlowFunc_0(int a_0) { uint _S1 = uint(a_0); uint v_0; - int i_0; livenessStart_0(v_0, 0); v_0 = _S1; + int i_0; livenessStart_1(i_0, 0); i_0 = 0; for(;;) @@ -91,9 +91,9 @@ void main() { int index_0 = int(gl_GlobalInvocationID.x); int i_2; - int res_0; livenessStart_1(i_2, 0); i_2 = 0; + int res_0; livenessStart_1(res_0, 0); res_0 = index_0; for(;;) @@ -113,30 +113,33 @@ void main() SomeStruct_0 _S8 = makeSomeStruct_0(); t_0 = _S8; const int _S9[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 u_0 = { 0, 0, _S9 }; - SomeStruct_0 u_1; + SomeStruct_0 u_0; if((v_1 & 256) != 0) { s_3.x_0 = ((anotherBuffer_0)._data[(uint(v_1 & 3))]); t_0.x_0 = ((anotherBuffer_0)._data[(uint(v_1 & 3))]); - livenessStart_2(u_1, 0); - u_1 = u_0; + livenessStart_2(u_0, 0); + u_0.a_1 = 0; + u_0.x_0 = 0; + u_0.c_0 = _S9; } else { SomeStruct_0 x_1; livenessStart_2(x_1, 0); - x_1 = u_0; + x_1.a_1 = 0; + x_1.x_0 = 0; + x_1.c_0 = _S9; x_1.x_0 = ((anotherBuffer_0)._data[(uint(v_1 & 3))]) + 1; SomeStruct_0 _S10 = x_1; livenessEnd_2(x_1, 0); - livenessStart_2(u_1, 0); - u_1 = _S10; + livenessStart_2(u_0, 0); + u_0 = _S10; } s_3.c_0[index_0 & 7] = s_3.c_0[index_0 & 7] + 1; int _S11 = s_3.x_0 + t_0.x_0; - SomeStruct_0 _S12 = u_1; - livenessEnd_2(u_1, 0); + SomeStruct_0 _S12 = u_0; + livenessEnd_2(u_0, 0); int _S13 = _S11 + _S12.x_0; int _S14 = doThing_0(t_0); int _S15 = _S13 + _S14; diff --git a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-assign.slang.1.expected b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-assign.slang.1.expected index 22affc22e..d921747af 100644 --- a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-assign.slang.1.expected +++ b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-assign.slang.1.expected @@ -25,19 +25,17 @@ void main() uvec3 _S3 = ((gl_LaunchSizeEXT)); int idx_0 = launchID_0.x; RayDesc_0 ray_0; - ray_0.Origin_0 = vec3(float(idx_0), 0.00000000000000000000, 0.00000000000000000000); + ray_0.Origin_0 = vec3(float(idx_0), 0.0, 0.0); ray_0.TMin_0 = 0.00999999977648258209; - ray_0.Direction_0 = vec3(0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000); - ray_0.TMax_0 = 10000.00000000000000000000; - RayDesc_0 _S4 = ray_0; + ray_0.Direction_0 = vec3(0.0, 1.0, 0.0); + ray_0.TMax_0 = 10000.0; hitObjectNV hitObj_0; - hitObjectRecordMissNV(hitObj_0, uint(idx_0), _S4.Origin_0, _S4.TMin_0, _S4.Direction_0, _S4.TMax_0); - RayDesc_0 _S5 = ray_0; + hitObjectRecordMissNV(hitObj_0, uint(idx_0), ray_0.Origin_0, ray_0.TMin_0, ray_0.Direction_0, ray_0.TMax_0); hitObjectNV hitObj_1; - hitObjectRecordMissNV(hitObj_1, uint(idx_0 + 1), _S5.Origin_0, _S5.TMin_0, _S5.Direction_0, _S5.TMax_0); - bool _S6 = (hitObjectIsMissNV((hitObj_1))); - uint _S7 = uint(int(_S6)); - ((outputBuffer_0)._data[(uint(idx_0))]) = _S7; + hitObjectRecordMissNV(hitObj_1, uint(idx_0 + 1), ray_0.Origin_0, ray_0.TMin_0, ray_0.Direction_0, ray_0.TMax_0); + bool _S4 = (hitObjectIsMissNV((hitObj_1))); + uint _S5 = uint(int(_S4)); + ((outputBuffer_0)._data[(uint(idx_0))]) = _S5; return; } 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 847eab926..09e389c32 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 @@ -55,17 +55,16 @@ uint calcValue_0(hitObjectNV hit_0) uint geometryIndex_0 = (hitObjectGetGeometryIndexNV((hit_0))); uint primitiveIndex_0 = (hitObjectGetPrimitiveIndexNV((hit_0))); uint hitKind_0 = (hitObjectGetHitKindNV((hit_0))); - uint r_1 = 0U + hitKind_0 + instanceIndex_0 + instanceID_0 + geometryIndex_0 + primitiveIndex_0; + uint r_1 = hitKind_0 + instanceIndex_0 + instanceID_0 + geometryIndex_0 + primitiveIndex_0; RayDesc_0 ray_1 = HitObject_GetRayDesc_0(hit_0); - float _S6 = ray_1.TMin_0; - uint r_2 = r_1 + uint(_S6 > 0.00000000000000000000) + uint(ray_1.TMax_0 < _S6); + uint r_2 = r_1 + uint(ray_1.TMin_0 > 0.0) + uint(ray_1.TMax_0 < ray_1.TMin_0); SomeValues_0 objSomeValues_0 = HitObject_GetAttributes_0(hit_0); r_0 = r_2 + uint(objSomeValues_0.a_0); } else { - bool _S7 = (hitObjectIsMissNV((hit_0))); - if(_S7) + bool _S6 = (hitObjectIsMissNV((hit_0))); + if(_S6) { r_0 = 1U; } @@ -77,29 +76,29 @@ uint calcValue_0(hitObjectNV hit_0) return r_0; } -layout(std430, binding = 1) buffer _S8 { +layout(std430, binding = 1) buffer _S7 { uint _data[]; } outputBuffer_0; void main() { - uvec3 _S9 = ((gl_LaunchIDEXT)); - ivec2 launchID_0 = ivec2(_S9.xy); - uvec3 _S10 = ((gl_LaunchSizeEXT)); + uvec3 _S8 = ((gl_LaunchIDEXT)); + ivec2 launchID_0 = ivec2(_S8.xy); + uvec3 _S9 = ((gl_LaunchSizeEXT)); int idx_0 = launchID_0.x; RayDesc_0 ray_2; - ray_2.Origin_0 = vec3(float(idx_0), 0.00000000000000000000, 0.00000000000000000000); + ray_2.Origin_0 = vec3(float(idx_0), 0.0, 0.0); ray_2.TMin_0 = 0.00999999977648258209; - ray_2.Direction_0 = vec3(0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000); - ray_2.TMax_0 = 10000.00000000000000000000; - RayDesc_0 _S11 = ray_2; + ray_2.Direction_0 = vec3(0.0, 1.0, 0.0); + ray_2.TMax_0 = 10000.0; + RayDesc_0 _S10 = ray_2; hitObjectNV hitObj_0; - hitObjectRecordHitWithIndexNV(hitObj_0, scene_0, int(uint(idx_0)), int(uint(idx_0 * 2)), int(uint(idx_0 * 3)), 0U, 0U, _S11.Origin_0, _S11.TMin_0, _S11.Direction_0, _S11.TMax_0, (0)); + hitObjectRecordHitWithIndexNV(hitObj_0, scene_0, int(uint(idx_0)), int(uint(idx_0 * 2)), int(uint(idx_0 * 3)), 0U, 0U, _S10.Origin_0, _S10.TMin_0, _S10.Direction_0, _S10.TMax_0, (0)); uint r_3 = calcValue_0(hitObj_0); - RayDesc_0 _S12 = ray_2; + RayDesc_0 _S11 = ray_2; hitObjectNV hitObj_1; - hitObjectRecordHitNV(hitObj_1, scene_0, int(uint(idx_0)), int(uint(idx_0 * 3)), int(uint(idx_0 * 2)), 0U, 0U, 4U, _S12.Origin_0, _S12.TMin_0, _S12.Direction_0, _S12.TMax_0, (0)); - uint _S13 = calcValue_0(hitObj_1); - uint r_4 = r_3 + _S13; + hitObjectRecordHitNV(hitObj_1, scene_0, int(uint(idx_0)), int(uint(idx_0 * 3)), int(uint(idx_0 * 2)), 0U, 0U, 4U, _S11.Origin_0, _S11.TMin_0, _S11.Direction_0, _S11.TMax_0, (0)); + uint _S12 = calcValue_0(hitObj_1); + uint r_4 = r_3 + _S12; ((outputBuffer_0)._data[(uint(idx_0))]) = r_4; return; } diff --git a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-make-miss.slang.1.expected b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-make-miss.slang.1.expected index 33eb46da3..2bedf5743 100644 --- a/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-make-miss.slang.1.expected +++ b/tests/hlsl-intrinsic/shader-execution-reordering/hit-object-make-miss.slang.1.expected @@ -23,16 +23,15 @@ void main() { int idx_0 = int(gl_GlobalInvocationID.x); RayDesc_0 ray_0; - ray_0.Origin_0 = vec3(float(idx_0), 0.00000000000000000000, 0.00000000000000000000); + ray_0.Origin_0 = vec3(float(idx_0), 0.0, 0.0); ray_0.TMin_0 = 0.00999999977648258209; - ray_0.Direction_0 = vec3(0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000); - ray_0.TMax_0 = 10000.00000000000000000000; - RayDesc_0 _S2 = ray_0; + ray_0.Direction_0 = vec3(0.0, 1.0, 0.0); + ray_0.TMax_0 = 10000.0; hitObjectNV hitObj_0; - hitObjectRecordMissNV(hitObj_0, uint(idx_0), _S2.Origin_0, _S2.TMin_0, _S2.Direction_0, _S2.TMax_0); - bool _S3 = (hitObjectIsMissNV((hitObj_0))); - uint _S4 = uint(int(_S3)); - ((outputBuffer_0)._data[(uint(idx_0))]) = _S4; + hitObjectRecordMissNV(hitObj_0, uint(idx_0), ray_0.Origin_0, ray_0.TMin_0, ray_0.Direction_0, ray_0.TMax_0); + bool _S2 = (hitObjectIsMissNV((hitObj_0))); + uint _S3 = uint(int(_S2)); + ((outputBuffer_0)._data[(uint(idx_0))]) = _S3; return; } 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 f250c1c92..58f06cfec 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 @@ -41,7 +41,7 @@ uint calcValue_0(hitObjectNV hit_0) uint geometryIndex_0 = (hitObjectGetGeometryIndexNV((hit_0))); uint primitiveIndex_0 = (hitObjectGetPrimitiveIndexNV((hit_0))); SomeValues_0 objSomeValues_0 = HitObject_GetAttributes_0(hit_0); - r_0 = 0U + instanceIndex_0 + instanceID_0 + geometryIndex_0 + primitiveIndex_0 + uint(objSomeValues_0.a_0); + r_0 = instanceIndex_0 + instanceID_0 + geometryIndex_0 + primitiveIndex_0 + uint(objSomeValues_0.a_0); } else { @@ -80,36 +80,40 @@ void main() uvec3 _S4 = ((gl_LaunchSizeEXT)); int idx_0 = launchID_0.x; float _S5 = float(idx_0); - SomeValues_0 someValues_0 = { idx_0, _S5 * 2.00000000000000000000 }; + float _S6 = _S5 * 2.0; RayDesc_0 ray_0; - ray_0.Origin_0 = vec3(_S5, 0.00000000000000000000, 0.00000000000000000000); + ray_0.Origin_0 = vec3(_S5, 0.0, 0.0); ray_0.TMin_0 = 0.00999999977648258209; - ray_0.Direction_0 = vec3(0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000); - ray_0.TMax_0 = 10000.00000000000000000000; - RayDesc_0 _S6 = ray_0; - p_0 = someValues_0; + ray_0.Direction_0 = vec3(0.0, 1.0, 0.0); + ray_0.TMax_0 = 10000.0; + RayDesc_0 _S7 = ray_0; + p_0.a_0 = idx_0; + p_0.b_0 = _S6; hitObjectNV hitObj_0; - hitObjectTraceRayNV(hitObj_0, scene_0, 20U, 255U, 0U, 4U, 0U, _S6.Origin_0, _S6.TMin_0, _S6.Direction_0, _S6.TMax_0, (0)); + hitObjectTraceRayNV(hitObj_0, scene_0, 20U, 255U, 0U, 4U, 0U, _S7.Origin_0, _S7.TMin_0, _S7.Direction_0, _S7.TMax_0, (0)); uint r_1 = calcValue_0(hitObj_0); reorderThreadNV(hitObj_0); + float _S8 = _S5 * 4.0; SomeValues_0 otherValues_0; - SomeValues_0 _S7 = { idx_0 * -1, _S5 * 4.00000000000000000000 }; - otherValues_0 = _S7; + otherValues_0.a_0 = idx_0 * -1; + otherValues_0.b_0 = _S8; HitObject_Invoke_0(scene_0, hitObj_0, otherValues_0); - uint _S8 = calcValue_0(hitObj_0); - uint r_2 = r_1 + _S8; + uint _S9 = calcValue_0(hitObj_0); + uint r_2 = r_1 + _S9; reorderThreadNV(hitObj_0, uint(idx_0 & 3), 2U); - SomeValues_0 _S9 = { idx_0 * -2, _S5 * 8.00000000000000000000 }; - otherValues_0 = _S9; + float _S10 = _S5 * 8.0; + otherValues_0.a_0 = idx_0 * -2; + otherValues_0.b_0 = _S10; HitObject_Invoke_0(scene_0, hitObj_0, otherValues_0); - uint _S10 = calcValue_0(hitObj_0); - uint r_3 = r_2 + _S10; + uint _S11 = calcValue_0(hitObj_0); + uint r_3 = r_2 + _S11; reorderThreadNV(uint(idx_0 & 1), 1U); - SomeValues_0 _S11 = { idx_0 * -4, _S5 * 16.00000000000000000000 }; - otherValues_0 = _S11; + float _S12 = _S5 * 16.0; + otherValues_0.a_0 = idx_0 * -4; + otherValues_0.b_0 = _S12; HitObject_Invoke_0(scene_0, hitObj_0, otherValues_0); - uint _S12 = calcValue_0(hitObj_0); - uint r_4 = r_3 + _S12; + uint _S13 = calcValue_0(hitObj_0); + uint r_4 = r_3 + _S13; ((outputBuffer_0)._data[(uint(idx_0))]) = r_4; return; } 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 f6f6f132d..e6d31a3c8 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 @@ -42,7 +42,7 @@ uint calcValue_0(hitObjectNV hit_0) uint geometryIndex_0 = (hitObjectGetGeometryIndexNV((hit_0))); uint primitiveIndex_0 = (hitObjectGetPrimitiveIndexNV((hit_0))); SomeValues_0 objSomeValues_0 = HitObject_GetAttributes_0(hit_0); - r_0 = 0U + instanceIndex_0 + instanceID_0 + geometryIndex_0 + primitiveIndex_0 + uint(objSomeValues_0.a_0); + r_0 = instanceIndex_0 + instanceID_0 + geometryIndex_0 + primitiveIndex_0 + uint(objSomeValues_0.a_0); } else { @@ -71,19 +71,20 @@ void main() int _S5 = idx_0 / 4; float currentTime_0 = float(_S5); float _S6 = float(idx_0); - SomeValues_0 someValues_0 = { idx_0, _S6 * 2.00000000000000000000 }; + float _S7 = _S6 * 2.0; RayDesc_0 ray_0; - ray_0.Origin_0 = vec3(_S6, 0.00000000000000000000, 0.00000000000000000000); + ray_0.Origin_0 = vec3(_S6, 0.0, 0.0); ray_0.TMin_0 = 0.00999999977648258209; - ray_0.Direction_0 = vec3(0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000); - ray_0.TMax_0 = 10000.00000000000000000000; - RayDesc_0 _S7 = ray_0; - p_0 = someValues_0; + ray_0.Direction_0 = vec3(0.0, 1.0, 0.0); + ray_0.TMax_0 = 10000.0; + RayDesc_0 _S8 = ray_0; + p_0.a_0 = idx_0; + p_0.b_0 = _S7; hitObjectNV hitObj_0; - hitObjectTraceRayMotionNV(hitObj_0, scene_0, 20U, 255U, 0U, 4U, 0U, _S7.Origin_0, _S7.TMin_0, _S7.Direction_0, _S7.TMax_0, currentTime_0, (0)); - uint _S8 = uint(idx_0); - uint _S9 = calcValue_0(hitObj_0); - ((outputBuffer_0)._data[(_S8)]) = _S9; + hitObjectTraceRayMotionNV(hitObj_0, scene_0, 20U, 255U, 0U, 4U, 0U, _S8.Origin_0, _S8.TMin_0, _S8.Direction_0, _S8.TMax_0, currentTime_0, (0)); + uint _S9 = uint(idx_0); + uint _S10 = calcValue_0(hitObj_0); + ((outputBuffer_0)._data[(_S9)]) = _S10; return; } 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 16099b5e2..9b5a4d193 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 @@ -41,7 +41,7 @@ uint calcValue_0(hitObjectNV hit_0) uint geometryIndex_0 = (hitObjectGetGeometryIndexNV((hit_0))); uint primitiveIndex_0 = (hitObjectGetPrimitiveIndexNV((hit_0))); SomeValues_0 objSomeValues_0 = HitObject_GetAttributes_0(hit_0); - r_0 = 0U + instanceIndex_0 + instanceID_0 + geometryIndex_0 + primitiveIndex_0 + uint(objSomeValues_0.a_0); + r_0 = instanceIndex_0 + instanceID_0 + geometryIndex_0 + primitiveIndex_0 + uint(objSomeValues_0.a_0); } else { @@ -68,19 +68,20 @@ void main() uvec3 _S4 = ((gl_LaunchSizeEXT)); int idx_0 = launchID_0.x; float _S5 = float(idx_0); - SomeValues_0 someValues_0 = { idx_0, _S5 * 2.00000000000000000000 }; + float _S6 = _S5 * 2.0; RayDesc_0 ray_0; - ray_0.Origin_0 = vec3(_S5, 0.00000000000000000000, 0.00000000000000000000); + ray_0.Origin_0 = vec3(_S5, 0.0, 0.0); ray_0.TMin_0 = 0.00999999977648258209; - ray_0.Direction_0 = vec3(0.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000); - ray_0.TMax_0 = 10000.00000000000000000000; - RayDesc_0 _S6 = ray_0; - p_0 = someValues_0; + ray_0.Direction_0 = vec3(0.0, 1.0, 0.0); + ray_0.TMax_0 = 10000.0; + RayDesc_0 _S7 = ray_0; + p_0.a_0 = idx_0; + p_0.b_0 = _S6; hitObjectNV hitObj_0; - hitObjectTraceRayNV(hitObj_0, scene_0, 20U, 255U, 0U, 4U, 0U, _S6.Origin_0, _S6.TMin_0, _S6.Direction_0, _S6.TMax_0, (0)); - uint _S7 = uint(idx_0); - uint _S8 = calcValue_0(hitObj_0); - ((outputBuffer_0)._data[(_S7)]) = _S8; + hitObjectTraceRayNV(hitObj_0, scene_0, 20U, 255U, 0U, 4U, 0U, _S7.Origin_0, _S7.TMin_0, _S7.Direction_0, _S7.TMax_0, (0)); + uint _S8 = uint(idx_0); + uint _S9 = calcValue_0(hitObj_0); + ((outputBuffer_0)._data[(_S8)]) = _S9; return; } 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 bad4dd370..79c6232f3 100644 --- a/tests/nv-extensions/nv-ray-tracing-motion-blur.slang.glsl +++ b/tests/nv-extensions/nv-ray-tracing-motion-blur.slang.glsl @@ -55,11 +55,9 @@ struct RayDesc_0 void TraceMotionRay_0(accelerationStructureEXT AccelerationStructure_0, uint RayFlags_0, uint InstanceInclusionMask_0, uint RayContributionToHitGroupIndex_0, uint MultiplierForGeometryContributionToHitGroupIndex_0, uint MissShaderIndex_0, RayDesc_0 Ray_0, float CurrentTime_0, inout ShadowRay_0 Payload_0) { p_0 = Payload_0; - traceRayMotionNV(AccelerationStructure_0, RayFlags_0, InstanceInclusionMask_0, RayContributionToHitGroupIndex_0, MultiplierForGeometryContributionToHitGroupIndex_0, MissShaderIndex_0, Ray_0.Origin_0, Ray_0.TMin_0, Ray_0.Direction_0, Ray_0.TMax_0, CurrentTime_0, (0)); Payload_0 = p_0; - return; } @@ -68,7 +66,7 @@ uniform accelerationStructureEXT as_0; float saturate_0(float x_0) { - float _S2 = clamp(x_0, float(0), float(1)); + float _S2 = clamp(x_0, 0.0, 1.0); return _S2; } @@ -85,11 +83,9 @@ ReflectionRay_0 p_1; void TraceRay_0(accelerationStructureEXT AccelerationStructure_1, uint RayFlags_1, uint InstanceInclusionMask_1, uint RayContributionToHitGroupIndex_1, uint MultiplierForGeometryContributionToHitGroupIndex_1, uint MissShaderIndex_1, RayDesc_0 Ray_1, inout ReflectionRay_0 Payload_1) { p_1 = Payload_1; - traceRayEXT(AccelerationStructure_1, RayFlags_1, InstanceInclusionMask_1, RayContributionToHitGroupIndex_1, MultiplierForGeometryContributionToHitGroupIndex_1, MissShaderIndex_1, Ray_1.Origin_0, Ray_1.TMin_0, Ray_1.Direction_0, Ray_1.TMax_0, (1)); Payload_1 = p_1; - return; } @@ -99,8 +95,6 @@ uniform image2D outputImage_0; void main() { - float atten_0; - uvec3 _S3 = ((gl_LaunchIDEXT)); ivec2 launchID_0 = ivec2(_S3.xy); @@ -108,8 +102,8 @@ void main() ivec2 launchSize_0 = ivec2(_S4.xy); - float _S5 = (float(launchID_0.x) + 0.50000000000000000000) / float(launchSize_0.x); - float _S6 = (float(launchID_0.y) + 0.50000000000000000000) / float(launchSize_0.y); + float _S5 = (float(launchID_0.x) + 0.5) / float(launchSize_0.x); + float _S6 = (float(launchID_0.y) + 0.5) / float(launchSize_0.y); vec2 inUV_0 = vec2(_S5, _S6); @@ -118,27 +112,28 @@ void main() vec3 P_0 = _S7.xyz; vec4 _S8 = (texture(sampler2D(samplerNormal_0,sampler_0), (inUV_0))); - vec3 N_0 = _S8.xyz * 2.00000000000000000000 - 1.00000000000000000000; + vec3 N_0 = _S8.xyz * 2.0 - 1.0; vec3 lightDelta_0 = ubo_0._data.light_0.position_0.xyz - P_0; float lightDist_0 = length(lightDelta_0); vec3 L_0 = normalize(lightDelta_0); - float _S9 = 1.00000000000000000000 / (lightDist_0 * lightDist_0); + float _S9 = 1.0 / (lightDist_0 * lightDist_0); RayDesc_0 ray_0; ray_0.Origin_0 = P_0; - ray_0.TMin_0 = 0.00000100000000000000; + ray_0.TMin_0 = 0.00000099999999747524; ray_0.Direction_0 = lightDelta_0; ray_0.TMax_0 = lightDist_0; ShadowRay_0 shadowRay_0; - shadowRay_0.hitDistance_0 = float(0); + shadowRay_0.hitDistance_0 = 0.0; + TraceMotionRay_0(as_0, 1U, 255U, 0U, 0U, 2U, ray_0, 1.0, shadowRay_0); - TraceMotionRay_0(as_0, uint(1), uint(255), uint(0), uint(0), uint(2), ray_0, float(1), shadowRay_0); + float atten_0; if(shadowRay_0.hitDistance_0 < lightDist_0) { - atten_0 = 0.00000000000000000000; + atten_0 = 0.0; } else { @@ -154,8 +149,8 @@ void main() vec3 color_2 = _S10 * _S12 * atten_0; ReflectionRay_0 reflectionRay_0; - TraceRay_0(as_0, uint(1), uint(255), uint(0), uint(0), uint(2), ray_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_1, 1.00000000000000000000)); + imageStore((outputImage_0), ivec2((uvec2(launchID_0))), vec4(color_2 + reflectionRay_0.color_1, 1.0)); return; }
\ No newline at end of file diff --git a/tests/pipeline/rasterization/mesh/hello.slang.glsl b/tests/pipeline/rasterization/mesh/hello.slang.glsl index c2c35915a..3a0848dcb 100644 --- a/tests/pipeline/rasterization/mesh/hello.slang.glsl +++ b/tests/pipeline/rasterization/mesh/hello.slang.glsl @@ -2,8 +2,9 @@ #extension GL_EXT_mesh_shader : require layout(row_major) uniform; layout(row_major) buffer; -const vec3 colors_0[3] = { vec3(1.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000), vec3(0.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000), vec3(1.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000) }; -const vec2 positions_0[3] = { vec2(0.00000000000000000000, -0.50000000000000000000), vec2(0.50000000000000000000, 0.50000000000000000000), vec2(-0.50000000000000000000, 0.50000000000000000000) }; +const vec3 colors_0[3] = { vec3(1.0, 1.0, 0.0), vec3(0.0, 1.0, 1.0), vec3(1.0, 0.0, 1.0) }; +const vec2 positions_0[3] = { vec2(0.0, -0.5), vec2(0.5, 0.5), vec2(-0.5, 0.5) }; + layout(location = 0) out vec3 _S1[3]; @@ -23,9 +24,8 @@ void main() SetMeshOutputsEXT(3U, 1U); if(gl_LocalInvocationIndex < 3U) { - vec3 _S2 = colors_0[gl_LocalInvocationIndex]; - gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position = vec4(positions_0[gl_LocalInvocationIndex], 0.00000000000000000000, 1.00000000000000000000); - _S1[gl_LocalInvocationIndex] = _S2; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position = vec4(positions_0[gl_LocalInvocationIndex], 0.0, 1.0); + _S1[gl_LocalInvocationIndex] = colors_0[gl_LocalInvocationIndex]; } else { diff --git a/tests/pipeline/rasterization/mesh/hello.slang.hlsl b/tests/pipeline/rasterization/mesh/hello.slang.hlsl index ea41895b1..a10dc6884 100644 --- a/tests/pipeline/rasterization/mesh/hello.slang.hlsl +++ b/tests/pipeline/rasterization/mesh/hello.slang.hlsl @@ -2,24 +2,26 @@ #ifdef SLANG_HLSL_ENABLE_NVAPI #include "nvHLSLExtns.h" #endif +#pragma warning(disable: 3557) -static const float3 colors_0[int(3)] = { float3(1.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000), float3(0.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000), float3(1.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000) }; -static const float2 positions_0[int(3)] = { float2(0.00000000000000000000, -0.50000000000000000000), float2(0.50000000000000000000, 0.50000000000000000000), float2(-0.50000000000000000000, 0.50000000000000000000) }; +static const float3 colors_0[int(3)] = { float3(1.0, 1.0, 0.0), float3(0.0, 1.0, 1.0), float3(1.0, 0.0, 1.0) }; +static const float2 positions_0[int(3)] = { float2(0.0, -0.5), float2(0.5, 0.5), float2(-0.5, 0.5) }; struct Vertex_0 { float4 pos_0 : SV_Position; float3 color_0 : Color; }; +[shader("mesh")] [numthreads(3, 1, 1)] [outputtopology("triangle")] -void main(uint tig_0 : SV_GROUPINDEX, vertices out Vertex_0 verts_0[int(3)], indices out uint3 triangles_0[int(1)]) +void main(uint tig_0 : SV_GROUPINDEX, vertices vertices out Vertex_0 verts_0[int(3)], indices indices out uint3 triangles_0[int(1)]) { SetMeshOutputCounts(3U, 1U); if(tig_0 < 3U) { - Vertex_0 _S1 = { float4(positions_0[tig_0], 0.00000000000000000000, 1.00000000000000000000), colors_0[tig_0] }; - verts_0[tig_0] = _S1; + verts_0[tig_0].pos_0 = float4(positions_0[tig_0], 0.0, 1.0); + verts_0[tig_0].color_0 = colors_0[tig_0]; } else { diff --git a/tests/pipeline/rasterization/mesh/hlsl-syntax.slang.glsl b/tests/pipeline/rasterization/mesh/hlsl-syntax.slang.glsl index 96d681c5c..5e059a8a3 100644 --- a/tests/pipeline/rasterization/mesh/hlsl-syntax.slang.glsl +++ b/tests/pipeline/rasterization/mesh/hlsl-syntax.slang.glsl @@ -2,8 +2,8 @@ #extension GL_EXT_mesh_shader : require layout(row_major) uniform; layout(row_major) buffer; -const vec3 colors_0[3] = { vec3(1.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000), vec3(0.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000), vec3(1.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000) }; -const vec2 positions_0[3] = { vec2(0.00000000000000000000, -0.50000000000000000000), vec2(0.50000000000000000000, 0.50000000000000000000), vec2(-0.50000000000000000000, 0.50000000000000000000) }; +const vec3 colors_0[3] = { vec3(1.0, 1.0, 0.0), vec3(0.0, 1.0, 1.0), vec3(1.0, 0.0, 1.0) }; +const vec2 positions_0[3] = { vec2(0.0, -0.5), vec2(0.5, 0.5), vec2(-0.5, 0.5) }; layout(location = 0) out vec3 _S1[3]; @@ -13,13 +13,13 @@ out gl_MeshPerVertexEXT } gl_MeshVerticesEXT[3]; +out uvec3 gl_PrimitiveTriangleIndicesEXT[1]; void foo_0(uint _S2) { if(_S2 < 3U) { - vec3 _S3 = colors_0[_S2]; - gl_MeshVerticesEXT[_S2].gl_Position = vec4(positions_0[_S2], 0.00000000000000000000, 1.00000000000000000000); - _S1[_S2] = _S3; + gl_MeshVerticesEXT[_S2].gl_Position = vec4(positions_0[_S2], 0.0, 1.0); + _S1[_S2] = colors_0[_S2]; } else { diff --git a/tests/pipeline/rasterization/mesh/passing-outputs.slang.glsl b/tests/pipeline/rasterization/mesh/passing-outputs.slang.glsl index db8a69ef3..31c2f0db2 100644 --- a/tests/pipeline/rasterization/mesh/passing-outputs.slang.glsl +++ b/tests/pipeline/rasterization/mesh/passing-outputs.slang.glsl @@ -17,57 +17,65 @@ struct Vertex_0 void just_two_0(out Vertex_0 v_0, out Vertex_0 w_0) { - Texes_0 _S1 = { vec2(0.00000000000000000000, 0.00000000000000000000), vec4(0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000) }; - Vertex_0 _S2 = { vec4(0.00000000000000000000), vec3(1.00000000000000000000), _S1 }; - v_0 = _S2; - w_0 = v_0; + const vec4 _S1 = vec4(0.0); + const vec3 _S2 = vec3(1.0); + Texes_0 _S3 = { vec2(0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0) }; + v_0.pos_0 = _S1; + v_0.col_0 = _S2; + v_0.ts_0 = _S3; + w_0.pos_0 = _S1; + w_0.col_0 = _S2; + w_0.ts_0 = _S3; return; } void just_one_0(out Vertex_0 v_1) { - Texes_0 _S3 = { vec2(0.00000000000000000000, 0.00000000000000000000), vec4(0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000) }; - Vertex_0 _S4 = { vec4(0.00000000000000000000), vec3(1.00000000000000000000), _S3 }; - v_1 = _S4; + const vec3 _S4 = vec3(1.0); + Texes_0 _S5 = { vec2(0.0, 0.0), vec4(0.0, 0.0, 0.0, 0.0) }; + v_1.pos_0 = vec4(0.0); + v_1.col_0 = _S4; + v_1.ts_0 = _S5; return; } void part_of_one_0(out vec4 p_0) { - p_0 = vec4(1.00000000000000000000, 2.00000000000000000000, 3.00000000000000000000, 4.00000000000000000000); + p_0 = vec4(1.0, 2.0, 3.0, 4.0); return; } void write_struct_0(out Texes_0 t_0) { - t_0.tex1_0 = vec2(0.00000000000000000000); - t_0.tex2_0 = vec4(1.00000000000000000000); + t_0.tex1_0 = vec2(0.0); + t_0.tex2_0 = vec4(1.0); return; } layout(location = 0) -out vec3 _S5[3]; +out vec3 _S6[3]; layout(location = 1) -out vec2 _S6[3]; +out vec2 _S7[3]; layout(location = 2) -out vec4 _S7[3]; +out vec4 _S8[3]; out gl_MeshPerVertexEXT { vec4 gl_Position; } gl_MeshVerticesEXT[3]; +out uvec3 gl_PrimitiveTriangleIndicesEXT[1]; void everything_0() { - vec3 _S8 = vec3(1.00000000000000000000); - vec2 _S9 = vec2(0.00000000000000000000, 0.00000000000000000000); - vec4 _S10 = vec4(0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000, 0.00000000000000000000); - gl_MeshVerticesEXT[0U].gl_Position = vec4(0.00000000000000000000); - _S5[0U] = _S8; + vec3 _S9 = vec3(1.0); + vec2 _S10 = vec2(0.0, 0.0); + vec4 _S11 = vec4(0.0, 0.0, 0.0, 0.0); + gl_MeshVerticesEXT[0U].gl_Position = vec4(0.0); _S6[0U] = _S9; _S7[0U] = _S10; + _S8[0U] = _S11; return; } @@ -79,66 +87,61 @@ void a_0() void b_0() { - Vertex_0 _S11; Vertex_0 _S12; - just_two_0(_S12, _S11); - Vertex_0 _S13 = _S12; + Vertex_0 _S13; + just_two_0(_S13, _S12); + Vertex_0 _S14 = _S13; gl_MeshVerticesEXT[0U].gl_Position = _S13.pos_0; - _S5[0U] = _S13.col_0; - Texes_0 _S14 = _S13.ts_0; - _S6[0U] = _S14.tex1_0; - _S7[0U] = _S14.tex2_0; - Vertex_0 _S15 = _S11; - gl_MeshVerticesEXT[0U].gl_Position = _S15.pos_0; - _S5[0U] = _S15.col_0; - Texes_0 _S16 = _S15.ts_0; - _S6[0U] = _S16.tex1_0; - _S7[0U] = _S16.tex2_0; + _S6[0U] = _S14.col_0; + _S7[0U] = _S14.ts_0.tex1_0; + _S8[0U] = _S14.ts_0.tex2_0; + Vertex_0 _S15 = _S12; + gl_MeshVerticesEXT[0U].gl_Position = _S12.pos_0; + _S6[0U] = _S15.col_0; + _S7[0U] = _S15.ts_0.tex1_0; + _S8[0U] = _S15.ts_0.tex2_0; return; } -void c_0(uint _S17) +void c_0(uint _S16) { - Vertex_0 _S18; - just_one_0(_S18); - Vertex_0 _S19 = _S18; - gl_MeshVerticesEXT[_S17].gl_Position = _S19.pos_0; - _S5[_S17] = _S19.col_0; - Texes_0 _S20 = _S19.ts_0; - _S6[_S17] = _S20.tex1_0; - _S7[_S17] = _S20.tex2_0; + Vertex_0 _S17; + just_one_0(_S17); + Vertex_0 _S18 = _S17; + gl_MeshVerticesEXT[_S16].gl_Position = _S17.pos_0; + _S6[_S16] = _S18.col_0; + _S7[_S16] = _S18.ts_0.tex1_0; + _S8[_S16] = _S18.ts_0.tex2_0; return; } -void d_0(uint _S21) +void d_0(uint _S19) { - Vertex_0 _S22; - Vertex_0 _S23; - just_two_0(_S23, _S22); - Vertex_0 _S24 = _S23; - gl_MeshVerticesEXT[_S21].gl_Position = _S24.pos_0; - _S5[_S21] = _S24.col_0; - Texes_0 _S25 = _S24.ts_0; - _S6[_S21] = _S25.tex1_0; - _S7[_S21] = _S25.tex2_0; - Vertex_0 _S26 = _S22; - gl_MeshVerticesEXT[0U].gl_Position = _S26.pos_0; - _S5[0U] = _S26.col_0; - Texes_0 _S27 = _S26.ts_0; - _S6[0U] = _S27.tex1_0; - _S7[0U] = _S27.tex2_0; + Vertex_0 _S20; + Vertex_0 _S21; + just_two_0(_S21, _S20); + Vertex_0 _S22 = _S21; + gl_MeshVerticesEXT[_S19].gl_Position = _S21.pos_0; + _S6[_S19] = _S22.col_0; + _S7[_S19] = _S22.ts_0.tex1_0; + _S8[_S19] = _S22.ts_0.tex2_0; + Vertex_0 _S23 = _S20; + gl_MeshVerticesEXT[0U].gl_Position = _S20.pos_0; + _S6[0U] = _S23.col_0; + _S7[0U] = _S23.ts_0.tex1_0; + _S8[0U] = _S23.ts_0.tex2_0; return; } -void e_0(uint _S28) +void e_0(uint _S24) { - part_of_one_0(gl_MeshVerticesEXT[_S28].gl_Position); - Texes_0 _S29; - write_struct_0(_S29); - Texes_0 _S30 = _S29; - _S6[_S28] = _S30.tex1_0; - _S7[_S28] = _S30.tex2_0; - part_of_one_0(_S7[_S28]); + part_of_one_0(gl_MeshVerticesEXT[_S24].gl_Position); + Texes_0 _S25; + write_struct_0(_S25); + Texes_0 _S26 = _S25; + _S7[_S24] = _S25.tex1_0; + _S8[_S24] = _S26.tex2_0; + part_of_one_0(_S8[_S24]); return; } diff --git a/tests/pipeline/rasterization/mesh/primitive-output.slang.glsl b/tests/pipeline/rasterization/mesh/primitive-output.slang.glsl index 6ff2dbce8..35efcf4af 100644 --- a/tests/pipeline/rasterization/mesh/primitive-output.slang.glsl +++ b/tests/pipeline/rasterization/mesh/primitive-output.slang.glsl @@ -2,8 +2,9 @@ #extension GL_EXT_mesh_shader : require layout(row_major) uniform; layout(row_major) buffer; -const vec3 colors_0[3] = { vec3(1.00000000000000000000, 1.00000000000000000000, 0.00000000000000000000), vec3(0.00000000000000000000, 1.00000000000000000000, 1.00000000000000000000), vec3(1.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000) }; -const vec2 positions_0[3] = { vec2(0.00000000000000000000, -0.50000000000000000000), vec2(0.50000000000000000000, 0.50000000000000000000), vec2(-0.50000000000000000000, 0.50000000000000000000) }; +const vec3 colors_0[3] = { vec3(1.0, 1.0, 0.0), vec3(0.0, 1.0, 1.0), vec3(1.0, 0.0, 1.0) }; +const vec2 positions_0[3] = { vec2(0.0, -0.5), vec2(0.5, 0.5), vec2(-0.5, 0.5) }; +out uvec3 gl_PrimitiveTriangleIndicesEXT[1]; layout(location = 0) out vec3 _S1[3]; @@ -30,9 +31,8 @@ void main() SetMeshOutputsEXT(3U, 1U); if(gl_LocalInvocationIndex < 3U) { - vec3 _S3 = colors_0[gl_LocalInvocationIndex]; - gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position = vec4(positions_0[gl_LocalInvocationIndex], 0.00000000000000000000, 1.00000000000000000000); - _S1[gl_LocalInvocationIndex] = _S3; + gl_MeshVerticesEXT[gl_LocalInvocationIndex].gl_Position = vec4(positions_0[gl_LocalInvocationIndex], 0.0, 1.0); + _S1[gl_LocalInvocationIndex] = colors_0[gl_LocalInvocationIndex]; } else { @@ -40,7 +40,7 @@ void main() if(gl_LocalInvocationIndex < 1U) { gl_PrimitiveTriangleIndicesEXT[gl_LocalInvocationIndex] = uvec3(0U, 1U, 2U); - _S2[gl_LocalInvocationIndex] = vec3(0.00000000000000000000, 0.00000000000000000000, 1.00000000000000000000); + _S2[gl_LocalInvocationIndex] = vec3(0.0, 0.0, 1.0); gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_PrimitiveID = int(gl_LocalInvocationIndex); gl_MeshPrimitivesEXT[gl_LocalInvocationIndex].gl_CullPrimitiveEXT = false; } diff --git a/tests/pipeline/ray-tracing/trace-ray-inline.slang.glsl b/tests/pipeline/ray-tracing/trace-ray-inline.slang.glsl index 389dae05a..04ef5a6fe 100644 --- a/tests/pipeline/ray-tracing/trace-ray-inline.slang.glsl +++ b/tests/pipeline/ray-tracing/trace-ray-inline.slang.glsl @@ -74,8 +74,7 @@ void main() rayQueryEXT query_0; MyRayPayload_0 payload_5; - MyRayPayload_0 _S2 = { -1 }; - payload_5 = _S2; + payload_5.value_1 = -1; rayQueryInitializeEXT((query_0), (myAccelerationStructure_0), (C_0._data.rayFlags_0 | 512), (C_0._data.instanceMask_0), (C_0._data.origin_0), (C_0._data.tMin_0), (C_0._data.direction_0), (C_0._data.tMax_0)); MyProceduralHitAttrs_0 committedProceduralAttrs_0; @@ -83,37 +82,34 @@ void main() for(;;) { - bool _S3 = rayQueryProceedEXT(query_0); + bool _S2 = rayQueryProceedEXT(query_0); - if(!_S3) + if(!_S2) { break; } - uint _S4 = (rayQueryGetIntersectionTypeEXT((query_0), false)); + uint _S3 = (rayQueryGetIntersectionTypeEXT((query_0), false)); MyProceduralHitAttrs_0 committedProceduralAttrs_1; - switch(_S4) + switch(_S3) { case 1U: { MyProceduralHitAttrs_0 candidateProceduralAttrs_0; - MyProceduralHitAttrs_0 _S5 = { 0 }; + candidateProceduralAttrs_0.value_0 = 0; + float tHit_1 = 0.0; + bool _S4 = myProceduralIntersection_0(tHit_1, candidateProceduralAttrs_0); - candidateProceduralAttrs_0 = _S5; - float tHit_1; - tHit_1 = 0.00000000000000000000; - bool _S6 = myProceduralIntersection_0(tHit_1, candidateProceduralAttrs_0); - - if(_S6) + if(_S4) { - bool _S7 = myProceduralAnyHit_0(payload_5); + bool _S5 = myProceduralAnyHit_0(payload_5); - if(_S7) + if(_S5) { rayQueryGenerateIntersectionEXT(query_0, tHit_1); - MyProceduralHitAttrs_0 _S8 = candidateProceduralAttrs_0; + MyProceduralHitAttrs_0 _S6 = candidateProceduralAttrs_0; if(C_0._data.shouldStopAtFirstHit_0 != 0U) { rayQueryTerminateEXT(query_0); @@ -122,7 +118,7 @@ void main() { } - committedProceduralAttrs_1 = _S8; + committedProceduralAttrs_1 = _S6; } else @@ -145,9 +141,9 @@ void main() case 0U: { - bool _S9 = myTriangleAnyHit_0(payload_5); + bool _S7 = myTriangleAnyHit_0(payload_5); - if(_S9) + if(_S7) { rayQueryConfirmIntersectionEXT(query_0); if(C_0._data.shouldStopAtFirstHit_0 != 0U) @@ -179,9 +175,9 @@ void main() } - uint _S10 = (rayQueryGetIntersectionTypeEXT((query_0), true)); + uint _S8 = (rayQueryGetIntersectionTypeEXT((query_0), true)); - switch(_S10) + switch(_S8) { case 1U: { |
