Skip to content

Commit

Permalink
gl: use red for single channel textures instead of alpha on GLES3
Browse files Browse the repository at this point in the history
Only GLES2 needs to use the alpha channel. glTexStorage2D only supports
red.
Issue #1391
  • Loading branch information
flyinghead committed Feb 9, 2024
1 parent c146a92 commit 3469b7f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/rend/gles/gles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const char* ShaderCompatSource = R"(
#if TARGET_GL == GLES3
out highp vec4 FragColor;
#define gl_FragColor FragColor
#define FOG_CHANNEL a
#define FOG_CHANNEL r
#elif TARGET_GL == GL3
out highp vec4 FragColor;
#define gl_FragColor FragColor
Expand Down Expand Up @@ -554,6 +554,7 @@ void findGLVersion()
gl.border_clamp_supported = true;
gl.prim_restart_supported = false;
gl.prim_restart_fixed_supported = true;
gl.single_channel_format = GL_RED;
}
else
{
Expand All @@ -562,8 +563,8 @@ void findGLVersion()
gl.index_type = GL_UNSIGNED_SHORT;
gl.prim_restart_supported = false;
gl.prim_restart_fixed_supported = false;
gl.single_channel_format = GL_ALPHA;
}
gl.single_channel_format = GL_ALPHA;
const char *extensions = (const char *)glGetString(GL_EXTENSIONS);
if (strstr(extensions, "GL_OES_packed_depth_stencil") != NULL)
gl.GL_OES_packed_depth_stencil_supported = true;
Expand Down

0 comments on commit 3469b7f

Please sign in to comment.