1

I have recently tried to save a arrayLength(&inArr) into i32 but I ended up getting this error.

   ┌─ gpu_test:24:9
   │
24 │         outArr[i] = arrLen;
   │         ^^^^^^^^^ naga::Expression [40]


    Entry point main at Compute is invalid
    Store of [41] into [40] doesn't have matching types

Im assuming this means I have an incorrect type but I haven't really found any information about naga::Expression [40] a side from a rust lib that didnt seem to have to do anything with it. Can anyone help me a bit and point me to the source where I can read about naga::Expression with a list of types and there numbers?

LAYTOR
  • 381
  • 4
  • 12
  • post your WGSL code or just paste your shader [here](https://webgpufundamentals.org/webgpu/lessons/resources/wgsl-offset-computer.html), pick process, and see what error it says. Also `arrayLength` returns a `u32` so you'll need to cast: [example](https://webgpufundamentals.org/webgpu/lessons/resources/wgsl-offset-computer.html#x=5d000001003400000000000000003d8888623728a306fc320e1a9bc1ccba6743c9e987a043cccbb0858eaaf32927751eea968ee2877b38a4cbedce80497d7423abbceaeb9e5ffff02d8400) – gman Aug 11 '23 at 06:58
  • 1
    I think you got my problem but are misunderstanding what I want. I already solved the problem thank you, but I just want to know how can I know what naga:Expression [40] even means. I understand that it has to do with the type system but where can I see that [41] is an u32 and [40] is i32. – LAYTOR Aug 11 '23 at 11:39
  • naga::Expresssion [40] is the `outArr[i]`, the part underlined before it says naga::Expression. I'm guessing somewhere it may say that `arrLen` is naga::Expression [41] and then those two values map to the diagnostic string. So, the store of `arrLen` into `outArr[i]` doesn't have matching types. You'll then have to find your declaraions to see the types. – dj2 Aug 11 '23 at 21:09
  • But why 40 and 41. I'm assuming this number is associated with there type but in what way? I know I can just check there types manually and I already did but it would be easer if I can just be told which type is which. – LAYTOR Aug 12 '23 at 08:07
  • 1
    I'm guessing 40 and 41 are that it's the 40th and 41st expressions. You can file bugs at https://github.com/gfx-rs/naga (there are a few about unclear error messages already) – dj2 Aug 13 '23 at 03:32
  • 1
    Same problem here — I'd guess that these indices, e.g. [40], [41], [42], each refer to a specific expression error. – Ailurus Sep 01 '23 at 15:33

0 Answers0