Now, I know the UPBGE team might be aware of this already, but if you put a Glass BDSF shader on an object in UPBGE on an M1 Mac, a certain part of the shader will return with this error:
UNSUPPORTED (log once): POSSIBLE ISSUE: unit 2 GLD_TEXTURE_INDEX_2D is unloadable and bound to sampler type (Float) - using zero texture because texture unloadable
This is not UPBGE’s fault. This issue comes from the M1 chip which unfortunately does not have full compatibility with OpenGL 3.0+.
Now, I have noticed something with this error.
What works:
-
2D Filters (these are not affected)
-
Most BDSF Shaders that do not combine both Reflections and Refractions
-
Diffuse Shaders
-
VideoTexture (Unless you project a shader, which will not work)
-
Specular Shaders
What does not work:
-
Using VideoTexture on any vertex object in conjunction with the shader
-
Reflection shaders (Most noticeably Glass), seems to be unable to combine the two Reflection and Refraction
It appears to me that M1 is unable to compile the shaders in the “What does not work” category of shaders. While yes, OpenGL has been depreciated unfortunately, the good thing, is that once Metal is up and running in UPBGE, Metal will be able to allow us to create shaders that will not fail to compile on M1.
The result, is that because M1 cannot send the requested shader to the GPU part of the chip, it instead has no output, resulting in the error in the console (appears only once), and the object used to place the shader on is either rendered straight black, a solid colour, or no texture at all, this is due to no output being produced.
The “unit 2 GLD_TEXTURE_INDEX_2D” means that the 3rd (or 2nd maybe) texture of the object could not be loaded due to it being bound to an incompatible sampler type. A sampler type is a variable. Since Float and Int samplers do not exist in M1, the chip does not know what to do, and it thus, fails to compile the shader, and this is how the result comes out - no output generated.
This does not occur in 2D Filters due to no vertexes used - just the screen is used for drawing, and a fragment shader is used, which will compile just fine.
I just wanted to hopefully clear some things up about this error. I might not be correct on this topic, but hopefully, this could be helpful to the devs. It’s annoying to create a shader, use VideoTexture to render it on an object and it does not compile due to the M1 being unable to fully utilise vertex shader objects with specific shaders. Metal will likely solve these issues.