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_clear.c8
-rw-r--r--src/mesa/pipe/softpipe/sp_context.c6
-rw-r--r--src/mesa/pipe/softpipe/sp_context.h3
-rw-r--r--src/mesa/pipe/softpipe/sp_draw_arrays.c1
-rw-r--r--src/mesa/pipe/softpipe/sp_prim_setup.c14
-rw-r--r--src/mesa/pipe/softpipe/sp_prim_vbuf.c4
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_depth_test.c47
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_fs.c47
-rw-r--r--src/mesa/pipe/softpipe/sp_region.c2
-rw-r--r--src/mesa/pipe/softpipe/sp_state_blend.c12
-rw-r--r--src/mesa/pipe/softpipe/sp_state_fs.c33
-rw-r--r--src/mesa/pipe/softpipe/sp_state_rasterizer.c6
-rw-r--r--src/mesa/pipe/softpipe/sp_state_sampler.c4
-rw-r--r--src/mesa/pipe/softpipe/sp_surface.c8
-rw-r--r--src/mesa/pipe/softpipe/sp_tex_layout.c6
-rw-r--r--src/mesa/pipe/softpipe/sp_tex_sample.c5
-rw-r--r--src/mesa/pipe/softpipe/sp_tile_cache.c4
17 files changed, 111 insertions, 99 deletions
diff --git a/src/mesa/pipe/softpipe/sp_clear.c b/src/mesa/pipe/softpipe/sp_clear.c
index df0537be1d..078b6a7964 100644
--- a/src/mesa/pipe/softpipe/sp_clear.c
+++ b/src/mesa/pipe/softpipe/sp_clear.c
@@ -72,10 +72,10 @@ softpipe_clear(struct pipe_context *pipe, struct pipe_surface *ps,
}
else if (ps == sp_tile_cache_get_surface(softpipe->cbuf_cache[0])) {
float clear[4];
- clear[0] = 0.2; /* XXX hack */
- clear[1] = 0.2; /* XXX hack */
- clear[2] = 0.2; /* XXX hack */
- clear[3] = 0.2; /* XXX hack */
+ clear[0] = 0.2f; /* XXX hack */
+ clear[1] = 0.2f; /* XXX hack */
+ clear[2] = 0.2f; /* XXX hack */
+ clear[3] = 0.2f; /* XXX hack */
sp_tile_cache_clear(softpipe->cbuf_cache[0], clear);
}
diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c
index f67588783b..46f591e425 100644
--- a/src/mesa/pipe/softpipe/sp_context.c
+++ b/src/mesa/pipe/softpipe/sp_context.c
@@ -289,12 +289,12 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys,
uint i;
#if defined(__i386__) || defined(__386__)
- softpipe->use_sse = getenv("GALLIUM_SSE") != NULL;
+ softpipe->use_sse = GETENV( "GALLIUM_SSE" ) != NULL;
#else
softpipe->use_sse = FALSE;
#endif
- softpipe->dump_fs = getenv( "GALLIUM_DUMP_FS" ) != NULL;
+ softpipe->dump_fs = GETENV( "GALLIUM_DUMP_FS" ) != NULL;
softpipe->pipe.winsys = pipe_winsys;
softpipe->pipe.destroy = softpipe_destroy;
@@ -396,7 +396,7 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys,
assert(softpipe->draw);
softpipe->setup = sp_draw_render_stage(softpipe);
- if (getenv("SP_VBUF")) {
+ if (GETENV( "SP_VBUF" ) != NULL) {
softpipe->vbuf = sp_draw_vbuf_stage(softpipe->draw,
&softpipe->pipe,
sp_vbuf_setup_draw);
diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h
index 720297653f..a411969bc0 100644
--- a/src/mesa/pipe/softpipe/sp_context.h
+++ b/src/mesa/pipe/softpipe/sp_context.h
@@ -31,7 +31,6 @@
#ifndef SP_CONTEXT_H
#define SP_CONTEXT_H
-#include "pipe/p_state.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
@@ -63,7 +62,7 @@ struct softpipe_tile_cache;
#define SP_NEW_CONSTANTS 0x4000
struct sp_vertex_shader_state {
- const struct pipe_shader_state *state;
+ struct pipe_shader_state *state;
void *draw_data;
};
diff --git a/src/mesa/pipe/softpipe/sp_draw_arrays.c b/src/mesa/pipe/softpipe/sp_draw_arrays.c
index 64a4fbe333..8a82cdfe1a 100644
--- a/src/mesa/pipe/softpipe/sp_draw_arrays.c
+++ b/src/mesa/pipe/softpipe/sp_draw_arrays.c
@@ -34,7 +34,6 @@
#include "pipe/p_defines.h"
#include "pipe/p_context.h"
#include "pipe/p_winsys.h"
-#include "pipe/p_util.h"
#include "sp_context.h"
#include "sp_state.h"
diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.c b/src/mesa/pipe/softpipe/sp_prim_setup.c
index 21d643bfe0..9f5a43a827 100644
--- a/src/mesa/pipe/softpipe/sp_prim_setup.c
+++ b/src/mesa/pipe/softpipe/sp_prim_setup.c
@@ -516,18 +516,18 @@ static void setup_tri_edges( struct setup_stage *setup )
float vmid_y = setup->vmid->data[0][1] - 0.5f;
float vmax_y = setup->vmax->data[0][1] - 0.5f;
- setup->emaj.sy = ceilf(vmin_y);
- setup->emaj.lines = (int) ceilf(vmax_y - setup->emaj.sy);
+ setup->emaj.sy = CEILF(vmin_y);
+ setup->emaj.lines = (int) CEILF(vmax_y - setup->emaj.sy);
setup->emaj.dxdy = setup->emaj.dx / setup->emaj.dy;
setup->emaj.sx = vmin_x + (setup->emaj.sy - vmin_y) * setup->emaj.dxdy;
- setup->etop.sy = ceilf(vmid_y);
- setup->etop.lines = (int) ceilf(vmax_y - setup->etop.sy);
+ setup->etop.sy = CEILF(vmid_y);
+ setup->etop.lines = (int) CEILF(vmax_y - setup->etop.sy);
setup->etop.dxdy = setup->etop.dx / setup->etop.dy;
setup->etop.sx = vmid_x + (setup->etop.sy - vmid_y) * setup->etop.dxdy;
- setup->ebot.sy = ceilf(vmin_y);
- setup->ebot.lines = (int) ceilf(vmid_y - setup->ebot.sy);
+ setup->ebot.sy = CEILF(vmin_y);
+ setup->ebot.lines = (int) CEILF(vmid_y - setup->ebot.sy);
setup->ebot.dxdy = setup->ebot.dx / setup->ebot.dy;
setup->ebot.sx = vmin_x + (setup->ebot.sy - vmin_y) * setup->ebot.dxdy;
}
@@ -934,7 +934,7 @@ setup_point(struct draw_stage *stage, struct prim_header *prim)
= sizeAttr > 0 ? v0->data[sizeAttr][0]
: setup->softpipe->rasterizer->point_size;
const float halfSize = 0.5F * size;
- const boolean round = setup->softpipe->rasterizer->point_smooth;
+ const boolean round = (boolean) setup->softpipe->rasterizer->point_smooth;
const float x = v0->data[0][0]; /* Note: data[0] is always position */
const float y = v0->data[0][1];
unsigned slot, j;
diff --git a/src/mesa/pipe/softpipe/sp_prim_vbuf.c b/src/mesa/pipe/softpipe/sp_prim_vbuf.c
index a26179e45c..ddf662eead 100644
--- a/src/mesa/pipe/softpipe/sp_prim_vbuf.c
+++ b/src/mesa/pipe/softpipe/sp_prim_vbuf.c
@@ -295,8 +295,8 @@ struct draw_stage *sp_draw_vbuf_stage( struct draw_context *draw_context,
vbuf->draw = draw;
vbuf->draw_context = draw_context;
- vbuf->element_map = malloc( IBUF_SIZE );
- vbuf->vertex_map = malloc( VBUF_SIZE );
+ vbuf->element_map = MALLOC( IBUF_SIZE );
+ vbuf->vertex_map = MALLOC( VBUF_SIZE );
vbuf->vertex_ptr = vbuf->vertex_map;
diff --git a/src/mesa/pipe/softpipe/sp_quad_depth_test.c b/src/mesa/pipe/softpipe/sp_quad_depth_test.c
index 9cb01d7b2f..f7e93af784 100644
--- a/src/mesa/pipe/softpipe/sp_quad_depth_test.c
+++ b/src/mesa/pipe/softpipe/sp_quad_depth_test.c
@@ -1,26 +1,29 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5
- *
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
- *
+/**************************************************************************
+ *
+ * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
* Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
/**
* \brief Quad depth testing
@@ -188,7 +191,7 @@ sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad)
for (j = 0; j < QUAD_SIZE; j++) {
int x = quad->x0 % TILE_SIZE + (j & 1);
int y = quad->y0 % TILE_SIZE + (j >> 1);
- tile->data.depth16[y][x] = bzzzz[j];
+ tile->data.depth16[y][x] = (ushort) bzzzz[j];
}
break;
case PIPE_FORMAT_U_Z32:
diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c
index c4f90e5064..d6d7eb6489 100644
--- a/src/mesa/pipe/softpipe/sp_quad_fs.c
+++ b/src/mesa/pipe/softpipe/sp_quad_fs.c
@@ -1,26 +1,29 @@
-/*
- * Mesa 3-D graphics library
- * Version: 6.5
- *
- * Copyright (C) 1999-2005 Brian Paul All Rights Reserved.
- *
+/**************************************************************************
+ *
+ * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
* Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- */
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
/* Vertices are just an array of floats, with all the attributes
* packed. We currently assume a layout like:
@@ -35,8 +38,6 @@
#include "pipe/p_util.h"
#include "pipe/p_defines.h"
-#include "pipe/llvm/llvmtgsi.h"
-
#include "x86/rtasm/x86sse.h"
#include "sp_context.h"
diff --git a/src/mesa/pipe/softpipe/sp_region.c b/src/mesa/pipe/softpipe/sp_region.c
index 80a67dcabc..fef63ef2f6 100644
--- a/src/mesa/pipe/softpipe/sp_region.c
+++ b/src/mesa/pipe/softpipe/sp_region.c
@@ -207,7 +207,7 @@ sp_region_fill(struct pipe_context *pipe,
ushort *row = (ushort *) get_pointer(dst, dstx, dsty);
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++)
- row[j] = value;
+ row[j] = (ushort) value;
row += dst->pitch;
}
}
diff --git a/src/mesa/pipe/softpipe/sp_state_blend.c b/src/mesa/pipe/softpipe/sp_state_blend.c
index 6376c3c61c..e9e6a55e0d 100644
--- a/src/mesa/pipe/softpipe/sp_state_blend.c
+++ b/src/mesa/pipe/softpipe/sp_state_blend.c
@@ -34,7 +34,7 @@ void *
softpipe_create_blend_state(struct pipe_context *pipe,
const struct pipe_blend_state *blend)
{
- struct pipe_blend_state *state = malloc(sizeof(struct pipe_blend_state));
+ struct pipe_blend_state *state = MALLOC( sizeof(struct pipe_blend_state) );
memcpy(state, blend, sizeof(struct pipe_blend_state));
return state;
}
@@ -52,7 +52,7 @@ void softpipe_bind_blend_state( struct pipe_context *pipe,
void softpipe_delete_blend_state(struct pipe_context *pipe,
void *blend)
{
- free(blend);
+ FREE( blend );
}
@@ -75,7 +75,7 @@ void *
softpipe_create_alpha_test_state(struct pipe_context *pipe,
const struct pipe_alpha_test_state *alpha)
{
- struct pipe_alpha_test_state *state = malloc(sizeof(struct pipe_alpha_test_state));
+ struct pipe_alpha_test_state *state = MALLOC( sizeof(struct pipe_alpha_test_state) );
memcpy(state, alpha, sizeof(struct pipe_alpha_test_state));
return state;
}
@@ -95,7 +95,7 @@ void
softpipe_delete_alpha_test_state(struct pipe_context *pipe,
void *alpha)
{
- free(alpha);
+ FREE( alpha );
}
void *
@@ -103,7 +103,7 @@ softpipe_create_depth_stencil_state(struct pipe_context *pipe,
const struct pipe_depth_stencil_state *depth_stencil)
{
struct pipe_depth_stencil_state *state =
- malloc(sizeof(struct pipe_depth_stencil_state));
+ MALLOC( sizeof(struct pipe_depth_stencil_state) );
memcpy(state, depth_stencil, sizeof(struct pipe_depth_stencil_state));
return state;
}
@@ -122,5 +122,5 @@ softpipe_bind_depth_stencil_state(struct pipe_context *pipe,
void
softpipe_delete_depth_stencil_state(struct pipe_context *pipe, void *depth)
{
- free(depth);
+ FREE( depth );
}
diff --git a/src/mesa/pipe/softpipe/sp_state_fs.c b/src/mesa/pipe/softpipe/sp_state_fs.c
index ad8ab561ef..351c2954f5 100644
--- a/src/mesa/pipe/softpipe/sp_state_fs.c
+++ b/src/mesa/pipe/softpipe/sp_state_fs.c
@@ -29,6 +29,7 @@
#include "sp_state.h"
#include "pipe/p_defines.h"
+#include "pipe/p_util.h"
#include "pipe/p_winsys.h"
#include "pipe/draw/draw_context.h"
#include "pipe/tgsi/exec/tgsi_core.h"
@@ -43,7 +44,7 @@ void * softpipe_create_fs_state(struct pipe_context *pipe,
* that now.
*/
- struct sp_fragment_shader_state *state = malloc(sizeof(struct sp_fragment_shader_state));
+ struct sp_fragment_shader_state *state = MALLOC( sizeof(struct sp_fragment_shader_state) );
state->shader = *templ;
if( softpipe->dump_fs ) {
@@ -80,7 +81,7 @@ void softpipe_delete_fs_state(struct pipe_context *pipe,
x86_release_func( &state->sse2_program );
#endif
- free( state );
+ FREE( state );
}
@@ -88,15 +89,27 @@ void * softpipe_create_vs_state(struct pipe_context *pipe,
const struct pipe_shader_state *templ)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
- struct sp_vertex_shader_state *state =
- malloc(sizeof(struct sp_vertex_shader_state));
- struct pipe_shader_state *templ_copy =
- malloc(sizeof(struct pipe_shader_state));
- memcpy(templ_copy, templ, sizeof(struct pipe_shader_state));
+ struct sp_vertex_shader_state *state;
+
+ state = MALLOC( sizeof(struct sp_vertex_shader_state) );
+ if (state == NULL ) {
+ return NULL;
+ }
+
+ state->state = MALLOC( sizeof(struct pipe_shader_state) );
+ if (state->state == NULL) {
+ FREE( state );
+ return NULL;
+ }
+ memcpy( state->state, templ, sizeof(struct pipe_shader_state) );
- state->state = templ_copy;
state->draw_data = draw_create_vertex_shader(softpipe->draw,
state->state);
+ if (state->draw_data == NULL) {
+ FREE( state->state );
+ FREE( state );
+ return NULL;
+ }
return state;
}
@@ -121,8 +134,8 @@ void softpipe_delete_vs_state(struct pipe_context *pipe,
(struct sp_vertex_shader_state *)vs;
draw_delete_vertex_shader(softpipe->draw, state->draw_data);
- free(state->state);
- free(state);
+ FREE( state->state );
+ FREE( state );
}
diff --git a/src/mesa/pipe/softpipe/sp_state_rasterizer.c b/src/mesa/pipe/softpipe/sp_state_rasterizer.c
index 076ea66d9e..a69e0d9012 100644
--- a/src/mesa/pipe/softpipe/sp_state_rasterizer.c
+++ b/src/mesa/pipe/softpipe/sp_state_rasterizer.c
@@ -1,6 +1,6 @@
/**************************************************************************
*
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -37,7 +37,7 @@ softpipe_create_rasterizer_state(struct pipe_context *pipe,
const struct pipe_rasterizer_state *setup)
{
struct pipe_rasterizer_state *state =
- malloc(sizeof(struct pipe_rasterizer_state));
+ MALLOC( sizeof(struct pipe_rasterizer_state) );
memcpy(state, setup, sizeof(struct pipe_rasterizer_state));
return state;
}
@@ -58,7 +58,7 @@ void softpipe_bind_rasterizer_state(struct pipe_context *pipe,
void softpipe_delete_rasterizer_state(struct pipe_context *pipe,
void *rasterizer)
{
- free(rasterizer);
+ FREE( rasterizer );
}
diff --git a/src/mesa/pipe/softpipe/sp_state_sampler.c b/src/mesa/pipe/softpipe/sp_state_sampler.c
index e70eabd578..7b528fbaf3 100644
--- a/src/mesa/pipe/softpipe/sp_state_sampler.c
+++ b/src/mesa/pipe/softpipe/sp_state_sampler.c
@@ -38,7 +38,7 @@ void *
softpipe_create_sampler_state(struct pipe_context *pipe,
const struct pipe_sampler_state *sampler)
{
- struct pipe_sampler_state *state = malloc(sizeof(struct pipe_sampler_state));
+ struct pipe_sampler_state *state = MALLOC( sizeof(struct pipe_sampler_state) );
memcpy(state, sampler, sizeof(struct pipe_sampler_state));
return state;
}
@@ -60,7 +60,7 @@ void
softpipe_delete_sampler_state(struct pipe_context *pipe,
void *sampler)
{
- free(sampler);
+ FREE( sampler );
}
diff --git a/src/mesa/pipe/softpipe/sp_surface.c b/src/mesa/pipe/softpipe/sp_surface.c
index bc343140ba..9d5529d8d6 100644
--- a/src/mesa/pipe/softpipe/sp_surface.c
+++ b/src/mesa/pipe/softpipe/sp_surface.c
@@ -1,6 +1,6 @@
/**************************************************************************
*
- * Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
* All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
@@ -172,7 +172,7 @@ z16_get_tile(struct pipe_surface *ps,
const ushort *src
= ((const ushort *) (ps->region->map + ps->offset))
+ y * ps->region->pitch + x;
- const float scale = 1.0 / 65535.0;
+ const float scale = 1.0f / 65535.0f;
unsigned i, j;
unsigned w0 = w;
@@ -418,7 +418,7 @@ z32_get_tile(struct pipe_surface *ps,
pRow[j * 4 + 0] =
pRow[j * 4 + 1] =
pRow[j * 4 + 2] =
- pRow[j * 4 + 3] = src[j] * scale;
+ pRow[j * 4 + 3] = (float) (scale * src[j]);
}
src += ps->region->pitch;
p += 4 * w0;
@@ -452,7 +452,7 @@ s8z24_get_tile(struct pipe_surface *ps,
pRow[j * 4 + 0] =
pRow[j * 4 + 1] =
pRow[j * 4 + 2] =
- pRow[j * 4 + 3] = (src[j] & 0xffffff) * scale;
+ pRow[j * 4 + 3] = (float) (scale * (src[j] & 0xffffff));
}
src += ps->region->pitch;
p += 4 * w0;
diff --git a/src/mesa/pipe/softpipe/sp_tex_layout.c b/src/mesa/pipe/softpipe/sp_tex_layout.c
index 15447d6600..3ac7bfcb73 100644
--- a/src/mesa/pipe/softpipe/sp_tex_layout.c
+++ b/src/mesa/pipe/softpipe/sp_tex_layout.c
@@ -30,10 +30,8 @@
* Michel Dänzer <michel@tungstengraphics.com>
*/
-#include "pipe/p_state.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
-#include "pipe/p_util.h"
#include "sp_tex_layout.h"
@@ -76,14 +74,14 @@ sp_miptree_set_level_info(struct pipe_mipmap_tree *mt,
/* Not sure when this would happen, but anyway:
*/
if (mt->level[level].image_offset) {
- free(mt->level[level].image_offset);
+ FREE( mt->level[level].image_offset );
mt->level[level].image_offset = NULL;
}
assert(nr_images);
assert(!mt->level[level].image_offset);
- mt->level[level].image_offset = (unsigned *) malloc(nr_images * sizeof(unsigned));
+ mt->level[level].image_offset = (unsigned *) MALLOC( nr_images * sizeof(unsigned) );
mt->level[level].image_offset[0] = 0;
}
diff --git a/src/mesa/pipe/softpipe/sp_tex_sample.c b/src/mesa/pipe/softpipe/sp_tex_sample.c
index 385b8042c3..0b91ef0e37 100644
--- a/src/mesa/pipe/softpipe/sp_tex_sample.c
+++ b/src/mesa/pipe/softpipe/sp_tex_sample.c
@@ -39,7 +39,6 @@
#include "sp_tile_cache.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
-#include "pipe/p_util.h"
#include "pipe/tgsi/exec/tgsi_exec.h"
@@ -580,7 +579,7 @@ sp_get_samples_2d_common(struct tgsi_sampler *sampler,
height = sampler->texture->level[level0].height;
}
else {
- width = height = 1.0;
+ width = height = 1;
}
assert(width > 0);
@@ -697,7 +696,7 @@ sp_get_samples_3d(struct tgsi_sampler *sampler,
depth = sampler->texture->level[level0].depth;
}
else {
- width = height = depth = 1.0;
+ width = height = depth = 1;
}
assert(width > 0);
diff --git a/src/mesa/pipe/softpipe/sp_tile_cache.c b/src/mesa/pipe/softpipe/sp_tile_cache.c
index 1b600aadf1..473316b674 100644
--- a/src/mesa/pipe/softpipe/sp_tile_cache.c
+++ b/src/mesa/pipe/softpipe/sp_tile_cache.c
@@ -99,7 +99,7 @@ sp_create_tile_cache(void)
struct softpipe_tile_cache *tc;
uint pos;
- tc = calloc(1, sizeof(*tc));
+ tc = CALLOC_STRUCT( softpipe_tile_cache );
if (tc) {
for (pos = 0; pos < NUM_ENTRIES; pos++) {
tc->entries[pos].x =
@@ -117,7 +117,7 @@ sp_destroy_tile_cache(struct softpipe_tile_cache *tc)
for (pos = 0; pos < NUM_ENTRIES; pos++) {
assert(tc->entries[pos].x < 0);
}
- free(tc);
+ FREE( tc );
}