From 09574bee850edec46d967b7cdbc2073f92b8223d Mon Sep 17 00:00:00 2001 From: Brian Date: Mon, 30 Jul 2007 14:00:27 -0600 Subject: implement read_quad_f_swz() --- src/mesa/drivers/dri/i915tex/intel_surface.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/mesa/drivers/dri/i915tex') diff --git a/src/mesa/drivers/dri/i915tex/intel_surface.c b/src/mesa/drivers/dri/i915tex/intel_surface.c index 29b640e58e..3be902cf9c 100644 --- a/src/mesa/drivers/dri/i915tex/intel_surface.c +++ b/src/mesa/drivers/dri/i915tex/intel_surface.c @@ -23,17 +23,28 @@ * XXX a lof of this is a temporary kludge */ -extern void -intel_map_unmap_buffers(struct intel_context *intel, GLboolean map); - static void -read_quad_f_swz(struct softpipe_surface *gs, GLint x, GLint y, +read_quad_f_swz(struct softpipe_surface *sps, GLint x, GLint y, GLfloat (*rrrr)[QUAD_SIZE]) { + struct intel_surface *is = (struct intel_surface *) sps; + struct intel_renderbuffer *irb = is->rb; + const GLubyte *src = (const GLubyte *) irb->region->map + + (y * irb->region->pitch + x) * irb->region->cpp; + GLfloat *dst = (GLfloat *) rrrr; + GLubyte temp[16]; + GLuint i, j; + memcpy(temp, src, 8); + memcpy(temp + 8, src + irb->region->pitch * irb->region->cpp, 8); + for (i = 0; i < 4; i++) { + for (j = 0; j < 4; j++) { + dst[j * 4 + i] = UBYTE_TO_FLOAT(temp[i * 4 + j]); + } + } } @@ -55,8 +66,6 @@ write_quad_f_swz(struct softpipe_surface *sps, GLint x, GLint y, } } - printf("intel_surface::write_quad\n"); - memcpy(dst, temp, 8); memcpy(dst + irb->region->pitch * irb->region->cpp, temp + 8, 8); } -- cgit v1.2.3