Wgpu-rs: Incorrect shader validation when using wgpu::VertexFormat::Ushort2Norm

Created on 26 Nov 2020  路  5Comments  路  Source: gfx-rs/wgpu-rs

I use wgpu 0.6.2 from crates.io and https://github.com/gfx-rs/wgpu-rs/blob/v0.6/examples/hello-triangle/main.rs as a basis

changes in main.rs:

        vertex_state: wgpu::VertexStateDescriptor {
            index_format: wgpu::IndexFormat::Uint16,
            vertex_buffers: &[wgpu::VertexBufferDescriptor {
                stride: 2 * 2,
                step_mode: wgpu::InputStepMode::Vertex,
                attributes: &wgpu::vertex_attr_array![0 => Ushort2Norm], // Float2 works without error
            }],
        },

shader.vert:

#version 450

layout(location = 0) in vec2 a_TexCoord;
layout(location = 0) out vec2 v_TexCoord;

void main() { v_TexCoord = a_TexCoord; }
// void main() { } // works without error

shader.frag:


#version 450

layout(location = 0) out vec4 outColor;
layout(location = 0) in vec2 v_TexCoord;

void main() { outColor = vec4(1.0, 0.0, 0.0, 1.0); }
thread 'main' panicked at 'error in stage VERTEX: error matching the stage input at 0 against the previous stage outputs: input type is not compatible with the provided', /home/lain/.cargo/registry/src/github.com-1ecc6299db9ec823/wgpu-0.6.2/src/backend/direct.rs:1355:35

full stderr/stdout

Looks like issue in naga.

$ glslc --version
2020.3
2020.4
11.0.0

Target: SPIR-V 1.0

$ rustc --version
rustc 1.50.0-nightly (fe982319a 2020-11-19)
bug

Most helpful comment

I think we'll start some preparations now, just needed to finish the bind group layout changes that were hanging in the air. Should expect 0.7 to come before the end of the year.

All 5 comments

Seems to validate fine in master. Naga integration has gone a long way since 0.6 was out.
How do you feel about either moving to master or disabling DeviceDescriptor::shader_validation for now, until we roll out 0.7?

In fact, I moved from the master to 0.6.2 only for the test.

@lain-dono could you confirm if this works as expected for you on master? Just in case, I pushed a commit I was testing in https://github.com/kvark/wgpu-rs/tree/test-ushort2-attrib

Seems to validate fine in master. Naga integration has gone a long way since 0.6 was out.
How do you feel about either moving to master or disabling DeviceDescriptor::shader_validation for now, until we roll out 0.7?

Maybe a wrong place to ask, but is there some estimation of 0.7 release?

I think we'll start some preparations now, just needed to finish the bind group layout changes that were hanging in the air. Should expect 0.7 to come before the end of the year.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

lordnoriyuki picture lordnoriyuki  路  4Comments

bvssvni picture bvssvni  路  5Comments

MarioSieg picture MarioSieg  路  4Comments

yutannihilation picture yutannihilation  路  4Comments

donpdonp picture donpdonp  路  3Comments