WebGL RenderTexture random access write compatibility

I’m trying to make a WebGL build for distribution convenience and I’m stuck with a RenderTexture problem. I’m not able to create a RenderTexture with the enableRandomWrite flag set to true, getting a “Create failed” message.
Complete message: RenderTexture.Create failed: format unsupported for random writes - RGBA16 SFloat (48).
I tried all available formats, actually using SystemInfo.GetCompatibleFormat to find any compatible format for FormatUsage.Render and I cannot find a way to make it work in the browser. Everything is fine in the editor, or in the standard Windows Platform where I develop.

I’m open to working differently as well if anyone has another way to write to a texture from a compute shader in a WebGL compatible way.

According to docs this flag requires shader model 5 graphics capabilities: Unity - Scripting API: RenderTexture.enableRandomWrite

WebGL 2.0 is roughly equivalent to OpenGLES 3.0 so the WebGL shader model is about equivalent to model 3.0 to 3.5 but definitely not 5: Unity - Manual: Targeting shader models and GPU features in HLSL

I don‘t know if alternatives exist.

1 Like

Thank you for your answer, that explains a lot!
I guess WebGPU will be the answer I’m looking for, I’m eager to see it coming to Unity!