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

[spv-out] Generated SPIR-V with duplicate OpName fails on Adreno drivers #1331

Closed
encounter opened this issue Sep 8, 2021 · 1 comment · Fixed by #1334
Closed

[spv-out] Generated SPIR-V with duplicate OpName fails on Adreno drivers #1331

encounter opened this issue Sep 8, 2021 · 1 comment · Fixed by #1334
Labels
area: back-end Outputs of shader conversion kind: bug Something isn't working lang: SPIR-V Binary SPIR-V input and output

Comments

@encounter
Copy link
Contributor

This one is fun! Apparently OpName is semantic, somehow, on Adreno drivers.

struct VertexOutput {
    [[builtin(position)]] pos: vec4<f32>;
    [[location(0)]] lighting: vec3<f32>;
};

[[stage(vertex)]]
fn vs_main_test(
    [[location(0)]] pos: vec3<f32>,
    [[location(1)]] lighting: vec3<f32>,
) -> VertexOutput {
    return VertexOutput(vec4<f32>(pos, 1.0), lighting);
}

Adreno rejects this SPIR-V simply because the stage input lighting has the same OpName as the stage output lighting.

Renaming the input lighting to in_lighting resolves this issue, and a spirv-dis --raw-id diff shows that the only difference is the OpName for that field.

However, the pos/pos OpNames do not cause an issue, indicating it's only a problem with non-builtin stage inputs and outputs. This example is also OK:

struct VertexOutput {
    [[builtin(position)]] pos: vec4<f32>;
    [[location(0)]] vertex_index: u32;
};

[[stage(vertex)]]
fn vs_main_test(
    [[builtin(vertex_index)]] vertex_index: u32,
    [[location(0)]] pos: vec3<f32>,
) -> VertexOutput {
    return VertexOutput(vec4<f32>(pos, 1.0), vertex_index);
}
@kvark kvark added area: back-end Outputs of shader conversion kind: bug Something isn't working lang: SPIR-V Binary SPIR-V input and output labels Sep 8, 2021
@kvark
Copy link
Member

kvark commented Sep 8, 2021

Would you be able to check if omitting OpName for them entirely is a good workaround?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: back-end Outputs of shader conversion kind: bug Something isn't working lang: SPIR-V Binary SPIR-V input and output
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants