GLSL 330, GLES 310 (WebGL/macOS) - Sampling texture array inside loop causes undefined behaviour.
polymonster opened this issue · 1 comments
When sampling texture array, texture cube array or shadow array inside a loop OpenGL exhibits undefined behaviour, I have tried using textureGrad, textureLod and replacing sampleShadow with a simple compare and all of these end up eventually causing undefined behaviour...
macOS can compile and run the shadow_maps sample in pmtech but sometimes the lighting pass will result in no triangles being rasterised with no warnings or errors, compiling the program and running again can sometimes fix but it will eventually return to nothing being rendered... this sample was previously working on older machine (MacBook Pro 2017) my current machine (MacBook Pro 2019) has never ran the samples correctly when texture arrays are involved, I am not sure if it is todo with the GPU or macOS version.
I am not sure how to get around the issue, the same machine can do all of the desired behaviour using metal which indicates the GPU can support it.
For the time being GLSL shaders built from macOS will omit any texture array calls of all flavours and return 0 for colour reads and 1 for compares, this fixes the OpenGL samples for macOS.
This is fixed and was not to do with pmfx. the issue was with pmtech when usingg GLSL version 330 the texture arrays were not being bound to the correct uniform location.