diff options
author | Erik Faye-Lund <[email protected]> | 2018-11-16 10:49:55 +0100 |
---|---|---|
committer | Erik Faye-Lund <[email protected]> | 2018-12-03 18:16:44 +0100 |
commit | 74eab1c62fd37ca172b912f66add030043a59c92 (patch) | |
tree | b661c218b3c20e8a5f1632db0b21b5cac4f1f336 /src/mesa/main/glformats.c | |
parent | c4136ed5cc07a73c01d24a1c17ebe71e2690aef7 (diff) |
mesa/main: split float-texture support checking in two
On OpenGL ES 2.0, there's separate extensions adding support for
half-float and float textures. So we need to validate the enums
separately as well.
This also prevents these enums from incorrectly being allowed on
OpenGL ES 1.x, where there's no extension that enables this in the
first place.
While we're at it, remove the pointless default-case, and the seemingly
stale fallthrough comment.
Signed-off-by: Erik Faye-Lund <[email protected]>
Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src/mesa/main/glformats.c')
-rw-r--r-- | src/mesa/main/glformats.c | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c index 4753465e50c..7506c238232 100644 --- a/src/mesa/main/glformats.c +++ b/src/mesa/main/glformats.c @@ -2386,28 +2386,37 @@ _mesa_base_tex_format(const struct gl_context *ctx, GLint internalFormat) return GL_YCBCR_MESA; } - if (ctx->Extensions.ARB_texture_float) { + if (_mesa_has_half_float_textures(ctx)) { switch (internalFormat) { case GL_ALPHA16F_ARB: - case GL_ALPHA32F_ARB: return GL_ALPHA; case GL_RGBA16F_ARB: - case GL_RGBA32F_ARB: return GL_RGBA; case GL_RGB16F_ARB: - case GL_RGB32F_ARB: return GL_RGB; case GL_INTENSITY16F_ARB: - case GL_INTENSITY32F_ARB: return GL_INTENSITY; case GL_LUMINANCE16F_ARB: - case GL_LUMINANCE32F_ARB: return GL_LUMINANCE; case GL_LUMINANCE_ALPHA16F_ARB: + return GL_LUMINANCE_ALPHA; + } + } + + if (_mesa_has_float_textures(ctx)) { + switch (internalFormat) { + case GL_ALPHA32F_ARB: + return GL_ALPHA; + case GL_RGBA32F_ARB: + return GL_RGBA; + case GL_RGB32F_ARB: + return GL_RGB; + case GL_INTENSITY32F_ARB: + return GL_INTENSITY; + case GL_LUMINANCE32F_ARB: + return GL_LUMINANCE; case GL_LUMINANCE_ALPHA32F_ARB: return GL_LUMINANCE_ALPHA; - default: - ; /* fallthrough */ } } @@ -2546,9 +2555,12 @@ _mesa_base_tex_format(const struct gl_context *ctx, GLint internalFormat) if (_mesa_has_rg_textures(ctx)) { switch (internalFormat) { case GL_R16F: + if (!_mesa_has_half_float_textures(ctx)) + break; + return GL_RED; case GL_R32F: - if (!ctx->Extensions.ARB_texture_float) - break; + if (!_mesa_has_float_textures(ctx)) + break; return GL_RED; case GL_R8I: case GL_R8UI: @@ -2566,9 +2578,12 @@ _mesa_base_tex_format(const struct gl_context *ctx, GLint internalFormat) return GL_RED; case GL_RG16F: + if (!_mesa_has_half_float_textures(ctx)) + break; + return GL_RG; case GL_RG32F: - if (!ctx->Extensions.ARB_texture_float) - break; + if (!_mesa_has_float_textures(ctx)) + break; return GL_RG; case GL_RG8I: case GL_RG8UI: |