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/pipeline | |
| parent | 101f164b036d0c1c012243df69179559b6f40fb8 (diff) | |
Arithmetic simplifications and more IR clean up logic. (#2632)
Diffstat (limited to 'tests/pipeline')
6 files changed, 107 insertions, 106 deletions
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: { |
