summaryrefslogtreecommitdiff
path: root/src/mesa/pipe
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r--src/mesa/pipe/draw/draw_context.c16
-rw-r--r--src/mesa/pipe/draw/draw_vertex_fetch.c8
-rw-r--r--src/mesa/pipe/draw/draw_vertex_shader.c15
-rw-r--r--src/mesa/pipe/draw/draw_wide_prims.c60
-rw-r--r--src/mesa/pipe/p_context.h6
-rw-r--r--src/mesa/pipe/p_util.h126
-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
-rw-r--r--src/mesa/pipe/tgsi/exec/tgsi_dump.c44
-rw-r--r--src/mesa/pipe/tgsi/exec/tgsi_exec.c22
-rw-r--r--src/mesa/pipe/tgsi/exec/tgsi_parse.c31
-rwxr-xr-xsrc/mesa/pipe/tgsi/exec/tgsi_sse2.c29
27 files changed, 366 insertions, 201 deletions
diff --git a/src/mesa/pipe/draw/draw_context.c b/src/mesa/pipe/draw/draw_context.c
index 61f9e4909b..80317dd6cf 100644
--- a/src/mesa/pipe/draw/draw_context.c
+++ b/src/mesa/pipe/draw/draw_context.c
@@ -42,7 +42,7 @@ struct draw_context *draw_create( void )
struct draw_context *draw = CALLOC_STRUCT( draw_context );
#if defined(__i386__) || defined(__386__)
- draw->use_sse = getenv("GALLIUM_SSE") != NULL;
+ draw->use_sse = GETENV( "GALLIUM_SSE" ) != NULL;
#else
draw->use_sse = FALSE;
#endif
@@ -71,7 +71,7 @@ struct draw_context *draw_create( void )
*/
{
int i;
- char *tmp = malloc(Elements(draw->vcache.vertex) * MAX_VERTEX_SIZE);
+ char *tmp = MALLOC( Elements(draw->vcache.vertex) * MAX_VERTEX_SIZE );
for (i = 0; i < Elements(draw->vcache.vertex); i++)
draw->vcache.vertex[i] = (struct vertex_header *)(tmp + i * MAX_VERTEX_SIZE);
@@ -92,8 +92,8 @@ struct draw_context *draw_create( void )
void draw_destroy( struct draw_context *draw )
{
- free( draw->vcache.vertex[0] ); /* Frees all the vertices. */
- free( draw );
+ FREE( draw->vcache.vertex[0] ); /* Frees all the vertices. */
+ FREE( draw );
}
@@ -233,10 +233,10 @@ void draw_alloc_tmps( struct draw_stage *stage, unsigned nr )
stage->nr_tmps = nr;
if (nr) {
- ubyte *store = (ubyte *) malloc(MAX_VERTEX_SIZE * nr);
+ ubyte *store = (ubyte *) MALLOC( MAX_VERTEX_SIZE * nr );
unsigned i;
- stage->tmp = (struct vertex_header **) malloc(sizeof(struct vertex_header *) * nr);
+ stage->tmp = (struct vertex_header **) MALLOC( sizeof(struct vertex_header *) * nr );
for (i = 0; i < nr; i++)
stage->tmp[i] = (struct vertex_header *)(store + i * MAX_VERTEX_SIZE);
@@ -246,8 +246,8 @@ void draw_alloc_tmps( struct draw_stage *stage, unsigned nr )
void draw_free_tmps( struct draw_stage *stage )
{
if (stage->tmp) {
- free(stage->tmp[0]);
- free(stage->tmp);
+ FREE( stage->tmp[0] );
+ FREE( stage->tmp );
}
}
diff --git a/src/mesa/pipe/draw/draw_vertex_fetch.c b/src/mesa/pipe/draw/draw_vertex_fetch.c
index de1cd06da6..5a7e6febe9 100644
--- a/src/mesa/pipe/draw/draw_vertex_fetch.c
+++ b/src/mesa/pipe/draw/draw_vertex_fetch.c
@@ -64,16 +64,16 @@ fetch_attrib4(const void *ptr, unsigned format, float attrib[4])
break;
case PIPE_FORMAT_R32G32B32A32_SSCALED:
- attrib[3] = ((int *) ptr)[3];
+ attrib[3] = (float) ((int *) ptr)[3];
/* fall-through */
case PIPE_FORMAT_R32G32B32_SSCALED:
- attrib[2] = ((int *) ptr)[2];
+ attrib[2] = (float) ((int *) ptr)[2];
/* fall-through */
case PIPE_FORMAT_R32G32_SSCALED:
- attrib[1] = ((int *) ptr)[1];
+ attrib[1] = (float) ((int *) ptr)[1];
/* fall-through */
case PIPE_FORMAT_R32_SSCALED:
- attrib[0] = ((int *) ptr)[0];
+ attrib[0] = (float) ((int *) ptr)[0];
break;
default:
diff --git a/src/mesa/pipe/draw/draw_vertex_shader.c b/src/mesa/pipe/draw/draw_vertex_shader.c
index 7fd17292b8..056ad007cf 100644
--- a/src/mesa/pipe/draw/draw_vertex_shader.c
+++ b/src/mesa/pipe/draw/draw_vertex_shader.c
@@ -42,7 +42,7 @@
#include "pipe/llvm/llvmtgsi.h"
-#define DBG 0
+#define DBG_VS 0
static INLINE unsigned
@@ -149,7 +149,7 @@ run_vertex_program(struct draw_context *draw,
vOut[j]->data[0][2] = z * scale[2] + trans[2];
vOut[j]->data[0][3] = w;
-#if DBG
+#if DBG_VS
printf("output[%d]win: %f %f %f %f\n", j,
vOut[j]->data[0][0],
vOut[j]->data[0][1],
@@ -166,7 +166,7 @@ run_vertex_program(struct draw_context *draw,
vOut[j]->data[slot][1] = machine->Outputs[slot].xyzw[1].f[j];
vOut[j]->data[slot][2] = machine->Outputs[slot].xyzw[2].f[j];
vOut[j]->data[slot][3] = machine->Outputs[slot].xyzw[3].f[j];
-#if DBG
+#if DBG_VS
printf("output[%d][%d]: %f %f %f %f\n", j, slot,
vOut[j]->data[slot][0],
vOut[j]->data[slot][1],
@@ -222,7 +222,11 @@ draw_create_vertex_shader(struct draw_context *draw,
{
struct draw_vertex_shader *vs;
- vs = calloc( 1, sizeof( struct draw_vertex_shader ) );
+ vs = CALLOC_STRUCT( draw_vertex_shader );
+ if (vs == NULL) {
+ return NULL;
+ }
+
vs->state = shader;
#if defined(__i386__) || defined(__386__)
@@ -269,6 +273,5 @@ void draw_delete_vertex_shader(struct draw_context *draw,
x86_release_func( (struct x86_function *) &vs->sse2_program );
#endif
- free( vs->state );
- free( vs );
+ FREE( vs );
}
diff --git a/src/mesa/pipe/draw/draw_wide_prims.c b/src/mesa/pipe/draw/draw_wide_prims.c
index 76b8a5319b..f3b4478f9a 100644
--- a/src/mesa/pipe/draw/draw_wide_prims.c
+++ b/src/mesa/pipe/draw/draw_wide_prims.c
@@ -111,44 +111,44 @@ static void wide_line( struct draw_stage *stage,
if (dx > dy) {
/* x-major line */
- pos0[1] = pos0[1] - half_width - 0.25;
- pos1[1] = pos1[1] + half_width - 0.25;
- pos2[1] = pos2[1] - half_width - 0.25;
- pos3[1] = pos3[1] + half_width - 0.25;
+ pos0[1] = pos0[1] - half_width - 0.25f;
+ pos1[1] = pos1[1] + half_width - 0.25f;
+ pos2[1] = pos2[1] - half_width - 0.25f;
+ pos3[1] = pos3[1] + half_width - 0.25f;
if (pos0[0] < pos2[0]) {
/* left to right line */
- pos0[0] -= 0.5;
- pos1[0] -= 0.5;
- pos2[0] -= 0.5;
- pos3[0] -= 0.5;
+ pos0[0] -= 0.5f;
+ pos1[0] -= 0.5f;
+ pos2[0] -= 0.5f;
+ pos3[0] -= 0.5f;
}
else {
/* right to left line */
- pos0[0] += 0.5;
- pos1[0] += 0.5;
- pos2[0] += 0.5;
- pos3[0] += 0.5;
+ pos0[0] += 0.5f;
+ pos1[0] += 0.5f;
+ pos2[0] += 0.5f;
+ pos3[0] += 0.5f;
}
}
else {
/* y-major line */
- pos0[0] = pos0[0] - half_width + 0.25;
- pos1[0] = pos1[0] + half_width + 0.25;
- pos2[0] = pos2[0] - half_width + 0.25;
- pos3[0] = pos3[0] + half_width + 0.25;
+ pos0[0] = pos0[0] - half_width + 0.25f;
+ pos1[0] = pos1[0] + half_width + 0.25f;
+ pos2[0] = pos2[0] - half_width + 0.25f;
+ pos3[0] = pos3[0] + half_width + 0.25f;
if (pos0[1] < pos2[1]) {
/* top to bottom line */
- pos0[1] -= 0.5;
- pos1[1] -= 0.5;
- pos2[1] -= 0.5;
- pos3[1] -= 0.5;
+ pos0[1] -= 0.5f;
+ pos1[1] -= 0.5f;
+ pos2[1] -= 0.5f;
+ pos3[1] -= 0.5f;
}
else {
/* bottom to top line */
- pos0[1] += 0.5;
- pos1[1] += 0.5;
- pos2[1] += 0.5;
- pos3[1] += 0.5;
+ pos0[1] += 0.5f;
+ pos1[1] += 0.5f;
+ pos2[1] += 0.5f;
+ pos3[1] += 0.5f;
}
}
@@ -179,7 +179,7 @@ static void set_texcoords(const struct wide_stage *wide,
uint j = wide->texcoord_slot[i];
v->data[j][0] = tc[0];
if (wide->texcoord_mode[i] == PIPE_SPRITE_COORD_LOWER_LEFT)
- v->data[j][1] = 1.0 - tc[1];
+ v->data[j][1] = 1.0f - tc[1];
else
v->data[j][1] = tc[1];
v->data[j][2] = tc[2];
@@ -198,7 +198,7 @@ static void wide_point( struct draw_stage *stage,
struct prim_header *header )
{
const struct wide_stage *wide = wide_stage(stage);
- const boolean sprite = stage->draw->rasterizer->point_sprite;
+ const boolean sprite = (boolean) stage->draw->rasterizer->point_sprite;
float half_size;
float left_adj, right_adj;
@@ -223,8 +223,8 @@ static void wide_point( struct draw_stage *stage,
half_size = wide->half_point_size;
}
- left_adj = -half_size + 0.25;
- right_adj = half_size + 0.25;
+ left_adj = -half_size + 0.25f;
+ right_adj = half_size + 0.25f;
pos0[0] += left_adj;
pos0[1] -= half_size;
@@ -267,8 +267,8 @@ static void wide_begin( struct draw_stage *stage )
struct wide_stage *wide = wide_stage(stage);
struct draw_context *draw = stage->draw;
- wide->half_point_size = 0.5 * draw->rasterizer->point_size;
- wide->half_line_width = 0.5 * draw->rasterizer->line_width;
+ wide->half_point_size = 0.5f * draw->rasterizer->point_size;
+ wide->half_line_width = 0.5f * draw->rasterizer->line_width;
if (draw->rasterizer->line_width != 1.0) {
wide->stage.line = wide_line;
diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h
index a1441a7e43..3bd266674f 100644
--- a/src/mesa/pipe/p_context.h
+++ b/src/mesa/pipe/p_context.h
@@ -29,7 +29,7 @@
#define PIPE_CONTEXT_H
#include "p_state.h"
-#include "p_compiler.h"
+#include "p_util.h"
struct pipe_state_cache;
/**
@@ -265,7 +265,7 @@ pipe_region_reference(struct pipe_region **ptr, struct pipe_region *region)
/* free the old region */
assert(oldReg->map_refcount == 0);
/* XXX dereference the region->buffer */
- free(oldReg);
+ FREE( oldReg );
}
*ptr = NULL;
}
@@ -292,7 +292,7 @@ pipe_surface_reference(struct pipe_surface **ptr, struct pipe_surface *surf)
if (oldSurf->refcount == 0) {
/* free the old region */
pipe_region_reference(&oldSurf->region, NULL);
- free(oldSurf);
+ FREE( oldSurf );
}
*ptr = NULL;
}
diff --git a/src/mesa/pipe/p_util.h b/src/mesa/pipe/p_util.h
index 4f68f5e1bd..7897bc90e4 100644
--- a/src/mesa/pipe/p_util.h
+++ b/src/mesa/pipe/p_util.h
@@ -1,28 +1,29 @@
-
-/*
- * Mesa 3-D graphics library
- * Version: 6.5.2
- *
- * Copyright (C) 1999-2006 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.
+ *
+ **************************************************************************/
#ifndef P_UTIL_H
#define P_UTIL_H
@@ -30,12 +31,84 @@
#include "p_compiler.h"
#include <math.h>
-#define CALLOC_STRUCT(T) (struct T *) calloc(1, sizeof(struct T))
+#ifdef WIN32
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+void * __stdcall
+EngAllocMem(
+ unsigned long Flags,
+ unsigned long MemSize,
+ unsigned long Tag );
+
+void __stdcall
+EngFreeMem(
+ void *Mem );
+
+#ifdef __cplusplus
+}
+#endif
+
+static INLINE void *
+MALLOC( unsigned size )
+{
+ return EngAllocMem( 0, size, 'D3AG' );
+}
+
+static INLINE void *
+CALLOC( unsigned count, unsigned size )
+{
+ void *ptr = MALLOC( count * size );
+ if( ptr ) {
+ memset( ptr, 0, count * size );
+ }
+ return ptr;
+}
+
+static INLINE void
+FREE( void *ptr )
+{
+ if( ptr ) {
+ EngFreeMem( ptr );
+ }
+}
+
+static INLINE void *
+REALLOC( void *old_ptr, unsigned old_size, unsigned new_size )
+{
+ void *new_ptr;
+ if( new_size <= old_size ) {
+ return old_ptr;
+ }
+ new_ptr = MALLOC( new_size );
+ if( new_ptr ) {
+ memcpy( new_ptr, old_ptr, old_size );
+ }
+ FREE( old_ptr );
+ return new_ptr;
+}
+
+#define GETENV( X ) NULL
+
+#else // WIN32
#define MALLOC( SIZE ) malloc( SIZE )
+#define CALLOC( COUNT, SIZE ) calloc( COUNT, SIZE )
+
#define FREE( PTR ) free( PTR )
+#define REALLOC( OLDPTR, OLDSIZE, NEWSIZE ) realloc( OLDPTR, NEWSIZE )
+
+#define GETENV( X ) getenv( X )
+
+#endif // WIN32
+
+#define CALLOC_STRUCT(T) (struct T *) CALLOC(1, sizeof(struct T))
+
#define CLAMP( X, MIN, MAX ) ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) )
#define MIN2( A, B ) ( (A)<(B) ? (A) : (B) )
#define MAX2( A, B ) ( (A)>(B) ? (A) : (B) )
@@ -221,5 +294,10 @@ static INLINE float LOG2(float val)
return num.f + log_2;
}
+#if defined(__GNUC__)
+#define CEILF(x) ceilf(x)
+#else
+#define CEILF(x) ((float) ceil(x))
+#endif
#endif
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 );
}
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_dump.c b/src/mesa/pipe/tgsi/exec/tgsi_dump.c
index f740500dec..1df71efff7 100644
--- a/src/mesa/pipe/tgsi/exec/tgsi_dump.c
+++ b/src/mesa/pipe/tgsi/exec/tgsi_dump.c
@@ -1,3 +1,30 @@
+/**************************************************************************
+ *
+ * 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, 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 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.
+ *
+ **************************************************************************/
+
#include "tgsi_platform.h"
#include "tgsi_core.h"
@@ -8,15 +35,6 @@ struct text_dump
};
static void
-text_dump_write(
- struct text_dump *dump,
- const void *buffer,
- unsigned size )
-{
- fwrite( buffer, size, 1, dump->file );
-}
-
-static void
text_dump_str(
struct text_dump *dump,
const char *str )
@@ -25,13 +43,13 @@ text_dump_str(
size_t len = strlen( str );
for( i = 0; i < len; i++ ) {
- text_dump_write( dump, &str[i], 1 );
+ fprintf( dump->file, "%c", str[i] );
if( str[i] == '\n' ) {
unsigned i;
for( i = 0; i < dump->tabs; i++ ) {
- text_dump_write( dump, " ", 4 );
+ fprintf( dump->file, " " );
}
}
}
@@ -1434,9 +1452,5 @@ tgsi_dump(
TXT( "\ntgsi-dump end -------------------\n" );
tgsi_parse_free( &parse );
-
- if (dump->file != stderr &&
- dump->file != stdout)
- fclose( dump->file );
}
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_exec.c b/src/mesa/pipe/tgsi/exec/tgsi_exec.c
index e4f23d3eef..7607ded63a 100644
--- a/src/mesa/pipe/tgsi/exec/tgsi_exec.c
+++ b/src/mesa/pipe/tgsi/exec/tgsi_exec.c
@@ -133,10 +133,10 @@ tgsi_exec_prepare( struct tgsi_exec_machine *mach )
labels->count = 0;
declarations = (struct tgsi_full_declaration *)
- malloc(maxDeclarations * sizeof(struct tgsi_full_declaration));
+ MALLOC( maxDeclarations * sizeof(struct tgsi_full_declaration) );
instructions = (struct tgsi_full_instruction *)
- malloc(maxInstructions * sizeof(struct tgsi_full_instruction));
+ MALLOC( maxInstructions * sizeof(struct tgsi_full_instruction) );
k = tgsi_parse_init( &parse, mach->Tokens );
if (k != TGSI_PARSE_OK) {
@@ -153,10 +153,12 @@ tgsi_exec_prepare( struct tgsi_exec_machine *mach )
case TGSI_TOKEN_TYPE_DECLARATION:
/* save expanded declaration */
if (numDeclarations == maxDeclarations) {
- maxDeclarations += 10;
- declarations = realloc(declarations,
+ declarations = REALLOC(declarations,
maxDeclarations
+ * sizeof(struct tgsi_full_instruction),
+ (maxDeclarations + 10)
* sizeof(struct tgsi_full_instruction));
+ maxDeclarations += 10;
}
memcpy(declarations + numDeclarations,
&parse.FullToken.FullInstruction,
@@ -186,10 +188,12 @@ tgsi_exec_prepare( struct tgsi_exec_machine *mach )
/* save expanded instruction */
if (numInstructions == maxInstructions) {
- maxInstructions += 10;
- instructions = realloc(instructions,
+ instructions = REALLOC(instructions,
maxInstructions
+ * sizeof(struct tgsi_full_instruction),
+ (maxInstructions + 10)
* sizeof(struct tgsi_full_instruction));
+ maxInstructions += 10;
}
memcpy(instructions + numInstructions,
&parse.FullToken.FullInstruction,
@@ -204,13 +208,13 @@ tgsi_exec_prepare( struct tgsi_exec_machine *mach )
tgsi_parse_free (&parse);
if (mach->Declarations) {
- free(mach->Declarations);
+ FREE( mach->Declarations );
}
mach->Declarations = declarations;
mach->NumDeclarations = numDeclarations;
if (mach->Instructions) {
- free(mach->Instructions);
+ FREE( mach->Instructions );
}
mach->Instructions = instructions;
mach->NumInstructions = numInstructions;
@@ -242,7 +246,7 @@ tgsi_exec_machine_init(
k = tgsi_parse_init (&parse, mach->Tokens);
if (k != TGSI_PARSE_OK) {
- printf("Problem parsing!\n");
+ fprintf( stderr, "Problem parsing!\n" );
return;
}
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_parse.c b/src/mesa/pipe/tgsi/exec/tgsi_parse.c
index 1096afffad..aee71decb3 100644
--- a/src/mesa/pipe/tgsi/exec/tgsi_parse.c
+++ b/src/mesa/pipe/tgsi/exec/tgsi_parse.c
@@ -1,3 +1,30 @@
+/**************************************************************************
+ *
+ * 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, 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 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.
+ *
+ **************************************************************************/
+
#include "tgsi_platform.h"
#include "tgsi_core.h"
@@ -13,7 +40,7 @@ tgsi_full_token_free(
union tgsi_full_token *full_token )
{
if( full_token->Token.Type == TGSI_TOKEN_TYPE_IMMEDIATE ) {
- free( full_token->FullImmediate.u.Pointer );
+ FREE( full_token->FullImmediate.u.Pointer );
}
}
@@ -123,7 +150,7 @@ tgsi_parse_token(
switch (imm->Immediate.DataType) {
case TGSI_IMM_FLOAT32:
- imm->u.Pointer = malloc(
+ imm->u.Pointer = MALLOC(
sizeof( struct tgsi_immediate_float32 ) * (imm->Immediate.Size - 1) );
for( i = 0; i < imm->Immediate.Size - 1; i++ ) {
next_token( ctx, &imm->u.ImmediateFloat32[i] );
diff --git a/src/mesa/pipe/tgsi/exec/tgsi_sse2.c b/src/mesa/pipe/tgsi/exec/tgsi_sse2.c
index a71c5155c0..bc20d9ca05 100755
--- a/src/mesa/pipe/tgsi/exec/tgsi_sse2.c
+++ b/src/mesa/pipe/tgsi/exec/tgsi_sse2.c
@@ -1,3 +1,30 @@
+/**************************************************************************
+ *
+ * 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, 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 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.
+ *
+ **************************************************************************/
+
#include "tgsi_platform.h"
#include "tgsi_core.h"
#include "x86/rtasm/x86sse.h"
@@ -465,7 +492,7 @@ emit_shufps(
struct x86_function *func,
struct x86_reg dst,
struct x86_reg src,
- unsigned shuf )
+ unsigned char shuf )
{
DUMP_RRI( "SHUFPS", dst, src, shuf );
sse_shufps( func, dst, src, shuf );