From 2f53713beb9aa425d8248bae6a3c388a7de189de Mon Sep 17 00:00:00 2001 From: Keith Whitwell Date: Wed, 19 Dec 2007 11:35:21 +0000 Subject: [PATCH] 965: fix off-by-one in surface dimensions --- .../pipe/i965simple/brw_wm_surface_state.c | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/mesa/pipe/i965simple/brw_wm_surface_state.c b/src/mesa/pipe/i965simple/brw_wm_surface_state.c index 0f851dd1ed4..1eb11cbb914 100644 --- a/src/mesa/pipe/i965simple/brw_wm_surface_state.c +++ b/src/mesa/pipe/i965simple/brw_wm_surface_state.c @@ -155,13 +155,13 @@ void brw_update_texture_surface( struct brw_context *brw, surf.ss1.base_addr = brw_buffer_offset( brw, tObj->buffer ); surf.ss2.mip_count = tObj->base.last_level - tObj->base.first_level; - surf.ss2.width = tObj->base.width[0]; - surf.ss2.height = tObj->base.height[0]; + surf.ss2.width = tObj->base.width[0] - 1; + surf.ss2.height = tObj->base.height[0] - 1; surf.ss3.tile_walk = BRW_TILEWALK_XMAJOR; surf.ss3.tiled_surface = 0; /* always zero */ - surf.ss3.pitch = tObj->pitch; - surf.ss3.depth = tObj->base.depth[0]; + surf.ss3.pitch = tObj->pitch - 1; + surf.ss3.depth = tObj->base.depth[0] - 1; surf.ss4.min_lod = 0; @@ -192,25 +192,25 @@ static void upload_wm_surfaces(struct brw_context *brw ) /* BRW_NEW_FRAMEBUFFER */ - struct pipe_surface *region = brw->attribs.FrameBuffer.cbufs[0];/*fixme*/ + struct pipe_surface *pipe_surface = brw->attribs.FrameBuffer.cbufs[0];/*fixme*/ memset(&surf, 0, sizeof(surf)); - if (region != NULL) { - if (region->cpp == 4) + if (pipe_surface != NULL) { + if (pipe_surface->cpp == 4) surf.ss0.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM; else surf.ss0.surface_format = BRW_SURFACEFORMAT_B5G6R5_UNORM; surf.ss0.surface_type = BRW_SURFACE_2D; - surf.ss1.base_addr = brw_buffer_offset( brw, region->buffer ); + surf.ss1.base_addr = brw_buffer_offset( brw, pipe_surface->buffer ); - surf.ss2.width = region->width; - surf.ss2.height = region->height; + surf.ss2.width = pipe_surface->width - 1; + surf.ss2.height = pipe_surface->height - 1; surf.ss3.tile_walk = BRW_TILEWALK_XMAJOR; surf.ss3.tiled_surface = 0; - surf.ss3.pitch = region->pitch; + surf.ss3.pitch = pipe_surface->pitch - 1; } else { surf.ss0.surface_format = BRW_SURFACEFORMAT_B8G8R8A8_UNORM; surf.ss0.surface_type = BRW_SURFACE_NULL; -- 2.30.2