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 );
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 );
#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"
*/
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 {
*/
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
* - 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,
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,
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;
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 );
#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.
*
/* 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:
*/