summaryrefslogtreecommitdiff
path: root/src/mesa/pipe
diff options
context:
space:
mode:
authorBrian <brian.paul@tungstengraphics.com>2007-06-22 12:47:04 -0600
committerBrian <brian.paul@tungstengraphics.com>2007-06-22 12:47:04 -0600
commitf79c225d9e5adee6287a9bba35f014c3fe00d3f9 (patch)
tree7f8641c4118a87aabeb76f75db5d45a53e522f2d /src/mesa/pipe
parent493ed9fc11a2bf272a2c1e9e5a072e4f02b46554 (diff)
Assorted token renaming/removal, minor state changes, etc.
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r--src/mesa/pipe/p_defines.h15
-rw-r--r--src/mesa/pipe/p_state.h55
-rw-r--r--src/mesa/pipe/softpipe/sp_prim_cull.c5
-rw-r--r--src/mesa/pipe/softpipe/sp_prim_twoside.c3
-rw-r--r--src/mesa/pipe/softpipe/sp_prim_unfilled.c12
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_alpha_test.c8
-rw-r--r--src/mesa/pipe/softpipe/sp_state_setup.c5
7 files changed, 46 insertions, 57 deletions
diff --git a/src/mesa/pipe/p_defines.h b/src/mesa/pipe/p_defines.h
index 550240e647..75573107ff 100644
--- a/src/mesa/pipe/p_defines.h
+++ b/src/mesa/pipe/p_defines.h
@@ -89,16 +89,13 @@
#define PIPE_POLYGON_MODE_LINE 1
#define PIPE_POLYGON_MODE_POINT 2
-/** Polygon cull mode */
-#define PIPE_POLYGON_CULL_NONE 0
-#define PIPE_POLYGON_CULL_FRONT 1
-#define PIPE_POLYGON_CULL_BACK 2
-#define PIPE_POLYGON_CULL_BOTH 3
-
-/** Polygon front winding order */
-#define PIPE_POLYGON_FRONT_CW 0
-#define PIPE_POLYGON_FRONT_CCW 1
+/** Polygon front/back window, also for culling */
+#define PIPE_WINDING_NONE 0
+#define PIPE_WINDING_CW 1
+#define PIPE_WINDING_CCW 2
+#define PIPE_WINDING_BOTH (PIPE_WINDING_CW | PIPE_WINDING_CCW)
+/** Stencil ops */
#define PIPE_STENCIL_OP_KEEP 0
#define PIPE_STENCIL_OP_ZERO 1
#define PIPE_STENCIL_OP_REPLACE 2
diff --git a/src/mesa/pipe/p_state.h b/src/mesa/pipe/p_state.h
index 8e68fac1bd..b841181cf0 100644
--- a/src/mesa/pipe/p_state.h
+++ b/src/mesa/pipe/p_state.h
@@ -25,38 +25,43 @@
*
**************************************************************************/
+
+/**
+ * Abstract graphics pipe state objects.
+ *
+ * Basic notes:
+ * 1. Want compact representations, so we use bitfields.
+ * 2. Put bitfields before other (GLfloat) fields.
+ */
+
+
#ifndef PIPE_STATE_H
#define PIPE_STATE_H
#include "mtypes.h"
-#define WINDING_NONE 0
-#define WINDING_CW 1
-#define WINDING_CCW 2
-#define WINDING_BOTH (WINDING_CW | WINDING_CCW)
-#define FILL_POINT 1
-#define FILL_LINE 2
-#define FILL_TRI 3
-
-struct pipe_setup_state {
+/**
+ * Primitive (point/line/tri) setup info
+ */
+struct pipe_setup_state
+{
GLuint flatshade:1;
GLuint light_twoside:1;
- GLuint front_winding:2;
+ GLuint front_winding:2; /**< PIPE_WINDING_x */
- GLuint cull_mode:2;
+ GLuint cull_mode:2; /**< PIPE_WINDING_x */
- GLuint fill_cw:2;
- GLuint fill_ccw:2;
+ GLuint fill_cw:2; /**< PIPE_POLYGON_MODE_x */
+ GLuint fill_ccw:2; /**< PIPE_POLYGON_MODE_x */
GLuint offset_cw:1;
GLuint offset_ccw:1;
GLuint scissor:1;
GLuint poly_stipple:1;
-
- GLuint pad:18;
+ GLuint poly_smooth:1;
GLfloat offset_units;
GLfloat offset_scale;
@@ -137,6 +142,7 @@ struct pipe_clear_color_state
GLfloat color[4];
};
+/** XXXX probably merge into pipe_setup_state */
struct pipe_line_state
{
GLuint smooth:1;
@@ -146,6 +152,7 @@ struct pipe_line_state
GLfloat width;
};
+/** XXXX probably merge into pipe_setup_state */
struct pipe_point_state
{
GLuint smooth:1;
@@ -154,16 +161,6 @@ struct pipe_point_state
GLfloat attenuation[3];
};
-struct pipe_polygon_state {
- GLuint cull_mode:2; /**< PIPE_POLYGON_CULL_x */
- GLuint front_winding:1; /**< PIPE_POLYGON_FRONT_CCW,CW */
- GLuint front_mode:2; /**< PIPE_POLYGON_MODE_x */
- GLuint back_mode:2; /**< PIPE_POLYGON_MODE_x */
- GLuint stipple:1; /**< enable */
- GLuint smooth:1; /**< enable */
- /* XXX Polygon offset? */
-};
-
struct pipe_stencil_state {
GLuint front_enabled:1;
GLuint front_func:3; /**< PIPE_FUNC_x */
@@ -215,6 +212,10 @@ struct pipe_sampler_state
GLuint wrap_r:3; /**< PIPE_TEX_WRAP_x */
GLuint min_filter:3; /**< PIPE_TEX_FILTER_x */
GLuint mag_filter:1; /**< PIPE_TEX_FILTER_LINEAR or _NEAREST */
+ GLuint compare:1; /**< shadow/depth compare enabled? */
+ GLenum compare_mode:1; /**< PIPE_TEX_COMPARE_x */
+ GLenum compare_func:3; /**< PIPE_FUNC_x */
+ GLfloat shadow_ambient; /**< shadow test fail color/intensity */
GLfloat min_lod;
GLfloat max_lod;
GLfloat lod_bias;
@@ -223,10 +224,6 @@ struct pipe_sampler_state
GLint MaxLevel; /**< max mipmap level, OpenGL 1.2 */
#endif
GLfloat max_anisotropy;
- GLuint compare:1; /**< shadow/depth compare enabled? */
- GLenum compare_mode:1; /**< PIPE_TEX_COMPARE_x */
- GLenum compare_func:3; /**< PIPE_FUNC_x */
- GLfloat shadow_ambient; /**< shadow test fail color/intensity */
};
#endif
diff --git a/src/mesa/pipe/softpipe/sp_prim_cull.c b/src/mesa/pipe/softpipe/sp_prim_cull.c
index 16920d478a..63099fbee0 100644
--- a/src/mesa/pipe/softpipe/sp_prim_cull.c
+++ b/src/mesa/pipe/softpipe/sp_prim_cull.c
@@ -29,6 +29,7 @@
*/
#include "imports.h"
+#include "pipe/p_defines.h"
#include "sp_context.h"
#include "sp_prim.h"
@@ -75,8 +76,8 @@ static void cull_tri( struct prim_stage *stage,
_mesa_printf("%s %f\n", __FUNCTION__, header->det );
if (header->det != 0) {
- GLuint mode = (header->det < 0) ? WINDING_CW : WINDING_CCW;
-
+ GLuint mode = (header->det < 0) ? PIPE_WINDING_CW : PIPE_WINDING_CCW;
+
if ((mode & cull_stage(stage)->mode) == 0)
stage->next->tri( stage->next, header );
}
diff --git a/src/mesa/pipe/softpipe/sp_prim_twoside.c b/src/mesa/pipe/softpipe/sp_prim_twoside.c
index 8ac0b5c130..5e9f218d1e 100644
--- a/src/mesa/pipe/softpipe/sp_prim_twoside.c
+++ b/src/mesa/pipe/softpipe/sp_prim_twoside.c
@@ -30,6 +30,7 @@
#include "imports.h"
#include "vf/vf.h"
+#include "pipe/p_defines.h"
#include "sp_context.h"
#include "sp_prim.h"
@@ -52,7 +53,7 @@ static void twoside_begin( struct prim_stage *stage )
{
struct twoside_stage *twoside = twoside_stage(stage);
- twoside->facing = (stage->softpipe->setup.front_winding == WINDING_CW) ? -1 : 1;
+ twoside->facing = (stage->softpipe->setup.front_winding == PIPE_WINDING_CW) ? -1 : 1;
stage->next->begin( stage->next );
}
diff --git a/src/mesa/pipe/softpipe/sp_prim_unfilled.c b/src/mesa/pipe/softpipe/sp_prim_unfilled.c
index 73147337fd..ab0dab09d4 100644
--- a/src/mesa/pipe/softpipe/sp_prim_unfilled.c
+++ b/src/mesa/pipe/softpipe/sp_prim_unfilled.c
@@ -31,7 +31,7 @@
#include "sp_context.h"
#include "sp_prim.h"
-
+#include "pipe/p_defines.h"
struct unfilled_stage {
@@ -113,17 +113,17 @@ static void unfilled_tri( struct prim_stage *stage,
GLuint mode = unfilled->mode[header->det < 0];
switch (mode) {
- case FILL_TRI:
+ case PIPE_POLYGON_MODE_FILL:
stage->next->tri( stage->next, header );
break;
-
- case FILL_LINE:
+ case PIPE_POLYGON_MODE_LINE:
lines( stage, header );
break;
-
- case GL_POINT:
+ case PIPE_POLYGON_MODE_POINT:
points( stage, header );
break;
+ default:
+ abort();
}
}
diff --git a/src/mesa/pipe/softpipe/sp_quad_alpha_test.c b/src/mesa/pipe/softpipe/sp_quad_alpha_test.c
index f7cebca6ea..0059b3abf4 100644
--- a/src/mesa/pipe/softpipe/sp_quad_alpha_test.c
+++ b/src/mesa/pipe/softpipe/sp_quad_alpha_test.c
@@ -16,16 +16,8 @@ alpha_test_quad(struct quad_stage *qs, struct quad_header *quad)
{
struct softpipe_context *softpipe = qs->softpipe;
GLuint j;
- struct softpipe_surface *sps = softpipe_surface(softpipe->framebuffer.zbuf);
const GLfloat ref = softpipe->alpha_test.ref;
-#if 0
- assert(sps); /* shouldn't get here if there's no zbuffer */
-#else
- if (!sps)
- return;
-#endif
-
switch (softpipe->alpha_test.func) {
case PIPE_FUNC_NEVER:
quad->mask = 0x0;
diff --git a/src/mesa/pipe/softpipe/sp_state_setup.c b/src/mesa/pipe/softpipe/sp_state_setup.c
index 7be7d7fe40..a249ceb992 100644
--- a/src/mesa/pipe/softpipe/sp_state_setup.c
+++ b/src/mesa/pipe/softpipe/sp_state_setup.c
@@ -25,6 +25,7 @@
*
**************************************************************************/
+#include "pipe/p_defines.h"
#include "sp_context.h"
#include "sp_state.h"
#include "sp_prim.h"
@@ -39,8 +40,8 @@ static void validate_prim_pipe( struct softpipe_context *softpipe )
/* TODO: make the current primitive part of the state and build
* shorter pipelines for lines & points.
*/
- if (softpipe->setup.fill_cw != FILL_TRI ||
- softpipe->setup.fill_ccw != FILL_TRI) {
+ if (softpipe->setup.fill_cw != PIPE_POLYGON_MODE_FILL ||
+ softpipe->setup.fill_ccw != PIPE_POLYGON_MODE_FILL) {
softpipe->prim.unfilled->next = next;
next = softpipe->prim.unfilled;