[Mesa-dev] [PATCH v2 15/18] extensions: enable EXT_color_buffer_float for ES2/ES3

Jordan Justen jordan.l.justen at intel.com
Sat Jan 12 20:11:05 PST 2013


Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
---
 src/mesa/main/extensions.c |    1 +
 src/mesa/main/fbobject.c   |   26 +++++++++++++++++---------
 src/mesa/main/readpix.c    |    2 ++
 3 files changed, 20 insertions(+), 9 deletions(-)

diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c
index c3c73fc..8461195 100644
--- a/src/mesa/main/extensions.c
+++ b/src/mesa/main/extensions.c
@@ -231,6 +231,7 @@ static const struct extension extension_table[] = {
    { "GL_EXT_unpack_subimage",                     o(dummy_true),                                         ES2, 2011 },
    { "GL_EXT_vertex_array_bgra",                   o(EXT_vertex_array_bgra),                   GL,             2008 },
    { "GL_EXT_vertex_array",                        o(dummy_true),                              GLL,            1995 },
+   { "GL_EXT_color_buffer_float",                  o(dummy_true),                              ES2,            2013 },
 
    /* OES extensions */
    { "GL_OES_blend_equation_separate",             o(EXT_blend_equation_separate),                  ES1,       2009 },
diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
index a219398..abb9f34 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -1217,21 +1217,27 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
              ctx->Extensions.ARB_framebuffer_object ? GL_ALPHA : 0;
    case GL_R16F:
    case GL_R32F:
-      return (_mesa_is_desktop_gl(ctx) &&
-             ctx->Extensions.ARB_texture_rg &&
-             ctx->Extensions.ARB_texture_float) ? GL_RED : 0;
+      return ((_mesa_is_desktop_gl(ctx) &&
+               ctx->Extensions.ARB_texture_rg &&
+               ctx->Extensions.ARB_texture_float) ||
+              (ctx->API == API_OPENGLES2) /* EXT_color_buffer_float */ )
+         ? GL_RED : 0;
    case GL_RG16F:
    case GL_RG32F:
-      return (_mesa_is_desktop_gl(ctx) &&
-             ctx->Extensions.ARB_texture_rg &&
-             ctx->Extensions.ARB_texture_float) ? GL_RG : 0;
+      return ((_mesa_is_desktop_gl(ctx) &&
+               ctx->Extensions.ARB_texture_rg &&
+               ctx->Extensions.ARB_texture_float) ||
+              (ctx->API == API_OPENGLES2) /* EXT_color_buffer_float */ )
+         ? GL_RG : 0;
    case GL_RGB16F:
    case GL_RGB32F:
       return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_float)
          ? GL_RGB : 0;
    case GL_RGBA16F:
    case GL_RGBA32F:
-      return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.ARB_texture_float)
+      return ((_mesa_is_desktop_gl(ctx) &&
+               ctx->Extensions.ARB_texture_float) ||
+              (ctx->API == API_OPENGLES2) /* EXT_color_buffer_float */ )
          ? GL_RGBA : 0;
    case GL_ALPHA16F_ARB:
    case GL_ALPHA32F_ARB:
@@ -1258,7 +1264,8 @@ _mesa_base_fbo_format(struct gl_context *ctx, GLenum internalFormat)
               && ctx->Extensions.EXT_texture_shared_exponent)
          ? GL_RGB : 0;
    case GL_R11F_G11F_B10F:
-      return (_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_packed_float)
+      return ((_mesa_is_desktop_gl(ctx) && ctx->Extensions.EXT_packed_float) ||
+              (ctx->API == API_OPENGLES2) /* EXT_color_buffer_float */ )
          ? GL_RGB : 0;
 
    case GL_RGBA8UI_EXT:
@@ -1423,7 +1430,8 @@ renderbuffer_storage(GLenum target, GLenum internalFormat,
 
    baseFormat = _mesa_base_fbo_format(ctx, internalFormat);
    if (baseFormat == 0) {
-      _mesa_error(ctx, GL_INVALID_ENUM, "%s(internalFormat)", func);
+      _mesa_error(ctx, GL_INVALID_ENUM, "%s(internalFormat=%s)",
+                  func, _mesa_lookup_enum_by_nr(internalFormat));
       return;
    }
 
diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c
index cb4d02d..994e589 100644
--- a/src/mesa/main/readpix.c
+++ b/src/mesa/main/readpix.c
@@ -694,6 +694,8 @@ read_pixels_es3_error_check(GLenum format, GLenum type,
 
    switch (format) {
    case GL_RGBA:
+      if (type == GL_FLOAT && data_type == GL_FLOAT)
+         return GL_NO_ERROR; /* EXT_color_buffer_float */
       if (type == GL_UNSIGNED_BYTE && data_type == GL_UNSIGNED_NORMALIZED)
          return GL_NO_ERROR;
       if (internalFormat == GL_RGB10_A2 &&
-- 
1.7.10.4



More information about the mesa-dev mailing list