diff options
author | Brian Paul <[email protected]> | 2008-12-19 16:56:56 -0700 |
---|---|---|
committer | Brian Paul <[email protected]> | 2008-12-19 16:56:56 -0700 |
commit | 58a82ee57f1e1e67387dd860ac253223db250789 (patch) | |
tree | 031ee528fc49bec03d767c8c697f40d15a9ed616 /src/mesa/drivers | |
parent | 9c8db8685432fedd068157795422764ce96b89a0 (diff) | |
parent | f83f5ec8f5f1159cfd0ec2596ceab725c073266e (diff) |
Merge commit 'origin/master' into gallium-0.2
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_vs_emit.c | 2 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_pixel_bitmap.c | 83 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_pixel_copy.c | 7 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_tex_copy.c | 109 |
4 files changed, 109 insertions, 92 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_vs_emit.c b/src/mesa/drivers/dri/i965/brw_vs_emit.c index 25b4ee85cb0..4a9541378f7 100644 --- a/src/mesa/drivers/dri/i965/brw_vs_emit.c +++ b/src/mesa/drivers/dri/i965/brw_vs_emit.c @@ -420,7 +420,7 @@ static void emit_exp_noalias( struct brw_vs_compile *c, BRW_MATH_FUNCTION_EXP, brw_writemask(dst, WRITEMASK_Z), brw_swizzle1(arg0, 0), - BRW_MATH_PRECISION_PARTIAL); + BRW_MATH_PRECISION_FULL); } if (dst.dw1.bits.writemask & WRITEMASK_W) { diff --git a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c index e3ce1494e5d..fb1a051cdc8 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_bitmap.c @@ -32,6 +32,7 @@ #include "main/mtypes.h" #include "main/macros.h" #include "main/bufferobj.h" +#include "main/state.h" #include "swrast/swrast.h" #include "intel_screen.h" @@ -149,8 +150,18 @@ static GLuint get_bitmap_rect(GLsizei width, GLsizei height, return count; } - - +/** + * Returns the low Y value of the vertical range given, flipped according to + * whether the framebuffer is or not. + */ +static inline int +y_flip(struct gl_framebuffer *fb, int y, int height) +{ + if (fb->Name != 0) + return y; + else + return fb->Height - y - height; +} /* * Render a bitmap. @@ -171,6 +182,11 @@ do_blit_bitmap( GLcontext *ctx, unsigned int num_cliprects; drm_clip_rect_t *cliprects; int x_off, y_off; + GLsizei bitmap_width = width; + GLsizei bitmap_height = height; + + /* Update draw buffer bounds */ + _mesa_update_state(ctx); if (!dst) return GL_FALSE; @@ -202,8 +218,6 @@ do_blit_bitmap( GLcontext *ctx, intel_get_cliprects(intel, &cliprects, &num_cliprects, &x_off, &y_off); if (num_cliprects != 0) { - drm_clip_rect_t dest_rect; - GLint srcx = 0, srcy = 0; GLuint i; GLint orig_dstx = dstx; GLint orig_dsty = dsty; @@ -214,45 +228,26 @@ do_blit_bitmap( GLcontext *ctx, &dstx, &dsty, &width, &height)) goto out; - /* Convert from GL to hardware coordinates. Transform original points - * along with it so that we can look at cliprects in hw coordinates and - * map back to points in the source space. - */ - if (fb->Name == 0) { - /* bitmap to a system framebuffer */ - dstx = x_off + dstx; - dsty = y_off + (fb->Height - dsty - height); - orig_dstx = x_off + orig_dstx; - orig_dsty = y_off + (fb->Height - orig_dsty - height); - } else { - /* bitmap to a user framebuffer object */ - dstx = x_off + dstx; - dsty = y_off + dsty; - orig_dstx = x_off + orig_dstx; - orig_dsty = y_off + orig_dsty; - } - - dest_rect.x1 = dstx; - dest_rect.y1 = dsty; - dest_rect.x2 = dstx + width; - dest_rect.y2 = dsty + height; + dstx = x_off + dstx; + dsty = y_off + y_flip(fb, dsty, height); for (i = 0; i < num_cliprects; i++) { - drm_clip_rect_t rect; - int box_w, box_h; + int box_x, box_y, box_w, box_h; GLint px, py; GLuint stipple[32]; - if (!intel_intersect_cliprects(&rect, &dest_rect, &cliprects[i])) - continue; + box_x = dstx; + box_y = dsty; + box_w = width; + box_h = height; - /* Now go back to GL coordinates to figure out what subset of - * the bitmap we are uploading for this cliprect: - */ - box_w = rect.x2 - rect.x1; - box_h = rect.y2 - rect.y1; - srcx = rect.x1 - orig_dstx; - srcy = rect.y1 - orig_dsty; + /* Clip to drawable cliprect */ + if (!_mesa_clip_to_region(cliprects[i].x1, + cliprects[i].y1, + cliprects[i].x2 - cliprects[i].x1, + cliprects[i].y2 - cliprects[i].y1, + &box_x, &box_y, &box_w, &box_h)) + continue; #define DY 32 #define DX 32 @@ -273,10 +268,16 @@ do_blit_bitmap( GLcontext *ctx, /* May need to adjust this when padding has been introduced in * sz above: + * + * Have to translate destination coordinates back into source + * coordinates. */ - if (get_bitmap_rect(width, height, unpack, + if (get_bitmap_rect(bitmap_width, bitmap_height, unpack, bitmap, - srcx + px, srcy + py, w, h, + -orig_dstx + (box_x + px - x_off), + -orig_dsty + y_flip(fb, + box_y + py - y_off, h), + w, h, (GLubyte *)stipple, 8, fb->Name == 0 ? GL_TRUE : GL_FALSE) == 0) @@ -293,8 +294,8 @@ do_blit_bitmap( GLcontext *ctx, dst->buffer, 0, dst->tiling, - rect.x1 + px, - rect.y2 - (py + h), + box_x + px, + box_y + py, w, h, logic_op); } diff --git a/src/mesa/drivers/dri/intel/intel_pixel_copy.c b/src/mesa/drivers/dri/intel/intel_pixel_copy.c index 61d1296c26c..447c6494e79 100644 --- a/src/mesa/drivers/dri/intel/intel_pixel_copy.c +++ b/src/mesa/drivers/dri/intel/intel_pixel_copy.c @@ -266,6 +266,9 @@ do_blit_copypixels(GLcontext * ctx, drm_clip_rect_t *cliprects; int x_off, y_off; + /* Update draw buffer bounds */ + _mesa_update_state(ctx); + /* Copypixels can be more than a straight copy. Ensure all the * extra operations are disabled: */ @@ -308,8 +311,8 @@ do_blit_copypixels(GLcontext * ctx, /* Clip to source buffer. */ orig_srcx = srcx; orig_srcy = srcy; - if (!_mesa_clip_to_region(read_fb->_Xmin, read_fb->_Ymin, - read_fb->_Xmax, read_fb->_Ymax, + if (!_mesa_clip_to_region(0, 0, + read_fb->Width, read_fb->Height, &srcx, &srcy, &width, &height)) goto out; /* Adjust dst coords for our post-clipped source origin */ diff --git a/src/mesa/drivers/dri/intel/intel_tex_copy.c b/src/mesa/drivers/dri/intel/intel_tex_copy.c index b893990d271..08437aa0e2b 100644 --- a/src/mesa/drivers/dri/intel/intel_tex_copy.c +++ b/src/mesa/drivers/dri/intel/intel_tex_copy.c @@ -112,56 +112,47 @@ do_copy_texsubimage(struct intel_context *intel, intelImage->level); const GLint orig_x = x; const GLint orig_y = y; - const struct gl_framebuffer *fb = ctx->DrawBuffer; - - if (_mesa_clip_to_region(fb->_Xmin, fb->_Ymin, fb->_Xmax, fb->_Ymax, - &x, &y, &width, &height)) { - GLshort src_pitch; - - /* Update dst for clipped src. Need to also clip the source rect. - */ - dstx += x - orig_x; - dsty += y - orig_y; - - /* image_offset may be non-page-aligned, but that's illegal for tiling. + GLshort src_pitch; + + /* Update dst for clipped src. Need to also clip the source rect. */ + dstx += x - orig_x; + dsty += y - orig_y; + + /* image_offset may be non-page-aligned, but that's illegal for tiling. */ + assert(intelImage->mt->region->tiling == I915_TILING_NONE); + + if (ctx->ReadBuffer->Name == 0) { + /* reading from a window, adjust x, y */ + __DRIdrawablePrivate *dPriv = intel->driDrawable; + y = dPriv->y + (dPriv->h - (y + height)); + x += dPriv->x; + + /* Invert the data coming from the source rectangle due to GL + * and hardware disagreeing on where y=0 is. + * + * It appears that our offsets and pitches get mangled + * appropriately by the hardware, and we don't need to adjust them + * on our own. */ - assert(intelImage->mt->region->tiling == I915_TILING_NONE); - - if (ctx->ReadBuffer->Name == 0) { - /* reading from a window, adjust x, y */ - __DRIdrawablePrivate *dPriv = intel->driDrawable; - y = dPriv->y + (dPriv->h - (y + height)); - x += dPriv->x; - - /* Invert the data coming from the source rectangle due to GL - * and hardware disagreeing on where y=0 is. - * - * It appears that our offsets and pitches get mangled - * appropriately by the hardware, and we don't need to adjust them - * on our own. - */ - src_pitch = -src->pitch; - } - else { - /* reading from a FBO, y is already oriented the way we like */ - src_pitch = src->pitch; - } - - intelEmitCopyBlit(intel, - intelImage->mt->cpp, - src_pitch, - src->buffer, - 0, - src->tiling, - intelImage->mt->pitch, - intelImage->mt->region->buffer, - image_offset, - intelImage->mt->region->tiling, - x, y, dstx, dsty, width, height, - GL_COPY); + src_pitch = -src->pitch; + } else { + /* reading from a FBO, y is already oriented the way we like */ + src_pitch = src->pitch; } - } + intelEmitCopyBlit(intel, + intelImage->mt->cpp, + src_pitch, + src->buffer, + 0, + src->tiling, + intelImage->mt->pitch, + intelImage->mt->region->buffer, + image_offset, + intelImage->mt->region->tiling, + x, y, dstx, dsty, width, height, + GL_COPY); + } UNLOCK_HARDWARE(intel); @@ -188,6 +179,7 @@ intelCopyTexImage1D(GLcontext * ctx, GLenum target, GLint level, _mesa_select_tex_object(ctx, texUnit, target); struct gl_texture_image *texImage = _mesa_select_tex_image(ctx, texObj, target, level); + int srcx, srcy, dstx, dsty, height; if (border) goto fail; @@ -199,10 +191,20 @@ intelCopyTexImage1D(GLcontext * ctx, GLenum target, GLint level, width, border, GL_RGBA, CHAN_TYPE, NULL, &ctx->DefaultPacking, texObj, texImage); + srcx = x; + srcy = y; + dstx = 0; + dsty = 0; + height = 1; + if (!_mesa_clip_copytexsubimage(ctx, + &dstx, &dsty, + &srcx, &srcy, + &width, &height)) + return; if (!do_copy_texsubimage(intel_context(ctx), target, intel_texture_image(texImage), - internalFormat, 0, 0, x, y, width, 1)) + internalFormat, 0, 0, x, y, width, height)) goto fail; return; @@ -224,10 +226,21 @@ intelCopyTexImage2D(GLcontext * ctx, GLenum target, GLint level, _mesa_select_tex_object(ctx, texUnit, target); struct gl_texture_image *texImage = _mesa_select_tex_image(ctx, texObj, target, level); + int srcx, srcy, dstx, dsty; if (border) goto fail; + srcx = x; + srcy = y; + dstx = 0; + dsty = 0; + if (!_mesa_clip_copytexsubimage(ctx, + &dstx, &dsty, + &srcx, &srcy, + &width, &height)) + return; + /* Setup or redefine the texture object, mipmap tree and texture * image. Don't populate yet. */ |