Mesa (master): meta: Use float for temporary images, not (un) signed normalized.

Kenneth Graunke kwg at kemper.freedesktop.org
Thu Sep 27 22:39:26 UTC 2012


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

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Sat Sep 15 23:18:36 2012 -0700

meta: Use float for temporary images, not (un)signed normalized.

In commit 091eb15b694, Jordan changed get_temp_image_type() to use
_mesa_get_format_datatype() instead of returning GL_FLOAT.  That has
several possible return values: GL_FLOAT, GL_INT, GL_UNSIGNED_INT,
GL_SIGNED_NORMALIZED, and GL_UNSIGNED_NORMALIZED.

We do want to use GL_INT/GL_UNSIGNED_INT for integer formats.  However,
we want to continue using GL_FLOAT for the normalized fixed-point types.
There isn't any code in pack.c to handle GL_(UN)SIGNED_NORMALIZED.

Fixes oglconform's fboarb advanced.blit.copypix, which was regressed by
commit 091eb15b694a396f8453093575ccec2db7f14eb8.

NOTE: This is a candidate for the 9.0 branch.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=53573
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>

---

 src/mesa/drivers/common/meta.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index 6689337..d0bb5e0 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -3489,12 +3489,16 @@ get_temp_image_type(struct gl_context *ctx, gl_format format)
    case GL_LUMINANCE:
    case GL_LUMINANCE_ALPHA:
    case GL_INTENSITY:
-      if (ctx->DrawBuffer->Visual.redBits <= 8)
+      if (ctx->DrawBuffer->Visual.redBits <= 8) {
          return GL_UNSIGNED_BYTE;
-      else if (ctx->DrawBuffer->Visual.redBits <= 16)
+      } else if (ctx->DrawBuffer->Visual.redBits <= 16) {
          return GL_UNSIGNED_SHORT;
-      else
-         return _mesa_get_format_datatype(format);
+      } else {
+         GLenum datatype = _mesa_get_format_datatype(format);
+         if (datatype == GL_INT || datatype == GL_UNSIGNED_INT)
+            return datatype;
+         return GL_FLOAT;
+      }
    case GL_DEPTH_COMPONENT:
       return GL_UNSIGNED_INT;
    case GL_DEPTH_STENCIL:




More information about the mesa-commit mailing list