WebGPU-Step-By-Step icon indicating copy to clipboard operation
WebGPU-Step-By-Step copied to clipboard

Pass vec4 to a fragment wgsl

Open eduardfossas opened this issue 4 years ago • 1 comments

Hello, I am following your examples in the book and the videos on youtube and I see you decided to go for a template string inside a typescript file instead of using wgsl extension. I have two questions regarding this:

  • Is there a performance impact on doing so? Does it decrease the performance of WebGPU using a template string instead of a .wgsl file?
  • How can you pass a vec4 from the pipeline to a fragment wgsl shader?

Thank you very much for sharing your experience.

eduardfossas avatar Feb 01 '22 16:02 eduardfossas

no performance impact. wgsl file will be converted to string in the pipeline. starting from video series 42, I started to use wgsl extension to write shader code because it it easier to code that the string.

use uniform buffer to pass vec4 to shader.

jack1232 avatar Feb 13 '22 04:02 jack1232