Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slang successfully compiles to invalid shaders when duplicate or overlapping system value names are used #6319

Open
fairywreath opened this issue Feb 8, 2025 · 1 comment
Assignees

Comments

@fairywreath
Copy link
Contributor

fairywreath commented Feb 8, 2025

Slang successfully compiles shader with duplicate built-in decorations, for example:

float4 main(uint vertexID : SV_VertexID, uint anotherVertexID : SV_VertexID) : SV_Position {
    return float4(vertexID * 0.1, 0, 0, 1);
}

This compiles successfully to invalid shaders such as:

struct vertexOutput_0
{
    @builtin(position) output_0 : vec4<f32>,
};

@vertex
fn main(@builtin(vertex_index) vertexID_0 : u32, @builtin(vertex_index) anotherVertexID_0 : u32) -> vertexOutput_0
{
    var _S1 : vertexOutput_0 = vertexOutput_0( vec4<f32>(f32(vertexID_0) * 0.10000000149011612f, 0.0f, 0.0f, 1.0f) );
    return _S1;
}

Built-in/system values cannot be duplicated in the entry point parameter list for HLSL, WGSL and Metal. Slang either needs to error out or transform the duplicated system values to a single param.

@fairywreath
Copy link
Contributor Author

I cannot assign myself this issue but I will be working on it.

@fairywreath fairywreath changed the title Slang needs to error out when duplicate or overlappping system value names are used Slang compiles to incorrect shaders when duplicate or overlappping system value names are used Feb 8, 2025
@fairywreath fairywreath changed the title Slang compiles to incorrect shaders when duplicate or overlappping system value names are used Slang compiles to invalid shaders when duplicate or overlappping system value names are used Feb 8, 2025
@fairywreath fairywreath changed the title Slang compiles to invalid shaders when duplicate or overlappping system value names are used Slang successfully compiles to invalid shaders when duplicate or overlappping system value names are used Feb 8, 2025
@fairywreath fairywreath changed the title Slang successfully compiles to invalid shaders when duplicate or overlappping system value names are used Slang successfully compiles to invalid shaders when duplicate or overlapping system value names are used Feb 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant