Mesa (master): softpipe: pass surface format to get/put_tile functions

Brian Paul brianp at kemper.freedesktop.org
Sun Jan 23 01:35:36 UTC 2011


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

Author: Brian Paul <brianp at vmware.com>
Date:   Sat Jan 22 17:18:53 2011 -0700

softpipe: pass surface format to get/put_tile functions

When we read/write image tiles we need to use the format specified
in the pipe_surface, not the pipe_transfer format (which comes from
the underlying texture/resource format).

This comes up when rendering to sRGB surfaces (via OpenGL render to
texture).  Ignoring the new GL_ARB/EXT_framebuffer_sRGB extension
for now, when we render to a sRGB surface we need to treat it like
a regular, linear colorspace RGB surface.  Before, when we read/wrote
tiles to sRGB surfaces we were inadvertantly doing the color space
conversion.

---

 src/gallium/drivers/softpipe/sp_tile_cache.c |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c
index 480860a..60870b8 100644
--- a/src/gallium/drivers/softpipe/sp_tile_cache.c
+++ b/src/gallium/drivers/softpipe/sp_tile_cache.c
@@ -357,11 +357,12 @@ sp_flush_tile(struct softpipe_tile_cache* tc, unsigned pos)
                            tc->entries[pos]->data.depth32, 0/*STRIDE*/);
       }
       else {
-         pipe_put_tile_rgba(tc->pipe, tc->transfer,
-                            tc->tile_addrs[pos].bits.x * TILE_SIZE,
-                            tc->tile_addrs[pos].bits.y * TILE_SIZE,
-                            TILE_SIZE, TILE_SIZE,
-                            (float *) tc->entries[pos]->data.color);
+         pipe_put_tile_rgba_format(tc->pipe, tc->transfer,
+                                   tc->tile_addrs[pos].bits.x * TILE_SIZE,
+                                   tc->tile_addrs[pos].bits.y * TILE_SIZE,
+                                   TILE_SIZE, TILE_SIZE,
+                                   tc->surface->format,
+                                   (float *) tc->entries[pos]->data.color);
       }
       tc->tile_addrs[pos].bits.invalid = 1;  /* mark as empty */
    }
@@ -468,11 +469,12 @@ sp_find_cached_tile(struct softpipe_tile_cache *tc,
                               tile->data.depth32, 0/*STRIDE*/);
          }
          else {
-            pipe_put_tile_rgba(tc->pipe, pt,
-                               tc->tile_addrs[pos].bits.x * TILE_SIZE,
-                               tc->tile_addrs[pos].bits.y * TILE_SIZE,
-                               TILE_SIZE, TILE_SIZE,
-                               (float *) tile->data.color);
+            pipe_put_tile_rgba_format(tc->pipe, pt,
+                                      tc->tile_addrs[pos].bits.x * TILE_SIZE,
+                                      tc->tile_addrs[pos].bits.y * TILE_SIZE,
+                                      TILE_SIZE, TILE_SIZE,
+                                      tc->surface->format,
+                                      (float *) tile->data.color);
          }
       }
 




More information about the mesa-commit mailing list