summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/softpipe
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/pipe/softpipe')
-rw-r--r--src/mesa/pipe/softpipe/sp_prim_setup.c20
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_fs.c2
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_stipple.c2
-rw-r--r--src/mesa/pipe/softpipe/sp_surface.c64
-rw-r--r--src/mesa/pipe/softpipe/sp_texture.c2
-rw-r--r--src/mesa/pipe/softpipe/sp_tile_cache.c10
-rw-r--r--src/mesa/pipe/softpipe/sp_winsys.h1
7 files changed, 35 insertions, 66 deletions
diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.c b/src/mesa/pipe/softpipe/sp_prim_setup.c
index 722cadc5c0..89f8df945c 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 {
@@ -554,12 +554,6 @@ static void setup_tri_coefficients( struct setup_stage *setup )
*/
setup_fragcoord_coeff(setup);
}
- else if (fs->input_semantic_name[fragSlot] == TGSI_SEMANTIC_FOG) {
- /* FOG.y = front/back facing XXX fix this */
- setup->coef[fragSlot].a0[1] = 1 - setup->quad.facing;
- setup->coef[fragSlot].dadx[1] = 0.0;
- setup->coef[fragSlot].dady[1] = 0.0;
- }
else {
#endif
uint j;
@@ -578,8 +572,18 @@ static void setup_tri_coefficients( struct setup_stage *setup )
break;
default:
/* invalid interp mode */
- assert(0);
+ /* assert(0); re-enable this and run demos/fogcoord.c ... */
+ ;
+ }
+
+ if (fs->input_semantic_name[fragSlot] == TGSI_SEMANTIC_FOG) {
+ /* FOG.y = front/back facing XXX fix this */
+ setup->coef[fragSlot].a0[1] = 1 - setup->quad.facing;
+ setup->coef[fragSlot].dadx[1] = 0.0;
+ setup->coef[fragSlot].dady[1] = 0.0;
}
+
+
#if USE_INPUT_MAP
}
#endif
diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c
index 921dfbaccb..0001c76a80 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 0c42963dfe..8660432259 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 6c080d5b5c..d5119654ed 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;
@@ -71,45 +72,6 @@ softpipe_get_tex_surface(struct pipe_context *pipe,
}
-/**
- * Copy 2D rect from one place to another.
- * Position and sizes are in pixels.
- */
-static void
-copy_rect(ubyte * dst,
- unsigned cpp,
- unsigned dst_pitch,
- unsigned dst_x,
- unsigned dst_y,
- unsigned width,
- unsigned height,
- const ubyte * src,
- unsigned src_pitch,
- unsigned src_x,
- unsigned src_y)
-{
- unsigned i;
-
- dst_pitch *= cpp;
- src_pitch *= cpp;
- dst += dst_x * cpp;
- src += src_x * cpp;
- dst += dst_y * dst_pitch;
- src += src_y * src_pitch;
- width *= cpp;
-
- if (width == dst_pitch && width == src_pitch)
- memcpy(dst, src, height * width);
- else {
- for (i = 0; i < height; i++) {
- memcpy(dst, src, width);
- dst += dst_pitch;
- src += src_pitch;
- }
- }
-}
-
-
/* Upload data to a rectangular sub-region. Lots of choices how to do this:
*
* - memcpy by span to current destination
@@ -124,10 +86,10 @@ sp_surface_data(struct pipe_context *pipe,
const void *src, unsigned src_pitch,
unsigned srcx, unsigned srcy, unsigned width, unsigned height)
{
- copy_rect(pipe_surface_map(dst),
- dst->cpp,
- dst->pitch,
- dstx, dsty, width, height, src, src_pitch, srcx, srcy);
+ pipe_copy_rect(pipe_surface_map(dst),
+ dst->cpp,
+ dst->pitch,
+ dstx, dsty, width, height, src, src_pitch, srcx, srcy);
pipe_surface_unmap(dst);
}
@@ -144,14 +106,14 @@ sp_surface_copy(struct pipe_context *pipe,
{
assert( dst->cpp == src->cpp );
- copy_rect(pipe_surface_map(dst),
- dst->cpp,
- dst->pitch,
- dstx, dsty,
- width, height,
- pipe_surface_map(src),
- src->pitch,
- srcx, srcy);
+ pipe_copy_rect(pipe_surface_map(dst),
+ dst->cpp,
+ dst->pitch,
+ dstx, dsty,
+ width, height,
+ pipe_surface_map(src),
+ src->pitch,
+ srcx, srcy);
pipe_surface_unmap(src);
pipe_surface_unmap(dst);
diff --git a/src/mesa/pipe/softpipe/sp_texture.c b/src/mesa/pipe/softpipe/sp_texture.c
index e5e6bfe01b..532bcfcc51 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 6515ce668c..1974f77459 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 */
diff --git a/src/mesa/pipe/softpipe/sp_winsys.h b/src/mesa/pipe/softpipe/sp_winsys.h
index cbf64ebb85..d6b379f58c 100644
--- a/src/mesa/pipe/softpipe/sp_winsys.h
+++ b/src/mesa/pipe/softpipe/sp_winsys.h
@@ -37,6 +37,7 @@
#include "pipe/p_compiler.h" /* for boolean */
+enum pipe_format;
struct softpipe_winsys {
/** test if the given format is supported for front/back color bufs */