diff options
| author | kaizhangNV <149626564+kaizhangNV@users.noreply.github.com> | 2025-02-05 12:37:03 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-05 10:37:03 -0800 |
| commit | 9ec6b91686b651d959fd9ffbec283845bd725dd6 (patch) | |
| tree | 2c48202cb04b76e5ddcb274be35529378ddf8f31 /tests/pipeline/rasterization | |
| parent | 4b350645042b8e8fbdad19784ee745d11c7bc616 (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/rasterization')
| -rw-r--r-- | tests/pipeline/rasterization/mesh/hlsl-syntax.slang.glsl | 34 |
1 files changed, 22 insertions, 12 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; } |
