summaryrefslogtreecommitdiff
path: root/tests/pipeline
diff options
context:
space:
mode:
authorkaizhangNV <149626564+kaizhangNV@users.noreply.github.com>2025-02-05 12:37:03 -0600
committerGitHub <noreply@github.com>2025-02-05 10:37:03 -0800
commit9ec6b91686b651d959fd9ffbec283845bd725dd6 (patch)
tree2c48202cb04b76e5ddcb274be35529378ddf8f31 /tests/pipeline
parent4b350645042b8e8fbdad19784ee745d11c7bc616 (diff)
Feature/initialize list side branch (#6058)
* SP004: implement initialize list translation to ctor - We synthesize a member-wise constructor for each struct follow the rules described in SP004. - Add logic to translate the initialize list to constructor invoke - Add cuda-host decoration for the synthesized constructor - Remove the default constructor when we have a valid member init constructor - Disable -zero-initialize option, will re-implement it in followup (#6109). - Fix the overload lookup issue When creating invoke expression for ctor, we need to call ResolveInvoke() to find us the best candidates, however the existing lookup logic could find us the base constructor for child struct, we should eliminate this case by providing the LookupOptions::IgnoreInheritance to lookup, this requires us to create a subcontext on SemanticsVisitor to indicate that we only want to use this option on looking the constructor. - Do not implicit initialize a struct that doesn't have explicit default constructor. Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Diffstat (limited to 'tests/pipeline')
-rw-r--r--tests/pipeline/rasterization/mesh/hlsl-syntax.slang.glsl34
-rw-r--r--tests/pipeline/ray-tracing/trace-ray-inline.slang.hlsl93
2 files changed, 82 insertions, 45 deletions
diff --git a/tests/pipeline/rasterization/mesh/hlsl-syntax.slang.glsl b/tests/pipeline/rasterization/mesh/hlsl-syntax.slang.glsl
index 01e29f879..0d7a201ef 100644
--- a/tests/pipeline/rasterization/mesh/hlsl-syntax.slang.glsl
+++ b/tests/pipeline/rasterization/mesh/hlsl-syntax.slang.glsl
@@ -2,27 +2,40 @@
#extension GL_EXT_mesh_shader : require
layout(row_major) uniform;
layout(row_major) buffer;
-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 verts_color_0[3];
out gl_MeshPerVertexEXT
{
vec4 gl_Position;
} gl_MeshVerticesEXT[3];
+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) };
+
+struct Vertex_0
+{
+ vec4 pos_0;
+ vec3 color_0;
+};
+
+Vertex_0 Vertex_x24init_0(vec4 pos_1, vec3 color_1)
+{
+ Vertex_0 _S1;
+
+ _S1.pos_0 = pos_1;
+ _S1.color_0 = color_1;
+ return _S1;
+}
+layout(location = 0)
+out vec3 verts_color_0[3];
out uvec3 gl_PrimitiveTriangleIndicesEXT[1];
void foo_0(uint _S2)
{
if(_S2 < 3U)
{
- gl_MeshVerticesEXT[_S2].gl_Position = vec4(positions_0[_S2], 0.0, 1.0);
- verts_color_0[_S2] = colors_0[_S2];
- }
- else
- {
+ Vertex_0 _S3 = Vertex_x24init_0(vec4(positions_0[_S2], 0.0, 1.0), colors_0[_S2]);
+ gl_MeshVerticesEXT[_S2].gl_Position = _S3.pos_0;
+ verts_color_0[_S2] = _S3.color_0;
}
return;
}
@@ -39,8 +52,5 @@ void main()
{
gl_PrimitiveTriangleIndicesEXT[gl_LocalInvocationIndex] = uvec3(0U, 1U, 2U);
}
- else
- {
- }
return;
}
diff --git a/tests/pipeline/ray-tracing/trace-ray-inline.slang.hlsl b/tests/pipeline/ray-tracing/trace-ray-inline.slang.hlsl
index 4ed4c9966..df78f3c79 100644
--- a/tests/pipeline/ray-tracing/trace-ray-inline.slang.hlsl
+++ b/tests/pipeline/ray-tracing/trace-ray-inline.slang.hlsl
@@ -2,7 +2,11 @@
#ifdef SLANG_HLSL_ENABLE_NVAPI
#include "nvHLSLExtns.h"
#endif
-#pragma warning(disable: 3557)
+
+#ifndef __DXC_VERSION_MAJOR
+// warning X3557: loop doesn't seem to do anything, forcing loop to unroll
+#pragma warning(disable : 3557)
+#endif
struct SLANG_ParameterGroup_C_0
{
@@ -23,21 +27,45 @@ RaytracingAccelerationStructure myAccelerationStructure_0 : register(t0);
RWStructuredBuffer<int > resultBuffer_0 : register(u0);
-struct MyProceduralHitAttrs_0
+struct MyRayPayload_0
{
int value_0;
};
-bool myProceduralIntersection_0(inout float tHit_0, inout MyProceduralHitAttrs_0 hitAttrs_0)
+MyRayPayload_0 MyRayPayload_x24init_0(int value_1)
{
- return true;
+ MyRayPayload_0 _S1;
+ _S1.value_0 = value_1;
+ return _S1;
}
-struct MyRayPayload_0
+RayDesc RayDesc_x24init_0(float3 Origin_0, float TMin_0, float3 Direction_0, float TMax_0)
+{
+ RayDesc _S2;
+ _S2.Origin = Origin_0;
+ _S2.TMin = TMin_0;
+ _S2.Direction = Direction_0;
+ _S2.TMax = TMax_0;
+ return _S2;
+}
+
+struct MyProceduralHitAttrs_0
{
- int value_1;
+ int value_2;
};
+MyProceduralHitAttrs_0 MyProceduralHitAttrs_x24init_0(int value_3)
+{
+ MyProceduralHitAttrs_0 _S3;
+ _S3.value_2 = value_3;
+ return _S3;
+}
+
+bool myProceduralIntersection_0(inout float tHit_0, inout MyProceduralHitAttrs_0 hitAttrs_0)
+{
+ return true;
+}
+
bool myProceduralAnyHit_0(inout MyRayPayload_0 payload_0)
{
return true;
@@ -50,61 +78,59 @@ bool myTriangleAnyHit_0(inout MyRayPayload_0 payload_1)
void myTriangleClosestHit_0(inout MyRayPayload_0 payload_2)
{
- payload_2.value_1 = int(1);
+ payload_2.value_0 = int(1);
return;
}
void myProceduralClosestHit_0(inout MyRayPayload_0 payload_3, MyProceduralHitAttrs_0 attrs_0)
{
- payload_3.value_1 = attrs_0.value_0;
+ payload_3.value_0 = attrs_0.value_2;
return;
}
void myMiss_0(inout MyRayPayload_0 payload_4)
{
- payload_4.value_1 = int(0);
+ payload_4.value_0 = int(0);
return;
}
[shader("compute")][numthreads(1, 1, 1)]
-void main(uint3 tid_0 : SV_DISPATCHTHREADID)
+void main(uint3 tid_0 : SV_DispatchThreadID)
{
uint index_0 = tid_0.x;
- MyRayPayload_0 payload_5;
- payload_5.value_1 = int(-1);
- RayDesc ray_0 = { C_0.origin_0, C_0.tMin_0, C_0.direction_0, C_0.tMax_0 };
+ MyRayPayload_0 payload_5 = MyRayPayload_x24init_0(int(-1));
RayQuery<512U > query_0;
- query_0.TraceRayInline(myAccelerationStructure_0, C_0.rayFlags_0, C_0.instanceMask_0, ray_0);
+ query_0.TraceRayInline(myAccelerationStructure_0, C_0.rayFlags_0, C_0.instanceMask_0, RayDesc_x24init_0(C_0.origin_0, C_0.tMin_0, C_0.direction_0, C_0.tMax_0));
MyProceduralHitAttrs_0 committedProceduralAttrs_0;
+ MyProceduralHitAttrs_0 _S4 = MyProceduralHitAttrs_x24init_0(int(0));
for(;;)
{
- bool _S1 = query_0.Proceed();
- if(!_S1)
+ bool _S5 = query_0.Proceed();
+ if(!_S5)
{
break;
}
- uint _S2 = query_0.CandidateType();
+ uint _S6 = query_0.CandidateType();
MyProceduralHitAttrs_0 committedProceduralAttrs_1;
- switch(_S2)
+ switch(_S6)
{
case 1U:
{
- MyProceduralHitAttrs_0 candidateProceduralAttrs_0;
- candidateProceduralAttrs_0.value_0 = int(0);
+ MyProceduralHitAttrs_0 candidateProceduralAttrs_0 = _S4;
float tHit_1 = 0.0;
- bool _S3 = myProceduralIntersection_0(tHit_1, candidateProceduralAttrs_0);
- if(_S3)
+ bool _S7 = myProceduralIntersection_0(tHit_1, candidateProceduralAttrs_0);
+ if(_S7)
{
- bool _S4 = myProceduralAnyHit_0(payload_5);
- if(_S4)
+ bool _S8 = myProceduralAnyHit_0(payload_5);
+ if(_S8)
{
query_0.CommitProceduralPrimitiveHit(tHit_1);
- MyProceduralHitAttrs_0 _S5 = candidateProceduralAttrs_0;
- if(C_0.shouldStopAtFirstHit_0 != 0U)
+ MyProceduralHitAttrs_0 _S9 = candidateProceduralAttrs_0;
+ if((C_0.shouldStopAtFirstHit_0) != 0U)
{
query_0.Abort();
}
- committedProceduralAttrs_1 = _S5;
+ committedProceduralAttrs_1 = _S9;
}
else
{
@@ -119,11 +145,11 @@ void main(uint3 tid_0 : SV_DISPATCHTHREADID)
}
case 0U:
{
- bool _S6 = myTriangleAnyHit_0(payload_5);
- if(_S6)
+ bool _S10 = myTriangleAnyHit_0(payload_5);
+ if(_S10)
{
query_0.CommitNonOpaqueTriangleHit();
- if(C_0.shouldStopAtFirstHit_0 != 0U)
+ if((C_0.shouldStopAtFirstHit_0) != 0U)
{
query_0.Abort();
}
@@ -139,8 +165,8 @@ void main(uint3 tid_0 : SV_DISPATCHTHREADID)
}
committedProceduralAttrs_0 = committedProceduralAttrs_1;
}
- uint _S7 = query_0.CommittedStatus();
- switch(_S7)
+ uint _S11 = query_0.CommittedStatus();
+ switch(_S11)
{
case 1U:
{
@@ -162,6 +188,7 @@ void main(uint3 tid_0 : SV_DISPATCHTHREADID)
break;
}
}
- resultBuffer_0[index_0] = payload_5.value_1;
+ resultBuffer_0[index_0] = payload_5.value_0;
return;
}
+