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

WGSL: nointerpolate doesn't work #5625

Open
aleino-nv opened this issue Nov 21, 2024 · 4 comments
Open

WGSL: nointerpolate doesn't work #5625

aleino-nv opened this issue Nov 21, 2024 · 4 comments
Assignees
Labels
goal:forward looking Feature needed at a later date, not connected to a specific use case. kind:enhancement a desirable new feature, option, or behavior

Comments

@aleino-nv
Copy link
Collaborator

aleino-nv commented Nov 21, 2024

Failing tests:

  • tests/render/nointerpolation.hlsl (wgpu) is failing to generate the expected output (solid red triangle)
@aleino-nv
Copy link
Collaborator Author

Filing separate issue for tracking, but this will be done as part of #4943

@aleino-nv aleino-nv self-assigned this Nov 21, 2024
@aleino-nv
Copy link
Collaborator Author

@aleino-nv aleino-nv added goal:forward looking Feature needed at a later date, not connected to a specific use case. kind:enhancement a desirable new feature, option, or behavior labels Nov 21, 2024
@aleino-nv
Copy link
Collaborator Author

I'm working on a fix in the branch aleino/nointerpolate, but the resulting @interpolate attribute gets added to the CoarseVertex struct, whereas the actual output struct for the vertex shader (which also gets a @location attribute, as is required when using @interpolate) is the result of struct flattening.

I noticed that the struct flattening function does not move the interpolation mode decoration from the 'color' field over to the new flattened struct.

...

struct VertexStageOutput_0
{
    @location(0) color_0 : vec3<f32>,            // @interpolate *should* be here
    @builtin(position) sv_position_0 : vec4<f32>,
};

struct VertexStageInput_0
{
    @location(0) position_0 : vec3<f32>,
    @location(1) color_1 : vec3<f32>,
};

struct AssembledVertex_0
{
     position_1 : vec3<f32>,
     color_2 : vec3<f32>,
};

struct VertexStageInput_1
{
     assembledVertex_0 : AssembledVertex_0,
};

struct CoarseVertex_0
{
    @interpolate(flat)  color_3 : vec3<f32>,    // @interpolate *should not* be here
};

struct VertexStageOutput_1
{
     coarseVertex_0 : CoarseVertex_0,
     sv_position_1 : vec4<f32>,
};

@vertex
fn vertexMain( input_0 : VertexStageInput_0) -> VertexStageOutput_0
{
    ...
    var _S3 : VertexStageOutput_0;
    ...
    return _S3;
}

aleino-nv added a commit to aleino-nv/slang that referenced this issue Nov 22, 2024
* Move interpolation mode decorations to flattened structs
* Emit interpolation attribute
* Enable tests/render/nointerpolation.hlsl for WGSL, as a result.

This closes shader-slang#5625.
@aleino-nv
Copy link
Collaborator Author

aleino-nv commented Nov 22, 2024

PR based on the above observation #5641

aleino-nv added a commit to aleino-nv/slang that referenced this issue Nov 22, 2024
* Move interpolation mode decorations to flattened structs
* Emit interpolation attribute
* Enable tests/render/nointerpolation.hlsl for WGSL, as a result.

This closes shader-slang#5625.
aleino-nv added a commit to aleino-nv/slang that referenced this issue Nov 22, 2024
* Move interpolation mode decorations to flattened structs
* Emit interpolation attribute
* Enable tests/render/nointerpolation.hlsl for WGSL, as a result.

This closes shader-slang#5625.
aleino-nv added a commit to aleino-nv/slang that referenced this issue Nov 22, 2024
* Move interpolation mode decorations to flattened structs
* Emit interpolation attribute
* Enable tests/render/nointerpolation.hlsl for WGSL, as a result.

This closes shader-slang#5625.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
goal:forward looking Feature needed at a later date, not connected to a specific use case. kind:enhancement a desirable new feature, option, or behavior
Projects
None yet
Development

No branches or pull requests

1 participant