[Mesa-dev] [PATCH 3/4] i965/tex_image: Pull the tex format from the renderbuffer in intelSetTexBuffer2

Jason Ekstrand jason at jlekstrand.net
Wed Nov 8 23:20:46 UTC 2017


Cc: "17.3" <mesa-stable at lists.freedesktop.org>
---
 src/mesa/drivers/dri/i965/intel_tex_image.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_tex_image.c b/src/mesa/drivers/dri/i965/intel_tex_image.c
index c52992a..28800f6 100644
--- a/src/mesa/drivers/dri/i965/intel_tex_image.c
+++ b/src/mesa/drivers/dri/i965/intel_tex_image.c
@@ -462,20 +462,23 @@ intelSetTexBuffer2(__DRIcontext *pDRICtx, GLint target,
       return;
 
    if (rb->mt->cpp == 4) {
-      if (texture_format == __DRI_TEXTURE_FORMAT_RGB) {
+      if (texture_format == __DRI_TEXTURE_FORMAT_RGB)
          internal_format = GL_RGB;
-         texFormat = MESA_FORMAT_B8G8R8A8_UNORM;
-      }
-      else {
+      else
          internal_format = GL_RGBA;
-         texFormat = MESA_FORMAT_B8G8R8A8_UNORM;
-      }
    } else if (rb->mt->cpp == 2) {
       /* This is 565 */
       internal_format = GL_RGB;
-      texFormat = MESA_FORMAT_B5G6R5_UNORM;
    }
 
+   /* The interactions between GLX_EXT_texture_from_pixmap and sRGB are not
+    * defined at all.  However, since X has classically assumed that your data
+    * is just bits and sRGB rendering was added on, the assumption is that the
+    * the result of glXBindTexImageEXT will be a texture with a linear format
+    * even if it was rendered with sRGB encoding enabled.
+    */
+   texFormat = _mesa_get_srgb_format_linear(intel_rb_format(rb));
+
    intel_miptree_make_shareable(brw, rb->mt);
 
    _mesa_lock_texture(&brw->ctx, texObj);
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list