Only advertise the SDL_PIXELFORMAT_EXTERNAL_OES format if we can build the shader for it

This commit is contained in:
Sam Lantinga 2022-09-16 06:15:45 -07:00
parent 6de15ffcd6
commit 5bc85d6788
2 changed files with 5 additions and 2 deletions

View File

@ -578,7 +578,7 @@ static int GLES2_CacheShaders(GLES2_RenderData * data)
data->texcoord_precision_hint = GLES2_GetTexCoordPrecisionEnumFromHint(); data->texcoord_precision_hint = GLES2_GetTexCoordPrecisionEnumFromHint();
for (shader = 0; shader < GLES2_SHADER_COUNT; ++shader) { for (shader = 0; shader < GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES; ++shader) {
GLenum shader_type; GLenum shader_type;
if (shader == GLES2_SHADER_VERTEX_DEFAULT) { if (shader == GLES2_SHADER_VERTEX_DEFAULT) {
@ -2209,7 +2209,9 @@ GLES2_CreateRenderer(SDL_Window *window, Uint32 flags)
renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV21; renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_NV21;
#endif #endif
#ifdef GL_TEXTURE_EXTERNAL_OES #ifdef GL_TEXTURE_EXTERNAL_OES
renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_EXTERNAL_OES; if (GLES2_CacheShader(data, GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES, GL_FRAGMENT_SHADER)) {
renderer->info.texture_formats[renderer->info.num_texture_formats++] = SDL_PIXELFORMAT_EXTERNAL_OES;
}
#endif #endif
/* Set up parameters for rendering */ /* Set up parameters for rendering */

View File

@ -56,6 +56,7 @@ typedef enum
GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT601, GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT601,
GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709, GLES2_SHADER_FRAGMENT_TEXTURE_NV21_BT709,
#endif #endif
/* Shaders beyond this point are optional and not cached at render creation */
GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES, GLES2_SHADER_FRAGMENT_TEXTURE_EXTERNAL_OES,
GLES2_SHADER_COUNT GLES2_SHADER_COUNT
} GLES2_ShaderType; } GLES2_ShaderType;