BlazorExtensions/Canvas

UniformAsync

mludlum opened this issue · 0 comments

I know the last post is in 2022, but I see active forks. Hopefully someone will see this and comment...

I don't think UniformAsync implements the uniform* bindings correctly (if not, completely). My understanding is that in OpenGL, you call Uniform1 to upload a float, or an array of floats. Uinform2/3/4 for float vectors 2/3/4 or an array of vectors of those lengths.

This UniformAsync implementation assumes a single 1/2/3/4 vector and does not support an array of vectors.

UniformAsync should be split into Uniform1Async, Uniform2Async, Uniform3Async, Uniform4Async and validate that the input float array is a multiple of 1/2/3/4 floats, respectively.

I'm porting a Windows OpenTK application to WebAssembly, and one of my shaders takes an array of vector4s as a color lookup table. So, I may pass 100 vector4s to the shader, and index that lookup table. UniformAsync doesn't support that.