Open Bug 1967008 Opened 1 year ago Updated 1 year ago

Categories

(Core :: Graphics: WebGPU, defect)

defect

Tracking

()

People

(Reporter: jrmuizel, Unassigned)

References

(Blocks 1 open bug)

Details

   1: 
   2: 
   3: 
   4: void OFFSET_POSITION(inout vec4 position) {
 ERROR: 
Shader '' parsing error: expected global item (`struct`, `const`, `var`, `alias`, `fn`, `diagnostic`, `enable`, `requires`, `;`) or the end of the file, found "void"
  ┌─ wgsl:4:1
  │
4 │ void OFFSET_POSITION(inout vec4 position) {
  │ ^^^^ expected global item (`struct`, `const`, `var`, `alias`, `fn`, `diagnostic`, `enable`, `requires`, `;`) or the end of the file

   5: }
   6: struct Uniforms {
   7:   modelViewProjectionMatrix : mat4x4<f32>,
   8: };
   9: 
  10: @group(0) @binding(0) var<uniform> app : Uniforms;
  11: // @group(0) @binding(1) var uTexture : texture_2d<f32>;
  12: // @group(0) @binding(2) var uTextureSampler : sampler;
  13: 
  14: struct VertexInputs {
  15:   // CUBE GEOMETRY
  16:   @location(0) positions : vec4<f32>,
  17:   @location(1) texCoords : vec2<f32>
  18: };
  19: 
  20: struct FragmentInputs {
  21:   @builtin(position) Position : vec4<f32>,
  22:   @location(0) fragUV : vec2<f32>,
  23:   @location(1) fragPosition: vec4<f32>,
  24: }
  25: 
  26: @vertex
  27: fn vertexMain(inputs: VertexInputs) -> FragmentInputs {
  28:   var outputs : FragmentInputs;
  29:   outputs.Position = app.modelViewProjectionMatrix * inputs.positions;
  30:   outputs.fragUV = inputs.texCoords;
  31:   outputs.fragPosition = 0.5 * (inputs.positions + vec4(1.0, 1.0, 1.0, 1.0));
  32:   return outputs;
  33: }
  34: 
  35: @fragment
  36: fn fragmentMain(inputs: FragmentInputs) -> @location(0) vec4<f32> {
  37:   return inputs.fragPosition;
  38:   // return textureSample(uTexture, uTextureSampler, inputs.fragUV);
  39: }
  40: 

The example seems broken in Chrome and Safari as well so this is likely low priority

Yeah, that's definitely not valid WGSL we're emitting an error for. Maybe somebody's conversion to WGSL isn't working as expected?

Severity: -- → S3
You need to log in before you can comment on or make changes to this bug.