summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2008-04-19 13:20:26 +0100
committerKeith Whitwell <keith@tungstengraphics.com>2008-04-19 13:20:26 +0100
commit1246d06313f443c91dea07239b43a88ba2b86dde (patch)
tree312ac965e387f6fc5323ce2aa9562031ceba23fd /src
parent882e5d84dcb19c24b7b56cfe6049810023f3a17e (diff)
draw: remove named clipmask flags, tidy up pt middle ends
Diffstat (limited to 'src')
-rw-r--r--src/gallium/auxiliary/draw/draw_context.h37
-rw-r--r--src/gallium/auxiliary/draw/draw_private.h9
-rw-r--r--src/gallium/auxiliary/draw/draw_pt.c36
-rw-r--r--src/gallium/auxiliary/draw/draw_pt.h6
-rw-r--r--src/gallium/auxiliary/draw/draw_pt_post_vs.c12
5 files changed, 35 insertions, 65 deletions
diff --git a/src/gallium/auxiliary/draw/draw_context.h b/src/gallium/auxiliary/draw/draw_context.h
index c7ac32b452..a0ac980c89 100644
--- a/src/gallium/auxiliary/draw/draw_context.h
+++ b/src/gallium/auxiliary/draw/draw_context.h
@@ -42,37 +42,11 @@
struct pipe_context;
-struct vertex_buffer;
-struct vertex_info;
struct draw_context;
struct draw_stage;
struct draw_vertex_shader;
-/**
- * Clipmask flags
- */
-/*@{*/
-#define CLIP_RIGHT_BIT 0x01
-#define CLIP_LEFT_BIT 0x02
-#define CLIP_TOP_BIT 0x04
-#define CLIP_BOTTOM_BIT 0x08
-#define CLIP_NEAR_BIT 0x10
-#define CLIP_FAR_BIT 0x20
-/*@}*/
-
-/**
- * Bitshift for each clip flag
- */
-/*@{*/
-#define CLIP_RIGHT_SHIFT 0
-#define CLIP_LEFT_SHIFT 1
-#define CLIP_TOP_SHIFT 2
-#define CLIP_BOTTOM_SHIFT 3
-#define CLIP_NEAR_SHIFT 4
-#define CLIP_FAR_SHIFT 5
-/*@}*/
-
struct draw_context *draw_create( void );
@@ -168,15 +142,10 @@ void draw_arrays(struct draw_context *draw, unsigned prim,
void draw_flush(struct draw_context *draw);
-/***********************************************************************
- * draw_debug.c
- */
-boolean draw_validate_prim( unsigned prim, unsigned length );
-unsigned draw_trim_prim( unsigned mode, unsigned count );
-
-
-
+/*******************************************************************************
+ * Driver backend interface
+ */
struct vbuf_render;
void draw_set_render( struct draw_context *draw,
struct vbuf_render *render );
diff --git a/src/gallium/auxiliary/draw/draw_private.h b/src/gallium/auxiliary/draw/draw_private.h
index 476b1184d4..37ffdbf902 100644
--- a/src/gallium/auxiliary/draw/draw_private.h
+++ b/src/gallium/auxiliary/draw/draw_private.h
@@ -44,7 +44,6 @@
#include "pipe/p_state.h"
#include "pipe/p_defines.h"
-#include "rtasm/rtasm_x86sse.h"
#include "tgsi/exec/tgsi_exec.h"
#include "tgsi/util/tgsi_scan.h"
@@ -171,7 +170,8 @@ struct draw_context
*/
struct {
struct {
- struct draw_pt_middle_end *opt[PT_MAX_MIDDLE];
+ struct draw_pt_middle_end *fetch_emit;
+ struct draw_pt_middle_end *general;
} middle;
struct {
@@ -289,11 +289,6 @@ extern boolean draw_need_pipeline(const struct draw_context *draw,
*/
boolean draw_pt_init( struct draw_context *draw );
void draw_pt_destroy( struct draw_context *draw );
-boolean draw_pt_arrays( struct draw_context *draw,
- unsigned prim,
- unsigned start,
- unsigned count );
-
void draw_pt_reset_vertex_ids( struct draw_context *draw );
#define DRAW_FLUSH_STATE_CHANGE 0x8
diff --git a/src/gallium/auxiliary/draw/draw_pt.c b/src/gallium/auxiliary/draw/draw_pt.c
index ecaed84070..f153a3ee2c 100644
--- a/src/gallium/auxiliary/draw/draw_pt.c
+++ b/src/gallium/auxiliary/draw/draw_pt.c
@@ -44,7 +44,7 @@
* - pipeline -- the prim pipeline: clipping, wide lines, etc
* - backend -- the vbuf_render provided by the driver.
*/
-boolean
+static boolean
draw_pt_arrays(struct draw_context *draw,
unsigned prim,
unsigned start,
@@ -70,19 +70,16 @@ draw_pt_arrays(struct draw_context *draw,
opt |= PT_SHADE;
}
+ if (opt)
+ middle = draw->pt.middle.general;
+ else
+ middle = draw->pt.middle.fetch_emit;
- middle = draw->pt.middle.opt[opt];
- if (middle == NULL) {
- middle = draw->pt.middle.opt[PT_PIPELINE | PT_CLIPTEST | PT_SHADE];
- }
-
- assert(middle);
/* May create a short-circuited version of this for small primitives:
*/
frontend = draw->pt.front.vcache;
-
frontend->prepare( frontend, prim, middle, opt );
frontend->run( frontend,
@@ -102,11 +99,12 @@ boolean draw_pt_init( struct draw_context *draw )
if (!draw->pt.front.vcache)
return FALSE;
- draw->pt.middle.opt[0] = draw_pt_fetch_emit( draw );
- draw->pt.middle.opt[PT_SHADE | PT_CLIPTEST | PT_PIPELINE] =
- draw_pt_fetch_pipeline_or_emit( draw );
+ draw->pt.middle.fetch_emit = draw_pt_fetch_emit( draw );
+ if (!draw->pt.middle.fetch_emit)
+ return FALSE;
- if (!draw->pt.middle.opt[PT_SHADE | PT_CLIPTEST | PT_PIPELINE])
+ draw->pt.middle.general = draw_pt_fetch_pipeline_or_emit( draw );
+ if (!draw->pt.middle.general)
return FALSE;
return TRUE;
@@ -115,13 +113,15 @@ boolean draw_pt_init( struct draw_context *draw )
void draw_pt_destroy( struct draw_context *draw )
{
- int i;
+ if (draw->pt.middle.general) {
+ draw->pt.middle.general->destroy( draw->pt.middle.general );
+ draw->pt.middle.general = NULL;
+ }
- for (i = 0; i < PT_MAX_MIDDLE; i++)
- if (draw->pt.middle.opt[i]) {
- draw->pt.middle.opt[i]->destroy( draw->pt.middle.opt[i] );
- draw->pt.middle.opt[i] = NULL;
- }
+ if (draw->pt.middle.fetch_emit) {
+ draw->pt.middle.fetch_emit->destroy( draw->pt.middle.fetch_emit );
+ draw->pt.middle.fetch_emit = NULL;
+ }
if (draw->pt.front.vcache) {
draw->pt.front.vcache->destroy( draw->pt.front.vcache );
diff --git a/src/gallium/auxiliary/draw/draw_pt.h b/src/gallium/auxiliary/draw/draw_pt.h
index eb23ee1c1e..1119e9c6b8 100644
--- a/src/gallium/auxiliary/draw/draw_pt.h
+++ b/src/gallium/auxiliary/draw/draw_pt.h
@@ -50,6 +50,12 @@ struct draw_context;
#define DRAW_PT_FLAG_MASK (3<<30)
+#define PT_SHADE 0x1
+#define PT_CLIPTEST 0x2
+#define PT_PIPELINE 0x4
+#define PT_MAX_MIDDLE 0x8
+
+
/* The "front end" - prepare sets of fetch, draw elements for the
* middle end.
*
diff --git a/src/gallium/auxiliary/draw/draw_pt_post_vs.c b/src/gallium/auxiliary/draw/draw_pt_post_vs.c
index 315b02f4ee..b3ecec6ece 100644
--- a/src/gallium/auxiliary/draw/draw_pt_post_vs.c
+++ b/src/gallium/auxiliary/draw/draw_pt_post_vs.c
@@ -52,12 +52,12 @@ compute_clipmask_gl(const float *clip, /*const*/ float plane[][4], unsigned nr)
/* Do the hardwired planes first:
*/
- if (-clip[0] + clip[3] < 0) mask |= CLIP_RIGHT_BIT;
- if ( clip[0] + clip[3] < 0) mask |= CLIP_LEFT_BIT;
- if (-clip[1] + clip[3] < 0) mask |= CLIP_TOP_BIT;
- if ( clip[1] + clip[3] < 0) mask |= CLIP_BOTTOM_BIT;
- if (-clip[2] + clip[3] < 0) mask |= CLIP_FAR_BIT;
- if ( clip[2] + clip[3] < 0) mask |= CLIP_NEAR_BIT;
+ if (-clip[0] + clip[3] < 0) mask |= (1<<0);
+ if ( clip[0] + clip[3] < 0) mask |= (1<<1);
+ if (-clip[1] + clip[3] < 0) mask |= (1<<2);
+ if ( clip[1] + clip[3] < 0) mask |= (1<<3);
+ if ( clip[2] + clip[3] < 0) mask |= (1<<4); /* match mesa clipplane numbering - for now */
+ if (-clip[2] + clip[3] < 0) mask |= (1<<5); /* match mesa clipplane numbering - for now */
/* Followed by any remaining ones:
*/