- Home /
conditional vertex texture fetch / texture lookups in vertex shader
hello.
so I just found out that our old android friend Samsung S3 has a problem with vertex texture fetch. the unity error i got via logcat:
03-03 14:29:02.083: E/Unity(6662): (Filename: Runtime/GfxDevice/opengles/GlslGpuProgramGLES.cpp Line: 413)
03-03 14:29:02.083: E/Unity(6662): GLES20: vprog textures are used, but not supported.
as far as i understand - although support is required by GLES2.0, they bypass it by returning zero for GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS [1].
the tex2Dlod() call in our surface shader is already wrapped in
#if !defined(SHADER_API_OPENGL)
...
#endif
and has the necessary #pragma target 3.0 defined. and it works on devices that support it.
my question is what would be the best way to disable that for problematic devices only (like the S3)? there are no device group keywords for shader preprocessor tokens and i don't wanna swap material on load just for one device. so maybe via a custom Shader.EnableKeyword? but then how would i access the value of GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS to determine this case?
cheers, d
[1]: https://www.khronos.org/message_boards/showthread.php/7847-It-looks-like-modern-Galaxy-S2-does-not-support-opengl-es-2 (Galaxy 2, but i guess it is the same)
I have the same problem, and I set a fallback shader that work on S3. It works, but unfortunately we still receive error reports from all these devices.
yes, our fallback shader also works. seems like not the show stopper i suspected it to be.
Your answer
![](https://koobas.hobune.stream/wayback/20220613184949im_/https://answers.unity.com/themes/thub/images/avi.jpg)