Fixed OpenGLES shaders failing after renderer has been created

Cache all the shaders up front, so we can verify that they won't silently fail at runtime.

If compiling the fragment shaders with the precision hint fails, try again without specifying precision.

Fixes https://github.com/libsdl-org/SDL/issues/6166
Fixes https://github.com/libsdl-org/SDL/issues/6174
This commit is contained in:
Sam Lantinga
2022-09-14 08:03:46 -07:00
parent 228b9fb517
commit b5102a551b
3 changed files with 79 additions and 54 deletions

View File

@@ -28,7 +28,6 @@
typedef enum
{
GLES2_SHADER_FRAGMENT_INCLUDE_NONE = 0,
GLES2_SHADER_FRAGMENT_INCLUDE_DEFAULT,
GLES2_SHADER_FRAGMENT_INCLUDE_BEST_TEXCOORD_PRECISION,
GLES2_SHADER_FRAGMENT_INCLUDE_MEDIUM_TEXCOORD_PRECISION,
GLES2_SHADER_FRAGMENT_INCLUDE_HIGH_TEXCOORD_PRECISION,
@@ -61,8 +60,8 @@ typedef enum
GLES2_SHADER_COUNT
} GLES2_ShaderType;
const Uint8 *GLES2_GetShader(GLES2_ShaderType type);
const Uint8 *GLES2_GetShaderInclude(GLES2_ShaderIncludeType type);
const char *GLES2_GetShader(GLES2_ShaderType type);
const char *GLES2_GetShaderInclude(GLES2_ShaderIncludeType type);
GLES2_ShaderIncludeType GLES2_GetTexCoordPrecisionEnumFromHint(void);
#endif /* SDL_VIDEO_RENDER_OGL_ES2 */