diff options
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r-- | src/mesa/pipe/i915simple/i915_surface.c | 103 | ||||
-rw-r--r-- | src/mesa/pipe/i965simple/brw_surface.c | 73 |
2 files changed, 5 insertions, 171 deletions
diff --git a/src/mesa/pipe/i915simple/i915_surface.c b/src/mesa/pipe/i915simple/i915_surface.c index b61ad17561c..d4c02c53595 100644 --- a/src/mesa/pipe/i915simple/i915_surface.c +++ b/src/mesa/pipe/i915simple/i915_surface.c @@ -50,103 +50,6 @@ } while(0) -/** - * Note: this is exactly like a8r8g8b8_get_tile() in sp_surface.c - * Share it someday. - */ -/** XXX this will go away eventually */ -static void -i915_get_tile_rgba(struct pipe_context *pipe, - struct pipe_surface *ps, - uint x, uint y, uint w, uint h, float *p) -{ - const unsigned *src - = ((const unsigned *) (ps->map)) - + y * ps->pitch + x; - unsigned i, j; - unsigned w0 = w; - - CLIP_TILE; - - switch (ps->format) { - case PIPE_FORMAT_A8R8G8B8_UNORM: - for (i = 0; i < h; i++) { - float *pRow = p; - for (j = 0; j < w; j++) { - const unsigned pixel = src[j]; - pRow[0] = UBYTE_TO_FLOAT((pixel >> 16) & 0xff); - pRow[1] = UBYTE_TO_FLOAT((pixel >> 8) & 0xff); - pRow[2] = UBYTE_TO_FLOAT((pixel >> 0) & 0xff); - pRow[3] = UBYTE_TO_FLOAT((pixel >> 24) & 0xff); - pRow += 4; - } - src += ps->pitch; - p += w0 * 4; - } - break; - case PIPE_FORMAT_S8Z24_UNORM: - { - const float scale = 1.0f / (float) 0xffffff; - for (i = 0; i < h; i++) { - float *pRow = p; - for (j = 0; j < w; j++) { - const unsigned pixel = src[j]; - pRow[0] = - pRow[1] = - pRow[2] = - pRow[3] = (pixel & 0xffffff) * scale; - pRow += 4; - } - src += ps->pitch; - p += w0 * 4; - } - } - break; - default: - assert(0); - } -} - - -/** XXX this will go away eventually */ -static void -i915_put_tile_rgba(struct pipe_context *pipe, - struct pipe_surface *ps, - uint x, uint y, uint w, uint h, const float *p) -{ - unsigned *dst - = ((unsigned *) (ps->map)) - + y * ps->pitch + x; - unsigned i, j; - unsigned w0 = w; - - assert(ps->format == PIPE_FORMAT_A8R8G8B8_UNORM); - - CLIP_TILE; - - switch (ps->format) { - case PIPE_FORMAT_A8R8G8B8_UNORM: - for (i = 0; i < h; i++) { - const float *pRow = p; - for (j = 0; j < w; j++) { - unsigned r, g, b, a; - UNCLAMPED_FLOAT_TO_UBYTE(r, pRow[0]); - UNCLAMPED_FLOAT_TO_UBYTE(g, pRow[1]); - UNCLAMPED_FLOAT_TO_UBYTE(b, pRow[2]); - UNCLAMPED_FLOAT_TO_UBYTE(a, pRow[3]); - dst[j] = (a << 24) | (r << 16) | (g << 8) | b; - pRow += 4; - } - dst += ps->pitch; - p += w0 * 4; - } - break; - default: - assert(0); - } -} - - /* * XXX note: same as code in sp_surface.c */ @@ -422,13 +325,9 @@ i915_init_surface_functions(struct i915_context *i915) i915->pipe.get_tex_surface = i915_get_tex_surface; i915->pipe.get_tile = i915_get_tile; i915->pipe.put_tile = i915_put_tile; -#if 0 - i915->pipe.get_tile_rgba = i915_get_tile_rgba; - i915->pipe.put_tile_rgba = i915_put_tile_rgba; -#else i915->pipe.get_tile_rgba = softpipe_get_tile_rgba; i915->pipe.put_tile_rgba = softpipe_put_tile_rgba; -#endif + i915->pipe.surface_data = i915_surface_data; i915->pipe.surface_copy = i915_surface_copy; i915->pipe.surface_fill = i915_surface_fill; diff --git a/src/mesa/pipe/i965simple/brw_surface.c b/src/mesa/pipe/i965simple/brw_surface.c index b5a03180474..b0d2fec8e0a 100644 --- a/src/mesa/pipe/i965simple/brw_surface.c +++ b/src/mesa/pipe/i965simple/brw_surface.c @@ -33,6 +33,8 @@ #include "pipe/p_inlines.h" #include "pipe/p_winsys.h" +#include "pipe/softpipe/sp_rgba_tile.h" /* XXX TEMPORARY */ + #define CLIP_TILE \ do { \ @@ -47,73 +49,6 @@ } while(0) -/** - * Note: this is exactly like a8r8g8b8_get_tile() in sp_surface.c - * Share it someday. - */ -static void -brw_get_tile_rgba(struct pipe_context *pipe, - struct pipe_surface *ps, - uint x, uint y, uint w, uint h, float *p) -{ - const unsigned *src - = ((const unsigned *) (ps->map + ps->offset)) - + y * ps->pitch + x; - unsigned i, j; - unsigned w0 = w; - - CLIP_TILE; - - switch (ps->format) { - case PIPE_FORMAT_A8R8G8B8_UNORM: - for (i = 0; i < h; i++) { - float *pRow = p; - for (j = 0; j < w; j++) { - const unsigned pixel = src[j]; - pRow[0] = UBYTE_TO_FLOAT((pixel >> 16) & 0xff); - pRow[1] = UBYTE_TO_FLOAT((pixel >> 8) & 0xff); - pRow[2] = UBYTE_TO_FLOAT((pixel >> 0) & 0xff); - pRow[3] = UBYTE_TO_FLOAT((pixel >> 24) & 0xff); - pRow += 4; - } - src += ps->pitch; - p += w0 * 4; - } - break; - case PIPE_FORMAT_S8Z24_UNORM: - { - const float scale = 1.0f / (float) 0xffffff; - for (i = 0; i < h; i++) { - float *pRow = p; - for (j = 0; j < w; j++) { - const unsigned pixel = src[j]; - pRow[0] = - pRow[1] = - pRow[2] = - pRow[3] = (pixel & 0xffffff) * scale; - pRow += 4; - } - src += ps->pitch; - p += w0 * 4; - } - } - break; - default: - assert(0); - } -} - - -static void -brw_put_tile_rgba(struct pipe_context *pipe, - struct pipe_surface *ps, - uint x, uint y, uint w, uint h, const float *p) -{ - /* TODO */ - assert(0); -} - - /* * XXX note: same as code in sp_surface.c */ @@ -388,8 +323,8 @@ brw_init_surface_functions(struct brw_context *brw) brw->pipe.get_tex_surface = brw_get_tex_surface; brw->pipe.get_tile = brw_get_tile; brw->pipe.put_tile = brw_put_tile; - brw->pipe.get_tile_rgba = brw_get_tile_rgba; - brw->pipe.put_tile_rgba = brw_put_tile_rgba; + brw->pipe.get_tile_rgba = softpipe_get_tile_rgba; + brw->pipe.put_tile_rgba = softpipe_put_tile_rgba; brw->pipe.surface_data = brw_surface_data; brw->pipe.surface_copy = brw_surface_copy; |