Skip to content

WGSL location indicies are not generated, leading to invalid output #8388

@Devon7925

Description

@Devon7925

Issue Description

When compiling to WGSL, location indices are not being generated.
ehttps://github.com/shader-slang/slang/blob/5500f11768d4d93eef4dfcecf0821fee747bf1a4/docs/user-guide/a2-03-wgsl-target-specific.md?plain=1#L116

This leads to generated wgsl shader code being invalid and failing with errors like the following:

Error while parsing WGSL: :3603:6 error: missing entry point IO attribute
     texcoord_0 : vec2<f32>,
     ^^^^^^^^^^

:3607:1 note: while analyzing entry point 'vertexMain'
fn vertexMain(@builtin(vertex_index) vertexID_0 : u32) -> VOut_0
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
{
^

This may be related to the changes in #8146.

Reproducer Code

https://shader-slang.org/slang-playground/?demo=entrypoint.slang
Set the target to wgsl.
Adding [vk::location(0)] to the props of the original struct does not fix the issue.

Expected Behavior

The struct VOut_0 should have its normal and uv properties annotated with locations.

struct VOut_0
{
    @builtin(position) position_0 : vec4<f32>,
    @location(0) normal_0 : vec3<f32>,
    @location(1) uv_0 : vec2<f32>,
};

Actual Behavior

They aren't annotated.

struct VOut_0
{
    @builtin(position) position_0 : vec4<f32>,
     normal_0 : vec3<f32>,
     uv_0 : vec2<f32>,
};

Environment

This happens on latest commit but does not happen on my local computer's version of 2025.11-12-gc5295eae2.

Metadata

Metadata

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions