WGSL Bad Practice?

So I have a bunch of predetermined/prebaked data that I want to nest on a shader.

Making a complex storage buffer for it or a uniform seemed like the wrong path since the data is never going to mutate after the initial creation of the shader.

So I decided to construct the shader parts as strings and just inject that into the code:


and then later I used it like:
{A33545F2-69D9-4063-A0C0-531BFBA2A8D2}

At what point does this become bad practice? Will this overload my shaders if I do too much data? Is there a better way to do this? I’m including this data on both a compute shader and my vertex and fragment shader.

The WebGPU Matrix channel is a good place to ask questions about WebGPU/WGSL best practices and performance: https://app.element.io/#/room/#WebGPU:matrix.org.

Regarding your question, I would say that it’s ok to do it in the code only for very small amount of data because it will consume valuable register resources, which are quite sparse. Even if static, I would pass the data through a ubo, or a storage buffer, or even through a texture (I don’t know which one would be the fastest, though).

Thank you so much, Ill start using that resource!