From 271f9dac79a9247de9a57f4d248e404bf1652a13 Mon Sep 17 00:00:00 2001 From: José Fonseca Date: Thu, 17 Jan 2008 13:39:14 +0900 Subject: Back-port miscellaneous fixes from internal branch (mostly portability fixes). These are changes that are in our internal branch, but somehow were skipped so far. It was done using visual comparison of the branches -- it is likely that changes are being carried on the wrong way --- src/mesa/pipe/softpipe/sp_prim_setup.c | 2 +- src/mesa/pipe/softpipe/sp_quad_fs.c | 2 +- src/mesa/pipe/softpipe/sp_quad_stipple.c | 2 ++ src/mesa/pipe/softpipe/sp_surface.c | 1 + src/mesa/pipe/softpipe/sp_texture.c | 2 +- src/mesa/pipe/softpipe/sp_tile_cache.c | 10 +++++----- 6 files changed, 11 insertions(+), 8 deletions(-) (limited to 'src/mesa/pipe/softpipe') diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.c b/src/mesa/pipe/softpipe/sp_prim_setup.c index 7847027caed..89f8df945cc 100644 --- a/src/mesa/pipe/softpipe/sp_prim_setup.c +++ b/src/mesa/pipe/softpipe/sp_prim_setup.c @@ -488,7 +488,7 @@ setup_fragcoord_coeff(struct setup_stage *setup) if (setup->softpipe->rasterizer->origin_lower_left) { /* y=0=bottom */ const int winHeight = setup->softpipe->framebuffer.cbufs[0]->height; - setup->coef[0].a0[1] = winHeight - 1; + setup->coef[0].a0[1] = (float) (winHeight - 1); setup->coef[0].dady[1] = -1.0; } else { diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c index 921dfbaccb4..0001c76a805 100644 --- a/src/mesa/pipe/softpipe/sp_quad_fs.c +++ b/src/mesa/pipe/softpipe/sp_quad_fs.c @@ -133,7 +133,7 @@ shade_quad( machine->InterpCoefs = quad->coef; /* Compute X, Y, Z, W vals for this quad */ - setup_pos_vector(quad->posCoef, quad->x0, quad->y0, &machine->QuadPos); + setup_pos_vector(quad->posCoef, (float) quad->x0, (float) quad->y0, &machine->QuadPos); /* run shader */ #if defined(__i386__) || defined(__386__) diff --git a/src/mesa/pipe/softpipe/sp_quad_stipple.c b/src/mesa/pipe/softpipe/sp_quad_stipple.c index 0c42963dfe3..8660432259c 100644 --- a/src/mesa/pipe/softpipe/sp_quad_stipple.c +++ b/src/mesa/pipe/softpipe/sp_quad_stipple.c @@ -36,6 +36,7 @@ stipple_quad(struct quad_stage *qs, struct quad_header *quad) stipple1 = softpipe->poly_stipple.stipple[y1 % 32]; #if 1 + { const int col0 = quad->x0 % 32; if ((stipple0 & (bit31 >> col0)) == 0) quad->mask &= ~MASK_TOP_LEFT; @@ -48,6 +49,7 @@ stipple_quad(struct quad_stage *qs, struct quad_header *quad) if ((stipple1 & (bit30 >> col0)) == 0) quad->mask &= ~MASK_BOTTOM_RIGHT; + } #else /* We'd like to use this code, but we'd need to redefine * MASK_TOP_LEFT to be (1 << 1) and MASK_TOP_RIGHT to be (1 << 0), diff --git a/src/mesa/pipe/softpipe/sp_surface.c b/src/mesa/pipe/softpipe/sp_surface.c index 6c080d5b5c8..a580fb3e820 100644 --- a/src/mesa/pipe/softpipe/sp_surface.c +++ b/src/mesa/pipe/softpipe/sp_surface.c @@ -50,6 +50,7 @@ softpipe_get_tex_surface(struct pipe_context *pipe, ps = pipe->winsys->surface_alloc(pipe->winsys); if (ps) { assert(ps->refcount); + assert(ps->winsys); pipe->winsys->buffer_reference(pipe->winsys, &ps->buffer, spt->buffer); ps->format = pt->format; ps->cpp = pt->cpp; diff --git a/src/mesa/pipe/softpipe/sp_texture.c b/src/mesa/pipe/softpipe/sp_texture.c index e5e6bfe01b8..532bcfcc51d 100644 --- a/src/mesa/pipe/softpipe/sp_texture.c +++ b/src/mesa/pipe/softpipe/sp_texture.c @@ -126,7 +126,7 @@ softpipe_texture_release(struct pipe_context *pipe, struct pipe_texture **pt) pipe->winsys->buffer_reference(pipe->winsys, &spt->buffer, NULL); - free(spt); + FREE(spt); } *pt = NULL; } diff --git a/src/mesa/pipe/softpipe/sp_tile_cache.c b/src/mesa/pipe/softpipe/sp_tile_cache.c index 6515ce668c8..1974f774591 100644 --- a/src/mesa/pipe/softpipe/sp_tile_cache.c +++ b/src/mesa/pipe/softpipe/sp_tile_cache.c @@ -286,7 +286,7 @@ clear_tile(struct softpipe_cached_tile *tile, else { for (i = 0; i < TILE_SIZE; i++) { for (j = 0; j < TILE_SIZE; j++) { - tile->data.depth16[i][j] = clear_value; + tile->data.depth16[i][j] = (ushort) clear_value; } } } @@ -564,10 +564,10 @@ sp_tile_cache_clear(struct softpipe_tile_cache *tc, uint clearValue) r = g = b = a = 0; } - tc->clear_color[0] = r / 255.0; - tc->clear_color[1] = g / 255.0; - tc->clear_color[2] = b / 255.0; - tc->clear_color[3] = a / 255.0; + tc->clear_color[0] = r / 255.0f; + tc->clear_color[1] = g / 255.0f; + tc->clear_color[2] = b / 255.0f; + tc->clear_color[3] = a / 255.0f; #if TILE_CLEAR_OPTIMIZATION /* set flags to indicate all the tiles are cleared */ -- cgit v1.2.3