summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mesa/pipe/draw/draw_context.c11
-rw-r--r--src/mesa/pipe/draw/draw_private.h50
-rw-r--r--src/mesa/pipe/draw/draw_unfilled.c12
-rw-r--r--src/mesa/pipe/draw/draw_vb.c621
-rw-r--r--src/mesa/pipe/p_context.h10
-rw-r--r--src/mesa/pipe/p_defines.h71
-rw-r--r--src/mesa/pipe/p_state.h21
-rw-r--r--src/mesa/pipe/p_util.h83
-rw-r--r--src/mesa/pipe/softpipe/sp_clear.c4
-rw-r--r--src/mesa/pipe/softpipe/sp_context.c27
-rw-r--r--src/mesa/pipe/softpipe/sp_context.h24
-rw-r--r--src/mesa/pipe/softpipe/sp_headers.h24
-rw-r--r--src/mesa/pipe/softpipe/sp_prim_setup.c219
-rw-r--r--src/mesa/pipe/softpipe/sp_prim_setup.h78
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_alpha_test.c7
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_blend.c36
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_bufloop.c8
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_colormask.c14
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_coverage.c5
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_depth_test.c15
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_fs.c48
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_occlusion.c3
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_output.c14
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_stencil.c35
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_stipple.c11
-rw-r--r--src/mesa/pipe/softpipe/sp_region.c64
-rw-r--r--src/mesa/pipe/softpipe/sp_state.h5
-rw-r--r--src/mesa/pipe/softpipe/sp_state_blend.c2
-rw-r--r--src/mesa/pipe/softpipe/sp_state_clip.c2
-rw-r--r--src/mesa/pipe/softpipe/sp_state_derived.c22
-rw-r--r--src/mesa/pipe/softpipe/sp_state_sampler.c6
-rw-r--r--src/mesa/pipe/softpipe/sp_state_surface.c2
-rw-r--r--src/mesa/pipe/softpipe/sp_surface.c127
-rw-r--r--src/mesa/pipe/softpipe/sp_surface.h35
-rw-r--r--src/mesa/pipe/softpipe/sp_tex_layout.c87
-rw-r--r--src/mesa/pipe/softpipe/sp_tex_layout.h2
-rw-r--r--src/mesa/pipe/softpipe/sp_tex_sample.c72
-rw-r--r--src/mesa/pipe/softpipe/sp_tex_sample.h8
-rw-r--r--src/mesa/pipe/tgsi/core/tgsi_build.h146
-rw-r--r--src/mesa/pipe/tgsi/core/tgsi_dump.h2
-rw-r--r--src/mesa/pipe/tgsi/core/tgsi_exec.h42
-rw-r--r--src/mesa/pipe/tgsi/core/tgsi_parse.h6
-rw-r--r--src/mesa/pipe/tgsi/core/tgsi_token.h272
-rw-r--r--src/mesa/pipe/tgsi/core/tgsi_util.h34
44 files changed, 1268 insertions, 1119 deletions
diff --git a/src/mesa/pipe/draw/draw_context.c b/src/mesa/pipe/draw/draw_context.c
index a97f488387..4335b47e09 100644
--- a/src/mesa/pipe/draw/draw_context.c
+++ b/src/mesa/pipe/draw/draw_context.c
@@ -59,6 +59,16 @@ struct draw_context *draw_create( void )
draw->vf = vf_create( GL_TRUE );
+ /* Statically allocate maximum sized vertices for the cache - could be cleverer...
+ */
+ {
+ int i;
+ 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);
+ }
+
return draw;
}
@@ -70,6 +80,7 @@ void draw_destroy( struct draw_context *draw )
vf_destroy( draw->vf );
+ FREE( draw->vcache.vertex[0] ); /* Frees all the vertices. */
FREE( draw );
}
diff --git a/src/mesa/pipe/draw/draw_private.h b/src/mesa/pipe/draw/draw_private.h
index 3dfaa0581d..597393afdc 100644
--- a/src/mesa/pipe/draw/draw_private.h
+++ b/src/mesa/pipe/draw/draw_private.h
@@ -61,12 +61,18 @@ struct vertex_header {
GLfloat data[][4]; /* Note variable size */
};
+#define MAX_VERTEX_SIZE ((2 + FRAG_ATTRIB_MAX) * 4 * sizeof(GLfloat))
+
+
/**
* Basic info for a point/line/triangle primitive.
*/
struct prim_header {
GLfloat det; /**< front/back face determinant */
+ GLuint reset_line_stipple:1;
+ GLuint edgeflags:3;
+ GLuint pad:28;
struct vertex_header *v[3]; /**< 1 to 3 vertex pointers */
};
@@ -103,6 +109,12 @@ struct draw_stage
};
+#define PRIM_QUEUE_LENGTH 16
+#define VCACHE_SIZE 32
+#define VCACHE_OVERFLOW 4
+#define VS_QUEUE_LENGTH (VCACHE_SIZE + VCACHE_OVERFLOW + 1) /* can never fill up */
+
+
/**
* Private context for the drawing module.
*/
@@ -141,7 +153,45 @@ struct draw_context
GLuint nr_vertices;
GLboolean in_vb;
+ void *elts;
+
+ struct vertex_header *(*get_vertex)( struct draw_context *draw,
+ GLuint i );
+
+ /* Post-tnl vertex cache:
+ */
+ struct {
+ GLuint referenced;
+ GLuint idx[VCACHE_SIZE + VCACHE_OVERFLOW];
+ struct vertex_header *vertex[VCACHE_SIZE + VCACHE_OVERFLOW];
+ GLuint overflow;
+ } vcache;
+
+ /* Vertex shader queue:
+ */
+ struct {
+ struct {
+ GLuint elt;
+ struct vertex_header *dest;
+ } queue[VS_QUEUE_LENGTH];
+ GLuint queue_nr;
+ } vs;
+
+ /* Prim pipeline queue:
+ */
+ struct {
+
+ /* Need to queue up primitives until their vertices have been
+ * transformed by a vs queue flush.
+ */
+ struct prim_header queue[PRIM_QUEUE_LENGTH];
+ GLuint queue_nr;
+ } pq;
+
+
+
GLenum prim; /**< GL_POINTS, GL_LINE_STRIP, GL_QUADS, etc */
+ unsigned reduced_prim;
/* Helper for tnl:
*/
diff --git a/src/mesa/pipe/draw/draw_unfilled.c b/src/mesa/pipe/draw/draw_unfilled.c
index 05242d8d10..e0e486ebe6 100644
--- a/src/mesa/pipe/draw/draw_unfilled.c
+++ b/src/mesa/pipe/draw/draw_unfilled.c
@@ -91,9 +91,9 @@ static void points( struct draw_stage *stage,
struct vertex_header *v1 = header->v[1];
struct vertex_header *v2 = header->v[2];
- if (v0->edgeflag) point( stage, v0 );
- if (v1->edgeflag) point( stage, v1 );
- if (v2->edgeflag) point( stage, v2 );
+ if (header->edgeflags & 0x1) point( stage, v0 );
+ if (header->edgeflags & 0x2) point( stage, v1 );
+ if (header->edgeflags & 0x4) point( stage, v2 );
}
@@ -104,9 +104,9 @@ static void lines( struct draw_stage *stage,
struct vertex_header *v1 = header->v[1];
struct vertex_header *v2 = header->v[2];
- if (v0->edgeflag) line( stage, v0, v1 );
- if (v1->edgeflag) line( stage, v1, v2 );
- if (v2->edgeflag) line( stage, v2, v0 );
+ if (header->edgeflags & 0x1) line( stage, v0, v1 );
+ if (header->edgeflags & 0x2) line( stage, v1, v2 );
+ if (header->edgeflags & 0x4) line( stage, v2, v0 );
}
diff --git a/src/mesa/pipe/draw/draw_vb.c b/src/mesa/pipe/draw/draw_vb.c
index f9c10e5f97..ef32f02ec1 100644
--- a/src/mesa/pipe/draw/draw_vb.c
+++ b/src/mesa/pipe/draw/draw_vb.c
@@ -40,356 +40,377 @@
#include "draw_context.h"
-/* This file is a temporary set of hooks to allow us to use the tnl/
- * and vf/ modules until we have replacements in pipe.
- */
+#define RP_NONE 0
+#define RP_POINT 1
+#define RP_LINE 2
+#define RP_TRI 3
+
+static unsigned reduced_prim[GL_POLYGON + 1] = {
+ RP_POINT,
+ RP_LINE,
+ RP_LINE,
+ RP_LINE,
+ RP_TRI,
+ RP_TRI,
+ RP_TRI,
+ RP_TRI,
+ RP_TRI,
+ RP_TRI
+};
-static struct vertex_header *get_vertex( struct draw_context *pipe,
- GLuint i )
-{
- return (struct vertex_header *)(pipe->verts + i * pipe->vertex_size);
-}
+/* This file is a temporary set of hooks to allow us to use the tnl/
+ * and vf/ modules until we have replacements in pipe.
+ */
-static void draw_allocate_vertices( struct draw_context *draw,
- GLuint nr_vertices )
+static void vs_flush( struct draw_context *draw )
{
- draw->nr_vertices = nr_vertices;
- draw->verts = (GLubyte *) malloc( nr_vertices * draw->vertex_size );
+ unsigned i;
- draw->pipeline.first->begin( draw->pipeline.first );
+ /* We're not really running a vertex shader yet, so flushing the vs
+ * queue is just a matter of building the vertices and returning.
+ */
+ /* Actually, I'm cheating even more and pre-building them still
+ * with the mesa/vf module. So it's very easy...
+ */
+ for (i = 0; i < draw->vs.queue_nr; i++) {
+ /* Would do the following steps here:
+ *
+ * 1) Loop over vertex element descriptors, fetch data from each
+ * to build the pre-tnl vertex. This might require a new struct
+ * to represent the pre-tnl vertex.
+ *
+ * 2) Bundle groups of upto 4 pre-tnl vertices together and pass
+ * to vertex shader.
+ *
+ * 3) Do any necessary unswizzling, make sure vertex headers are
+ * correctly populated, store resulting post-transformed
+ * vertices in vcache.
+ *
+ * In this version, just do the last step:
+ */
+ unsigned elt = draw->vs.queue[i].elt;
+ struct vertex_header *dest = draw->vs.queue[i].dest;
+
+ /* Magic:
+ */
+ memcpy(dest,
+ draw->verts + elt * draw->vertex_size,
+ draw->vertex_size);
+
+ }
+ draw->vs.queue_nr = 0;
}
-static void draw_set_prim( struct draw_context *draw,
- GLenum prim )
+
+static void draw_flush( struct draw_context *draw )
{
- draw->prim = prim;
+ struct draw_stage *first = draw->pipeline.first;
+ unsigned i;
- /* Not done yet - need to force edgeflags to 1 in strip/fan
- * primitives.
+ /* Make sure all vertices are available:
*/
-#if 0
- switch (prim) {
- case GL_TRIANGLES:
- case GL_POLYGON:
- case GL_QUADS:
- case GL_QUAD_STRIP: /* yes, we need this */
- respect_edgeflags( pipe, GL_TRUE );
+ vs_flush( draw );
+
+
+ switch (draw->reduced_prim) {
+ case RP_TRI:
+ for (i = 0; i < draw->pq.queue_nr; i++) {
+ if (draw->pq.queue[i].reset_line_stipple)
+ first->reset_stipple_counter( first );
+
+ first->tri( first, &draw->pq.queue[i] );
+ }
break;
+ case RP_LINE:
+ for (i = 0; i < draw->pq.queue_nr; i++) {
+ if (draw->pq.queue[i].reset_line_stipple)
+ first->reset_stipple_counter( first );
- default:
- respect_edgeflags( pipe, GL_FALSE );
+ first->line( first, &draw->pq.queue[i] );
+ }
+ break;
+ case RP_POINT:
+ first->reset_stipple_counter( first );
+ for (i = 0; i < draw->pq.queue_nr; i++)
+ first->point( first, &draw->pq.queue[i] );
break;
}
-#endif
-}
-
+ draw->pq.queue_nr = 0;
+ draw->vcache.referenced = 0;
+ draw->vcache.overflow = 0;
+}
-static void do_quad( struct draw_stage *first,
- struct vertex_header *v0,
- struct vertex_header *v1,
- struct vertex_header *v2,
- struct vertex_header *v3 )
+static void draw_invalidate_vcache( struct draw_context *draw )
{
- struct prim_header prim;
-
- {
- GLuint tmp = v1->edgeflag;
- v1->edgeflag = 0;
-
- prim.v[0] = v0;
- prim.v[1] = v1;
- prim.v[2] = v3;
- first->tri( first, &prim );
+ unsigned i;
+
+ assert(draw->pq.queue_nr == 0);
+ assert(draw->vs.queue_nr == 0);
+ assert(draw->vcache.referenced == 0);
+
+ for (i = 0; i < Elements( draw->vcache.idx ); i++)
+ draw->vcache.idx[i] = ~0;
+}
- v1->edgeflag = tmp;
- }
- {
- GLuint tmp = v3->edgeflag;
- v3->edgeflag = 0;
+/* Return a pointer to a freshly queued primitive header. Ensure that
+ * there is room in the vertex cache for a maximum of "nr_verts" new
+ * vertices. Flush primitive and/or vertex queues if necessary to
+ * make space.
+ */
+static struct prim_header *get_queued_prim( struct draw_context *draw,
+ GLuint nr_verts )
+{
+ if (draw->pq.queue_nr + 1 >= PRIM_QUEUE_LENGTH ||
+ draw->vcache.overflow + nr_verts >= VCACHE_OVERFLOW)
+ draw_flush( draw );
- prim.v[0] = v1;
- prim.v[1] = v2;
- prim.v[2] = v3;
- first->tri( first, &prim );
+ /* The vs queue is sized so that this can never happen:
+ */
+ assert(draw->vs.queue_nr + nr_verts < VS_QUEUE_LENGTH);
- v3->edgeflag = tmp;
- }
+ return &draw->pq.queue[draw->pq.queue_nr++];
}
-
-
-static void draw_indexed_prim( struct draw_context *draw,
- const GLuint *elts,
- GLuint count )
+/* Check if vertex is in cache, otherwise add it. It won't go through
+ * VS yet, not until there is a flush operation or the VS queue fills up.
+ */
+static struct vertex_header *get_vertex( struct draw_context *draw,
+ GLuint i )
{
- struct draw_stage * const first = draw->pipeline.first;
- struct prim_header prim;
- GLuint i;
+ unsigned slot = (i + (i>>5)) & 31;
+
+ /* Cache miss?
+ */
+ if (draw->vcache.idx[slot] != i) {
- prim.det = 0; /* valid from cull stage onwards */
- prim.v[0] = 0;
- prim.v[1] = 0;
- prim.v[2] = 0;
+ /* If slot is in use, use the overflow area:
+ */
+ if (draw->vcache.referenced & (1<<slot))
+ slot = draw->vcache.overflow++;
- switch (draw->prim) {
- case GL_POINTS:
- for (i = 0; i < count; i ++) {
- prim.v[0] = get_vertex( draw, elts[i] );
+ draw->vcache.idx[slot] = i;
- first->point( first, &prim );
- }
- break;
+ /* Add to vertex shader queue:
+ */
+ draw->vs.queue[draw->vs.queue_nr].dest = draw->vcache.vertex[slot];
+ draw->vs.queue[draw->vs.queue_nr].elt = i;
+ draw->vs.queue_nr++;
+ }
- case GL_LINES:
- for (i = 0; i+1 < count; i += 2) {
- prim.v[0] = get_vertex( draw, elts[i + 0] );
- prim.v[1] = get_vertex( draw, elts[i + 1] );
-
- first->reset_stipple_counter( first );
- first->line( first, &prim );
- }
- break;
+ /* Mark slot as in-use:
+ */
+ draw->vcache.referenced |= (1<<slot);
+ return draw->vcache.vertex[slot];
+}
- case GL_LINE_LOOP:
- if (count >= 2) {
- first->reset_stipple_counter( first );
- for (i = 1; i < count; i++) {
- prim.v[0] = get_vertex( draw, elts[i-1] );
- prim.v[1] = get_vertex( draw, elts[i] );
- first->line( first, &prim );
- }
- prim.v[0] = get_vertex( draw, elts[count-1] );
- prim.v[1] = get_vertex( draw, elts[0] );
- first->line( first, &prim );
- }
- break;
+static struct vertex_header *get_uint_elt_vertex( struct draw_context *draw,
+ GLuint i )
+{
+ const GLuint *elts = (const GLuint *)draw->elts;
+ return get_vertex( draw, elts[i] );
+}
- case GL_LINE_STRIP:
- /* I'm guessing it will be necessary to have something like a
- * render->reset_line_stipple() method to properly support
- * splitting strips into primitives like this. Alternately we
- * could just scan ahead to find individual clipped lines and
- * otherwise leave the strip intact - that might be better, but
- * require more complex code here.
- */
- if (count >= 2) {
- first->reset_stipple_counter( first );
- prim.v[0] = 0;
- prim.v[1] = get_vertex( draw, elts[0] );
-
- for (i = 1; i < count; i++) {
- prim.v[0] = prim.v[1];
- prim.v[1] = get_vertex( draw, elts[i] );
-
- first->line( first, &prim );
- }
- }
- break;
+#if 0
+static struct vertex_header *get_ushort_elt_vertex( struct draw_context *draw,
+ const void *elts,
+ GLuint i )
+{
+ const GLushort *elts = (const GLushort *)draw->elts;
+ return get_vertex( draw, elts[i] );
+}
- case GL_TRIANGLES:
- for (i = 0; i+2 < count; i += 3) {
- prim.v[0] = get_vertex( draw, elts[i + 0] );
- prim.v[1] = get_vertex( draw, elts[i + 1] );
- prim.v[2] = get_vertex( draw, elts[i + 2] );
-
- first->tri( first, &prim );
- }
- break;
+static struct vertex_header *get_ubyte_elt_vertex( struct draw_context *draw,
+ const void *elts,
+ GLuint i )
+{
+ const GLubyte *elts = (const GLubyte *)draw->elts;
+ return get_vertex( draw, elts[i] );
+}
+#endif
- case GL_TRIANGLE_STRIP:
- for (i = 0; i+2 < count; i++) {
- if (i & 1) {
- prim.v[0] = get_vertex( draw, elts[i + 1] );
- prim.v[1] = get_vertex( draw, elts[i + 0] );
- prim.v[2] = get_vertex( draw, elts[i + 2] );
- }
- else {
- prim.v[0] = get_vertex( draw, elts[i + 0] );
- prim.v[1] = get_vertex( draw, elts[i + 1] );
- prim.v[2] = get_vertex( draw, elts[i + 2] );
- }
-
- first->tri( first, &prim );
- }
- break;
- case GL_TRIANGLE_FAN:
- if (count >= 3) {
- prim.v[0] = get_vertex( draw, elts[0] );
- prim.v[1] = 0;
- prim.v[2] = get_vertex( draw, elts[1] );
-
- for (i = 0; i+2 < count; i++) {
- prim.v[1] = prim.v[2];
- prim.v[2] = get_vertex( draw, elts[i+2] );
-
- first->tri( first, &prim );
- }
- }
- break;
+static void draw_set_prim( struct draw_context *draw,
+ GLenum prim )
+{
+ if (reduced_prim[prim] != draw->reduced_prim) {
+ draw_flush( draw );
+ draw->reduced_prim = reduced_prim[prim];
+ }
- case GL_QUADS:
- for (i = 0; i+3 < count; i += 4) {
- do_quad( first,
- get_vertex( draw, elts[i + 0] ),
- get_vertex( draw, elts[i + 1] ),
- get_vertex( draw, elts[i + 2] ),
- get_vertex( draw, elts[i + 3] ));
- }
- break;
+ draw->prim = prim;
+}
- case GL_QUAD_STRIP:
- for (i = 0; i+3 < count; i += 2) {
- do_quad( first,
- get_vertex( draw, elts[i + 2] ),
- get_vertex( draw, elts[i + 0] ),
- get_vertex( draw, elts[i + 1] ),
- get_vertex( draw, elts[i + 3] ));
- }
- break;
+static void do_point( struct draw_context *draw,
+ GLuint i0 )
+{
+ struct prim_header *prim = get_queued_prim( draw, 1 );
+
+ prim->reset_line_stipple = 0;
+ prim->edgeflags = 1;
+ prim->pad = 0;
+ prim->v[0] = draw->get_vertex( draw, i0 );
+}
- case GL_POLYGON:
- if (count >= 3) {
- int e1save, e2save;
- prim.v[0] = 0;
- prim.v[1] = get_vertex( draw, elts[1] );
- prim.v[2] = get_vertex( draw, elts[0] );
- e2save = prim.v[2]->edgeflag;
-
- for (i = 0; i+2 < count; i++) {
- prim.v[0] = prim.v[1];
- prim.v[1] = get_vertex( draw, elts[i+2] );
-
- /* save v1 edge flag, and clear if not last triangle */
- e1save = prim.v[1]->edgeflag;
- if (i + 3 < count)
- prim.v[1]->edgeflag = 0;
- /* draw */
- first->tri( first, &prim );
+static void do_line( struct draw_context *draw,
+ GLboolean reset_stipple,
+ GLuint i0,
+ GLuint i1 )
+{
+ struct prim_header *prim = get_queued_prim( draw, 2 );
+
+ prim->reset_line_stipple = reset_stipple;
+ prim->edgeflags = 1;
+ prim->pad = 0;
+ prim->v[0] = draw->get_vertex( draw, i0 );
+ prim->v[1] = draw->get_vertex( draw, i1 );
+}
- prim.v[1]->edgeflag = e1save; /* restore */
- prim.v[2]->edgeflag = 0; /* disable edge after 1st tri */
- }
- prim.v[2]->edgeflag = e2save;
- }
- break;
+static void do_triangle( struct draw_context *draw,
+ GLuint i0,
+ GLuint i1,
+ GLuint i2 )
+{
+ struct prim_header *prim = get_queued_prim( draw, 3 );
+
+ prim->reset_line_stipple = 1;
+ prim->edgeflags = ~0;
+ prim->pad = 0;
+ prim->v[0] = draw->get_vertex( draw, i0 );
+ prim->v[1] = draw->get_vertex( draw, i1 );
+ prim->v[2] = draw->get_vertex( draw, i2 );
+}
+
+static void do_ef_triangle( struct draw_context *draw,
+ GLboolean reset_stipple,
+ GLuint ef_mask,
+ GLuint i0,
+ GLuint i1,
+ GLuint i2 )
+{
+ struct prim_header *prim = get_queued_prim( draw, 3 );
+ struct vertex_header *v0 = draw->get_vertex( draw, i0 );
+ struct vertex_header *v1 = draw->get_vertex( draw, i1 );
+ struct vertex_header *v2 = draw->get_vertex( draw, i2 );
+
+ prim->reset_line_stipple = reset_stipple;
+
+ prim->edgeflags = ef_mask & ((v0->edgeflag << 0) |
+ (v1->edgeflag << 1) |
+ (v2->edgeflag << 2));
+ prim->pad = 0;
+ prim->v[0] = v0;
+ prim->v[1] = v1;
+ prim->v[2] = v2;
+}
- default:
- assert(0);
- break;
- }
+
+static void do_quad( struct draw_context *draw,
+ unsigned v0,
+ unsigned v1,
+ unsigned v2,
+ unsigned v3 )
+{
+ do_ef_triangle( draw, 1, ~(1<<0), v0, v1, v3 );
+ do_ef_triangle( draw, 0, ~(1<<1), v1, v2, v3 );
}
+
static void draw_prim( struct draw_context *draw,
GLuint start,
GLuint count )
{
- struct draw_stage * const first = draw->pipeline.first;
- struct prim_header prim;
GLuint i;
// _mesa_printf("%s (%d) %d/%d\n", __FUNCTION__, draw->prim, start, count );
- prim.det = 0; /* valid from cull stage onwards */
- prim.v[0] = 0;
- prim.v[1] = 0;
- prim.v[2] = 0;
-
switch (draw->prim) {
case GL_POINTS:
for (i = 0; i < count; i ++) {
- prim.v[0] = get_vertex( draw, start + i );
- first->point( first, &prim );
+ do_point( draw,
+ start + i );
}
break;
case GL_LINES:
for (i = 0; i+1 < count; i += 2) {
- prim.v[0] = get_vertex( draw, start + i + 0 );
- prim.v[1] = get_vertex( draw, start + i + 1 );
-
- first->reset_stipple_counter( first );
- first->line( first, &prim );
+ do_line( draw,
+ TRUE,
+ start + i + 0,
+ start + i + 1);
}
break;
case GL_LINE_LOOP:
if (count >= 2) {
- first->reset_stipple_counter( first );
for (i = 1; i < count; i++) {
- prim.v[0] = get_vertex( draw, start + i - 1 );
- prim.v[1] = get_vertex( draw, start + i );
- first->line( first, &prim );
+ do_line( draw,
+ i == 1, /* XXX: only if vb not split */
+ start + i - 1,
+ start + i );
}
- prim.v[0] = get_vertex( draw, start + count - 1 );
- prim.v[1] = get_vertex( draw, start + 0 );
- first->line( first, &prim );
+ do_line( draw,
+ 0,
+ start + count - 1,
+ start + 0 );
}
break;
case GL_LINE_STRIP:
if (count >= 2) {
- first->reset_stipple_counter( first );
- prim.v[0] = 0;
- prim.v[1] = get_vertex( draw, start + 0 );
-
for (i = 1; i < count; i++) {
- prim.v[0] = prim.v[1];
- prim.v[1] = get_vertex( draw, start + i );
-
- first->line( first, &prim );
+ do_line( draw,
+ i == 1,
+ start + i - 1,
+ start + i );
}
}
break;
case GL_TRIANGLES:
for (i = 0; i+2 < count; i += 3) {
- prim.v[0] = get_vertex( draw, start + i + 0 );
- prim.v[1] = get_vertex( draw, start + i + 1 );
- prim.v[2] = get_vertex( draw, start + i + 2 );
-
- first->tri( first, &prim );
+ do_ef_triangle( draw,
+ 1,
+ ~0,
+ start + i + 0,
+ start + i + 1,
+ start + i + 2 );
}
break;
case GL_TRIANGLE_STRIP:
for (i = 0; i+2 < count; i++) {
if (i & 1) {
- prim.v[0] = get_vertex( draw, start + i + 1 );
- prim.v[1] = get_vertex( draw, start + i + 0 );
- prim.v[2] = get_vertex( draw, start + i + 2 );
+ do_triangle( draw,
+ start + i + 1,
+ start + i + 0,
+ start + i + 2 );
}
else {
- prim.v[0] = get_vertex( draw, start + i + 0 );
- prim.v[1] = get_vertex( draw, start + i + 1 );
- prim.v[2] = get_vertex( draw, start + i + 2 );
+ do_triangle( draw,
+ start + i + 0,
+ start + i + 1,
+ start + i + 2 );
}
-
- first->tri( first, &prim );
}
break;
case GL_TRIANGLE_FAN:
if (count >= 3) {
- prim.v[0] = get_vertex( draw, start + 0 );
- prim.v[1] = 0;
- prim.v[2] = get_vertex( draw, start + 1 );
-
for (i = 0; i+2 < count; i++) {
- prim.v[1] = prim.v[2];
- prim.v[2] = get_vertex( draw, start + i + 2 );
-
- first->tri( first, &prim );
+ do_triangle( draw,
+ start + 0,
+ start + i + 1,
+ start + i + 2 );
}
}
break;
@@ -397,48 +418,42 @@ static void draw_prim( struct draw_context *draw,
case GL_QUADS:
for (i = 0; i+3 < count; i += 4) {
- do_quad( first,
- get_vertex( draw, start + i + 0 ),
- get_vertex( draw, start + i + 1 ),
- get_vertex( draw, start + i + 2 ),
- get_vertex( draw, start + i + 3 ));
+ do_quad( draw,
+ start + i + 0,
+ start + i + 1,
+ start + i + 2,
+ start + i + 3);
}
break;
case GL_QUAD_STRIP:
for (i = 0; i+3 < count; i += 2) {
- do_quad( first,
- get_vertex( draw, start + i + 2 ),
- get_vertex( draw, start + i + 0 ),
- get_vertex( draw, start + i + 1 ),
- get_vertex( draw, start + i + 3 ));
+ do_quad( draw,
+ start + i + 2,
+ start + i + 0,
+ start + i + 1,
+ start + i + 3);
}
break;
case GL_POLYGON:
if (count >= 3) {
- int e1save, e2save;
- prim.v[0] = 0;
- prim.v[1] = get_vertex( draw, start + 1 );
- prim.v[2] = get_vertex( draw, start + 0 );
- e2save = prim.v[2]->edgeflag;
+ unsigned ef_mask = (1<<2) | (1<<0);
for (i = 0; i+2 < count; i++) {
- prim.v[0] = prim.v[1];
- prim.v[1] = get_vertex( draw, start + i + 2 );
- /* save v1 edge flag, and clear if not last triangle */
- e1save = prim.v[1]->edgeflag;
- if (i + 3 < count)
- prim.v[1]->edgeflag = 0;
+ if (i + 3 >= count)
+ ef_mask |= (1<<1);
- /* draw */
- first->tri( first, &prim );
+ do_ef_triangle( draw,
+ i == 0,
+ ef_mask,
+ start + i + 1,
+ start + i + 2,
+ start + i + 0);
- prim.v[1]->edgeflag = e1save; /* restore */
- prim.v[2]->edgeflag = 0; /* disable edge after 1st tri */
+ ef_mask &= ~(1<<2);
}
- prim.v[2]->edgeflag = e2save;
}
break;
@@ -449,10 +464,18 @@ static void draw_prim( struct draw_context *draw,
}
-static void draw_release_vertices( struct draw_context *draw )
+static void draw_allocate_vertices( struct draw_context *draw,
+ GLuint nr_vertices )
{
- draw->pipeline.first->end( draw->pipeline.first );
+ draw->nr_vertices = nr_vertices;
+ draw->verts = (GLubyte *) malloc( nr_vertices * draw->vertex_size );
+ draw_invalidate_vcache( draw );
+}
+
+
+static void draw_release_vertices( struct draw_context *draw )
+{
free(draw->verts);
draw->verts = NULL;
}
@@ -598,6 +621,8 @@ void draw_vb(struct draw_context *draw,
draw->in_vb = 1;
+ draw->pipeline.first->begin( draw->pipeline.first );
+
/* Allocate the vertices:
*/
draw_allocate_vertices( draw, VB->Count );
@@ -605,11 +630,14 @@ void draw_vb(struct draw_context *draw,
/* Bind the vb outputs:
*/
vf_set_sources( draw->vf, VB->AttribPtr, 0 );
-
- /* Build the hardware or prim-pipe vertices:
- */
vf_emit_vertices( draw->vf, VB->Count, draw->verts );
+ draw->elts = VB->Elts;
+
+ if (VB->Elts)
+ draw->get_vertex = get_uint_elt_vertex;
+ else
+ draw->get_vertex = get_vertex;
for (i = 0; i < VB->PrimitiveCount; i++) {
@@ -628,21 +656,15 @@ void draw_vb(struct draw_context *draw,
if (draw->prim != mode)
draw_set_prim( draw, mode );
- if (VB->Elts) {
- draw_indexed_prim( draw,
- VB->Elts + start,
- length );
- }
- else {
- draw_prim( draw,
- start,
- length );
- }
+ draw_prim( draw, start, length );
}
+ draw_flush(draw);
+ draw->pipeline.first->end( draw->pipeline.first );
draw_release_vertices( draw );
draw->verts = NULL;
draw->in_vb = 0;
+ draw->elts = NULL;
}
@@ -661,11 +683,17 @@ draw_vertices(struct draw_context *draw,
assert(mode <= GL_POLYGON);
+ draw->get_vertex = get_vertex;
draw->vertex_size
= sizeof(struct vertex_header) + numAttrs * 4 * sizeof(GLfloat);
+
+
+
/*draw_prim_info(mode, &first, &incr);*/
draw_allocate_vertices( draw, numVerts );
+ draw->pipeline.first->begin( draw->pipeline.first );
+
if (draw->prim != mode)
draw_set_prim( draw, mode );
@@ -694,6 +722,9 @@ draw_vertices(struct draw_context *draw,
/* draw */
draw_prim(draw, 0, numVerts);
+ draw_flush(draw);
+ draw->pipeline.first->end( draw->pipeline.first );
+
/* clean up */
draw_release_vertices( draw );
@@ -759,8 +790,6 @@ void draw_set_vertex_attributes( struct draw_context *draw,
}
-#define MAX_VERTEX_SIZE ((2 + FRAG_ATTRIB_MAX) * 4 * sizeof(GLfloat))
-
void draw_alloc_tmps( struct draw_stage *stage, GLuint nr )
{
stage->nr_tmps = nr;
diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h
index 7635755947..c0685fa8cb 100644
--- a/src/mesa/pipe/p_context.h
+++ b/src/mesa/pipe/p_context.h
@@ -136,7 +136,15 @@ struct pipe_context {
void (*set_viewport_state)( struct pipe_context *,
const struct pipe_viewport_state * );
-
+ void (*set_vertex_buffer)( struct pipe_context *,
+ unsigned index,
+ struct pipe_vertex_buffer * );
+
+ void (*set_vertex_element)( struct pipe_context *,
+ unsigned index,
+ struct pipe_vertex_element * );
+
+
/*
* Surface functions
* This might go away...
diff --git a/src/mesa/pipe/p_defines.h b/src/mesa/pipe/p_defines.h
index e6aff6fb49..addbb026bf 100644
--- a/src/mesa/pipe/p_defines.h
+++ b/src/mesa/pipe/p_defines.h
@@ -162,8 +162,15 @@
/**
* Texture/surface image formats (preliminary)
*/
+
+/* KW: Added lots of surface formats to support vertex element layout
+ * definitions, and eventually render-to-vertex-buffer. Could
+ * consider making float/int/uint/scaled/normalized a separate
+ * parameter, but on the other hand there are special cases like
+ * z24s8, compressed textures, ycbcr, etc that won't fit that model.
+ */
+
#define PIPE_FORMAT_NONE 0 /**< unstructured */
-#define PIPE_FORMAT_U_R8_G8_B8_A8 1 /**< ubyte[4] RGBA */
#define PIPE_FORMAT_U_A8_R8_G8_B8 2 /**< ubyte[4] ARGB */
#define PIPE_FORMAT_U_A1_R5_G5_B5 3 /**< 16-bit packed RGBA */
#define PIPE_FORMAT_U_A4_R4_G4_B4 4 /**< 16-bit packed RGBA */
@@ -180,8 +187,68 @@
#define PIPE_FORMAT_F_Z32 15 /**< float Z/depth */
#define PIPE_FORMAT_S8_Z24 16 /**< 8-bit stencil + 24-bit Z */
#define PIPE_FORMAT_U_S8 17 /**< 8-bit stencil */
-#define PIPE_FORMAT_COUNT 18 /**< number of formats */
+#define PIPE_FORMAT_R64_FLOAT 0x20
+#define PIPE_FORMAT_R64G64_FLOAT 0x21
+#define PIPE_FORMAT_R64G64B64_FLOAT 0x22
+#define PIPE_FORMAT_R64G64B64A64_FLOAT 0x23
+#define PIPE_FORMAT_R32_FLOAT 0x24
+#define PIPE_FORMAT_R32G32_FLOAT 0x25
+#define PIPE_FORMAT_R32G32B32_FLOAT 0x26
+#define PIPE_FORMAT_R32G32B32A32_FLOAT 0x27
+#define PIPE_FORMAT_R32_UNORM 0x28
+#define PIPE_FORMAT_R32G32_UNORM 0x29
+#define PIPE_FORMAT_R32G32B32_UNORM 0x2a
+#define PIPE_FORMAT_R32G32B32A32_UNORM 0x2b
+#define PIPE_FORMAT_R32_USCALED 0x2c
+#define PIPE_FORMAT_R32G32_USCALED 0x2d
+#define PIPE_FORMAT_R32G32B32_USCALED 0x2e
+#define PIPE_FORMAT_R32G32B32A32_USCALED 0x2f
+#define PIPE_FORMAT_R32_SNORM 0x30
+#define PIPE_FORMAT_R32G32_SNORM 0x31
+#define PIPE_FORMAT_R32G32B32_SNORM 0x32
+#define PIPE_FORMAT_R32G32B32A32_SNORM 0x33
+#define PIPE_FORMAT_R32_SSCALED 0x34
+#define PIPE_FORMAT_R32G32_SSCALED 0x35
+#define PIPE_FORMAT_R32G32B32_SSCALED 0x36
+#define PIPE_FORMAT_R32G32B32A32_SSCALED 0x37
+#define PIPE_FORMAT_R16_UNORM 0x38
+#define PIPE_FORMAT_R16G16_UNORM 0x39
+#define PIPE_FORMAT_R16G16B16_UNORM 0x3a
+#define PIPE_FORMAT_R16G16B16A16_UNORM 0x3b
+#define PIPE_FORMAT_R16_USCALED 0x3c
+#define PIPE_FORMAT_R16G16_USCALED 0x3d
+#define PIPE_FORMAT_R16G16B16_USCALED 0x3e
+#define PIPE_FORMAT_R16G16B16A16_USCALED 0x3f
+#define PIPE_FORMAT_R16_SNORM 0x40
+#define PIPE_FORMAT_R16G16_SNORM 0x41
+#define PIPE_FORMAT_R16G16B16_SNORM 0x42
+#define PIPE_FORMAT_R16G16B16A16_SNORM 0x43
+#define PIPE_FORMAT_R16_SSCALED 0x44
+#define PIPE_FORMAT_R16G16_SSCALED 0x45
+#define PIPE_FORMAT_R16G16B16_SSCALED 0x46
+#define PIPE_FORMAT_R16G16B16A16_SSCALED 0x47
+#define PIPE_FORMAT_R8_UNORM 0x48
+#define PIPE_FORMAT_R8G8_UNORM 0x49
+#define PIPE_FORMAT_R8G8B8_UNORM 0x4a
+#define PIPE_FORMAT_R8G8B8A8_UNORM 0x4b
+#define PIPE_FORMAT_R8_USCALED 0x4c
+#define PIPE_FORMAT_R8G8_USCALED 0x4d
+#define PIPE_FORMAT_R8G8B8_USCALED 0x4e
+#define PIPE_FORMAT_R8G8B8A8_USCALED 0x4f
+#define PIPE_FORMAT_R8_SNORM 0x50
+#define PIPE_FORMAT_R8G8_SNORM 0x51
+#define PIPE_FORMAT_R8G8B8_SNORM 0x52
+#define PIPE_FORMAT_R8G8B8A8_SNORM 0x53
+#define PIPE_FORMAT_R8_SSCALED 0x54
+#define PIPE_FORMAT_R8G8_SSCALED 0x55
+#define PIPE_FORMAT_R8G8B8_SSCALED 0x56
+#define PIPE_FORMAT_R8G8B8A8_SSCALED 0x57
+#define PIPE_FORMAT_COUNT 0x58 /**< number of formats */
+
+/* Duplicated formats:
+ */
+#define PIPE_FORMAT_U_R8_G8_B8_A8 PIPE_FORMAT_R8G8B8A8_UNORM
/**
* Surface flags
diff --git a/src/mesa/pipe/p_state.h b/src/mesa/pipe/p_state.h
index dc2b589e55..5051ebbfc0 100644
--- a/src/mesa/pipe/p_state.h
+++ b/src/mesa/pipe/p_state.h
@@ -320,4 +320,25 @@ struct pipe_mipmap_tree
};
+
+struct pipe_vertex_buffer
+{
+ unsigned pitch:11;
+ unsigned max_index;
+ struct pipe_buffer_handle *buffer;
+ unsigned buffer_offset;
+};
+
+
+
+struct pipe_vertex_element
+{
+ unsigned src_offset:11;
+ unsigned vertex_buffer_index:5;
+ unsigned dst_offset:8;
+ unsigned src_format:8; /* PIPE_FORMAT_* */
+};
+
+
+
#endif
diff --git a/src/mesa/pipe/p_util.h b/src/mesa/pipe/p_util.h
index 979befb194..50d57a2ed0 100644
--- a/src/mesa/pipe/p_util.h
+++ b/src/mesa/pipe/p_util.h
@@ -28,25 +28,14 @@
#define P_UTIL_H
#include "p_compiler.h"
+#include <math.h>
#define CALLOC_STRUCT(T) (struct T *) calloc(1, sizeof(struct T))
-
-
-/** Clamp X to [MIN,MAX] */
#define CLAMP( X, MIN, MAX ) ( (X)<(MIN) ? (MIN) : ((X)>(MAX) ? (MAX) : (X)) )
-
-/** Assign X to CLAMP(X, MIN, MAX) */
-#define CLAMP_SELF(x, mn, mx) \
- ( (x)<(mn) ? ((x) = (mn)) : ((x)>(mx) ? ((x)=(mx)) : (x)) )
-
-/** Minimum of two values: */
#define MIN2( A, B ) ( (A)<(B) ? (A) : (B) )
-
-/** Maximum of two values: */
#define MAX2( A, B ) ( (A)>(B) ? (A) : (B) )
-
#define Elements(x) sizeof(x)/sizeof(*(x))
union fi {
@@ -114,4 +103,74 @@ static INLINE unsigned pack_ui32_float4( float a,
float_to_ubyte(d) );
}
+#define COPY_4V( DST, SRC ) \
+do { \
+ (DST)[0] = (SRC)[0]; \
+ (DST)[1] = (SRC)[1]; \
+ (DST)[2] = (SRC)[2]; \
+ (DST)[3] = (SRC)[3]; \
+} while (0)
+
+
+static INLINE int ifloor(float f)
+{
+ int ai, bi;
+ double af, bf;
+ union fi u;
+
+ af = (3 << 22) + 0.5 + (double)f;
+ bf = (3 << 22) + 0.5 - (double)f;
+ u.f = (float) af; ai = u.i;
+ u.f = (float) bf; bi = u.i;
+ return (ai - bi) >> 1;
+}
+
+
+#if defined(__GNUC__) && defined(__i386__)
+static INLINE int iround(float f)
+{
+ int r;
+ __asm__ ("fistpl %0" : "=m" (r) : "t" (f) : "st");
+ return r;
+}
+#elif defined(__MSC__) && defined(__WIN32__)
+static INLINE int iround(float f)
+{
+ int r;
+ _asm {
+ fld f
+ fistp r
+ }
+ return r;
+}
+#else
+#define IROUND(f) ((int) (((f) >= 0.0F) ? ((f) + 0.5F) : ((f) - 0.5F)))
+#endif
+
+
+/* Could maybe have an inline version of this?
+ */
+#if defined(__GNUC__)
+#define FABSF(x) fabsf(x)
+#else
+#define FABSF(x) ((GLfloat) fabs(x))
+#endif
+
+/* Pretty fast, and accurate.
+ * Based on code from http://www.flipcode.com/totd/
+ */
+static INLINE float LOG2(float val)
+{
+ union fi num;
+ int log_2;
+
+ num.f = val;
+ log_2 = ((num.i >> 23) & 255) - 128;
+ num.i &= ~(255 << 23);
+ num.i += 127 << 23;
+ num.f = ((-1.0f/3) * num.f + 2) * num.f - 2.0f/3;
+ return num.f + log_2;
+}
+
+
#endif
diff --git a/src/mesa/pipe/softpipe/sp_clear.c b/src/mesa/pipe/softpipe/sp_clear.c
index 14ddf0c306..2774413720 100644
--- a/src/mesa/pipe/softpipe/sp_clear.c
+++ b/src/mesa/pipe/softpipe/sp_clear.c
@@ -35,7 +35,7 @@
#include "sp_context.h"
#include "sp_surface.h"
#include "sp_state.h"
-#include "colormac.h"
+//#include "colormac.h"
/**
@@ -47,7 +47,7 @@ softpipe_clear(struct pipe_context *pipe, struct pipe_surface *ps,
unsigned clearValue)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
- GLint x, y, w, h;
+ int x, y, w, h;
softpipe_update_derived(softpipe); /* not needed?? */
diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c
index 34ef00f619..1ea6bbbf7f 100644
--- a/src/mesa/pipe/softpipe/sp_context.c
+++ b/src/mesa/pipe/softpipe/sp_context.c
@@ -29,10 +29,9 @@
* Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "main/imports.h"
-#include "main/macros.h"
#include "pipe/draw/draw_context.h"
#include "pipe/p_defines.h"
+#include "pipe/p_util.h"
#include "sp_clear.h"
#include "sp_context.h"
#include "sp_flush.h"
@@ -50,11 +49,11 @@
* If we find texture and drawable support differs, add a selector
* parameter or another function.
*/
-static const GLuint *
-softpipe_supported_formats(struct pipe_context *pipe, GLuint *numFormats)
+static const unsigned *
+softpipe_supported_formats(struct pipe_context *pipe, unsigned *numFormats)
{
#if 0
- static const GLuint supported[] = {
+ static const unsigned supported[] = {
PIPE_FORMAT_U_R8_G8_B8_A8,
PIPE_FORMAT_U_A8_R8_G8_B8,
PIPE_FORMAT_U_R5_G6_B5,
@@ -82,9 +81,9 @@ softpipe_supported_formats(struct pipe_context *pipe, GLuint *numFormats)
static void
-softpipe_max_texture_size(struct pipe_context *pipe, GLuint textureType,
- GLuint *maxWidth, GLuint *maxHeight,
- GLuint *maxDepth)
+softpipe_max_texture_size(struct pipe_context *pipe, unsigned textureType,
+ unsigned *maxWidth, unsigned *maxHeight,
+ unsigned *maxDepth)
{
switch (textureType) {
case PIPE_TEXTURE_1D:
@@ -112,7 +111,7 @@ softpipe_max_texture_size(struct pipe_context *pipe, GLuint textureType,
static void map_surfaces(struct softpipe_context *sp)
{
struct pipe_context *pipe = &sp->pipe;
- GLuint i;
+ unsigned i;
for (i = 0; i < sp->framebuffer.num_cbufs; i++) {
struct softpipe_surface *sps = softpipe_surface(sp->framebuffer.cbufs[i]);
@@ -147,7 +146,7 @@ static void map_surfaces(struct softpipe_context *sp)
static void unmap_surfaces(struct softpipe_context *sp)
{
struct pipe_context *pipe = &sp->pipe;
- GLuint i;
+ unsigned i;
for (i = 0; i < sp->framebuffer.num_cbufs; i++) {
struct softpipe_surface *sps = softpipe_surface(sp->framebuffer.cbufs[i]);
@@ -206,9 +205,9 @@ static void softpipe_draw_vb( struct pipe_context *pipe,
static void
softpipe_draw_vertices(struct pipe_context *pipe,
- GLuint mode,
- GLuint numVertex, const GLfloat *verts,
- GLuint numAttribs, const GLuint attribs[])
+ unsigned mode,
+ unsigned numVertex, const float *verts,
+ unsigned numAttribs, const unsigned attribs[])
{
struct softpipe_context *softpipe = softpipe_context( pipe );
@@ -230,7 +229,7 @@ static void softpipe_reset_occlusion_counter(struct pipe_context *pipe)
}
/* XXX pipe param should be const */
-static GLuint softpipe_get_occlusion_counter(struct pipe_context *pipe)
+static unsigned softpipe_get_occlusion_counter(struct pipe_context *pipe)
{
struct softpipe_context *softpipe = softpipe_context( pipe );
return softpipe->occlusion_counter;
diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h
index a99c083caa..8887c576c1 100644
--- a/src/mesa/pipe/softpipe/sp_context.h
+++ b/src/mesa/pipe/softpipe/sp_context.h
@@ -31,7 +31,7 @@
#ifndef SP_CONTEXT_H
#define SP_CONTEXT_H
-#include "glheader.h"
+//#include "glheader.h"
#include "pipe/p_state.h"
#include "pipe/p_context.h"
@@ -88,7 +88,7 @@ struct softpipe_context {
struct pipe_stencil_state stencil;
struct pipe_mipmap_tree *texture[PIPE_MAX_SAMPLERS];
struct pipe_viewport_state viewport;
- GLuint dirty;
+ unsigned dirty;
/* Setup derived state. TODO: this should be passed in the program
* tokens as parameters to DECL instructions.
@@ -103,28 +103,28 @@ struct softpipe_context {
*/
/** Map fragment program attribute to quad/coef array slot */
- GLuint fp_attr_to_slot[PIPE_ATTRIB_MAX];
+ unsigned fp_attr_to_slot[PIPE_ATTRIB_MAX];
/** Map vertex format attribute to a vertex attribute slot */
- GLuint vf_attr_to_slot[PIPE_ATTRIB_MAX];
- GLuint nr_attrs;
- GLuint nr_frag_attrs; /**< number of active fragment attribs */
- GLbitfield attr_mask; /**< bitfield of VF_ATTRIB_ indexes/bits */
+ unsigned vf_attr_to_slot[PIPE_ATTRIB_MAX];
+ unsigned nr_attrs;
+ unsigned nr_frag_attrs; /**< number of active fragment attribs */
+ unsigned attr_mask; /**< bitfield of VF_ATTRIB_ indexes/bits */
- GLboolean need_z; /**< produce quad/fragment Z values? */
- GLboolean need_w; /**< produce quad/fragment W values? */
+ boolean need_z; /**< produce quad/fragment Z values? */
+ boolean need_w; /**< produce quad/fragment W values? */
#if 0
/* Stipple derived state:
*/
- GLubyte stipple_masks[16][16];
+ ubyte stipple_masks[16][16];
#endif
/** Derived from scissor and surface bounds: */
struct pipe_scissor_state cliprect;
- GLuint occlusion_counter;
+ unsigned occlusion_counter;
- GLuint line_stipple_counter;
+ unsigned line_stipple_counter;
/** Software quad rendering pipeline */
struct {
diff --git a/src/mesa/pipe/softpipe/sp_headers.h b/src/mesa/pipe/softpipe/sp_headers.h
index 68a84621f2..b7f46cb658 100644
--- a/src/mesa/pipe/softpipe/sp_headers.h
+++ b/src/mesa/pipe/softpipe/sp_headers.h
@@ -57,9 +57,9 @@
struct setup_coefficient {
- GLfloat a0[NUM_CHANNELS]; /* in an xyzw layout */
- GLfloat dadx[NUM_CHANNELS];
- GLfloat dady[NUM_CHANNELS];
+ float a0[NUM_CHANNELS]; /* in an xyzw layout */
+ float dadx[NUM_CHANNELS];
+ float dady[NUM_CHANNELS];
};
@@ -69,18 +69,18 @@ struct setup_coefficient {
* "Channel-Serial" or "SoA" layout.
*/
struct quad_header {
- GLint x0;
- GLint y0;
- GLuint mask:4;
- GLuint facing:1; /**< Front (0) or back (1) facing? */
- GLuint prim:2; /**< PRIM_POINT, LINE, TRI */
+ int x0;
+ int y0;
+ unsigned mask:4;
+ unsigned facing:1; /**< Front (0) or back (1) facing? */
+ unsigned prim:2; /**< PRIM_POINT, LINE, TRI */
struct {
- GLfloat color[4][QUAD_SIZE]; /* rrrr, gggg, bbbb, aaaa */
- GLfloat depth[QUAD_SIZE];
+ float color[4][QUAD_SIZE]; /* rrrr, gggg, bbbb, aaaa */
+ float depth[QUAD_SIZE];
} outputs;
- GLfloat coverage[QUAD_SIZE]; /** fragment coverage for antialiasing */
+ float coverage[QUAD_SIZE]; /** fragment coverage for antialiasing */
const struct setup_coefficient *coef;
@@ -88,7 +88,7 @@ struct quad_header {
* encoded in fragment program DECL
* statements. */
- GLuint nr_attrs;
+ unsigned nr_attrs;
};
diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.c b/src/mesa/pipe/softpipe/sp_prim_setup.c
index 7a3d011b7b..45d09860c3 100644
--- a/src/mesa/pipe/softpipe/sp_prim_setup.c
+++ b/src/mesa/pipe/softpipe/sp_prim_setup.c
@@ -33,25 +33,26 @@
*/
-#include "imports.h"
-#include "macros.h"
+//#include "imports.h"
+//#include "macros.h"
#include "sp_context.h"
#include "sp_headers.h"
-#include "pipe/draw/draw_private.h"
#include "sp_quad.h"
#include "sp_prim_setup.h"
+#include "pipe/draw/draw_private.h"
+#include "pipe/p_util.h"
/**
* Triangle edge info
*/
struct edge {
- GLfloat dx; /**< X(v1) - X(v0), used only during setup */
- GLfloat dy; /**< Y(v1) - Y(v0), used only during setup */
- GLfloat dxdy; /**< dx/dy */
- GLfloat sx, sy; /**< first sample point coord */
- GLint lines; /**< number of lines on this edge */
+ float dx; /**< X(v1) - X(v0), used only during setup */
+ float dy; /**< Y(v1) - Y(v0), used only during setup */
+ float dxdy; /**< dx/dy */
+ float sx, sy; /**< first sample point coord */
+ int lines; /**< number of lines on this edge */
};
@@ -77,17 +78,17 @@ struct setup_stage {
struct edge etop;
struct edge emaj;
- GLfloat oneoverarea;
+ float oneoverarea;
struct setup_coefficient coef[FRAG_ATTRIB_MAX];
struct quad_header quad;
struct {
- GLint left[2]; /**< [0] = row0, [1] = row1 */
- GLint right[2];
- GLint y;
- GLuint y_flags;
- GLuint mask; /**< mask of MASK_BOTTOM/TOP_LEFT/RIGHT bits */
+ int left[2]; /**< [0] = row0, [1] = row1 */
+ int right[2];
+ int y;
+ unsigned y_flags;
+ unsigned mask; /**< mask of MASK_BOTTOM/TOP_LEFT/RIGHT bits */
} span;
};
@@ -146,7 +147,7 @@ clip_emit_quad(struct setup_stage *setup)
* Emit a quad (pass to next stage). No clipping is done.
*/
static INLINE void
-emit_quad( struct setup_stage *setup, GLint x, GLint y, GLuint mask )
+emit_quad( struct setup_stage *setup, int x, int y, unsigned mask )
{
struct softpipe_context *sp = setup->softpipe;
setup->quad.x0 = x;
@@ -160,7 +161,7 @@ emit_quad( struct setup_stage *setup, GLint x, GLint y, GLuint mask )
* Given an X or Y coordinate, return the block/quad coordinate that it
* belongs to.
*/
-static INLINE GLint block( GLint x )
+static INLINE int block( int x )
{
return x & ~1;
}
@@ -173,10 +174,10 @@ static INLINE GLint block( GLint x )
* this is pretty nasty... may need to rework flush_spans again to
* fix it, if possible.
*/
-static GLuint calculate_mask( struct setup_stage *setup,
- GLint x )
+static unsigned calculate_mask( struct setup_stage *setup,
+ int x )
{
- GLuint mask = 0;
+ unsigned mask = 0;
if (x >= setup->span.left[0] && x < setup->span.right[0])
mask |= MASK_BOTTOM_LEFT;
@@ -199,8 +200,8 @@ static GLuint calculate_mask( struct setup_stage *setup,
*/
static void flush_spans( struct setup_stage *setup )
{
- GLint minleft, maxright;
- GLint x;
+ int minleft, maxright;
+ int x;
switch (setup->span.y_flags) {
case 3:
@@ -249,7 +250,7 @@ static void print_vertex(const struct setup_stage *setup,
}
#endif
-static GLboolean setup_sort_vertices( struct setup_stage *setup,
+static boolean setup_sort_vertices( struct setup_stage *setup,
const struct prim_header *prim )
{
const struct vertex_header *v0 = prim->v[0];
@@ -267,9 +268,9 @@ static GLboolean setup_sort_vertices( struct setup_stage *setup,
/* determine bottom to top order of vertices */
{
- GLfloat y0 = v0->data[0][1];
- GLfloat y1 = v1->data[0][1];
- GLfloat y2 = v2->data[0][1];
+ float y0 = v0->data[0][1];
+ float y1 = v1->data[0][1];
+ float y2 = v2->data[0][1];
if (y0 <= y1) {
if (y1 <= y2) {
/* y0<=y1<=y2 */
@@ -330,7 +331,7 @@ static GLboolean setup_sort_vertices( struct setup_stage *setup,
* use the prim->det value because its sign is correct.
*/
{
- const GLfloat area = (setup->emaj.dx * setup->ebot.dy -
+ const float area = (setup->emaj.dx * setup->ebot.dy -
setup->ebot.dx * setup->emaj.dy);
setup->oneoverarea = 1.0 / area;
@@ -346,7 +347,7 @@ static GLboolean setup_sort_vertices( struct setup_stage *setup,
*/
setup->quad.facing = (prim->det > 0.0) ^ (setup->softpipe->setup.front_winding == PIPE_WINDING_CW);
- return GL_TRUE;
+ return TRUE;
}
@@ -358,8 +359,8 @@ static GLboolean setup_sort_vertices( struct setup_stage *setup,
* \param i which component of the slot (0..3)
*/
static void const_coeff( struct setup_stage *setup,
- GLuint slot,
- GLuint i )
+ unsigned slot,
+ unsigned i )
{
assert(slot < FRAG_ATTRIB_MAX);
assert(i <= 3);
@@ -378,13 +379,13 @@ static void const_coeff( struct setup_stage *setup,
* for a triangle.
*/
static void tri_linear_coeff( struct setup_stage *setup,
- GLuint slot,
- GLuint i)
+ unsigned slot,
+ unsigned i)
{
- GLfloat botda = setup->vmid->data[slot][i] - setup->vmin->data[slot][i];
- GLfloat majda = setup->vmax->data[slot][i] - setup->vmin->data[slot][i];
- GLfloat a = setup->ebot.dy * majda - botda * setup->emaj.dy;
- GLfloat b = setup->emaj.dx * botda - majda * setup->ebot.dx;
+ float botda = setup->vmid->data[slot][i] - setup->vmin->data[slot][i];
+ float majda = setup->vmax->data[slot][i] - setup->vmin->data[slot][i];
+ float a = setup->ebot.dy * majda - botda * setup->emaj.dy;
+ float b = setup->emaj.dx * botda - majda * setup->ebot.dx;
assert(slot < FRAG_ATTRIB_MAX);
assert(i <= 3);
@@ -423,19 +424,19 @@ static void tri_linear_coeff( struct setup_stage *setup,
* for a triangle.
*/
static void tri_persp_coeff( struct setup_stage *setup,
- GLuint slot,
- GLuint i )
+ unsigned slot,
+ unsigned i )
{
/* premultiply by 1/w:
*/
- GLfloat mina = setup->vmin->data[slot][i] * setup->vmin->data[0][3];
- GLfloat mida = setup->vmid->data[slot][i] * setup->vmid->data[0][3];
- GLfloat maxa = setup->vmax->data[slot][i] * setup->vmax->data[0][3];
-
- GLfloat botda = mida - mina;
- GLfloat majda = maxa - mina;
- GLfloat a = setup->ebot.dy * majda - botda * setup->emaj.dy;
- GLfloat b = setup->emaj.dx * botda - majda * setup->ebot.dx;
+ float mina = setup->vmin->data[slot][i] * setup->vmin->data[0][3];
+ float mida = setup->vmid->data[slot][i] * setup->vmid->data[0][3];
+ float maxa = setup->vmax->data[slot][i] * setup->vmax->data[0][3];
+
+ float botda = mida - mina;
+ float majda = maxa - mina;
+ float a = setup->ebot.dy * majda - botda * setup->emaj.dy;
+ float b = setup->emaj.dx * botda - majda * setup->ebot.dx;
assert(slot < FRAG_ATTRIB_MAX);
assert(i <= 3);
@@ -455,7 +456,7 @@ static void tri_persp_coeff( struct setup_stage *setup,
static void setup_tri_coefficients( struct setup_stage *setup )
{
const enum interp_mode *interp = setup->softpipe->interp;
- GLuint slot, j;
+ unsigned slot, j;
/* z and w are done by linear interpolation:
*/
@@ -488,25 +489,25 @@ static void setup_tri_coefficients( struct setup_stage *setup )
static void setup_tri_edges( struct setup_stage *setup )
{
- GLfloat vmin_x = setup->vmin->data[0][0] + 0.5;
- GLfloat vmid_x = setup->vmid->data[0][0] + 0.5;
+ float vmin_x = setup->vmin->data[0][0] + 0.5;
+ float vmid_x = setup->vmid->data[0][0] + 0.5;
- GLfloat vmin_y = setup->vmin->data[0][1] - 0.5;
- GLfloat vmid_y = setup->vmid->data[0][1] - 0.5;
- GLfloat vmax_y = setup->vmax->data[0][1] - 0.5;
+ float vmin_y = setup->vmin->data[0][1] - 0.5;
+ float vmid_y = setup->vmid->data[0][1] - 0.5;
+ float vmax_y = setup->vmax->data[0][1] - 0.5;
setup->emaj.sy = ceilf(vmin_y);
- setup->emaj.lines = (GLint) ceilf(vmax_y - setup->emaj.sy);
+ 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 = (GLint) ceilf(vmax_y - setup->etop.sy);
+ 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 = (GLint) ceilf(vmid_y - setup->ebot.sy);
+ 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;
}
@@ -519,13 +520,13 @@ static void setup_tri_edges( struct setup_stage *setup )
static void subtriangle( struct setup_stage *setup,
struct edge *eleft,
struct edge *eright,
- GLuint lines )
+ unsigned lines )
{
const struct pipe_scissor_state *cliprect = &setup->softpipe->cliprect;
- GLint y, start_y, finish_y;
- GLint sy = (GLint)eleft->sy;
+ int y, start_y, finish_y;
+ int sy = (int)eleft->sy;
- assert((GLint)eleft->sy == (GLint) eright->sy);
+ assert((int)eleft->sy == (int) eright->sy);
/* clip top/bottom */
start_y = sy;
@@ -552,8 +553,8 @@ static void subtriangle( struct setup_stage *setup,
*
* this is all drowned out by the attribute interpolation anyway.
*/
- GLint left = (GLint)(eleft->sx + y * eleft->dxdy);
- GLint right = (GLint)(eright->sx + y * eright->dxdy);
+ int left = (int)(eleft->sx + y * eleft->dxdy);
+ int right = (int)(eright->sx + y * eright->dxdy);
/* clip left/right */
if (left < cliprect->minx)
@@ -562,7 +563,7 @@ static void subtriangle( struct setup_stage *setup,
right = cliprect->maxx;
if (left < right) {
- GLint _y = sy+y;
+ int _y = sy+y;
if (block(_y) != setup->span.y) {
flush_spans(setup);
setup->span.y = block(_y);
@@ -633,11 +634,11 @@ static void setup_tri( struct draw_stage *stage,
* for a line.
*/
static void
-line_linear_coeff(struct setup_stage *setup, GLuint slot, GLuint i)
+line_linear_coeff(struct setup_stage *setup, unsigned slot, unsigned i)
{
- const GLfloat dz = setup->vmax->data[slot][i] - setup->vmin->data[slot][i];
- const GLfloat dadx = dz * setup->emaj.dx * setup->oneoverarea;
- const GLfloat dady = dz * setup->emaj.dy * setup->oneoverarea;
+ const float dz = setup->vmax->data[slot][i] - setup->vmin->data[slot][i];
+ const float dadx = dz * setup->emaj.dx * setup->oneoverarea;
+ const float dady = dz * setup->emaj.dy * setup->oneoverarea;
setup->coef[slot].dadx[i] = dadx;
setup->coef[slot].dady[i] = dady;
setup->coef[slot].a0[i]
@@ -652,7 +653,7 @@ line_linear_coeff(struct setup_stage *setup, GLuint slot, GLuint i)
* for a line.
*/
static void
-line_persp_coeff(struct setup_stage *setup, GLuint slot, GLuint i)
+line_persp_coeff(struct setup_stage *setup, unsigned slot, unsigned i)
{
/* XXX to do */
line_linear_coeff(setup, slot, i); /* XXX temporary */
@@ -667,7 +668,7 @@ static INLINE void
setup_line_coefficients(struct setup_stage *setup, struct prim_header *prim)
{
const enum interp_mode *interp = setup->softpipe->interp;
- GLuint slot, j;
+ unsigned slot, j;
/* use setup->vmin, vmax to point to vertices */
setup->vprovoke = prim->v[1];
@@ -712,13 +713,13 @@ setup_line_coefficients(struct setup_stage *setup, struct prim_header *prim)
* Plot a pixel in a line segment.
*/
static INLINE void
-plot(struct setup_stage *setup, GLint x, GLint y)
+plot(struct setup_stage *setup, int x, int y)
{
- const GLint iy = y & 1;
- const GLint ix = x & 1;
- const GLint quadX = x - ix;
- const GLint quadY = y - iy;
- const GLint mask = (1 << ix) << (2 * iy);
+ const int iy = y & 1;
+ const int ix = x & 1;
+ const int quadX = x - ix;
+ const int quadY = y - iy;
+ const int mask = (1 << ix) << (2 * iy);
if (quadX != setup->quad.x0 ||
quadY != setup->quad.y0)
@@ -741,10 +742,10 @@ plot(struct setup_stage *setup, GLint x, GLint y)
* Determine whether or not to emit a line fragment by checking
* line stipple pattern.
*/
-static INLINE GLuint
-stipple_test(GLint counter, GLushort pattern, GLint factor)
+static INLINE unsigned
+stipple_test(int counter, ushort pattern, int factor)
{
- GLint b = (counter / factor) & 0xf;
+ int b = (counter / factor) & 0xf;
return (1 << b) & pattern;
}
@@ -761,13 +762,13 @@ setup_line(struct draw_stage *stage, struct prim_header *prim)
struct setup_stage *setup = setup_stage( stage );
struct softpipe_context *sp = setup->softpipe;
- GLint x0 = (GLint) v0->data[0][0];
- GLint x1 = (GLint) v1->data[0][0];
- GLint y0 = (GLint) v0->data[0][1];
- GLint y1 = (GLint) v1->data[0][1];
- GLint dx = x1 - x0;
- GLint dy = y1 - y0;
- GLint xstep, ystep;
+ int x0 = (int) v0->data[0][0];
+ int x1 = (int) v1->data[0][0];
+ int y0 = (int) v0->data[0][1];
+ int y1 = (int) v1->data[0][1];
+ int dx = x1 - x0;
+ int dy = y1 - y0;
+ int xstep, ystep;
if (dx == 0 && dy == 0)
return;
@@ -806,10 +807,10 @@ setup_line(struct draw_stage *stage, struct prim_header *prim)
if (dx > dy) {
/*** X-major line ***/
- GLint i;
- const GLint errorInc = dy + dy;
- GLint error = errorInc - dx;
- const GLint errorDec = error - dx;
+ int i;
+ const int errorInc = dy + dy;
+ int error = errorInc - dx;
+ const int errorDec = error - dx;
for (i = 0; i < dx; i++) {
if (!sp->setup.line_stipple_enable ||
@@ -833,10 +834,10 @@ setup_line(struct draw_stage *stage, struct prim_header *prim)
}
else {
/*** Y-major line ***/
- GLint i;
- const GLint errorInc = dx + dx;
- GLint error = errorInc - dy;
- const GLint errorDec = error - dy;
+ int i;
+ const int errorInc = dx + dx;
+ int error = errorInc - dy;
+ const int errorDec = error - dy;
for (i = 0; i < dy; i++) {
if (!sp->setup.line_stipple_enable ||
@@ -877,12 +878,12 @@ setup_point(struct draw_stage *stage, struct prim_header *prim)
{
struct setup_stage *setup = setup_stage( stage );
/*XXX this should be a vertex attrib! */
- const GLfloat halfSize = 0.5 * setup->softpipe->setup.point_size;
- const GLboolean round = setup->softpipe->setup.point_smooth;
+ const float halfSize = 0.5 * setup->softpipe->setup.point_size;
+ const boolean round = setup->softpipe->setup.point_smooth;
const struct vertex_header *v0 = prim->v[0];
- const GLfloat x = v0->data[FRAG_ATTRIB_WPOS][0];
- const GLfloat y = v0->data[FRAG_ATTRIB_WPOS][1];
- GLuint slot, j;
+ const float x = v0->data[FRAG_ATTRIB_WPOS][0];
+ const float y = v0->data[FRAG_ATTRIB_WPOS][1];
+ unsigned slot, j;
/* For points, all interpolants are constant-valued.
* However, for point sprites, we'll need to setup texcoords appropriately.
@@ -912,31 +913,31 @@ setup_point(struct draw_stage *stage, struct prim_header *prim)
if (halfSize <= 0.5 && !round) {
/* special case for 1-pixel points */
- const GLint ix = ((GLint) x) & 1;
- const GLint iy = ((GLint) y) & 1;
+ const int ix = ((int) x) & 1;
+ const int iy = ((int) y) & 1;
setup->quad.x0 = x - ix;
setup->quad.y0 = y - iy;
setup->quad.mask = (1 << ix) << (2 * iy);
clip_emit_quad(setup);
}
else {
- const GLint ixmin = block((GLint) (x - halfSize));
- const GLint ixmax = block((GLint) (x + halfSize));
- const GLint iymin = block((GLint) (y - halfSize));
- const GLint iymax = block((GLint) (y + halfSize));
- GLint ix, iy;
+ const int ixmin = block((int) (x - halfSize));
+ const int ixmax = block((int) (x + halfSize));
+ const int iymin = block((int) (y - halfSize));
+ const int iymax = block((int) (y + halfSize));
+ int ix, iy;
if (round) {
/* rounded points */
- const GLfloat rmin = halfSize - 0.7071F; /* 0.7071 = sqrt(2)/2 */
- const GLfloat rmax = halfSize + 0.7071F;
- const GLfloat rmin2 = MAX2(0.0F, rmin * rmin);
- const GLfloat rmax2 = rmax * rmax;
- const GLfloat cscale = 1.0F / (rmax2 - rmin2);
+ const float rmin = halfSize - 0.7071F; /* 0.7071 = sqrt(2)/2 */
+ const float rmax = halfSize + 0.7071F;
+ const float rmin2 = MAX2(0.0F, rmin * rmin);
+ const float rmax2 = rmax * rmax;
+ const float cscale = 1.0F / (rmax2 - rmin2);
for (iy = iymin; iy <= iymax; iy += 2) {
for (ix = ixmin; ix <= ixmax; ix += 2) {
- GLfloat dx, dy, dist2, cover;
+ float dx, dy, dist2, cover;
setup->quad.mask = 0x0;
diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.h b/src/mesa/pipe/softpipe/sp_prim_setup.h
index 0180454a8d..dece42fe45 100644
--- a/src/mesa/pipe/softpipe/sp_prim_setup.h
+++ b/src/mesa/pipe/softpipe/sp_prim_setup.h
@@ -37,86 +37,12 @@
* all the enabled attributes run contiguously.
*/
-#include "glheader.h"
-#include "imports.h"
-#if 0
-#include "s_tri_public.h"
-#include "s_context.h"
-#endif
+struct draw_stage;
+struct softpipe_context;
extern struct draw_stage *sp_draw_render_stage( struct softpipe_context *softpipe );
-#if 0 /* UNUSED? */
-struct tri_context;
-struct fp_context;
-struct be_context;
-
-/* Note the rasterizer does not take a GLcontext argument. This is
- * deliberate.
- */
-struct tri_context *tri_create_context( GLcontext *ctx );
-
-void tri_destroy_context( struct tri_context *tri );
-
-void tri_set_fp_context( struct tri_context *tri,
- struct fp_context *fp,
- void (*fp_run)( struct fp_context *fp,
- const struct fp_inputs *,
- struct fp_outputs * ));
-
-
-void tri_set_be_context( struct tri_context *tri,
- struct be_context *be,
- void (*be_run)( struct be_context *be,
- const struct fp_outputs * ));
-
-void tri_set_attribs( struct tri_context *tri,
- const struct attr_info *info,
- GLuint nr_attrib );
-
-void tri_set_backface( struct tri_context *tri,
- GLfloat backface );
-
-void tri_set_scissor( struct tri_context *tri,
- GLint x,
- GLint y,
- GLuint width,
- GLuint height,
- GLboolean enabled );
-
-void tri_set_stipple( struct tri_context *tri,
- const GLuint *pattern,
- GLboolean enabled );
-
-/* Unfilled triangles will be handled elsewhere (higher in the
- * pipeline), as will things like stipple (lower in the pipeline).
- */
-
-void tri_triangle( struct tri_context *tri,
- const struct vertex *v0,
- const struct vertex *v1,
- const struct vertex *v2 );
-
-/* TODO: rasterize_line, rasterize_point??
- * How will linestipple work?
- */
-
-
-#ifdef SETUP_PRIVATE
-
-GLboolean tri_setup( struct tri_context *tri,
- const struct vertex *v0,
- const struct vertex *v1,
- const struct vertex *v2 );
-
-void tri_rasterize( struct tri_context *tri );
-void tri_rasterize_spans( struct tri_context *tri );
-
-#endif
-
-
-#endif
#endif /* SP_PRIM_SETUP_H */
diff --git a/src/mesa/pipe/softpipe/sp_quad_alpha_test.c b/src/mesa/pipe/softpipe/sp_quad_alpha_test.c
index 1c51907078..64c1624bd0 100644
--- a/src/mesa/pipe/softpipe/sp_quad_alpha_test.c
+++ b/src/mesa/pipe/softpipe/sp_quad_alpha_test.c
@@ -3,20 +3,19 @@
* quad alpha test
*/
-#include "glheader.h"
-#include "imports.h"
#include "sp_context.h"
#include "sp_headers.h"
#include "sp_quad.h"
#include "pipe/p_defines.h"
+#include "pipe/p_util.h"
static void
alpha_test_quad(struct quad_stage *qs, struct quad_header *quad)
{
struct softpipe_context *softpipe = qs->softpipe;
- const GLfloat ref = softpipe->alpha_test.ref;
- GLuint passMask = 0x0, j;
+ const float ref = softpipe->alpha_test.ref;
+ unsigned passMask = 0x0, j;
switch (softpipe->alpha_test.func) {
case PIPE_FUNC_NEVER:
diff --git a/src/mesa/pipe/softpipe/sp_quad_blend.c b/src/mesa/pipe/softpipe/sp_quad_blend.c
index 09d0aa258c..7e8851d214 100644
--- a/src/mesa/pipe/softpipe/sp_quad_blend.c
+++ b/src/mesa/pipe/softpipe/sp_quad_blend.c
@@ -30,10 +30,8 @@
* \author Brian Paul
*/
-#include "glheader.h"
-#include "imports.h"
-#include "macros.h"
#include "pipe/p_defines.h"
+#include "pipe/p_util.h"
#include "sp_context.h"
#include "sp_headers.h"
#include "sp_surface.h"
@@ -101,11 +99,11 @@ do { \
static void
blend_quad(struct quad_stage *qs, struct quad_header *quad)
{
- static const GLfloat zero[4] = { 0, 0, 0, 0 };
- static const GLfloat one[4] = { 1, 1, 1, 1 };
+ static const float zero[4] = { 0, 0, 0, 0 };
+ static const float one[4] = { 1, 1, 1, 1 };
struct softpipe_context *softpipe = qs->softpipe;
struct softpipe_surface *sps = softpipe_surface(softpipe->cbuf);
- GLfloat source[4][QUAD_SIZE], dest[4][QUAD_SIZE];
+ float source[4][QUAD_SIZE], dest[4][QUAD_SIZE];
/* get colors from framebuffer */
sps->read_quad_f_swz(sps, quad->x0, quad->y0, dest);
@@ -126,7 +124,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
break;
case PIPE_BLENDFACTOR_SRC_ALPHA:
{
- const GLfloat *alpha = quad->outputs.color[3];
+ const float *alpha = quad->outputs.color[3];
VEC4_MUL(source[0], quad->outputs.color[0], alpha); /* R */
VEC4_MUL(source[1], quad->outputs.color[1], alpha); /* G */
VEC4_MUL(source[2], quad->outputs.color[2], alpha); /* B */
@@ -139,7 +137,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
break;
case PIPE_BLENDFACTOR_DST_ALPHA:
{
- const GLfloat *alpha = dest[3];
+ const float *alpha = dest[3];
VEC4_MUL(source[0], quad->outputs.color[0], alpha); /* R */
VEC4_MUL(source[1], quad->outputs.color[1], alpha); /* G */
VEC4_MUL(source[2], quad->outputs.color[2], alpha); /* B */
@@ -150,7 +148,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
break;
case PIPE_BLENDFACTOR_CONST_COLOR:
{
- GLfloat comp[4];
+ float comp[4];
VEC4_SCALAR(comp, softpipe->blend_color.color[0]); /* R */
VEC4_MUL(source[0], quad->outputs.color[0], comp); /* R */
VEC4_SCALAR(comp, softpipe->blend_color.color[1]); /* G */
@@ -161,7 +159,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
break;
case PIPE_BLENDFACTOR_CONST_ALPHA:
{
- GLfloat alpha[4];
+ float alpha[4];
VEC4_SCALAR(alpha, softpipe->blend_color.color[3]);
VEC4_MUL(source[0], quad->outputs.color[0], alpha); /* R */
VEC4_MUL(source[1], quad->outputs.color[1], alpha); /* G */
@@ -181,7 +179,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
break;
case PIPE_BLENDFACTOR_INV_SRC_COLOR:
{
- GLfloat inv_comp[4];
+ float inv_comp[4];
VEC4_SUB(inv_comp, one, quad->outputs.color[0]); /* R */
VEC4_MUL(source[0], quad->outputs.color[0], inv_comp); /* R */
VEC4_SUB(inv_comp, one, quad->outputs.color[1]); /* G */
@@ -192,7 +190,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
break;
case PIPE_BLENDFACTOR_INV_SRC_ALPHA:
{
- GLfloat inv_alpha[4];
+ float inv_alpha[4];
VEC4_SUB(inv_alpha, one, quad->outputs.color[3]);
VEC4_MUL(source[0], quad->outputs.color[0], inv_alpha); /* R */
VEC4_MUL(source[1], quad->outputs.color[1], inv_alpha); /* G */
@@ -201,7 +199,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
break;
case PIPE_BLENDFACTOR_INV_DST_ALPHA:
{
- GLfloat inv_alpha[4];
+ float inv_alpha[4];
VEC4_SUB(inv_alpha, one, dest[3]);
VEC4_MUL(source[0], quad->outputs.color[0], inv_alpha); /* R */
VEC4_MUL(source[1], quad->outputs.color[1], inv_alpha); /* G */
@@ -210,7 +208,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
break;
case PIPE_BLENDFACTOR_INV_DST_COLOR:
{
- GLfloat inv_comp[4];
+ float inv_comp[4];
VEC4_SUB(inv_comp, one, dest[0]); /* R */
VEC4_MUL(source[0], quad->outputs.color[0], inv_comp); /* R */
VEC4_SUB(inv_comp, one, dest[1]); /* G */
@@ -221,7 +219,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
break;
case PIPE_BLENDFACTOR_INV_CONST_COLOR:
{
- GLfloat inv_comp[4];
+ float inv_comp[4];
/* R */
VEC4_SCALAR(inv_comp, 1.0 - softpipe->blend_color.color[0]);
VEC4_MUL(source[0], quad->outputs.color[0], inv_comp);
@@ -235,7 +233,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
break;
case PIPE_BLENDFACTOR_INV_CONST_ALPHA:
{
- GLfloat alpha[4], inv_alpha[4];
+ float alpha[4], inv_alpha[4];
VEC4_SCALAR(alpha, 1.0 - softpipe->blend_color.color[3]);
VEC4_MUL(source[0], quad->outputs.color[0], inv_alpha); /* R */
VEC4_MUL(source[1], quad->outputs.color[1], inv_alpha); /* G */
@@ -261,7 +259,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
break;
case PIPE_BLENDFACTOR_SRC_ALPHA:
{
- const GLfloat *alpha = quad->outputs.color[3];
+ const float *alpha = quad->outputs.color[3];
VEC4_MUL(source[3], quad->outputs.color[3], alpha); /* A */
}
break;
@@ -283,7 +281,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
break;
case PIPE_BLENDFACTOR_INV_SRC_ALPHA:
{
- GLfloat one_minus_alpha[QUAD_SIZE];
+ float one_minus_alpha[QUAD_SIZE];
VEC4_SUB(one_minus_alpha, one, quad->outputs.color[3]);
VEC4_MUL(dest[0], dest[0], one_minus_alpha); /* R */
VEC4_MUL(dest[1], dest[1], one_minus_alpha); /* G */
@@ -309,7 +307,7 @@ blend_quad(struct quad_stage *qs, struct quad_header *quad)
break;
case PIPE_BLENDFACTOR_INV_SRC_ALPHA:
{
- GLfloat one_minus_alpha[QUAD_SIZE];
+ float one_minus_alpha[QUAD_SIZE];
VEC4_SUB(one_minus_alpha, one, quad->outputs.color[3]);
VEC4_MUL(dest[3], dest[3], one_minus_alpha); /* A */
}
diff --git a/src/mesa/pipe/softpipe/sp_quad_bufloop.c b/src/mesa/pipe/softpipe/sp_quad_bufloop.c
index c459a9e8b0..ae2fb5ef97 100644
--- a/src/mesa/pipe/softpipe/sp_quad_bufloop.c
+++ b/src/mesa/pipe/softpipe/sp_quad_bufloop.c
@@ -1,7 +1,5 @@
-
-#include "main/glheader.h"
-#include "main/imports.h"
+#include "pipe/p_util.h"
#include "sp_context.h"
#include "sp_headers.h"
#include "sp_surface.h"
@@ -15,8 +13,8 @@ static void
cbuf_loop_quad(struct quad_stage *qs, struct quad_header *quad)
{
struct softpipe_context *softpipe = qs->softpipe;
- GLfloat tmp[4][QUAD_SIZE];
- GLuint i;
+ float tmp[4][QUAD_SIZE];
+ unsigned i;
assert(sizeof(quad->outputs.color) == sizeof(tmp));
assert(softpipe->framebuffer.num_cbufs <= PIPE_MAX_COLOR_BUFS);
diff --git a/src/mesa/pipe/softpipe/sp_quad_colormask.c b/src/mesa/pipe/softpipe/sp_quad_colormask.c
index 5102a000b5..7bb65bf8c8 100644
--- a/src/mesa/pipe/softpipe/sp_quad_colormask.c
+++ b/src/mesa/pipe/softpipe/sp_quad_colormask.c
@@ -30,10 +30,8 @@
* \author Brian Paul
*/
-#include "main/glheader.h"
-#include "main/imports.h"
-#include "main/macros.h"
#include "pipe/p_defines.h"
+#include "pipe/p_util.h"
#include "sp_context.h"
#include "sp_headers.h"
#include "sp_surface.h"
@@ -46,25 +44,25 @@ colormask_quad(struct quad_stage *qs, struct quad_header *quad)
{
struct softpipe_context *softpipe = qs->softpipe;
struct softpipe_surface *sps = softpipe_surface(softpipe->cbuf);
- GLfloat dest[4][QUAD_SIZE];
+ float dest[4][QUAD_SIZE];
sps->read_quad_f_swz(sps, quad->x0, quad->y0, dest);
/* R */
if (!(softpipe->blend.colormask & PIPE_MASK_R))
- COPY_4FV(quad->outputs.color[0], dest[0]);
+ COPY_4V(quad->outputs.color[0], dest[0]);
/* G */
if (!(softpipe->blend.colormask & PIPE_MASK_G))
- COPY_4FV(quad->outputs.color[1], dest[1]);
+ COPY_4V(quad->outputs.color[1], dest[1]);
/* B */
if (!(softpipe->blend.colormask & PIPE_MASK_B))
- COPY_4FV(quad->outputs.color[2], dest[2]);
+ COPY_4V(quad->outputs.color[2], dest[2]);
/* A */
if (!(softpipe->blend.colormask & PIPE_MASK_A))
- COPY_4FV(quad->outputs.color[3], dest[3]);
+ COPY_4V(quad->outputs.color[3], dest[3]);
/* pass quad to next stage */
qs->next->run(qs->next, quad);
diff --git a/src/mesa/pipe/softpipe/sp_quad_coverage.c b/src/mesa/pipe/softpipe/sp_quad_coverage.c
index efeb85aab9..8dfec59350 100644
--- a/src/mesa/pipe/softpipe/sp_quad_coverage.c
+++ b/src/mesa/pipe/softpipe/sp_quad_coverage.c
@@ -32,9 +32,8 @@
*/
-#include "main/glheader.h"
-#include "main/macros.h"
#include "pipe/p_defines.h"
+#include "pipe/p_util.h"
#include "sp_context.h"
#include "sp_headers.h"
#include "sp_quad.h"
@@ -51,7 +50,7 @@ coverage_quad(struct quad_stage *qs, struct quad_header *quad)
if ((softpipe->setup.poly_smooth && quad->prim == PRIM_TRI) ||
(softpipe->setup.line_smooth && quad->prim == PRIM_LINE) ||
(softpipe->setup.point_smooth && quad->prim == PRIM_POINT)) {
- GLuint j;
+ unsigned j;
for (j = 0; j < QUAD_SIZE; j++) {
assert(quad->coverage[j] >= 0.0);
assert(quad->coverage[j] <= 1.0);
diff --git a/src/mesa/pipe/softpipe/sp_quad_depth_test.c b/src/mesa/pipe/softpipe/sp_quad_depth_test.c
index 28f264b3c4..5d46e70393 100644
--- a/src/mesa/pipe/softpipe/sp_quad_depth_test.c
+++ b/src/mesa/pipe/softpipe/sp_quad_depth_test.c
@@ -26,9 +26,8 @@
* \brief Quad depth testing
*/
-#include "main/glheader.h"
-#include "main/imports.h"
#include "pipe/p_defines.h"
+#include "pipe/p_util.h"
#include "sp_context.h"
#include "sp_headers.h"
#include "sp_surface.h"
@@ -44,11 +43,11 @@ sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad)
{
struct softpipe_context *softpipe = qs->softpipe;
struct softpipe_surface *sps = softpipe_surface(softpipe->framebuffer.zbuf);
- GLuint bzzzz[QUAD_SIZE]; /**< Z values fetched from depth buffer */
- GLuint qzzzz[QUAD_SIZE]; /**< Z values from the quad */
- GLuint zmask = 0;
- GLuint j;
- GLfloat scale;
+ unsigned bzzzz[QUAD_SIZE]; /**< Z values fetched from depth buffer */
+ unsigned qzzzz[QUAD_SIZE]; /**< Z values from the quad */
+ unsigned zmask = 0;
+ unsigned j;
+ float scale;
assert(sps); /* shouldn't get here if there's no zbuffer */
@@ -72,7 +71,7 @@ sp_depth_test_quad(struct quad_stage *qs, struct quad_header *quad)
* Z-fighting errors.
*/
for (j = 0; j < QUAD_SIZE; j++) {
- qzzzz[j] = (GLuint) (quad->outputs.depth[j] * scale);
+ qzzzz[j] = (unsigned) (quad->outputs.depth[j] * scale);
}
/* get zquad from zbuffer */
diff --git a/src/mesa/pipe/softpipe/sp_quad_fs.c b/src/mesa/pipe/softpipe/sp_quad_fs.c
index e767d0a470..edb3245cba 100644
--- a/src/mesa/pipe/softpipe/sp_quad_fs.c
+++ b/src/mesa/pipe/softpipe/sp_quad_fs.c
@@ -32,8 +32,6 @@
* all the enabled attributes run contiguously.
*/
-#include "main/mtypes.h"
-
#include "pipe/p_util.h"
#include "tgsi/core/tgsi_core.h"
@@ -42,6 +40,8 @@
#include "sp_quad.h"
#include "sp_tex_sample.h"
+#include "main/mtypes.h"
+
#if 0
#if defined __GNUC__
#define ALIGNED_ATTRIBS 1
@@ -73,9 +73,9 @@ struct exec_machine {
const struct setup_coefficient *coef; /**< will point to quad->coef */
#if ALIGNED_ATTRIBS
- GLfloat attr[PIPE_ATTRIB_MAX][NUM_CHANNELS][QUAD_SIZE] __attribute__(( aligned( 16 ) ));
+ float attr[PIPE_ATTRIB_MAX][NUM_CHANNELS][QUAD_SIZE] __attribute__(( aligned( 16 ) ));
#else
- GLfloat attr[PIPE_ATTRIB_MAX][NUM_CHANNELS][QUAD_SIZE];
+ float attr[PIPE_ATTRIB_MAX][NUM_CHANNELS][QUAD_SIZE];
#endif
};
@@ -84,10 +84,10 @@ struct exec_machine {
* Compute quad's attributes values, as constants (GL_FLAT shading).
*/
static INLINE void cinterp( struct exec_machine *exec,
- GLuint attrib,
- GLuint i )
+ unsigned attrib,
+ unsigned i )
{
- GLuint j;
+ unsigned j;
for (j = 0; j < QUAD_SIZE; j++) {
exec->attr[attrib][i][j] = exec->coef[attrib].a0[i];
@@ -104,14 +104,14 @@ static INLINE void cinterp( struct exec_machine *exec,
* INPUT[attr] = MAD INPUT[attr], COEF_DADY[attr], INPUT_WPOS.yyyy
*/
static INLINE void linterp( struct exec_machine *exec,
- GLuint attrib,
- GLuint i )
+ unsigned attrib,
+ unsigned i )
{
- GLuint j;
+ unsigned j;
for (j = 0; j < QUAD_SIZE; j++) {
- const GLfloat x = exec->attr[FRAG_ATTRIB_WPOS][0][j];
- const GLfloat y = exec->attr[FRAG_ATTRIB_WPOS][1][j];
+ const float x = exec->attr[FRAG_ATTRIB_WPOS][0][j];
+ const float y = exec->attr[FRAG_ATTRIB_WPOS][1][j];
exec->attr[attrib][i][j] = (exec->coef[attrib].a0[i] +
exec->coef[attrib].dadx[i] * x +
exec->coef[attrib].dady[i] * y);
@@ -132,16 +132,16 @@ static INLINE void linterp( struct exec_machine *exec,
*
*/
static INLINE void pinterp( struct exec_machine *exec,
- GLuint attrib,
- GLuint i )
+ unsigned attrib,
+ unsigned i )
{
- GLuint j;
+ unsigned j;
for (j = 0; j < QUAD_SIZE; j++) {
- const GLfloat x = exec->attr[FRAG_ATTRIB_WPOS][0][j];
- const GLfloat y = exec->attr[FRAG_ATTRIB_WPOS][1][j];
+ const float x = exec->attr[FRAG_ATTRIB_WPOS][0][j];
+ const float y = exec->attr[FRAG_ATTRIB_WPOS][1][j];
/* FRAG_ATTRIB_WPOS.w here is really 1/w */
- const GLfloat w = 1.0 / exec->attr[FRAG_ATTRIB_WPOS][3][j];
+ const float w = 1.0 / exec->attr[FRAG_ATTRIB_WPOS][3][j];
exec->attr[attrib][i][j] = ((exec->coef[attrib].a0[i] +
exec->coef[attrib].dadx[i] * x +
exec->coef[attrib].dady[i] * y) * w);
@@ -158,9 +158,9 @@ shade_quad( struct quad_stage *qs, struct quad_header *quad )
struct quad_shade_stage *qss = quad_shade_stage(qs);
struct softpipe_context *softpipe = qs->softpipe;
struct exec_machine exec;
- const GLfloat fx = quad->x0;
- const GLfloat fy = quad->y0;
- GLuint attr, i;
+ const float fx = quad->x0;
+ const float fy = quad->y0;
+ unsigned attr, i;
exec.coef = quad->coef;
@@ -216,7 +216,7 @@ shade_quad( struct quad_stage *qs, struct quad_header *quad )
struct tgsi_exec_machine machine;
struct tgsi_exec_vector outputs[FRAG_ATTRIB_MAX + 1];
struct tgsi_exec_vector *aoutputs;
- GLuint i;
+ unsigned i;
#if !ALIGNED_ATTRIBS
struct tgsi_exec_vector inputs[FRAG_ATTRIB_MAX + 1];
@@ -289,7 +289,7 @@ shade_quad( struct quad_stage *qs, struct quad_header *quad )
}
#else
{
- GLuint attr = softpipe->fp_attr_to_slot[FRAG_ATTRIB_COL0];
+ unsigned attr = softpipe->fp_attr_to_slot[FRAG_ATTRIB_COL0];
assert(attr);
memcpy(quad->outputs.color,
@@ -318,7 +318,7 @@ static void shade_begin(struct quad_stage *qs)
{
struct quad_shade_stage *qss = quad_shade_stage(qs);
struct softpipe_context *softpipe = qs->softpipe;
- GLuint i, entry;
+ unsigned i, entry;
for (i = 0; i < PIPE_MAX_SAMPLERS; i++) {
qss->samplers[i].state = &softpipe->sampler[i];
diff --git a/src/mesa/pipe/softpipe/sp_quad_occlusion.c b/src/mesa/pipe/softpipe/sp_quad_occlusion.c
index 8073f94553..6b094a5bef 100644
--- a/src/mesa/pipe/softpipe/sp_quad_occlusion.c
+++ b/src/mesa/pipe/softpipe/sp_quad_occlusion.c
@@ -32,9 +32,8 @@
*/
-#include "main/glheader.h"
-#include "main/imports.h"
#include "pipe/p_defines.h"
+#include "pipe/p_util.h"
#include "sp_context.h"
#include "sp_headers.h"
#include "sp_surface.h"
diff --git a/src/mesa/pipe/softpipe/sp_quad_output.c b/src/mesa/pipe/softpipe/sp_quad_output.c
index 62f466be5d..49420c4fe7 100644
--- a/src/mesa/pipe/softpipe/sp_quad_output.c
+++ b/src/mesa/pipe/softpipe/sp_quad_output.c
@@ -31,20 +31,18 @@
* Attributes are assumed to be 4 floats wide but are packed so that
* all the enabled attributes run contiguously.
*/
-
-#include "glheader.h"
-#include "imports.h"
+#include "pipe/p_util.h"
#include "sp_context.h"
#include "sp_headers.h"
#include "sp_surface.h"
#include "sp_quad.h"
-static void mask_copy( GLfloat (*dest)[4],
- GLfloat (*src)[4],
- GLuint mask )
+static void mask_copy( float (*dest)[4],
+ float (*src)[4],
+ unsigned mask )
{
- GLuint i, j;
+ unsigned i, j;
for (i = 0; i < 4; i++) {
if (mask & (1<<i)) {
@@ -68,7 +66,7 @@ output_quad(struct quad_stage *qs, struct quad_header *quad)
struct softpipe_surface *sps = softpipe_surface(softpipe->cbuf);
if (quad->mask != MASK_ALL) {
- GLfloat tmp[4][QUAD_SIZE];
+ float tmp[4][QUAD_SIZE];
/* XXX probably add a masked-write function someday */
diff --git a/src/mesa/pipe/softpipe/sp_quad_stencil.c b/src/mesa/pipe/softpipe/sp_quad_stencil.c
index 857f1a5989..47b3b4f089 100644
--- a/src/mesa/pipe/softpipe/sp_quad_stencil.c
+++ b/src/mesa/pipe/softpipe/sp_quad_stencil.c
@@ -4,13 +4,12 @@
*/
-#include "main/glheader.h"
-#include "main/imports.h"
#include "sp_context.h"
#include "sp_headers.h"
#include "sp_surface.h"
#include "sp_quad.h"
#include "pipe/p_defines.h"
+#include "pipe/p_util.h"
/** Only 8-bit stencil supported */
@@ -28,12 +27,12 @@
* values and ref value are to be used.
* \return mask indicating which pixels passed the stencil test
*/
-static GLbitfield
-do_stencil_test(const GLubyte stencilVals[QUAD_SIZE], GLuint func,
- GLbitfield ref, GLbitfield valMask)
+static unsigned
+do_stencil_test(const ubyte stencilVals[QUAD_SIZE], unsigned func,
+ unsigned ref, unsigned valMask)
{
- GLbitfield passMask = 0x0;
- GLuint j;
+ unsigned passMask = 0x0;
+ unsigned j;
ref &= valMask;
@@ -105,11 +104,11 @@ do_stencil_test(const GLubyte stencilVals[QUAD_SIZE], GLuint func,
* stencil values
*/
static void
-apply_stencil_op(GLubyte stencilVals[QUAD_SIZE],
- GLbitfield mask, GLuint op, GLubyte ref, GLubyte wrtMask)
+apply_stencil_op(ubyte stencilVals[QUAD_SIZE],
+ unsigned mask, unsigned op, ubyte ref, ubyte wrtMask)
{
- GLuint j;
- GLubyte newstencil[QUAD_SIZE];
+ unsigned j;
+ ubyte newstencil[QUAD_SIZE];
for (j = 0; j < QUAD_SIZE; j++) {
newstencil[j] = stencilVals[j];
@@ -202,9 +201,9 @@ stencil_test_quad(struct quad_stage *qs, struct quad_header *quad)
{
struct softpipe_context *softpipe = qs->softpipe;
struct softpipe_surface *s_surf = softpipe_surface(softpipe->framebuffer.sbuf);
- GLuint func, zFailOp, zPassOp, failOp;
- GLubyte ref, wrtMask, valMask;
- GLubyte stencilVals[QUAD_SIZE];
+ unsigned func, zFailOp, zPassOp, failOp;
+ ubyte ref, wrtMask, valMask;
+ ubyte stencilVals[QUAD_SIZE];
/* choose front or back face function, operator, etc */
/* XXX we could do these initializations once per primitive */
@@ -232,7 +231,7 @@ stencil_test_quad(struct quad_stage *qs, struct quad_header *quad)
/* do the stencil test first */
{
- GLbitfield passMask, failMask;
+ unsigned passMask, failMask;
passMask = do_stencil_test(stencilVals, func, ref, valMask);
failMask = quad->mask & ~passMask;
quad->mask &= passMask;
@@ -246,18 +245,18 @@ stencil_test_quad(struct quad_stage *qs, struct quad_header *quad)
/* now the pixels that passed the stencil test are depth tested */
if (softpipe->depth_test.enabled) {
- const GLbitfield origMask = quad->mask;
+ const unsigned origMask = quad->mask;
sp_depth_test_quad(qs, quad); /* quad->mask is updated */
/* update stencil buffer values according to z pass/fail result */
if (zFailOp != PIPE_STENCIL_OP_KEEP) {
- const GLbitfield failMask = origMask & ~quad->mask;
+ const unsigned failMask = origMask & ~quad->mask;
apply_stencil_op(stencilVals, failMask, zFailOp, ref, wrtMask);
}
if (zPassOp != PIPE_STENCIL_OP_KEEP) {
- const GLbitfield passMask = origMask & quad->mask;
+ const unsigned passMask = origMask & quad->mask;
apply_stencil_op(stencilVals, passMask, zPassOp, ref, wrtMask);
}
}
diff --git a/src/mesa/pipe/softpipe/sp_quad_stipple.c b/src/mesa/pipe/softpipe/sp_quad_stipple.c
index 6e93bf81f1..cb127095d7 100644
--- a/src/mesa/pipe/softpipe/sp_quad_stipple.c
+++ b/src/mesa/pipe/softpipe/sp_quad_stipple.c
@@ -3,12 +3,11 @@
* quad polygon stipple stage
*/
-#include "glheader.h"
-#include "imports.h"
#include "sp_context.h"
#include "sp_headers.h"
#include "sp_quad.h"
#include "pipe/p_defines.h"
+#include "pipe/p_util.h"
/**
@@ -19,10 +18,10 @@ stipple_quad(struct quad_stage *qs, struct quad_header *quad)
{
if (quad->prim == PRIM_TRI) {
struct softpipe_context *softpipe = qs->softpipe;
- const GLint col0 = quad->x0 % 32;
- const GLint row0 = quad->y0 % 32;
- const GLuint stipple0 = softpipe->poly_stipple.stipple[row0];
- const GLuint stipple1 = softpipe->poly_stipple.stipple[row0 + 1];
+ const int col0 = quad->x0 % 32;
+ const int row0 = quad->y0 % 32;
+ const unsigned stipple0 = softpipe->poly_stipple.stipple[row0];
+ const unsigned stipple1 = softpipe->poly_stipple.stipple[row0 + 1];
/* XXX there may be a better way to lay out the stored stipple
* values to further simplify this computation.
diff --git a/src/mesa/pipe/softpipe/sp_region.c b/src/mesa/pipe/softpipe/sp_region.c
index 10b7479e97..231ea1ea22 100644
--- a/src/mesa/pipe/softpipe/sp_region.c
+++ b/src/mesa/pipe/softpipe/sp_region.c
@@ -54,7 +54,7 @@ sp_region_idle(struct pipe_context *pipe, struct pipe_region *region)
}
-static GLubyte *
+static ubyte *
sp_region_map(struct pipe_context *pipe, struct pipe_region *region)
{
struct softpipe_context *sp = softpipe_context( pipe );
@@ -83,7 +83,7 @@ sp_region_unmap(struct pipe_context *pipe, struct pipe_region *region)
static struct pipe_region *
sp_region_alloc(struct pipe_context *pipe,
- GLuint cpp, GLuint width, GLuint height, GLbitfield flags)
+ unsigned cpp, unsigned width, unsigned height, unsigned flags)
{
struct softpipe_context *sp = softpipe_context( pipe );
struct pipe_region *region = calloc(sizeof(*region), 1);
@@ -112,7 +112,7 @@ sp_region_release(struct pipe_context *pipe, struct pipe_region **region)
if (!*region)
return;
- ASSERT((*region)->refcount > 0);
+ assert((*region)->refcount > 0);
(*region)->refcount--;
if ((*region)->refcount == 0) {
@@ -130,19 +130,19 @@ sp_region_release(struct pipe_context *pipe, struct pipe_region **region)
* XXX Move this into core Mesa?
*/
static void
-_mesa_copy_rect(GLubyte * dst,
- GLuint cpp,
- GLuint dst_pitch,
- GLuint dst_x,
- GLuint dst_y,
- GLuint width,
- GLuint height,
- const GLubyte * src,
- GLuint src_pitch,
- GLuint src_x,
- GLuint src_y)
+_mesa_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)
{
- GLuint i;
+ unsigned i;
dst_pitch *= cpp;
src_pitch *= cpp;
@@ -174,10 +174,10 @@ _mesa_copy_rect(GLubyte * dst,
static void
sp_region_data(struct pipe_context *pipe,
struct pipe_region *dst,
- GLuint dst_offset,
- GLuint dstx, GLuint dsty,
- const void *src, GLuint src_pitch,
- GLuint srcx, GLuint srcy, GLuint width, GLuint height)
+ unsigned dst_offset,
+ unsigned dstx, unsigned dsty,
+ const void *src, unsigned src_pitch,
+ unsigned srcx, unsigned srcy, unsigned width, unsigned height)
{
_mesa_copy_rect(pipe->region_map(pipe, dst) + dst_offset,
dst->cpp,
@@ -193,11 +193,11 @@ sp_region_data(struct pipe_context *pipe,
static void
sp_region_copy(struct pipe_context *pipe,
struct pipe_region *dst,
- GLuint dst_offset,
- GLuint dstx, GLuint dsty,
+ unsigned dst_offset,
+ unsigned dstx, unsigned dsty,
struct pipe_region *src,
- GLuint src_offset,
- GLuint srcx, GLuint srcy, GLuint width, GLuint height)
+ unsigned src_offset,
+ unsigned srcx, unsigned srcy, unsigned width, unsigned height)
{
assert( dst->cpp == src->cpp );
@@ -217,8 +217,8 @@ sp_region_copy(struct pipe_context *pipe,
/* Fill a rectangular sub-region. Need better logic about when to
* push buffers into AGP - will currently do so whenever possible.
*/
-static GLubyte *
-get_pointer(struct pipe_region *dst, GLuint x, GLuint y)
+static ubyte *
+get_pointer(struct pipe_region *dst, unsigned x, unsigned y)
{
return dst->map + (y * dst->pitch + x) * dst->cpp;
}
@@ -227,17 +227,17 @@ get_pointer(struct pipe_region *dst, GLuint x, GLuint y)
static void
sp_region_fill(struct pipe_context *pipe,
struct pipe_region *dst,
- GLuint dst_offset,
- GLuint dstx, GLuint dsty,
- GLuint width, GLuint height, GLuint value)
+ unsigned dst_offset,
+ unsigned dstx, unsigned dsty,
+ unsigned width, unsigned height, unsigned value)
{
- GLuint i, j;
+ unsigned i, j;
(void)pipe->region_map(pipe, dst);
switch (dst->cpp) {
case 1: {
- GLubyte *row = get_pointer(dst, dstx, dsty);
+ ubyte *row = get_pointer(dst, dstx, dsty);
for (i = 0; i < height; i++) {
memset(row, value, width);
row += dst->pitch;
@@ -245,7 +245,7 @@ sp_region_fill(struct pipe_context *pipe,
}
break;
case 2: {
- GLushort *row = (GLushort *) get_pointer(dst, dstx, dsty);
+ ushort *row = (ushort *) get_pointer(dst, dstx, dsty);
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++)
row[j] = value;
@@ -254,7 +254,7 @@ sp_region_fill(struct pipe_context *pipe,
}
break;
case 4: {
- GLuint *row = (GLuint *) get_pointer(dst, dstx, dsty);
+ unsigned *row = (unsigned *) get_pointer(dst, dstx, dsty);
for (i = 0; i < height; i++) {
for (j = 0; j < width; j++)
row[j] = value;
diff --git a/src/mesa/pipe/softpipe/sp_state.h b/src/mesa/pipe/softpipe/sp_state.h
index 3c572cdb6a..5adf5930b8 100644
--- a/src/mesa/pipe/softpipe/sp_state.h
+++ b/src/mesa/pipe/softpipe/sp_state.h
@@ -31,7 +31,6 @@
#ifndef SP_STATE_H
#define SP_STATE_H
-#include "glheader.h"
#include "pipe/p_state.h"
@@ -69,14 +68,14 @@ void softpipe_set_setup_state( struct pipe_context *,
const struct pipe_setup_state * );
void softpipe_set_sampler_state( struct pipe_context *,
- GLuint unit,
+ unsigned unit,
const struct pipe_sampler_state * );
void softpipe_set_stencil_state( struct pipe_context *,
const struct pipe_stencil_state * );
void softpipe_set_texture_state( struct pipe_context *,
- GLuint unit,
+ unsigned unit,
struct pipe_mipmap_tree * );
void softpipe_set_viewport_state( struct pipe_context *,
diff --git a/src/mesa/pipe/softpipe/sp_state_blend.c b/src/mesa/pipe/softpipe/sp_state_blend.c
index 8bc22b0efc..b2e85d86cc 100644
--- a/src/mesa/pipe/softpipe/sp_state_blend.c
+++ b/src/mesa/pipe/softpipe/sp_state_blend.c
@@ -27,8 +27,6 @@
/* Authors: Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "imports.h"
-
#include "sp_context.h"
#include "sp_state.h"
diff --git a/src/mesa/pipe/softpipe/sp_state_clip.c b/src/mesa/pipe/softpipe/sp_state_clip.c
index 8cf4383d3f..08c5f06d05 100644
--- a/src/mesa/pipe/softpipe/sp_state_clip.c
+++ b/src/mesa/pipe/softpipe/sp_state_clip.c
@@ -27,8 +27,6 @@
/* Authors: Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "imports.h"
-
#include "sp_context.h"
#include "sp_state.h"
#include "pipe/draw/draw_context.h"
diff --git a/src/mesa/pipe/softpipe/sp_state_derived.c b/src/mesa/pipe/softpipe/sp_state_derived.c
index e1faaed93c..0a2cfbb7d1 100644
--- a/src/mesa/pipe/softpipe/sp_state_derived.c
+++ b/src/mesa/pipe/softpipe/sp_state_derived.c
@@ -46,7 +46,7 @@ do { \
} while (0)
-static const GLuint frag_to_vf[FRAG_ATTRIB_MAX] =
+static const unsigned frag_to_vf[FRAG_ATTRIB_MAX] =
{
VF_ATTRIB_POS,
VF_ATTRIB_COLOR0,
@@ -78,27 +78,27 @@ static const GLuint frag_to_vf[FRAG_ATTRIB_MAX] =
*/
static void calculate_vertex_layout( struct softpipe_context *softpipe )
{
- const GLbitfield inputsRead = softpipe->fs.inputs_read;
- GLuint slot_to_vf_attr[VF_ATTRIB_MAX];
- GLbitfield attr_mask = 0x0;
- GLuint i;
+ const unsigned inputsRead = softpipe->fs.inputs_read;
+ unsigned slot_to_vf_attr[VF_ATTRIB_MAX];
+ unsigned attr_mask = 0x0;
+ unsigned i;
/* Need Z if depth test is enabled or the fragment program uses the
* fragment position (XYZW).
*/
if (softpipe->depth_test.enabled ||
(inputsRead & FRAG_ATTRIB_WPOS))
- softpipe->need_z = GL_TRUE;
+ softpipe->need_z = TRUE;
else
- softpipe->need_z = GL_FALSE;
+ softpipe->need_z = FALSE;
/* Need W if we do any perspective-corrected interpolation or the
* fragment program uses the fragment position.
*/
if (inputsRead & FRAG_ATTRIB_WPOS)
- softpipe->need_w = GL_TRUE;
+ softpipe->need_w = TRUE;
else
- softpipe->need_w = GL_FALSE;
+ softpipe->need_w = FALSE;
softpipe->nr_attrs = 0;
@@ -130,7 +130,7 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe )
if (inputsRead & (1 << i)) {
assert(i < sizeof(frag_to_vf) / sizeof(frag_to_vf[0]));
EMIT_ATTR(frag_to_vf[i], i, INTERP_PERSPECTIVE);
- softpipe->need_w = GL_TRUE;
+ softpipe->need_w = TRUE;
}
}
@@ -169,7 +169,7 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe )
static void
compute_cliprect(struct softpipe_context *sp)
{
- GLint surfWidth, surfHeight;
+ int surfWidth, surfHeight;
if (sp->framebuffer.num_cbufs > 0) {
surfWidth = sp->framebuffer.cbufs[0]->width;
diff --git a/src/mesa/pipe/softpipe/sp_state_sampler.c b/src/mesa/pipe/softpipe/sp_state_sampler.c
index 34cf210834..2e3d0c3d65 100644
--- a/src/mesa/pipe/softpipe/sp_state_sampler.c
+++ b/src/mesa/pipe/softpipe/sp_state_sampler.c
@@ -29,8 +29,6 @@
* Brian Paul
*/
-#include "imports.h"
-
#include "sp_context.h"
#include "sp_state.h"
@@ -38,7 +36,7 @@
void
softpipe_set_sampler_state(struct pipe_context *pipe,
- GLuint unit,
+ unsigned unit,
const struct pipe_sampler_state *sampler)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
@@ -52,7 +50,7 @@ softpipe_set_sampler_state(struct pipe_context *pipe,
void
softpipe_set_texture_state(struct pipe_context *pipe,
- GLuint unit,
+ unsigned unit,
struct pipe_mipmap_tree *texture)
{
struct softpipe_context *softpipe = softpipe_context(pipe);
diff --git a/src/mesa/pipe/softpipe/sp_state_surface.c b/src/mesa/pipe/softpipe/sp_state_surface.c
index 8ce81eb2b0..a534ffb2c2 100644
--- a/src/mesa/pipe/softpipe/sp_state_surface.c
+++ b/src/mesa/pipe/softpipe/sp_state_surface.c
@@ -27,8 +27,6 @@
/* Authors: Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "imports.h"
-
#include "sp_context.h"
#include "sp_state.h"
#include "sp_surface.h"
diff --git a/src/mesa/pipe/softpipe/sp_surface.c b/src/mesa/pipe/softpipe/sp_surface.c
index 1919947abf..4152e3510d 100644
--- a/src/mesa/pipe/softpipe/sp_surface.c
+++ b/src/mesa/pipe/softpipe/sp_surface.c
@@ -29,8 +29,7 @@
#include "sp_state.h"
#include "sp_surface.h"
#include "pipe/p_defines.h"
-#include "main/imports.h"
-#include "main/macros.h"
+#include "pipe/p_util.h"
/**
@@ -48,13 +47,13 @@
/*** PIPE_FORMAT_U_A8_R8_G8_B8 ***/
static void
-a8r8g8b8_read_quad_f_swz(struct softpipe_surface *sps, GLint x, GLint y,
- GLfloat (*rrrr)[QUAD_SIZE])
+a8r8g8b8_read_quad_f_swz(struct softpipe_surface *sps, int x, int y,
+ float (*rrrr)[QUAD_SIZE])
{
- const GLuint *src
- = ((const GLuint *) (sps->surface.region->map + sps->surface.offset))
+ const unsigned *src
+ = ((const unsigned *) (sps->surface.region->map + sps->surface.offset))
+ y * sps->surface.region->pitch + x;
- GLuint i, j;
+ unsigned i, j;
assert(sps->surface.format == PIPE_FORMAT_U_A8_R8_G8_B8);
assert(x < sps->surface.width - 1);
@@ -62,7 +61,7 @@ a8r8g8b8_read_quad_f_swz(struct softpipe_surface *sps, GLint x, GLint y,
for (i = 0; i < 2; i++) { /* loop over pixel row */
for (j = 0; j < 2; j++) { /* loop over pixel column */
- const GLuint p = src[j];
+ const unsigned p = src[j];
rrrr[0][i * 2 + j] = UBYTE_TO_FLOAT((p >> 16) & 0xff); /*R*/
rrrr[1][i * 2 + j] = UBYTE_TO_FLOAT((p >> 8) & 0xff); /*G*/
rrrr[2][i * 2 + j] = UBYTE_TO_FLOAT((p ) & 0xff); /*B*/
@@ -73,19 +72,19 @@ a8r8g8b8_read_quad_f_swz(struct softpipe_surface *sps, GLint x, GLint y,
}
static void
-a8r8g8b8_write_quad_f_swz(struct softpipe_surface *sps, GLint x, GLint y,
- GLfloat (*rrrr)[QUAD_SIZE])
+a8r8g8b8_write_quad_f_swz(struct softpipe_surface *sps, int x, int y,
+ float (*rrrr)[QUAD_SIZE])
{
- GLuint *dst
- = ((GLuint *) (sps->surface.region->map + sps->surface.offset))
+ unsigned *dst
+ = ((unsigned *) (sps->surface.region->map + sps->surface.offset))
+ y * sps->surface.region->pitch + x;
- GLuint i, j;
+ unsigned i, j;
assert(sps->surface.format == PIPE_FORMAT_U_A8_R8_G8_B8);
for (i = 0; i < 2; i++) { /* loop over pixel row */
for (j = 0; j < 2; j++) { /* loop over pixel column */
- GLubyte r, g, b, a;
+ ubyte r, g, b, a;
UNCLAMPED_FLOAT_TO_UBYTE(r, rrrr[0][i * 2 + j]); /*R*/
UNCLAMPED_FLOAT_TO_UBYTE(g, rrrr[1][i * 2 + j]); /*G*/
UNCLAMPED_FLOAT_TO_UBYTE(b, rrrr[2][i * 2 + j]); /*B*/
@@ -98,13 +97,13 @@ a8r8g8b8_write_quad_f_swz(struct softpipe_surface *sps, GLint x, GLint y,
static void
a8r8g8b8_get_tile(struct pipe_surface *ps,
- GLuint x, GLuint y, GLuint w, GLuint h, GLfloat *p)
+ unsigned x, unsigned y, unsigned w, unsigned h, float *p)
{
- const GLuint *src
- = ((const GLuint *) (ps->region->map + ps->offset))
+ const unsigned *src
+ = ((const unsigned *) (ps->region->map + ps->offset))
+ y * ps->region->pitch + x;
- GLuint i, j;
- GLuint w0 = w;
+ unsigned i, j;
+ unsigned w0 = w;
assert(ps->format == PIPE_FORMAT_U_A8_R8_G8_B8);
@@ -119,9 +118,9 @@ a8r8g8b8_get_tile(struct pipe_surface *ps,
h = ps->height -y;
#endif
for (i = 0; i < h; i++) {
- GLfloat *pRow = p;
+ float *pRow = p;
for (j = 0; j < w; j++) {
- const GLuint pixel = src[j];
+ const unsigned pixel = src[j];
pRow[0] = UBYTE_TO_FLOAT((pixel >> 16) & 0xff);
pRow[1] = UBYTE_TO_FLOAT((pixel >> 8) & 0xff);
pRow[2] = UBYTE_TO_FLOAT((pixel >> 0) & 0xff);
@@ -138,18 +137,18 @@ a8r8g8b8_get_tile(struct pipe_surface *ps,
static void
a1r5g5b5_get_tile(struct pipe_surface *ps,
- GLuint x, GLuint y, GLuint w, GLuint h, GLfloat *p)
+ unsigned x, unsigned y, unsigned w, unsigned h, float *p)
{
- const GLushort *src
- = ((const GLushort *) (ps->region->map + ps->offset))
+ const ushort *src
+ = ((const ushort *) (ps->region->map + ps->offset))
+ y * ps->region->pitch + x;
- GLuint i, j;
+ unsigned i, j;
assert(ps->format == PIPE_FORMAT_U_A1_R5_G5_B5);
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++) {
- const GLushort pixel = src[j];
+ const ushort pixel = src[j];
p[0] = ((pixel >> 10) & 0x1f) * (1.0 / 31);
p[1] = ((pixel >> 5) & 0x1f) * (1.0 / 31);
p[2] = ((pixel ) & 0x1f) * (1.0 / 31);
@@ -166,15 +165,15 @@ a1r5g5b5_get_tile(struct pipe_surface *ps,
static void
z16_read_quad_z(struct softpipe_surface *sps,
- GLint x, GLint y, GLuint zzzz[QUAD_SIZE])
+ int x, int y, unsigned zzzz[QUAD_SIZE])
{
- const GLushort *src
- = ((const GLushort *) (sps->surface.region->map + sps->surface.offset))
+ const ushort *src
+ = ((const ushort *) (sps->surface.region->map + sps->surface.offset))
+ y * sps->surface.region->pitch + x;
assert(sps->surface.format == PIPE_FORMAT_U_Z16);
- /* converting GLushort to GLuint: */
+ /* converting ushort to unsigned: */
zzzz[0] = src[0];
zzzz[1] = src[1];
src += sps->surface.region->pitch;
@@ -184,15 +183,15 @@ z16_read_quad_z(struct softpipe_surface *sps,
static void
z16_write_quad_z(struct softpipe_surface *sps,
- GLint x, GLint y, const GLuint zzzz[QUAD_SIZE])
+ int x, int y, const unsigned zzzz[QUAD_SIZE])
{
- GLushort *dst
- = ((GLushort *) (sps->surface.region->map + sps->surface.offset))
+ ushort *dst
+ = ((ushort *) (sps->surface.region->map + sps->surface.offset))
+ y * sps->surface.region->pitch + x;
assert(sps->surface.format == PIPE_FORMAT_U_Z16);
- /* converting GLuint to GLushort: */
+ /* converting unsigned to ushort: */
dst[0] = zzzz[0];
dst[1] = zzzz[1];
dst += sps->surface.region->pitch;
@@ -205,10 +204,10 @@ z16_write_quad_z(struct softpipe_surface *sps,
static void
z32_read_quad_z(struct softpipe_surface *sps,
- GLint x, GLint y, GLuint zzzz[QUAD_SIZE])
+ int x, int y, unsigned zzzz[QUAD_SIZE])
{
- const GLuint *src
- = ((GLuint *) (sps->surface.region->map + sps->surface.offset))
+ const unsigned *src
+ = ((unsigned *) (sps->surface.region->map + sps->surface.offset))
+ y * sps->surface.region->pitch + x;
assert(sps->surface.format == PIPE_FORMAT_U_Z32);
@@ -222,10 +221,10 @@ z32_read_quad_z(struct softpipe_surface *sps,
static void
z32_write_quad_z(struct softpipe_surface *sps,
- GLint x, GLint y, const GLuint zzzz[QUAD_SIZE])
+ int x, int y, const unsigned zzzz[QUAD_SIZE])
{
- GLuint *dst
- = ((GLuint *) (sps->surface.region->map + sps->surface.offset))
+ unsigned *dst
+ = ((unsigned *) (sps->surface.region->map + sps->surface.offset))
+ y * sps->surface.region->pitch + x;
assert(sps->surface.format == PIPE_FORMAT_U_Z32);
@@ -242,11 +241,11 @@ z32_write_quad_z(struct softpipe_surface *sps,
static void
s8z24_read_quad_z(struct softpipe_surface *sps,
- GLint x, GLint y, GLuint zzzz[QUAD_SIZE])
+ int x, int y, unsigned zzzz[QUAD_SIZE])
{
- static const GLuint mask = 0x00ffffff;
- const GLuint *src
- = ((GLuint *) (sps->surface.region->map + sps->surface.offset))
+ static const unsigned mask = 0x00ffffff;
+ const unsigned *src
+ = ((unsigned *) (sps->surface.region->map + sps->surface.offset))
+ y * sps->surface.region->pitch + x;
assert(sps->surface.format == PIPE_FORMAT_S8_Z24);
@@ -261,11 +260,11 @@ s8z24_read_quad_z(struct softpipe_surface *sps,
static void
s8z24_write_quad_z(struct softpipe_surface *sps,
- GLint x, GLint y, const GLuint zzzz[QUAD_SIZE])
+ int x, int y, const unsigned zzzz[QUAD_SIZE])
{
- static const GLuint mask = 0xff000000;
- GLuint *dst
- = ((GLuint *) (sps->surface.region->map + sps->surface.offset))
+ static const unsigned mask = 0xff000000;
+ unsigned *dst
+ = ((unsigned *) (sps->surface.region->map + sps->surface.offset))
+ y * sps->surface.region->pitch + x;
assert(sps->surface.format == PIPE_FORMAT_S8_Z24);
@@ -280,10 +279,10 @@ s8z24_write_quad_z(struct softpipe_surface *sps,
static void
s8z24_read_quad_stencil(struct softpipe_surface *sps,
- GLint x, GLint y, GLubyte ssss[QUAD_SIZE])
+ int x, int y, ubyte ssss[QUAD_SIZE])
{
- const GLuint *src
- = ((GLuint *) (sps->surface.region->map + sps->surface.offset))
+ const unsigned *src
+ = ((unsigned *) (sps->surface.region->map + sps->surface.offset))
+ y * sps->surface.region->pitch + x;
assert(sps->surface.format == PIPE_FORMAT_S8_Z24);
@@ -297,11 +296,11 @@ s8z24_read_quad_stencil(struct softpipe_surface *sps,
static void
s8z24_write_quad_stencil(struct softpipe_surface *sps,
- GLint x, GLint y, const GLubyte ssss[QUAD_SIZE])
+ int x, int y, const ubyte ssss[QUAD_SIZE])
{
- static const GLuint mask = 0x00ffffff;
- GLuint *dst
- = ((GLuint *) (sps->surface.region->map + sps->surface.offset))
+ static const unsigned mask = 0x00ffffff;
+ unsigned *dst
+ = ((unsigned *) (sps->surface.region->map + sps->surface.offset))
+ y * sps->surface.region->pitch + x;
assert(sps->surface.format == PIPE_FORMAT_S8_Z24);
@@ -318,9 +317,9 @@ s8z24_write_quad_stencil(struct softpipe_surface *sps,
static void
s8_read_quad_stencil(struct softpipe_surface *sps,
- GLint x, GLint y, GLubyte ssss[QUAD_SIZE])
+ int x, int y, ubyte ssss[QUAD_SIZE])
{
- const GLubyte *src
+ const ubyte *src
= sps->surface.region->map + sps->surface.offset
+ y * sps->surface.region->pitch + x;
@@ -335,9 +334,9 @@ s8_read_quad_stencil(struct softpipe_surface *sps,
static void
s8_write_quad_stencil(struct softpipe_surface *sps,
- GLint x, GLint y, const GLubyte ssss[QUAD_SIZE])
+ int x, int y, const ubyte ssss[QUAD_SIZE])
{
- GLubyte *dst
+ ubyte *dst
= sps->surface.region->map + sps->surface.offset
+ y * sps->surface.region->pitch + x;
@@ -393,7 +392,7 @@ softpipe_init_surface_funcs(struct softpipe_surface *sps)
static struct pipe_surface *
-softpipe_surface_alloc(struct pipe_context *pipe, GLuint pipeFormat)
+softpipe_surface_alloc(struct pipe_context *pipe, unsigned pipeFormat)
{
struct softpipe_surface *sps = CALLOC_STRUCT(softpipe_surface);
if (!sps)
@@ -419,17 +418,17 @@ softpipe_surface_alloc(struct pipe_context *pipe, GLuint pipeFormat)
struct pipe_surface *
softpipe_get_tex_surface(struct pipe_context *pipe,
struct pipe_mipmap_tree *mt,
- GLuint face, GLuint level, GLuint zslice)
+ unsigned face, unsigned level, unsigned zslice)
{
struct pipe_surface *ps;
- GLuint offset; /* in bytes */
+ unsigned offset; /* in bytes */
offset = mt->level[level].level_offset;
- if (mt->target == GL_TEXTURE_CUBE_MAP_ARB) {
+ if (mt->target == PIPE_TEXTURE_CUBE) {
offset += mt->level[level].image_offset[face] * mt->cpp;
}
- else if (mt->target == GL_TEXTURE_3D) {
+ else if (mt->target == PIPE_TEXTURE_3D) {
offset += mt->level[level].image_offset[zslice] * mt->cpp;
}
else {
diff --git a/src/mesa/pipe/softpipe/sp_surface.h b/src/mesa/pipe/softpipe/sp_surface.h
index 00b5edcd92..545983f431 100644
--- a/src/mesa/pipe/softpipe/sp_surface.h
+++ b/src/mesa/pipe/softpipe/sp_surface.h
@@ -31,7 +31,6 @@
#ifndef SP_SURFACE_H
#define SP_SURFACE_H
-#include "glheader.h"
#include "sp_headers.h"
#include "pipe/p_state.h"
@@ -50,47 +49,47 @@ struct softpipe_surface {
* Functions for read/writing surface data
*/
void (*read_quad_f)( struct softpipe_surface *,
- GLint x, GLint y,
- GLfloat (*rgba)[NUM_CHANNELS] );
+ int x, int y,
+ float (*rgba)[NUM_CHANNELS] );
void (*read_quad_f_swz)( struct softpipe_surface *,
- GLint x, GLint y,
- GLfloat (*rrrr)[QUAD_SIZE] );
+ int x, int y,
+ float (*rrrr)[QUAD_SIZE] );
void (*read_quad_ub)( struct softpipe_surface *,
- GLint x, GLint y,
- GLubyte (*rgba)[NUM_CHANNELS] );
+ int x, int y,
+ ubyte (*rgba)[NUM_CHANNELS] );
void (*write_quad_f)( struct softpipe_surface *,
- GLint x, GLint y,
- GLfloat (*rgba)[NUM_CHANNELS] );
+ int x, int y,
+ float (*rgba)[NUM_CHANNELS] );
void (*write_quad_f_swz)( struct softpipe_surface *,
- GLint x, GLint y,
- GLfloat (*rrrr)[QUAD_SIZE] );
+ int x, int y,
+ float (*rrrr)[QUAD_SIZE] );
void (*write_quad_ub)( struct softpipe_surface *,
- GLint x, GLint y,
- GLubyte (*rgba)[NUM_CHANNELS] );
+ int x, int y,
+ ubyte (*rgba)[NUM_CHANNELS] );
void (*read_quad_z)(struct softpipe_surface *,
- GLint x, GLint y, GLuint zzzz[QUAD_SIZE]);
+ int x, int y, unsigned zzzz[QUAD_SIZE]);
void (*write_quad_z)(struct softpipe_surface *,
- GLint x, GLint y, const GLuint zzzz[QUAD_SIZE]);
+ int x, int y, const unsigned zzzz[QUAD_SIZE]);
void (*read_quad_stencil)(struct softpipe_surface *,
- GLint x, GLint y, GLubyte ssss[QUAD_SIZE]);
+ int x, int y, ubyte ssss[QUAD_SIZE]);
void (*write_quad_stencil)(struct softpipe_surface *,
- GLint x, GLint y, const GLubyte ssss[QUAD_SIZE]);
+ int x, int y, const ubyte ssss[QUAD_SIZE]);
};
extern struct pipe_surface *
softpipe_get_tex_surface(struct pipe_context *pipe,
struct pipe_mipmap_tree *mt,
- GLuint face, GLuint level, GLuint zslice);
+ unsigned face, unsigned level, unsigned zslice);
extern void
diff --git a/src/mesa/pipe/softpipe/sp_tex_layout.c b/src/mesa/pipe/softpipe/sp_tex_layout.c
index fda1b46ab4..0517c01b5d 100644
--- a/src/mesa/pipe/softpipe/sp_tex_layout.c
+++ b/src/mesa/pipe/softpipe/sp_tex_layout.c
@@ -30,10 +30,10 @@
* Michel Dänzer <michel@tungstengraphics.com>
*/
-#include "macros.h"
#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"
@@ -43,7 +43,7 @@
* little.
*/
-static GLuint minify( GLuint d )
+static unsigned minify( unsigned d )
{
return MAX2(1, d>>1);
}
@@ -56,11 +56,11 @@ static int align(int value, int alignment)
static void
sp_miptree_set_level_info(struct pipe_mipmap_tree *mt,
- GLuint level,
- GLuint nr_images,
- GLuint x, GLuint y, GLuint w, GLuint h, GLuint d)
+ unsigned level,
+ unsigned nr_images,
+ unsigned x, unsigned y, unsigned w, unsigned h, unsigned d)
{
- assert(level < MAX_TEXTURE_LEVELS);
+ assert(level < PIPE_MAX_TEXTURE_LEVELS);
mt->level[level].width = w;
mt->level[level].height = h;
@@ -83,14 +83,14 @@ sp_miptree_set_level_info(struct pipe_mipmap_tree *mt,
assert(nr_images);
assert(!mt->level[level].image_offset);
- mt->level[level].image_offset = (GLuint *) malloc(nr_images * sizeof(GLuint));
+ mt->level[level].image_offset = (unsigned *) malloc(nr_images * sizeof(unsigned));
mt->level[level].image_offset[0] = 0;
}
static void
sp_miptree_set_image_offset(struct pipe_mipmap_tree *mt,
- GLuint level, GLuint img, GLuint x, GLuint y)
+ unsigned level, unsigned img, unsigned x, unsigned y)
{
if (img == 0 && level == 0)
assert(x == 0 && y == 0);
@@ -109,12 +109,12 @@ sp_miptree_set_image_offset(struct pipe_mipmap_tree *mt,
static void
sp_miptree_layout_2d( struct pipe_mipmap_tree *mt )
{
- GLint align_h = 2, align_w = 4;
- GLuint level;
- GLuint x = 0;
- GLuint y = 0;
- GLuint width = mt->width0;
- GLuint height = mt->height0;
+ int align_h = 2, align_w = 4;
+ unsigned level;
+ unsigned x = 0;
+ unsigned y = 0;
+ unsigned width = mt->width0;
+ unsigned height = mt->height0;
mt->pitch = mt->width0;
/* XXX FIX THIS:
@@ -130,7 +130,7 @@ sp_miptree_layout_2d( struct pipe_mipmap_tree *mt )
* 2nd mipmap out past the width of its parent.
*/
if (mt->first_level != mt->last_level) {
- GLuint mip1_width = align(minify(mt->width0), align_w)
+ unsigned mip1_width = align(minify(mt->width0), align_w)
+ minify(minify(mt->width0));
if (mip1_width > mt->width0)
@@ -144,7 +144,7 @@ sp_miptree_layout_2d( struct pipe_mipmap_tree *mt )
mt->total_height = 0;
for ( level = mt->first_level ; level <= mt->last_level ; level++ ) {
- GLuint img_height;
+ unsigned img_height;
sp_miptree_set_level_info(mt, level, 1, x, y, width, height, 1);
@@ -174,7 +174,7 @@ sp_miptree_layout_2d( struct pipe_mipmap_tree *mt )
}
-static const GLint initial_offsets[6][2] = {
+static const int initial_offsets[6][2] = {
{0, 0},
{0, 2},
{1, 0},
@@ -183,7 +183,7 @@ static const GLint initial_offsets[6][2] = {
{1, 3}
};
-static const GLint step_offsets[6][2] = {
+static const int step_offsets[6][2] = {
{0, 2},
{0, 2},
{-1, 2},
@@ -194,16 +194,16 @@ static const GLint step_offsets[6][2] = {
-GLboolean
+boolean
softpipe_mipmap_tree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree * mt)
{
- GLint level;
+ int level;
switch (mt->target) {
- case GL_TEXTURE_CUBE_MAP:{
- const GLuint dim = mt->width0;
- GLuint face;
- GLuint lvlWidth = mt->width0, lvlHeight = mt->height0;
+ case PIPE_TEXTURE_CUBE:{
+ const unsigned dim = mt->width0;
+ unsigned face;
+ unsigned lvlWidth = mt->width0, lvlHeight = mt->height0;
assert(lvlWidth == lvlHeight); /* cubemap images are square */
@@ -230,9 +230,9 @@ softpipe_mipmap_tree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree *
for (face = 0; face < 6; face++) {
- GLuint x = initial_offsets[face][0] * dim;
- GLuint y = initial_offsets[face][1] * dim;
- GLuint d = dim;
+ unsigned x = initial_offsets[face][0] * dim;
+ unsigned y = initial_offsets[face][1] * dim;
+ unsigned d = dim;
if (dim == 4 && face >= 4) {
y = mt->total_height - 4;
@@ -286,13 +286,13 @@ softpipe_mipmap_tree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree *
}
break;
}
- case GL_TEXTURE_3D:{
- GLuint width = mt->width0;
- GLuint height = mt->height0;
- GLuint depth = mt->depth0;
- GLuint pack_x_pitch, pack_x_nr;
- GLuint pack_y_pitch;
- GLuint level;
+ case PIPE_TEXTURE_3D:{
+ unsigned width = mt->width0;
+ unsigned height = mt->height0;
+ unsigned depth = mt->depth0;
+ unsigned pack_x_pitch, pack_x_nr;
+ unsigned pack_y_pitch;
+ unsigned level;
mt->pitch = ((mt->width0 * mt->cpp + 3) & ~3) / mt->cpp;
mt->total_height = 0;
@@ -302,10 +302,10 @@ softpipe_mipmap_tree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree *
pack_x_nr = 1;
for (level = mt->first_level; level <= mt->last_level; level++) {
- GLuint nr_images = mt->target == GL_TEXTURE_3D ? depth : 6;
- GLint x = 0;
- GLint y = 0;
- GLint q, j;
+ unsigned nr_images = mt->target == PIPE_TEXTURE_3D ? depth : 6;
+ int x = 0;
+ int y = 0;
+ int q, j;
sp_miptree_set_level_info(mt, level, nr_images,
0, mt->total_height,
@@ -341,13 +341,14 @@ softpipe_mipmap_tree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree *
break;
}
- case GL_TEXTURE_1D:
- case GL_TEXTURE_2D:
- case GL_TEXTURE_RECTANGLE_ARB:
+ case PIPE_TEXTURE_1D:
+ case PIPE_TEXTURE_2D:
+// case PIPE_TEXTURE_RECTANGLE:
sp_miptree_layout_2d(mt);
break;
default:
- _mesa_problem(NULL, "Unexpected tex target in sp_miptree_layout()");
+ assert(0);
+ break;
}
/*
@@ -356,6 +357,6 @@ softpipe_mipmap_tree_layout(struct pipe_context *pipe, struct pipe_mipmap_tree *
mt->total_height, mt->cpp, mt->pitch * mt->total_height * mt->cpp);
*/
- return GL_TRUE;
+ return TRUE;
}
diff --git a/src/mesa/pipe/softpipe/sp_tex_layout.h b/src/mesa/pipe/softpipe/sp_tex_layout.h
index be85e4be58..ea19c13b23 100644
--- a/src/mesa/pipe/softpipe/sp_tex_layout.h
+++ b/src/mesa/pipe/softpipe/sp_tex_layout.h
@@ -6,7 +6,7 @@ struct pipe_context;
struct pipe_mipmap_tree;
-extern GLboolean
+extern boolean
softpipe_mipmap_tree_layout(struct pipe_context *pipe,
struct pipe_mipmap_tree *mt);
diff --git a/src/mesa/pipe/softpipe/sp_tex_sample.c b/src/mesa/pipe/softpipe/sp_tex_sample.c
index 35993b946f..23a0306bba 100644
--- a/src/mesa/pipe/softpipe/sp_tex_sample.c
+++ b/src/mesa/pipe/softpipe/sp_tex_sample.c
@@ -33,12 +33,12 @@
*/
-#include "main/macros.h"
#include "sp_context.h"
#include "sp_surface.h"
#include "sp_tex_sample.h"
#include "pipe/p_context.h"
#include "pipe/p_defines.h"
+#include "pipe/p_util.h"
#include "pipe/tgsi/core/tgsi_exec.h"
@@ -49,7 +49,7 @@
* Also note, FRAC(x) doesn't truly return the fractional part of x for x < 0.
* Instead, if x < 0 then FRAC(x) = 1 - true_frac(x).
*/
-#define FRAC(f) ((f) - IFLOOR(f))
+#define FRAC(f) ((f) - ifloor(f))
/**
@@ -80,8 +80,8 @@ lerp_2d(float a, float b,
* Compute the remainder of a divided by b, but be careful with
* negative values so that REPEAT mode works right.
*/
-static INLINE GLint
-repeat_remainder(GLint a, GLint b)
+static INLINE int
+repeat_remainder(int a, int b)
{
if (a >= 0)
return a % b;
@@ -97,15 +97,15 @@ repeat_remainder(GLint a, GLint b)
* \param size the texture image size
* \return integer texture index
*/
-static INLINE GLint
-nearest_texcoord(GLuint wrapMode, float s, GLuint size)
+static INLINE int
+nearest_texcoord(unsigned wrapMode, float s, unsigned size)
{
- GLint i;
+ int i;
switch (wrapMode) {
case PIPE_TEX_WRAP_REPEAT:
/* s limited to [0,1) */
/* i limited to [0,size-1] */
- i = IFLOOR(s * size);
+ i = ifloor(s * size);
i = repeat_remainder(i, size);
return i;
case PIPE_TEX_WRAP_CLAMP:
@@ -116,7 +116,7 @@ nearest_texcoord(GLuint wrapMode, float s, GLuint size)
else if (s >= 1.0F)
i = size - 1;
else
- i = IFLOOR(s * size);
+ i = ifloor(s * size);
return i;
case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
{
@@ -129,7 +129,7 @@ nearest_texcoord(GLuint wrapMode, float s, GLuint size)
else if (s > max)
i = size - 1;
else
- i = IFLOOR(s * size);
+ i = ifloor(s * size);
}
return i;
case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
@@ -143,14 +143,14 @@ nearest_texcoord(GLuint wrapMode, float s, GLuint size)
else if (s >= max)
i = size;
else
- i = IFLOOR(s * size);
+ i = ifloor(s * size);
}
return i;
case PIPE_TEX_WRAP_MIRROR_REPEAT:
{
const float min = 1.0F / (2.0F * size);
const float max = 1.0F - min;
- const GLint flr = IFLOOR(s);
+ const int flr = ifloor(s);
float u;
if (flr & 1)
u = 1.0F - (s - (float) flr);
@@ -161,7 +161,7 @@ nearest_texcoord(GLuint wrapMode, float s, GLuint size)
else if (u > max)
i = size - 1;
else
- i = IFLOOR(u * size);
+ i = ifloor(u * size);
}
return i;
case PIPE_TEX_WRAP_MIRROR_CLAMP:
@@ -174,7 +174,7 @@ nearest_texcoord(GLuint wrapMode, float s, GLuint size)
else if (u >= 1.0F)
i = size - 1;
else
- i = IFLOOR(u * size);
+ i = ifloor(u * size);
}
return i;
case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
@@ -189,7 +189,7 @@ nearest_texcoord(GLuint wrapMode, float s, GLuint size)
else if (u > max)
i = size - 1;
else
- i = IFLOOR(u * size);
+ i = ifloor(u * size);
}
return i;
case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
@@ -204,7 +204,7 @@ nearest_texcoord(GLuint wrapMode, float s, GLuint size)
else if (u > max)
i = size;
else
- i = IFLOOR(u * size);
+ i = ifloor(u * size);
}
return i;
default:
@@ -224,14 +224,14 @@ nearest_texcoord(GLuint wrapMode, float s, GLuint size)
* \param a returns blend factor/weight between texture indexes
*/
static INLINE void
-linear_texcoord(GLuint wrapMode, float s, GLuint size,
- GLint *i0, GLint *i1, float *a)
+linear_texcoord(unsigned wrapMode, float s, unsigned size,
+ int *i0, int *i1, float *a)
{
float u;
switch (wrapMode) {
case PIPE_TEX_WRAP_REPEAT:
u = s * size - 0.5F;
- *i0 = repeat_remainder(IFLOOR(u), size);
+ *i0 = repeat_remainder(ifloor(u), size);
*i1 = repeat_remainder(*i0 + 1, size);
break;
case PIPE_TEX_WRAP_CLAMP:
@@ -242,7 +242,7 @@ linear_texcoord(GLuint wrapMode, float s, GLuint size,
else
u = s * size;
u -= 0.5F;
- *i0 = IFLOOR(u);
+ *i0 = ifloor(u);
*i1 = *i0 + 1;
break;
case PIPE_TEX_WRAP_CLAMP_TO_EDGE:
@@ -253,11 +253,11 @@ linear_texcoord(GLuint wrapMode, float s, GLuint size,
else
u = s * size;
u -= 0.5F;
- *i0 = IFLOOR(u);
+ *i0 = ifloor(u);
*i1 = *i0 + 1;
if (*i0 < 0)
*i0 = 0;
- if (*i1 >= (GLint) size)
+ if (*i1 >= (int) size)
*i1 = size - 1;
break;
case PIPE_TEX_WRAP_CLAMP_TO_BORDER:
@@ -271,23 +271,23 @@ linear_texcoord(GLuint wrapMode, float s, GLuint size,
else
u = s * size;
u -= 0.5F;
- *i0 = IFLOOR(u);
+ *i0 = ifloor(u);
*i1 = *i0 + 1;
}
break;
case PIPE_TEX_WRAP_MIRROR_REPEAT:
{
- const GLint flr = IFLOOR(s);
+ const int flr = ifloor(s);
if (flr & 1)
u = 1.0F - (s - (float) flr);
else
u = s - (float) flr;
u = (u * size) - 0.5F;
- *i0 = IFLOOR(u);
+ *i0 = ifloor(u);
*i1 = *i0 + 1;
if (*i0 < 0)
*i0 = 0;
- if (*i1 >= (GLint) size)
+ if (*i1 >= (int) size)
*i1 = size - 1;
}
break;
@@ -298,7 +298,7 @@ linear_texcoord(GLuint wrapMode, float s, GLuint size,
else
u *= size;
u -= 0.5F;
- *i0 = IFLOOR(u);
+ *i0 = ifloor(u);
*i1 = *i0 + 1;
break;
case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_EDGE:
@@ -308,11 +308,11 @@ linear_texcoord(GLuint wrapMode, float s, GLuint size,
else
u *= size;
u -= 0.5F;
- *i0 = IFLOOR(u);
+ *i0 = ifloor(u);
*i1 = *i0 + 1;
if (*i0 < 0)
*i0 = 0;
- if (*i1 >= (GLint) size)
+ if (*i1 >= (int) size)
*i1 = size - 1;
break;
case PIPE_TEX_WRAP_MIRROR_CLAMP_TO_BORDER:
@@ -327,7 +327,7 @@ linear_texcoord(GLuint wrapMode, float s, GLuint size,
else
u *= size;
u -= 0.5F;
- *i0 = IFLOOR(u);
+ *i0 = ifloor(u);
*i1 = *i0 + 1;
}
break;
@@ -338,7 +338,7 @@ linear_texcoord(GLuint wrapMode, float s, GLuint size,
}
-static GLuint
+static unsigned
choose_cube_face(float rx, float ry, float rz, float *newS, float *newT)
{
/*
@@ -353,7 +353,7 @@ choose_cube_face(float rx, float ry, float rz, float *newS, float *newT)
-rz TEXTURE_CUBE_MAP_NEGATIVE_Z_EXT -rx -ry rz
*/
const float arx = FABSF(rx), ary = FABSF(ry), arz = FABSF(rz);
- GLuint face;
+ unsigned face;
float sc, tc, ma;
if (arx > ary && arx > arz) {
@@ -779,16 +779,16 @@ sp_get_samples(struct tgsi_sampler *sampler,
float rgba[NUM_CHANNELS][QUAD_SIZE])
{
switch (sampler->texture->target) {
- case GL_TEXTURE_1D:
+ case PIPE_TEXTURE_1D:
sp_get_samples_1d(sampler, s, t, p, lodbias, rgba);
break;
- case GL_TEXTURE_2D:
+ case PIPE_TEXTURE_2D:
sp_get_samples_2d(sampler, s, t, p, lodbias, rgba);
break;
- case GL_TEXTURE_3D:
+ case PIPE_TEXTURE_3D:
sp_get_samples_3d(sampler, s, t, p, lodbias, rgba);
break;
- case GL_TEXTURE_CUBE_MAP:
+ case PIPE_TEXTURE_CUBE:
sp_get_samples_cube(sampler, s, t, p, lodbias, rgba);
break;
default:
diff --git a/src/mesa/pipe/softpipe/sp_tex_sample.h b/src/mesa/pipe/softpipe/sp_tex_sample.h
index 43aae87283..404bfd0c36 100644
--- a/src/mesa/pipe/softpipe/sp_tex_sample.h
+++ b/src/mesa/pipe/softpipe/sp_tex_sample.h
@@ -7,11 +7,11 @@ struct tgsi_sampler;
extern void
sp_get_samples(struct tgsi_sampler *sampler,
- const GLfloat s[QUAD_SIZE],
- const GLfloat t[QUAD_SIZE],
- const GLfloat p[QUAD_SIZE],
+ const float s[QUAD_SIZE],
+ const float t[QUAD_SIZE],
+ const float p[QUAD_SIZE],
float lodbias,
- GLfloat rgba[NUM_CHANNELS][QUAD_SIZE]);
+ float rgba[NUM_CHANNELS][QUAD_SIZE]);
#endif /* SP_TEX_SAMPLE_H */
diff --git a/src/mesa/pipe/tgsi/core/tgsi_build.h b/src/mesa/pipe/tgsi/core/tgsi_build.h
index 35c1a2506d..8b5db5662c 100644
--- a/src/mesa/pipe/tgsi/core/tgsi_build.h
+++ b/src/mesa/pipe/tgsi/core/tgsi_build.h
@@ -24,7 +24,7 @@ tgsi_default_processor( void );
struct tgsi_processor
tgsi_build_processor(
- GLuint processor,
+ unsigned processor,
struct tgsi_header *header );
/*
@@ -36,31 +36,31 @@ tgsi_default_declaration( void );
struct tgsi_declaration
tgsi_build_declaration(
- GLuint file,
- GLuint declare,
- GLuint interpolate,
+ unsigned file,
+ unsigned declare,
+ unsigned interpolate,
struct tgsi_header *header );
struct tgsi_full_declaration
tgsi_default_full_declaration( void );
-GLuint
+unsigned
tgsi_build_full_declaration(
const struct tgsi_full_declaration *full_decl,
struct tgsi_token *tokens,
struct tgsi_header *header,
- GLuint maxsize );
+ unsigned maxsize );
struct tgsi_declaration_range
tgsi_build_declaration_range(
- GLuint first,
- GLuint last,
+ unsigned first,
+ unsigned last,
struct tgsi_declaration *declaration,
struct tgsi_header *header );
struct tgsi_declaration_mask
tgsi_build_declaration_mask(
- GLuint mask,
+ unsigned mask,
struct tgsi_declaration *declaration,
struct tgsi_header *header );
@@ -69,7 +69,7 @@ tgsi_default_declaration_interpolation( void );
struct tgsi_declaration_interpolation
tgsi_build_declaration_interpolation(
- GLuint interpolate,
+ unsigned interpolate,
struct tgsi_declaration *declaration,
struct tgsi_header *header );
@@ -89,16 +89,16 @@ tgsi_default_full_immediate( void );
struct tgsi_immediate_float32
tgsi_build_immediate_float32(
- GLfloat value,
+ float value,
struct tgsi_immediate *immediate,
struct tgsi_header *header );
-GLuint
+unsigned
tgsi_build_full_immediate(
const struct tgsi_full_immediate *full_imm,
struct tgsi_token *tokens,
struct tgsi_header *header,
- GLuint maxsize );
+ unsigned maxsize );
/*
* instruction
@@ -109,42 +109,42 @@ tgsi_default_instruction( void );
struct tgsi_instruction
tgsi_build_instruction(
- GLuint opcode,
- GLuint saturate,
- GLuint num_dst_regs,
- GLuint num_src_regs,
+ unsigned opcode,
+ unsigned saturate,
+ unsigned num_dst_regs,
+ unsigned num_src_regs,
struct tgsi_header *header );
struct tgsi_full_instruction
tgsi_default_full_instruction( void );
-GLuint
+unsigned
tgsi_build_full_instruction(
const struct tgsi_full_instruction *full_inst,
struct tgsi_token *tokens,
struct tgsi_header *header,
- GLuint maxsize );
+ unsigned maxsize );
struct tgsi_instruction_ext_nv
tgsi_default_instruction_ext_nv( void );
-GLuint
+unsigned
tgsi_compare_instruction_ext_nv(
struct tgsi_instruction_ext_nv a,
struct tgsi_instruction_ext_nv b );
struct tgsi_instruction_ext_nv
tgsi_build_instruction_ext_nv(
- GLuint precision,
- GLuint cond_dst_index,
- GLuint cond_flow_index,
- GLuint cond_mask,
- GLuint cond_swizzle_x,
- GLuint cond_swizzle_y,
- GLuint cond_swizzle_z,
- GLuint cond_swizzle_w,
- GLuint cond_dst_update,
- GLuint cond_flow_update,
+ unsigned precision,
+ unsigned cond_dst_index,
+ unsigned cond_flow_index,
+ unsigned cond_mask,
+ unsigned cond_swizzle_x,
+ unsigned cond_swizzle_y,
+ unsigned cond_swizzle_z,
+ unsigned cond_swizzle_w,
+ unsigned cond_dst_update,
+ unsigned cond_flow_update,
struct tgsi_token *prev_token,
struct tgsi_instruction *instruction,
struct tgsi_header *header );
@@ -152,14 +152,14 @@ tgsi_build_instruction_ext_nv(
struct tgsi_instruction_ext_label
tgsi_default_instruction_ext_label( void );
-GLuint
+unsigned
tgsi_compare_instruction_ext_label(
struct tgsi_instruction_ext_label a,
struct tgsi_instruction_ext_label b );
struct tgsi_instruction_ext_label
tgsi_build_instruction_ext_label(
- GLuint label,
+ unsigned label,
struct tgsi_token *prev_token,
struct tgsi_instruction *instruction,
struct tgsi_header *header );
@@ -167,14 +167,14 @@ tgsi_build_instruction_ext_label(
struct tgsi_instruction_ext_texture
tgsi_default_instruction_ext_texture( void );
-GLuint
+unsigned
tgsi_compare_instruction_ext_texture(
struct tgsi_instruction_ext_texture a,
struct tgsi_instruction_ext_texture b );
struct tgsi_instruction_ext_texture
tgsi_build_instruction_ext_texture(
- GLuint texture,
+ unsigned texture,
struct tgsi_token *prev_token,
struct tgsi_instruction *instruction,
struct tgsi_header *header );
@@ -184,15 +184,15 @@ tgsi_default_src_register( void );
struct tgsi_src_register
tgsi_build_src_register(
- GLuint file,
- GLuint swizzle_x,
- GLuint swizzle_y,
- GLuint swizzle_z,
- GLuint swizzle_w,
- GLuint negate,
- GLuint indirect,
- GLuint dimension,
- GLint index,
+ unsigned file,
+ unsigned swizzle_x,
+ unsigned swizzle_y,
+ unsigned swizzle_z,
+ unsigned swizzle_w,
+ unsigned negate,
+ unsigned indirect,
+ unsigned dimension,
+ int index,
struct tgsi_instruction *instruction,
struct tgsi_header *header );
@@ -202,22 +202,22 @@ tgsi_default_full_src_register( void );
struct tgsi_src_register_ext_swz
tgsi_default_src_register_ext_swz( void );
-GLuint
+unsigned
tgsi_compare_src_register_ext_swz(
struct tgsi_src_register_ext_swz a,
struct tgsi_src_register_ext_swz b );
struct tgsi_src_register_ext_swz
tgsi_build_src_register_ext_swz(
- GLuint ext_swizzle_x,
- GLuint ext_swizzle_y,
- GLuint ext_swizzle_z,
- GLuint ext_swizzle_w,
- GLuint negate_x,
- GLuint negate_y,
- GLuint negate_z,
- GLuint negate_w,
- GLuint ext_divide,
+ unsigned ext_swizzle_x,
+ unsigned ext_swizzle_y,
+ unsigned ext_swizzle_z,
+ unsigned ext_swizzle_w,
+ unsigned negate_x,
+ unsigned negate_y,
+ unsigned negate_z,
+ unsigned negate_w,
+ unsigned ext_divide,
struct tgsi_token *prev_token,
struct tgsi_instruction *instruction,
struct tgsi_header *header );
@@ -225,18 +225,18 @@ tgsi_build_src_register_ext_swz(
struct tgsi_src_register_ext_mod
tgsi_default_src_register_ext_mod( void );
-GLuint
+unsigned
tgsi_compare_src_register_ext_mod(
struct tgsi_src_register_ext_mod a,
struct tgsi_src_register_ext_mod b );
struct tgsi_src_register_ext_mod
tgsi_build_src_register_ext_mod(
- GLuint complement,
- GLuint bias,
- GLuint scale_2x,
- GLuint absolute,
- GLuint negate,
+ unsigned complement,
+ unsigned bias,
+ unsigned scale_2x,
+ unsigned absolute,
+ unsigned negate,
struct tgsi_token *prev_token,
struct tgsi_instruction *instruction,
struct tgsi_header *header );
@@ -246,8 +246,8 @@ tgsi_default_dimension( void );
struct tgsi_dimension
tgsi_build_dimension(
- GLuint indirect,
- GLuint index,
+ unsigned indirect,
+ unsigned index,
struct tgsi_instruction *instruction,
struct tgsi_header *header );
@@ -256,9 +256,9 @@ tgsi_default_dst_register( void );
struct tgsi_dst_register
tgsi_build_dst_register(
- GLuint file,
- GLuint mask,
- GLint index,
+ unsigned file,
+ unsigned mask,
+ int index,
struct tgsi_instruction *instruction,
struct tgsi_header *header );
@@ -268,19 +268,19 @@ tgsi_default_full_dst_register( void );
struct tgsi_dst_register_ext_concode
tgsi_default_dst_register_ext_concode( void );
-GLuint
+unsigned
tgsi_compare_dst_register_ext_concode(
struct tgsi_dst_register_ext_concode a,
struct tgsi_dst_register_ext_concode b );
struct tgsi_dst_register_ext_concode
tgsi_build_dst_register_ext_concode(
- GLuint cc,
- GLuint swizzle_x,
- GLuint swizzle_y,
- GLuint swizzle_z,
- GLuint swizzle_w,
- GLint index,
+ unsigned cc,
+ unsigned swizzle_x,
+ unsigned swizzle_y,
+ unsigned swizzle_z,
+ unsigned swizzle_w,
+ int index,
struct tgsi_token *prev_token,
struct tgsi_instruction *instruction,
struct tgsi_header *header );
@@ -288,14 +288,14 @@ tgsi_build_dst_register_ext_concode(
struct tgsi_dst_register_ext_modulate
tgsi_default_dst_register_ext_modulate( void );
-GLuint
+unsigned
tgsi_compare_dst_register_ext_modulate(
struct tgsi_dst_register_ext_modulate a,
struct tgsi_dst_register_ext_modulate b );
struct tgsi_dst_register_ext_modulate
tgsi_build_dst_register_ext_modulate(
- GLuint modulate,
+ unsigned modulate,
struct tgsi_token *prev_token,
struct tgsi_instruction *instruction,
struct tgsi_header *header );
diff --git a/src/mesa/pipe/tgsi/core/tgsi_dump.h b/src/mesa/pipe/tgsi/core/tgsi_dump.h
index 8553bdff59..70860c0885 100644
--- a/src/mesa/pipe/tgsi/core/tgsi_dump.h
+++ b/src/mesa/pipe/tgsi/core/tgsi_dump.h
@@ -12,7 +12,7 @@ extern "C" {
void
tgsi_dump(
const struct tgsi_token *tokens,
- GLuint flags );
+ unsigned flags );
#if defined __cplusplus
} // extern "C"
diff --git a/src/mesa/pipe/tgsi/core/tgsi_exec.h b/src/mesa/pipe/tgsi/core/tgsi_exec.h
index 5e07e18a31..eed2207d7d 100644
--- a/src/mesa/pipe/tgsi/core/tgsi_exec.h
+++ b/src/mesa/pipe/tgsi/core/tgsi_exec.h
@@ -1,6 +1,8 @@
#if !defined TGSI_EXEC_H
#define TGSI_EXEC_H
+#include "pipe/p_compiler.h"
+
#if 0
#include "x86/rtasm/x86sse.h"
#endif
@@ -11,9 +13,9 @@ extern "C" {
union tgsi_exec_channel
{
- GLfloat f[4];
- GLint i[4];
- GLuint u[4];
+ float f[4];
+ int i[4];
+ unsigned u[4];
};
struct tgsi_exec_vector
@@ -33,7 +35,7 @@ struct tgsi_exec_vector
struct tgsi_texture_cache_entry
{
int x, y, face, level, zslice;
- GLfloat data[TEX_CACHE_TILE_SIZE][TEX_CACHE_TILE_SIZE][4];
+ float data[TEX_CACHE_TILE_SIZE][TEX_CACHE_TILE_SIZE][4];
};
struct tgsi_sampler
@@ -42,19 +44,19 @@ struct tgsi_sampler
struct pipe_mipmap_tree *texture;
/** Get samples for four fragments in a quad */
void (*get_samples)(struct tgsi_sampler *sampler,
- const GLfloat s[QUAD_SIZE],
- const GLfloat t[QUAD_SIZE],
- const GLfloat p[QUAD_SIZE],
- GLfloat lodbias,
- GLfloat rgba[NUM_CHANNELS][QUAD_SIZE]);
+ const float s[QUAD_SIZE],
+ const float t[QUAD_SIZE],
+ const float p[QUAD_SIZE],
+ float lodbias,
+ float rgba[NUM_CHANNELS][QUAD_SIZE]);
void *pipe; /*XXX temporary*/
struct tgsi_texture_cache_entry cache[TEX_CACHE_NUM_ENTRIES];
};
struct tgsi_exec_labels
{
- GLuint labels[128][2];
- GLuint count;
+ unsigned labels[128][2];
+ unsigned count;
};
#define TGSI_EXEC_TEMP_00000000_I 32
@@ -107,15 +109,15 @@ struct tgsi_exec_cond_state
{
struct tgsi_exec_cond_regs IfPortion;
struct tgsi_exec_cond_regs ElsePortion;
- GLuint Condition;
- GLboolean WasElse;
+ unsigned Condition;
+ boolean WasElse;
};
/* XXX: This is temporary */
struct tgsi_exec_cond_stack
{
struct tgsi_exec_cond_state States[8];
- GLuint Index; /* into States[] */
+ unsigned Index; /* into States[] */
};
struct tgsi_exec_machine
@@ -136,15 +138,15 @@ struct tgsi_exec_machine
struct tgsi_sampler *Samplers;
- GLfloat Imms[256][4];
- GLuint ImmLimit;
- GLfloat (*Consts)[4];
+ float Imms[256][4];
+ unsigned ImmLimit;
+ float (*Consts)[4];
const struct tgsi_exec_vector *Inputs;
struct tgsi_exec_vector *Outputs;
struct tgsi_token *Tokens;
- GLuint Processor;
+ unsigned Processor;
- GLuint *Primitives;
+ unsigned *Primitives;
struct tgsi_exec_cond_stack CondStack;
#if XXX_SSE
@@ -156,7 +158,7 @@ void
tgsi_exec_machine_init(
struct tgsi_exec_machine *mach,
struct tgsi_token *tokens,
- GLuint numSamplers,
+ unsigned numSamplers,
struct tgsi_sampler *samplers);
void
diff --git a/src/mesa/pipe/tgsi/core/tgsi_parse.h b/src/mesa/pipe/tgsi/core/tgsi_parse.h
index 61ad0669b1..bba01431fa 100644
--- a/src/mesa/pipe/tgsi/core/tgsi_parse.h
+++ b/src/mesa/pipe/tgsi/core/tgsi_parse.h
@@ -86,7 +86,7 @@ tgsi_full_token_free(
struct tgsi_parse_context
{
const struct tgsi_token *Tokens;
- GLuint Position;
+ unsigned Position;
struct tgsi_full_version FullVersion;
struct tgsi_full_header FullHeader;
union tgsi_full_token FullToken;
@@ -95,7 +95,7 @@ struct tgsi_parse_context
#define TGSI_PARSE_OK 0
#define TGSI_PARSE_ERROR 1
-GLuint
+unsigned
tgsi_parse_init(
struct tgsi_parse_context *ctx,
const struct tgsi_token *tokens );
@@ -104,7 +104,7 @@ void
tgsi_parse_free(
struct tgsi_parse_context *ctx );
-GLuint
+unsigned
tgsi_parse_end_of_tokens(
struct tgsi_parse_context *ctx );
diff --git a/src/mesa/pipe/tgsi/core/tgsi_token.h b/src/mesa/pipe/tgsi/core/tgsi_token.h
index ec62836ef3..dc9301ed37 100644
--- a/src/mesa/pipe/tgsi/core/tgsi_token.h
+++ b/src/mesa/pipe/tgsi/core/tgsi_token.h
@@ -7,15 +7,15 @@ extern "C" {
struct tgsi_version
{
- GLuint MajorVersion : 8;
- GLuint MinorVersion : 8;
- GLuint Padding : 16;
+ unsigned MajorVersion : 8;
+ unsigned MinorVersion : 8;
+ unsigned Padding : 16;
};
struct tgsi_header
{
- GLuint HeaderSize : 8;
- GLuint BodySize : 24;
+ unsigned HeaderSize : 8;
+ unsigned BodySize : 24;
};
#define TGSI_PROCESSOR_FRAGMENT 0
@@ -24,8 +24,8 @@ struct tgsi_header
struct tgsi_processor
{
- GLuint Processor : 4; /* TGSI_PROCESSOR_ */
- GLuint Padding : 28;
+ unsigned Processor : 4; /* TGSI_PROCESSOR_ */
+ unsigned Padding : 28;
};
#define TGSI_TOKEN_TYPE_DECLARATION 0
@@ -34,10 +34,10 @@ struct tgsi_processor
struct tgsi_token
{
- GLuint Type : 4; /* TGSI_TOKEN_TYPE_ */
- GLuint Size : 8; /* UINT */
- GLuint Padding : 19;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_TOKEN_TYPE_ */
+ unsigned Size : 8; /* UINT */
+ unsigned Padding : 19;
+ unsigned Extended : 1; /* BOOL */
};
#define TGSI_FILE_NULL 0
@@ -54,24 +54,24 @@ struct tgsi_token
struct tgsi_declaration
{
- GLuint Type : 4; /* TGSI_TOKEN_TYPE_DECLARATION */
- GLuint Size : 8; /* UINT */
- GLuint File : 4; /* TGSI_FILE_ */
- GLuint Declare : 4; /* TGSI_DECLARE_ */
- GLuint Interpolate : 1; /* BOOL */
- GLuint Padding : 10;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_TOKEN_TYPE_DECLARATION */
+ unsigned Size : 8; /* UINT */
+ unsigned File : 4; /* TGSI_FILE_ */
+ unsigned Declare : 4; /* TGSI_DECLARE_ */
+ unsigned Interpolate : 1; /* BOOL */
+ unsigned Padding : 10;
+ unsigned Extended : 1; /* BOOL */
};
struct tgsi_declaration_range
{
- GLuint First : 16; /* UINT */
- GLuint Last : 16; /* UINT */
+ unsigned First : 16; /* UINT */
+ unsigned Last : 16; /* UINT */
};
struct tgsi_declaration_mask
{
- GLuint Mask : 32; /* UINT */
+ unsigned Mask : 32; /* UINT */
};
#define TGSI_INTERPOLATE_CONSTANT 0
@@ -80,24 +80,24 @@ struct tgsi_declaration_mask
struct tgsi_declaration_interpolation
{
- GLuint Interpolate : 4; /* TGSI_INTERPOLATE_ */
- GLuint Padding : 28;
+ unsigned Interpolate : 4; /* TGSI_INTERPOLATE_ */
+ unsigned Padding : 28;
};
#define TGSI_IMM_FLOAT32 0
struct tgsi_immediate
{
- GLuint Type : 4; /* TGSI_TOKEN_TYPE_IMMEDIATE */
- GLuint Size : 8; /* UINT */
- GLuint DataType : 4; /* TGSI_IMM_ */
- GLuint Padding : 15;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_TOKEN_TYPE_IMMEDIATE */
+ unsigned Size : 8; /* UINT */
+ unsigned DataType : 4; /* TGSI_IMM_ */
+ unsigned Padding : 15;
+ unsigned Extended : 1; /* BOOL */
};
struct tgsi_immediate_float32
{
- GLfloat Float;
+ float Float;
};
/*
@@ -1088,14 +1088,14 @@ struct tgsi_immediate_float32
struct tgsi_instruction
{
- GLuint Type : 4; /* TGSI_TOKEN_TYPE_INSTRUCTION */
- GLuint Size : 8; /* UINT */
- GLuint Opcode : 8; /* TGSI_OPCODE_ */
- GLuint Saturate : 2; /* TGSI_SAT_ */
- GLuint NumDstRegs : 2; /* UINT */
- GLuint NumSrcRegs : 4; /* UINT */
- GLuint Padding : 3;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_TOKEN_TYPE_INSTRUCTION */
+ unsigned Size : 8; /* UINT */
+ unsigned Opcode : 8; /* TGSI_OPCODE_ */
+ unsigned Saturate : 2; /* TGSI_SAT_ */
+ unsigned NumDstRegs : 2; /* UINT */
+ unsigned NumSrcRegs : 4; /* UINT */
+ unsigned Padding : 3;
+ unsigned Extended : 1; /* BOOL */
};
/*
@@ -1116,9 +1116,9 @@ struct tgsi_instruction
struct tgsi_instruction_ext
{
- GLuint Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_ */
- GLuint Padding : 27;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_ */
+ unsigned Padding : 27;
+ unsigned Extended : 1; /* BOOL */
};
/*
@@ -1174,27 +1174,27 @@ struct tgsi_instruction_ext
struct tgsi_instruction_ext_nv
{
- GLuint Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_NV */
- GLuint Precision : 4; /* TGSI_PRECISION_ */
- GLuint CondDstIndex : 4; /* UINT */
- GLuint CondFlowIndex : 4; /* UINT */
- GLuint CondMask : 4; /* TGSI_CC_ */
- GLuint CondSwizzleX : 2; /* TGSI_SWIZZLE_ */
- GLuint CondSwizzleY : 2; /* TGSI_SWIZZLE_ */
- GLuint CondSwizzleZ : 2; /* TGSI_SWIZZLE_ */
- GLuint CondSwizzleW : 2; /* TGSI_SWIZZLE_ */
- GLuint CondDstUpdate : 1; /* BOOL */
- GLuint CondFlowEnable : 1; /* BOOL */
- GLuint Padding : 1;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_NV */
+ unsigned Precision : 4; /* TGSI_PRECISION_ */
+ unsigned CondDstIndex : 4; /* UINT */
+ unsigned CondFlowIndex : 4; /* UINT */
+ unsigned CondMask : 4; /* TGSI_CC_ */
+ unsigned CondSwizzleX : 2; /* TGSI_SWIZZLE_ */
+ unsigned CondSwizzleY : 2; /* TGSI_SWIZZLE_ */
+ unsigned CondSwizzleZ : 2; /* TGSI_SWIZZLE_ */
+ unsigned CondSwizzleW : 2; /* TGSI_SWIZZLE_ */
+ unsigned CondDstUpdate : 1; /* BOOL */
+ unsigned CondFlowEnable : 1; /* BOOL */
+ unsigned Padding : 1;
+ unsigned Extended : 1; /* BOOL */
};
struct tgsi_instruction_ext_label
{
- GLuint Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_LABEL */
- GLuint Label : 24; /* UINT */
- GLuint Padding : 3;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_LABEL */
+ unsigned Label : 24; /* UINT */
+ unsigned Padding : 3;
+ unsigned Extended : 1; /* BOOL */
};
#define TGSI_TEXTURE_UNKNOWN 0
@@ -1209,10 +1209,10 @@ struct tgsi_instruction_ext_label
struct tgsi_instruction_ext_texture
{
- GLuint Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_TEXTURE */
- GLuint Texture : 8; /* TGSI_TEXTURE_ */
- GLuint Padding : 19;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_TEXTURE */
+ unsigned Texture : 8; /* TGSI_TEXTURE_ */
+ unsigned Padding : 19;
+ unsigned Extended : 1; /* BOOL */
};
#define TGSI_WRITEMASK_NONE 0x00
@@ -1234,11 +1234,11 @@ struct tgsi_instruction_ext_texture
struct tgsi_instruction_ext_predicate
{
- GLuint Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_PREDICATE */
- GLuint PredDstIndex : 4; /* UINT */
- GLuint PredWriteMask : 4; /* TGSI_WRITEMASK_ */
- GLuint Padding : 19;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_INSTRUCTION_EXT_TYPE_PREDICATE */
+ unsigned PredDstIndex : 4; /* UINT */
+ unsigned PredWriteMask : 4; /* TGSI_WRITEMASK_ */
+ unsigned Padding : 19;
+ unsigned Extended : 1; /* BOOL */
};
/*
@@ -1261,16 +1261,16 @@ struct tgsi_instruction_ext_predicate
struct tgsi_src_register
{
- GLuint File : 4; /* TGSI_FILE_ */
- GLuint SwizzleX : 2; /* TGSI_SWIZZLE_ */
- GLuint SwizzleY : 2; /* TGSI_SWIZZLE_ */
- GLuint SwizzleZ : 2; /* TGSI_SWIZZLE_ */
- GLuint SwizzleW : 2; /* TGSI_SWIZZLE_ */
- GLuint Negate : 1; /* BOOL */
- GLuint Indirect : 1; /* BOOL */
- GLuint Dimension : 1; /* BOOL */
- GLint Index : 16; /* SINT */
- GLuint Extended : 1; /* BOOL */
+ unsigned File : 4; /* TGSI_FILE_ */
+ unsigned SwizzleX : 2; /* TGSI_SWIZZLE_ */
+ unsigned SwizzleY : 2; /* TGSI_SWIZZLE_ */
+ unsigned SwizzleZ : 2; /* TGSI_SWIZZLE_ */
+ unsigned SwizzleW : 2; /* TGSI_SWIZZLE_ */
+ unsigned Negate : 1; /* BOOL */
+ unsigned Indirect : 1; /* BOOL */
+ unsigned Dimension : 1; /* BOOL */
+ int Index : 16; /* SINT */
+ unsigned Extended : 1; /* BOOL */
};
/*
@@ -1287,9 +1287,9 @@ struct tgsi_src_register
struct tgsi_src_register_ext
{
- GLuint Type : 4; /* TGSI_SRC_REGISTER_EXT_TYPE_ */
- GLuint Padding : 27;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_SRC_REGISTER_EXT_TYPE_ */
+ unsigned Padding : 27;
+ unsigned Extended : 1; /* BOOL */
};
/*
@@ -1323,18 +1323,18 @@ struct tgsi_src_register_ext
struct tgsi_src_register_ext_swz
{
- GLuint Type : 4; /* TGSI_SRC_REGISTER_EXT_TYPE_SWZ */
- GLuint ExtSwizzleX : 4; /* TGSI_EXTSWIZZLE_ */
- GLuint ExtSwizzleY : 4; /* TGSI_EXTSWIZZLE_ */
- GLuint ExtSwizzleZ : 4; /* TGSI_EXTSWIZZLE_ */
- GLuint ExtSwizzleW : 4; /* TGSI_EXTSWIZZLE_ */
- GLuint NegateX : 1; /* BOOL */
- GLuint NegateY : 1; /* BOOL */
- GLuint NegateZ : 1; /* BOOL */
- GLuint NegateW : 1; /* BOOL */
- GLuint ExtDivide : 4; /* TGSI_EXTSWIZZLE_ */
- GLuint Padding : 3;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_SRC_REGISTER_EXT_TYPE_SWZ */
+ unsigned ExtSwizzleX : 4; /* TGSI_EXTSWIZZLE_ */
+ unsigned ExtSwizzleY : 4; /* TGSI_EXTSWIZZLE_ */
+ unsigned ExtSwizzleZ : 4; /* TGSI_EXTSWIZZLE_ */
+ unsigned ExtSwizzleW : 4; /* TGSI_EXTSWIZZLE_ */
+ unsigned NegateX : 1; /* BOOL */
+ unsigned NegateY : 1; /* BOOL */
+ unsigned NegateZ : 1; /* BOOL */
+ unsigned NegateW : 1; /* BOOL */
+ unsigned ExtDivide : 4; /* TGSI_EXTSWIZZLE_ */
+ unsigned Padding : 3;
+ unsigned Extended : 1; /* BOOL */
};
/*
@@ -1352,34 +1352,34 @@ struct tgsi_src_register_ext_swz
struct tgsi_src_register_ext_mod
{
- GLuint Type : 4; /* TGSI_SRC_REGISTER_EXT_TYPE_MOD */
- GLuint Complement : 1; /* BOOL */
- GLuint Bias : 1; /* BOOL */
- GLuint Scale2X : 1; /* BOOL */
- GLuint Absolute : 1; /* BOOL */
- GLuint Negate : 1; /* BOOL */
- GLuint Padding : 22;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_SRC_REGISTER_EXT_TYPE_MOD */
+ unsigned Complement : 1; /* BOOL */
+ unsigned Bias : 1; /* BOOL */
+ unsigned Scale2X : 1; /* BOOL */
+ unsigned Absolute : 1; /* BOOL */
+ unsigned Negate : 1; /* BOOL */
+ unsigned Padding : 22;
+ unsigned Extended : 1; /* BOOL */
};
struct tgsi_dimension
{
- GLuint Indirect : 1; /* BOOL */
- GLuint Dimension : 1; /* BOOL */
- GLuint Padding : 13;
- GLint Index : 16; /* SINT */
- GLuint Extended : 1; /* BOOL */
+ unsigned Indirect : 1; /* BOOL */
+ unsigned Dimension : 1; /* BOOL */
+ unsigned Padding : 13;
+ int Index : 16; /* SINT */
+ unsigned Extended : 1; /* BOOL */
};
struct tgsi_dst_register
{
- GLuint File : 4; /* TGSI_FILE_ */
- GLuint WriteMask : 4; /* TGSI_WRITEMASK_ */
- GLuint Indirect : 1; /* BOOL */
- GLuint Dimension : 1; /* BOOL */
- GLint Index : 16; /* SINT */
- GLuint Padding : 5;
- GLuint Extended : 1; /* BOOL */
+ unsigned File : 4; /* TGSI_FILE_ */
+ unsigned WriteMask : 4; /* TGSI_WRITEMASK_ */
+ unsigned Indirect : 1; /* BOOL */
+ unsigned Dimension : 1; /* BOOL */
+ int Index : 16; /* SINT */
+ unsigned Padding : 5;
+ unsigned Extended : 1; /* BOOL */
};
/*
@@ -1394,9 +1394,9 @@ struct tgsi_dst_register
struct tgsi_dst_register_ext
{
- GLuint Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_ */
- GLuint Padding : 27;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_ */
+ unsigned Padding : 27;
+ unsigned Extended : 1; /* BOOL */
};
/*
@@ -1415,15 +1415,15 @@ struct tgsi_dst_register_ext
struct tgsi_dst_register_ext_concode
{
- GLuint Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_CONDCODE */
- GLuint CondMask : 4; /* TGSI_CC_ */
- GLuint CondSwizzleX : 2; /* TGSI_SWIZZLE_ */
- GLuint CondSwizzleY : 2; /* TGSI_SWIZZLE_ */
- GLuint CondSwizzleZ : 2; /* TGSI_SWIZZLE_ */
- GLuint CondSwizzleW : 2; /* TGSI_SWIZZLE_ */
- GLuint CondSrcIndex : 4; /* UINT */
- GLuint Padding : 11;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_CONDCODE */
+ unsigned CondMask : 4; /* TGSI_CC_ */
+ unsigned CondSwizzleX : 2; /* TGSI_SWIZZLE_ */
+ unsigned CondSwizzleY : 2; /* TGSI_SWIZZLE_ */
+ unsigned CondSwizzleZ : 2; /* TGSI_SWIZZLE_ */
+ unsigned CondSwizzleW : 2; /* TGSI_SWIZZLE_ */
+ unsigned CondSrcIndex : 4; /* UINT */
+ unsigned Padding : 11;
+ unsigned Extended : 1; /* BOOL */
};
#define TGSI_MODULATE_1X 0
@@ -1436,10 +1436,10 @@ struct tgsi_dst_register_ext_concode
struct tgsi_dst_register_ext_modulate
{
- GLuint Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_MODULATE */
- GLuint Modulate : 4; /* TGSI_MODULATE_ */
- GLuint Padding : 23;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_MODULATE */
+ unsigned Modulate : 4; /* TGSI_MODULATE_ */
+ unsigned Padding : 23;
+ unsigned Extended : 1; /* BOOL */
};
/*
@@ -1451,15 +1451,15 @@ struct tgsi_dst_register_ext_modulate
struct tgsi_dst_register_ext_predicate
{
- GLuint Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_PREDICATE */
- GLuint PredSwizzleX : 2; /* TGSI_SWIZZLE_ */
- GLuint PredSwizzleY : 2; /* TGSI_SWIZZLE_ */
- GLuint PredSwizzleZ : 2; /* TGSI_SWIZZLE_ */
- GLuint PredSwizzleW : 2; /* TGSI_SWIZZLE_ */
- GLuint PredSrcIndex : 4; /* UINT */
- GLuint Negate : 1; /* BOOL */
- GLuint Padding : 14;
- GLuint Extended : 1; /* BOOL */
+ unsigned Type : 4; /* TGSI_DST_REGISTER_EXT_TYPE_PREDICATE */
+ unsigned PredSwizzleX : 2; /* TGSI_SWIZZLE_ */
+ unsigned PredSwizzleY : 2; /* TGSI_SWIZZLE_ */
+ unsigned PredSwizzleZ : 2; /* TGSI_SWIZZLE_ */
+ unsigned PredSwizzleW : 2; /* TGSI_SWIZZLE_ */
+ unsigned PredSrcIndex : 4; /* UINT */
+ unsigned Negate : 1; /* BOOL */
+ unsigned Padding : 14;
+ unsigned Extended : 1; /* BOOL */
};
#if defined __cplusplus
diff --git a/src/mesa/pipe/tgsi/core/tgsi_util.h b/src/mesa/pipe/tgsi/core/tgsi_util.h
index 70c48690c5..ef14446f0e 100644
--- a/src/mesa/pipe/tgsi/core/tgsi_util.h
+++ b/src/mesa/pipe/tgsi/core/tgsi_util.h
@@ -9,58 +9,58 @@ void *
tgsi_align_128bit(
void *unaligned );
-GLuint
+unsigned
tgsi_util_get_src_register_swizzle(
const struct tgsi_src_register *reg,
- GLuint component );
+ unsigned component );
-GLuint
+unsigned
tgsi_util_get_src_register_extswizzle(
const struct tgsi_src_register_ext_swz *reg,
- GLuint component);
+ unsigned component);
-GLuint
+unsigned
tgsi_util_get_full_src_register_extswizzle(
const struct tgsi_full_src_register *reg,
- GLuint component );
+ unsigned component );
void
tgsi_util_set_src_register_swizzle(
struct tgsi_src_register *reg,
- GLuint swizzle,
- GLuint component );
+ unsigned swizzle,
+ unsigned component );
void
tgsi_util_set_src_register_extswizzle(
struct tgsi_src_register_ext_swz *reg,
- GLuint swizzle,
- GLuint component );
+ unsigned swizzle,
+ unsigned component );
-GLuint
+unsigned
tgsi_util_get_src_register_extnegate(
const struct tgsi_src_register_ext_swz *reg,
- GLuint component );
+ unsigned component );
void
tgsi_util_set_src_register_extnegate(
struct tgsi_src_register_ext_swz *reg,
- GLuint negate,
- GLuint component );
+ unsigned negate,
+ unsigned component );
#define TGSI_UTIL_SIGN_CLEAR 0 /* Force positive */
#define TGSI_UTIL_SIGN_SET 1 /* Force negative */
#define TGSI_UTIL_SIGN_TOGGLE 2 /* Negate */
#define TGSI_UTIL_SIGN_KEEP 3 /* No change */
-GLuint
+unsigned
tgsi_util_get_full_src_register_sign_mode(
const struct tgsi_full_src_register *reg,
- GLuint component );
+ unsigned component );
void
tgsi_util_set_full_src_register_sign_mode(
struct tgsi_full_src_register *reg,
- GLuint sign_mode );
+ unsigned sign_mode );
#if defined __cplusplus
} // extern "C"