Mesa (master): mesa: Fix render buffer initial internal format in GLES 3

Chad Versace chadversary at kemper.freedesktop.org
Thu Jan 15 21:37:26 UTC 2015


Module: Mesa
Branch: master
Commit: e407fb1af4c0ca20fd839e8c3cb63cf82789b8ca
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=e407fb1af4c0ca20fd839e8c3cb63cf82789b8ca

Author: Mike Mason <michael.w.mason at intel.com>
Date:   Wed Jan 14 12:12:27 2015 -0800

mesa: Fix render buffer initial internal format in GLES 3

Changes the initial internal format of a render buffer
to GL_RGBA4 in GLES 3. This fixes a failure in the following
DrawElements test:

  dEQP-GLES3.functional.state_query.rbo.renderbuffer_internal_format

Reviewed-by: Chad Versace <chad.versace at intel.com>

---

 src/mesa/main/renderbuffer.c |   19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c
index 0bc7f2b..cc97ab2 100644
--- a/src/mesa/main/renderbuffer.c
+++ b/src/mesa/main/renderbuffer.c
@@ -53,7 +53,24 @@ _mesa_init_renderbuffer(struct gl_renderbuffer *rb, GLuint name)
    rb->Width = 0;
    rb->Height = 0;
    rb->Depth = 0;
-   rb->InternalFormat = GL_RGBA;
+
+   /* In GL 3, the initial format is GL_RGBA according to Table 6.26
+    * on page 302 of the GL 3.3 spec.
+    *
+    * In GLES 3, the initial format is GL_RGBA4 according to Table 6.15
+    * on page 258 of the GLES 3.0.4 spec.
+    *
+    * If the context is current, set the initial format based on the
+    * specs. If the context is not current, we cannot determine the
+    * API, so default to GL_RGBA.
+    */
+   GET_CURRENT_CONTEXT(ctx);
+   if (ctx && _mesa_is_gles3(ctx)) {
+      rb->InternalFormat = GL_RGBA4;
+   } else {
+      rb->InternalFormat = GL_RGBA;
+   }
+
    rb->Format = MESA_FORMAT_NONE;
 }
 




More information about the mesa-commit mailing list