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

Scalar type in Vector is not added to the IR #85

Closed
Napokue opened this issue Jun 26, 2020 · 5 comments
Closed

Scalar type in Vector is not added to the IR #85

Napokue opened this issue Jun 26, 2020 · 5 comments
Assignees
Labels
area: back-end Outputs of shader conversion kind: bug Something isn't working lang: SPIR-V Binary SPIR-V input and output

Comments

@Napokue
Copy link
Collaborator

Napokue commented Jun 26, 2020

Converting this WGSL:

[[location 0]] var<in> a_pos : vec2<f32>;
[[location 0]] var<out> v_uv : vec2<f32>;

fn main_vert() -> void {
  v_uv = a_pos * a_pos;
  return;
}
entry_point vertex as "main" = main_vert;

To the following IR module (omitted most things):

types: Arena {
        data: [
            Type {
                name: None,
                inner: Vector {
                    size: Bi,
                    kind: Float,
                    width: 32,
                },
            },
        ],
    },

As you can see, the Float scalar is not created, the SPIR-V back-end has to check if the scalar type already exists, if not, create it.

The reason the quad.wgsl works, is because at the top of the file is the following line declared:
const c_scale: f32 = 1.2;

This causes the front-end to create the Float scalar for the Vectors that need this.

@Napokue Napokue added kind: bug Something isn't working lang: WGSL WebGPU shading language area: front-end Input formats for conversion labels Jun 26, 2020
@Napokue
Copy link
Collaborator Author

Napokue commented Jun 26, 2020

Talked with @kvark at Matrix about this, the problems needs to be fixed in the back-ends. The back-end has to check if the scalar type is available, if not, create it.

@Napokue Napokue added area: back-end Outputs of shader conversion lang: SPIR-V Binary SPIR-V input and output and removed area: front-end Input formats for conversion lang: WGSL WebGPU shading language labels Jun 26, 2020
@kvark
Copy link
Member

kvark commented Jun 26, 2020

More specifically, it's a problem with SPIR-V backend. I don't think anything else need to adjust for this.

@pjoe
Copy link
Collaborator

pjoe commented Aug 5, 2020

Also ran into this using glsl frontend

@pjoe
Copy link
Collaborator

pjoe commented Aug 5, 2020

Wondering if this would cause issues for other backends too? Maybe we should have things like this handle in middle-out - ehh middle-end 😄

@Napokue
Copy link
Collaborator Author

Napokue commented Aug 17, 2020

Fixed in #88, closing issue.

@Napokue Napokue closed this as completed Aug 17, 2020
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

No branches or pull requests

3 participants