Closed Bug 1870208 Opened 2 years ago Closed 2 years ago

WebGPU Fundamentals' triangle examples don't render

Categories

(Core :: Graphics: WebGPU, defect, P3)

defect

Tracking

()

RESOLVED FIXED

People

(Reporter: ErichDonGubler, Assigned: ErichDonGubler)

References

(Blocks 2 open bugs, )

Details

STR

  1. Open the Drawing triangles to textures section of the eponymous first page of WebGPU Fundamentals' tutorial.

  2. Scroll to the end of the section where a split code editor and runner display the triangle shader. Observe that errors appear in the right-hand size, where the rendered image would be, of the form:

    ❌WebGPU GPUValidationError: Error matching ShaderStages(VERTEX) shader requirements against the pipeline, caused by: Shader module is invalid
    ❌WebGPU GPUValidationError: In a set_pipeline command, caused by: Render pipeline Id(16,1,d3d12) is invalid
    ❌WebGPU GPUValidationError: Command encoder is invalid
    

:jimb tells me that this is gfx-rs/wgpu#4337.

Summary: WebGPU Fundamentals' triangle example doesn't render → WebGPU Fundamentals' first triangle example doesn't render
Summary: WebGPU Fundamentals' first triangle example doesn't render → WebGPU Fundamentals' triangle examples don't render

Workaround: In each of the offending examples I've noticed, there's a bit of shader code that looks like this:

  let pos = array(
    vec2f( 0.0,  0.5),  // top center
    vec2f(-0.5, -0.5),  // bottom left
    vec2f( 0.5, -0.5)   // bottom right
  );

If you change let to var:

-let pos = array(
+var pos = array(

…then the shader compiles, and the remainder of the WebGPU code seems to Just Work™.

Depends on: 1913424

I now get:

Uncaptured WebGPU error: Internal error in ShaderStages(VERTEX) shader: Metal: program_source:44:12: error: no viable conversion from returned value of type 'OurVertexShaderOutput' to function return type 'vsOutput'
    return vsOutput { _tmp.position, _tmp.texcoord };
           ^~~~~~~~
program_source:25:8: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'OurVertexShaderOutput' to 'const vsOutput &' for 1st argument
struct vsOutput {
       ^
program_source:25:8: note: candidate c

:jrmuizel: I have a fix at wgpu#6438, which is being tracked by bug 1926305.

Depends on: 1926305

This should now work fully; validated myself that all examples at https://webgpufundamentals.org/webgpu/lessons/webgpu-fundamentals.html#drawing-triangles-to-textures work now. 🥳

Assignee: nobody → egubler
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.