Mesa (master): mesa: add EXT_color_buffer_half_float plumbing
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Sep 8 05:20:55 UTC 2020
Module: Mesa
Branch: master
Commit: 8447b0f6518aad56b802470dc61920fef3699852
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=8447b0f6518aad56b802470dc61920fef3699852
Author: Tapani Pälli <tapani.palli at intel.com>
Date: Tue Sep 1 14:20:27 2020 +0300
mesa: add EXT_color_buffer_half_float plumbing
Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6491>
---
src/mesa/main/extensions_table.h | 1 +
src/mesa/main/fbobject.c | 23 ++++++++++++++++++++---
src/mesa/main/mtypes.h | 1 +
3 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index 0e40ab462fa..c2541de3b1a 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -220,6 +220,7 @@ EXT(EXT_buffer_storage , ARB_buffer_storage
EXT(EXT_clip_control , ARB_clip_control , x , x , x , ES2, 2017)
EXT(EXT_clip_cull_distance , ARB_cull_distance , x , x , x , 30, 2016)
EXT(EXT_color_buffer_float , dummy_true , x , x , x , 30, 2013)
+EXT(EXT_color_buffer_half_float , EXT_color_buffer_half_float , x , x , x , 20, 2017)
EXT(EXT_compiled_vertex_array , dummy_true , GLL, x , x , x , 1996)
EXT(EXT_compressed_ETC1_RGB8_sub_texture , OES_compressed_ETC1_RGB8_texture , x , x , ES1, ES2, 2014)
EXT(EXT_copy_image , OES_copy_image , x , x , x , 30, 2014)
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index 23fca13d5cb..20d88e2ce15 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -794,14 +794,18 @@ is_format_color_renderable(const struct gl_context *ctx, mesa_format format,
return _mesa_has_EXT_texture_rg(ctx);
case GL_R16F:
case GL_RG16F:
- return _mesa_is_gles3(ctx);
+ return _mesa_is_gles3(ctx) ||
+ (_mesa_has_EXT_color_buffer_half_float(ctx) &&
+ _mesa_has_EXT_texture_rg(ctx));
case GL_RGBA16F:
case GL_RGBA32F:
return _mesa_has_EXT_color_buffer_float(ctx);
+ case GL_RGB16F:
+ return _mesa_has_EXT_color_buffer_half_float(ctx) &&
+ _mesa_has_OES_texture_half_float(ctx);
case GL_RGB32F:
case GL_RGB32I:
case GL_RGB32UI:
- case GL_RGB16F:
case GL_RGB16I:
case GL_RGB16UI:
case GL_RGB8_SNORM:
@@ -853,7 +857,7 @@ gles_check_float_renderable(const struct gl_context *ctx,
return false;
/* Unsized GL_HALF_FLOAT supported only with EXT_color_buffer_half_float. */
- if (att->Texture->_IsHalfFloat)
+ if (att->Texture->_IsHalfFloat && !_mesa_has_EXT_color_buffer_half_float(ctx))
return false;
const struct gl_texture_object *texObj = att->Texture;
@@ -1146,6 +1150,16 @@ _mesa_test_framebuffer_completeness(struct gl_context *ctx,
att = &fb->Attachment[BUFFER_COLOR0 + i];
test_attachment_completeness(ctx, GL_COLOR, att);
if (!att->Complete) {
+ /* With EXT_color_buffer_half_float, check if attachment was incomplete
+ * due to invalid format. This is special case for the extension where
+ * CTS tests expect unsupported framebuffer status instead of incomplete.
+ */
+ if ((_mesa_is_gles(ctx) && _mesa_has_EXT_color_buffer_half_float(ctx)) &&
+ !gles_check_float_renderable(ctx, att)) {
+ fb->_Status = GL_FRAMEBUFFER_UNSUPPORTED;
+ return;
+ }
+
fb->_Status = GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT;
fbo_incomplete(ctx, "color attachment incomplete", i);
return;
@@ -2280,6 +2294,9 @@ _mesa_base_fbo_format(const struct gl_context *ctx, GLenum internalFormat)
_mesa_is_gles3(ctx) /* EXT_color_buffer_float */ )
? GL_RG : 0;
case GL_RGB16F:
+ return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_float) ||
+ (_mesa_is_gles(ctx) && _mesa_has_EXT_color_buffer_half_float(ctx))
+ ? GL_RGB : 0;
case GL_RGB32F:
return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_float)
? GL_RGB : 0;
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index f9353d9ef95..5fb526f0579 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -4247,6 +4247,7 @@ struct gl_extensions
GLboolean ARB_conservative_depth;
GLboolean ARB_copy_image;
GLboolean ARB_cull_distance;
+ GLboolean EXT_color_buffer_half_float;
GLboolean ARB_depth_buffer_float;
GLboolean ARB_depth_clamp;
GLboolean ARB_depth_texture;
More information about the mesa-commit
mailing list