summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/glformats.c
diff options
context:
space:
mode:
authorGert Wollny <[email protected]>2018-11-01 12:59:24 +0100
committerGert Wollny <[email protected]>2018-11-02 11:52:44 +0100
commitb8e9c6522d8d1bc78be2bf1b411b22cc6615dbdf (patch)
treeb4e887c644c7c7a69a2759ff6d376b756683328d /src/mesa/main/glformats.c
parent742dace8251b764775ee049cf529715f90afecc1 (diff)
mesa/core: Add definitions and translations for EXT_texture_sRGB_R8
v2: - fix format definition line - disable for desktop GL - don't add GL_R8_EXT to glext.h since it is already in GLES2/gl2ext.h in glext.h and include this header where needed (all Emil) v3: - swrast: Fill the function table for sRGB_R8 The size of the function table is checked at compile time and must correspond to the number of mesa texture formats. dri/swrast being gles-2.0 doesn't support the extension though v4: - correct format layout comment (Ilia Mirkin) - correct logic for accepting GL_RED only textures (in part Ilia Mirkin) EXT_texture_sRGB_R8 requires OpenGL ES 3.0 which includes ARB_texture_rg/EXT_texture_rg, so one only must check for the first when SR8_EXT is really requested. v5: - add define for GL_ES8_XT to glheader.h and don't include GLES headers (Ilia Mirkin) Signed-off-by: Gert Wollny <[email protected]> Reviewed-by: Ilia Mirkin <[email protected]>
Diffstat (limited to 'src/mesa/main/glformats.c')
-rw-r--r--src/mesa/main/glformats.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/mesa/main/glformats.c b/src/mesa/main/glformats.c
index f8fc36e9311..6cdc7818756 100644
--- a/src/mesa/main/glformats.c
+++ b/src/mesa/main/glformats.c
@@ -2486,6 +2486,15 @@ _mesa_base_tex_format(const struct gl_context *ctx, GLint internalFormat)
}
}
+ if (ctx->Extensions.EXT_texture_sRGB_R8) {
+ switch (internalFormat) {
+ case GL_SR8_EXT:
+ return GL_RED;
+ default:
+ ; /* fallthrough */
+ }
+ }
+
if (ctx->Version >= 30 ||
ctx->Extensions.EXT_texture_integer) {
switch (internalFormat) {
@@ -3215,9 +3224,11 @@ _mesa_es3_error_check_format_and_type(const struct gl_context *ctx,
return GL_INVALID_OPERATION;
switch (type) {
case GL_UNSIGNED_BYTE:
- if (internalFormat != GL_R8)
- return GL_INVALID_OPERATION;
- break;
+ if (internalFormat == GL_R8 ||
+ ((internalFormat == GL_SR8_EXT) &&
+ ctx->Extensions.EXT_texture_sRGB_R8))
+ break;
+ return GL_INVALID_OPERATION;
case GL_BYTE:
if (internalFormat != GL_R8_SNORM)