C_SOURCES = \
draw_context.c \
+ draw_pipe.c \
draw_pipe_aaline.c \
draw_pipe_aapoint.c \
draw_pipe_clip.c \
#include "draw_context.h"
#include "draw_vbuf.h"
#include "draw_vs.h"
+#include "draw_pt.h"
+#include "draw_pipe.h"
struct draw_context *draw_create( void )
draw->use_sse = FALSE;
#endif
- /* create pipeline stages */
- draw->pipeline.wide_line = draw_wide_line_stage( draw );
- draw->pipeline.wide_point = draw_wide_point_stage( draw );
- draw->pipeline.stipple = draw_stipple_stage( draw );
- draw->pipeline.unfilled = draw_unfilled_stage( draw );
- draw->pipeline.twoside = draw_twoside_stage( draw );
- draw->pipeline.offset = draw_offset_stage( draw );
- draw->pipeline.clip = draw_clip_stage( draw );
- draw->pipeline.flatshade = draw_flatshade_stage( draw );
- draw->pipeline.cull = draw_cull_stage( draw );
- draw->pipeline.validate = draw_validate_stage( draw );
- draw->pipeline.first = draw->pipeline.validate;
-
- if (!draw->pipeline.wide_line ||
- !draw->pipeline.wide_point ||
- !draw->pipeline.stipple ||
- !draw->pipeline.unfilled ||
- !draw->pipeline.twoside ||
- !draw->pipeline.offset ||
- !draw->pipeline.clip ||
- !draw->pipeline.flatshade ||
- !draw->pipeline.cull ||
- !draw->pipeline.validate)
- goto fail;
-
-
ASSIGN_4V( draw->plane[0], -1, 0, 0, 1 );
ASSIGN_4V( draw->plane[1], 1, 0, 0, 1 );
ASSIGN_4V( draw->plane[2], 0, -1, 0, 1 );
ASSIGN_4V( draw->plane[5], 0, 0, -1, 1 ); /* mesa's a bit wonky */
draw->nr_planes = 6;
- /* these defaults are oriented toward the needs of softpipe */
- draw->wide_point_threshold = 1000000.0; /* infinity */
- draw->wide_line_threshold = 1.0;
- draw->line_stipple = TRUE;
- draw->point_sprite = TRUE;
draw->reduced_prim = ~0; /* != any of PIPE_PRIM_x */
draw->machine.Inputs = align_malloc(PIPE_MAX_ATTRIBS * sizeof(struct tgsi_exec_vector), 16);
draw->machine.Outputs = align_malloc(PIPE_MAX_ATTRIBS * sizeof(struct tgsi_exec_vector), 16);
+ if (!draw_pipeline_init( draw ))
+ goto fail;
if (!draw_pt_init( draw ))
goto fail;
if (!draw)
return;
- if (draw->pipeline.wide_line)
- draw->pipeline.wide_line->destroy( draw->pipeline.wide_line );
- if (draw->pipeline.wide_point)
- draw->pipeline.wide_point->destroy( draw->pipeline.wide_point );
- if (draw->pipeline.stipple)
- draw->pipeline.stipple->destroy( draw->pipeline.stipple );
- if (draw->pipeline.unfilled)
- draw->pipeline.unfilled->destroy( draw->pipeline.unfilled );
- if (draw->pipeline.twoside)
- draw->pipeline.twoside->destroy( draw->pipeline.twoside );
- if (draw->pipeline.offset)
- draw->pipeline.offset->destroy( draw->pipeline.offset );
- if (draw->pipeline.clip)
- draw->pipeline.clip->destroy( draw->pipeline.clip );
- if (draw->pipeline.flatshade)
- draw->pipeline.flatshade->destroy( draw->pipeline.flatshade );
- if (draw->pipeline.cull)
- draw->pipeline.cull->destroy( draw->pipeline.cull );
- if (draw->pipeline.validate)
- draw->pipeline.validate->destroy( draw->pipeline.validate );
- if (draw->pipeline.aaline)
- draw->pipeline.aaline->destroy( draw->pipeline.aaline );
- if (draw->pipeline.aapoint)
- draw->pipeline.aapoint->destroy( draw->pipeline.aapoint );
- if (draw->pipeline.pstipple)
- draw->pipeline.pstipple->destroy( draw->pipeline.pstipple );
- if (draw->pipeline.rasterize)
- draw->pipeline.rasterize->destroy( draw->pipeline.rasterize );
if (draw->machine.Inputs)
align_free(draw->machine.Inputs);
+
if (draw->machine.Outputs)
align_free(draw->machine.Outputs);
+
tgsi_exec_machine_free_data(&draw->machine);
/* Not so fast -- we're just borrowing this at the moment.
draw->render->destroy( draw->render );
*/
+ draw_pipeline_destroy( draw );
draw_pt_destroy( draw );
FREE( draw );
draw_wide_point_threshold(struct draw_context *draw, float threshold)
{
draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
- draw->wide_point_threshold = threshold;
+ draw->pipeline.wide_point_threshold = threshold;
}
draw_wide_line_threshold(struct draw_context *draw, float threshold)
{
draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
- draw->wide_line_threshold = threshold;
+ draw->pipeline.wide_line_threshold = threshold;
}
draw_enable_line_stipple(struct draw_context *draw, boolean enable)
{
draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
- draw->line_stipple = enable;
+ draw->pipeline.line_stipple = enable;
}
draw_enable_point_sprites(struct draw_context *draw, boolean enable)
{
draw_do_flush( draw, DRAW_FLUSH_STATE_CHANGE );
- draw->point_sprite = enable;
+ draw->pipeline.point_sprite = enable;
}
}
-/**
- * Allocate space for temporary post-transform vertices, such as for clipping.
- */
-void draw_alloc_temp_verts( struct draw_stage *stage, unsigned nr )
-{
- assert(!stage->tmp);
-
- stage->nr_tmps = nr;
-
- if (nr) {
- ubyte *store = (ubyte *) MALLOC( MAX_VERTEX_SIZE * nr );
- unsigned i;
-
- stage->tmp = (struct vertex_header **) MALLOC( sizeof(struct vertex_header *) * nr );
-
- for (i = 0; i < nr; i++)
- stage->tmp[i] = (struct vertex_header *)(store + i * MAX_VERTEX_SIZE);
- }
-}
-
-
-void draw_free_temp_verts( struct draw_stage *stage )
-{
- if (stage->tmp) {
- FREE( stage->tmp[0] );
- FREE( stage->tmp );
- stage->tmp = NULL;
- }
-}
-
boolean draw_use_sse(struct draw_context *draw)
{
}
-void draw_reset_vertex_ids(struct draw_context *draw)
-{
- struct draw_stage *stage = draw->pipeline.first;
-
- while (stage) {
- unsigned i;
-
- for (i = 0; i < stage->nr_tmps; i++)
- stage->tmp[i]->vertex_id = UNDEFINED_VERTEX_ID;
-
- stage = stage->next;
- }
-
- draw_pt_reset_vertex_ids(draw);
-}
-
-
void draw_set_render( struct draw_context *draw,
struct vbuf_render *render )
{
draw->user.elts = elements;
draw->user.eltSize = eltSize;
}
+
+
+
+/* Revamp me please:
+ */
+void draw_do_flush( struct draw_context *draw, unsigned flags )
+{
+ if (!draw->flushing)
+ {
+ draw->flushing = TRUE;
+
+ if (flags >= DRAW_FLUSH_STATE_CHANGE) {
+ draw->pipeline.first->flush( draw->pipeline.first, flags );
+ draw->pipeline.first = draw->pipeline.validate;
+ draw->reduced_prim = ~0; /* is reduced_prim needed any more? */
+ }
+
+ draw->flushing = FALSE;
+ }
+}
--- /dev/null
+/**************************************************************************
+ *
+ * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+ /*
+ * Authors:
+ * Keith Whitwell <keith@tungstengraphics.com>
+ */
+
+#include "pipe/p_util.h"
+#include "draw/draw_private.h"
+#include "draw/draw_pipe.h"
+
+
+boolean draw_pipeline_init( struct draw_context *draw )
+{
+ /* create pipeline stages */
+ draw->pipeline.wide_line = draw_wide_line_stage( draw );
+ draw->pipeline.wide_point = draw_wide_point_stage( draw );
+ draw->pipeline.stipple = draw_stipple_stage( draw );
+ draw->pipeline.unfilled = draw_unfilled_stage( draw );
+ draw->pipeline.twoside = draw_twoside_stage( draw );
+ draw->pipeline.offset = draw_offset_stage( draw );
+ draw->pipeline.clip = draw_clip_stage( draw );
+ draw->pipeline.flatshade = draw_flatshade_stage( draw );
+ draw->pipeline.cull = draw_cull_stage( draw );
+ draw->pipeline.validate = draw_validate_stage( draw );
+ draw->pipeline.first = draw->pipeline.validate;
+
+ if (!draw->pipeline.wide_line ||
+ !draw->pipeline.wide_point ||
+ !draw->pipeline.stipple ||
+ !draw->pipeline.unfilled ||
+ !draw->pipeline.twoside ||
+ !draw->pipeline.offset ||
+ !draw->pipeline.clip ||
+ !draw->pipeline.flatshade ||
+ !draw->pipeline.cull ||
+ !draw->pipeline.validate)
+ return FALSE;
+
+ /* these defaults are oriented toward the needs of softpipe */
+ draw->pipeline.wide_point_threshold = 1000000.0; /* infinity */
+ draw->pipeline.wide_line_threshold = 1.0;
+ draw->pipeline.line_stipple = TRUE;
+ draw->pipeline.point_sprite = TRUE;
+
+ return TRUE;
+}
+
+
+void draw_pipeline_destroy( struct draw_context *draw )
+{
+ if (draw->pipeline.wide_line)
+ draw->pipeline.wide_line->destroy( draw->pipeline.wide_line );
+ if (draw->pipeline.wide_point)
+ draw->pipeline.wide_point->destroy( draw->pipeline.wide_point );
+ if (draw->pipeline.stipple)
+ draw->pipeline.stipple->destroy( draw->pipeline.stipple );
+ if (draw->pipeline.unfilled)
+ draw->pipeline.unfilled->destroy( draw->pipeline.unfilled );
+ if (draw->pipeline.twoside)
+ draw->pipeline.twoside->destroy( draw->pipeline.twoside );
+ if (draw->pipeline.offset)
+ draw->pipeline.offset->destroy( draw->pipeline.offset );
+ if (draw->pipeline.clip)
+ draw->pipeline.clip->destroy( draw->pipeline.clip );
+ if (draw->pipeline.flatshade)
+ draw->pipeline.flatshade->destroy( draw->pipeline.flatshade );
+ if (draw->pipeline.cull)
+ draw->pipeline.cull->destroy( draw->pipeline.cull );
+ if (draw->pipeline.validate)
+ draw->pipeline.validate->destroy( draw->pipeline.validate );
+ if (draw->pipeline.aaline)
+ draw->pipeline.aaline->destroy( draw->pipeline.aaline );
+ if (draw->pipeline.aapoint)
+ draw->pipeline.aapoint->destroy( draw->pipeline.aapoint );
+ if (draw->pipeline.pstipple)
+ draw->pipeline.pstipple->destroy( draw->pipeline.pstipple );
+ if (draw->pipeline.rasterize)
+ draw->pipeline.rasterize->destroy( draw->pipeline.rasterize );
+}
+
+
+
+
+/* This is only used for temporary verts.
+ */
+#define MAX_VERTEX_SIZE ((2 + PIPE_MAX_SHADER_OUTPUTS) * 4 * sizeof(float))
+
+
+/**
+ * Allocate space for temporary post-transform vertices, such as for clipping.
+ */
+void draw_alloc_temp_verts( struct draw_stage *stage, unsigned nr )
+{
+ assert(!stage->tmp);
+
+ stage->nr_tmps = nr;
+
+ if (nr) {
+ ubyte *store = (ubyte *) MALLOC( MAX_VERTEX_SIZE * nr );
+ unsigned i;
+
+ stage->tmp = (struct vertex_header **) MALLOC( sizeof(struct vertex_header *) * nr );
+
+ for (i = 0; i < nr; i++)
+ stage->tmp[i] = (struct vertex_header *)(store + i * MAX_VERTEX_SIZE);
+ }
+}
+
+
+void draw_free_temp_verts( struct draw_stage *stage )
+{
+ if (stage->tmp) {
+ FREE( stage->tmp[0] );
+ FREE( stage->tmp );
+ stage->tmp = NULL;
+ }
+}
+
+void draw_reset_vertex_ids(struct draw_context *draw)
+{
+ struct draw_stage *stage = draw->pipeline.first;
+
+ while (stage) {
+ unsigned i;
+
+ for (i = 0; i < stage->nr_tmps; i++)
+ stage->tmp[i]->vertex_id = UNDEFINED_VERTEX_ID;
+
+ stage = stage->next;
+ }
+
+ draw_pt_reset_vertex_ids(draw);
+}
+
+
--- /dev/null
+/**************************************************************************
+ *
+ * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sub license, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the
+ * next paragraph) shall be included in all copies or substantial portions
+ * of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
+ * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ *
+ **************************************************************************/
+
+ /*
+ * Authors:
+ * Keith Whitwell <keith@tungstengraphics.com>
+ */
+
+#ifndef DRAW_PIPE_H
+#define DRAW_PIPE_H
+
+#include "pipe/p_compiler.h"
+#include "draw_private.h" /* for sizeof(vertex_header) */
+
+
+
+/**
+ * Base class for all primitive drawing stages.
+ */
+struct draw_stage
+{
+ struct draw_context *draw; /**< parent context */
+
+ struct draw_stage *next; /**< next stage in pipeline */
+
+ struct vertex_header **tmp; /**< temp vert storage, such as for clipping */
+ unsigned nr_tmps;
+
+ void (*point)( struct draw_stage *,
+ struct prim_header * );
+
+ void (*line)( struct draw_stage *,
+ struct prim_header * );
+
+ void (*tri)( struct draw_stage *,
+ struct prim_header * );
+
+ void (*flush)( struct draw_stage *,
+ unsigned flags );
+
+ void (*reset_stipple_counter)( struct draw_stage * );
+
+ void (*destroy)( struct draw_stage * );
+};
+
+
+extern struct draw_stage *draw_unfilled_stage( struct draw_context *context );
+extern struct draw_stage *draw_twoside_stage( struct draw_context *context );
+extern struct draw_stage *draw_offset_stage( struct draw_context *context );
+extern struct draw_stage *draw_clip_stage( struct draw_context *context );
+extern struct draw_stage *draw_flatshade_stage( struct draw_context *context );
+extern struct draw_stage *draw_cull_stage( struct draw_context *context );
+extern struct draw_stage *draw_stipple_stage( struct draw_context *context );
+extern struct draw_stage *draw_wide_line_stage( struct draw_context *context );
+extern struct draw_stage *draw_wide_point_stage( struct draw_context *context );
+extern struct draw_stage *draw_validate_stage( struct draw_context *context );
+
+
+extern void draw_free_temp_verts( struct draw_stage *stage );
+
+extern void draw_alloc_temp_verts( struct draw_stage *stage, unsigned nr );
+
+
+
+
+/**
+ * Get a writeable copy of a vertex.
+ * \param stage drawing stage info
+ * \param vert the vertex to copy (source)
+ * \param idx index into stage's tmp[] array to put the copy (dest)
+ * \return pointer to the copied vertex
+ */
+static INLINE struct vertex_header *
+dup_vert( struct draw_stage *stage,
+ const struct vertex_header *vert,
+ unsigned idx )
+{
+ struct vertex_header *tmp = stage->tmp[idx];
+ const uint vsize = sizeof(struct vertex_header)
+ + stage->draw->num_vs_outputs * 4 * sizeof(float);
+ memcpy(tmp, vert, vsize);
+ tmp->vertex_id = UNDEFINED_VERTEX_ID;
+ return tmp;
+}
+
+#endif
#include "draw_context.h"
#include "draw_private.h"
+#include "draw_pipe.h"
/**
#include "draw_context.h"
#include "draw_vs.h"
+#include "draw_pipe.h"
/*
#include "pipe/p_util.h"
#include "pipe/p_shader_tokens.h"
-#include "draw_context.h"
#include "draw_vs.h"
+#include "draw_pipe.h"
#ifndef IS_NEGATIVE
}
}
-
+static INLINE float
+dot4(const float *a, const float *b)
+{
+ return (a[0]*b[0] +
+ a[1]*b[1] +
+ a[2]*b[2] +
+ a[3]*b[3]);
+}
/* Clip a triangle against the viewport and user clip planes.
#include "pipe/p_util.h"
#include "pipe/p_defines.h"
-#include "draw_private.h"
+#include "draw_pipe.h"
struct cull_stage {
#include "pipe/p_util.h"
#include "pipe/p_shader_tokens.h"
#include "draw_vs.h"
+#include "draw_pipe.h"
/** subclass of draw_stage */
*/
#include "pipe/p_util.h"
-#include "draw_private.h"
+#include "draw_pipe.h"
#include "tgsi/util/tgsi_dump.h"
#include "draw_context.h"
-#include "draw_private.h"
+#include "draw_pipe.h"
#include "pipe/p_util.h"
#include "pipe/p_defines.h"
#include "pipe/p_shader_tokens.h"
-#include "draw_private.h"
+#include "draw_pipe.h"
/** Subclass of draw_stage */
#include "pipe/p_defines.h"
#include "pipe/p_shader_tokens.h"
#include "draw_vs.h"
-
+#include "draw_pipe.h"
struct twoside_stage {
struct draw_stage stage;
#include "pipe/p_util.h"
#include "pipe/p_defines.h"
#include "draw_private.h"
+#include "draw_pipe.h"
struct unfilled_stage {
#include "pipe/p_util.h"
#include "pipe/p_defines.h"
#include "draw_private.h"
+#include "draw_pipe.h"
static boolean points( unsigned prim )
{
if (lines(prim))
{
/* line stipple */
- if (draw->rasterizer->line_stipple_enable && draw->line_stipple)
+ if (draw->rasterizer->line_stipple_enable && draw->pipeline.line_stipple)
return TRUE;
/* wide lines */
- if (draw->rasterizer->line_width > draw->wide_line_threshold)
+ if (draw->rasterizer->line_width > draw->pipeline.wide_line_threshold)
return TRUE;
/* AA lines */
if (points(prim))
{
/* large points */
- if (draw->rasterizer->point_size > draw->wide_point_threshold)
+ if (draw->rasterizer->point_size > draw->pipeline.wide_point_threshold)
return TRUE;
/* AA points */
return TRUE;
/* point sprites */
- if (draw->rasterizer->point_sprite && draw->point_sprite)
+ if (draw->rasterizer->point_sprite && draw->pipeline.point_sprite)
return TRUE;
}
stage->next = next;
/* drawing wide lines? */
- wide_lines = (draw->rasterizer->line_width > draw->wide_line_threshold
+ wide_lines = (draw->rasterizer->line_width > draw->pipeline.wide_line_threshold
&& !draw->rasterizer->line_smooth);
/* drawing large points? */
- if (draw->rasterizer->point_sprite && draw->point_sprite)
+ if (draw->rasterizer->point_sprite && draw->pipeline.point_sprite)
wide_points = TRUE;
else if (draw->rasterizer->point_smooth && draw->pipeline.aapoint)
wide_points = FALSE;
- else if (draw->rasterizer->point_size > draw->wide_point_threshold)
+ else if (draw->rasterizer->point_size > draw->pipeline.wide_point_threshold)
wide_points = TRUE;
else
wide_points = FALSE;
next = draw->pipeline.wide_point;
}
- if (draw->rasterizer->line_stipple_enable && draw->line_stipple) {
+ if (draw->rasterizer->line_stipple_enable && draw->pipeline.line_stipple) {
draw->pipeline.stipple->next = next;
next = draw->pipeline.stipple;
precalc_flat = 1; /* only needed for lines really */
#include "draw_vbuf.h"
#include "draw_private.h"
#include "draw_vertex.h"
+#include "draw_pipe.h"
#include "translate/translate.h"
#include "pipe/p_defines.h"
#include "pipe/p_shader_tokens.h"
#include "draw_private.h"
+#include "draw_pipe.h"
struct wideline_stage {
#include "pipe/p_defines.h"
#include "pipe/p_shader_tokens.h"
#include "draw_vs.h"
+#include "draw_pipe.h"
struct widepoint_stage {
}
/* XXX we won't know the real size if it's computed by the vertex shader! */
- if ((draw->rasterizer->point_size > draw->wide_point_threshold) ||
- (draw->rasterizer->point_sprite && draw->point_sprite)) {
+ if ((draw->rasterizer->point_size > draw->pipeline.wide_point_threshold) ||
+ (draw->rasterizer->point_sprite && draw->pipeline.point_sprite)) {
stage->point = widepoint_point;
}
else {
struct pipe_context;
struct gallivm_prog;
struct gallivm_cpu_engine;
-
-struct draw_pt_middle_end;
-struct draw_pt_front_end;
struct draw_vertex_shader;
+struct draw_context;
+struct draw_stage;
+struct vbuf_render;
-#define MAX_SHADER_VERTICES 128
/**
* Basic vertex info.
float clip[4];
- float data[][4]; /* Note variable size */
+ /* This will probably become float (*data)[4] soon:
+ */
+ float data[][4];
};
/* NOTE: It should match vertex_id size above */
#define UNDEFINED_VERTEX_ID 0xffff
-/* XXX This is too large */
-#define MAX_VERTEX_SIZE ((2 + PIPE_MAX_SHADER_OUTPUTS) * 4 * sizeof(float))
-#define MAX_VERTEX_ALLOCATION ((MAX_VERTEX_SIZE + 0x0f) & ~0x0f)
-
-
/**
* Basic info for a point/line/triangle primitive.
-struct draw_context;
-
-/**
- * Base class for all primitive drawing stages.
- */
-struct draw_stage
-{
- struct draw_context *draw; /**< parent context */
-
- struct draw_stage *next; /**< next stage in pipeline */
-
- struct vertex_header **tmp; /**< temp vert storage, such as for clipping */
- unsigned nr_tmps;
-
- void (*point)( struct draw_stage *,
- struct prim_header * );
-
- void (*line)( struct draw_stage *,
- struct prim_header * );
-
- void (*tri)( struct draw_stage *,
- struct prim_header * );
-
- void (*flush)( struct draw_stage *,
- unsigned flags );
-
- void (*reset_stipple_counter)( struct draw_stage * );
-
- void (*destroy)( struct draw_stage * );
-};
-
-
-
-struct vbuf_render;
-
#define PT_SHADE 0x1
#define PT_CLIPTEST 0x2
struct draw_stage *wide_line;
struct draw_stage *wide_point;
struct draw_stage *rasterize;
+
+ float wide_point_threshold; /**< convert pnts to tris if larger than this */
+ float wide_line_threshold; /**< convert lines to tris if wider than this */
+ boolean line_stipple; /**< do line stipple? */
+ boolean point_sprite; /**< convert points to quads for sprites? */
+
} pipeline;
float plane[12][4];
unsigned nr_planes;
- float wide_point_threshold; /**< convert pnts to tris if larger than this */
- float wide_line_threshold; /**< convert lines to tris if wider than this */
- boolean line_stipple; /**< do line stipple? */
- boolean point_sprite; /**< convert points to quads for sprites? */
boolean use_sse;
/* If a prim stage introduces new vertex attributes, they'll be stored here
-extern struct draw_stage *draw_unfilled_stage( struct draw_context *context );
-extern struct draw_stage *draw_twoside_stage( struct draw_context *context );
-extern struct draw_stage *draw_offset_stage( struct draw_context *context );
-extern struct draw_stage *draw_clip_stage( struct draw_context *context );
-extern struct draw_stage *draw_flatshade_stage( struct draw_context *context );
-extern struct draw_stage *draw_cull_stage( struct draw_context *context );
-extern struct draw_stage *draw_stipple_stage( struct draw_context *context );
-extern struct draw_stage *draw_wide_line_stage( struct draw_context *context );
-extern struct draw_stage *draw_wide_point_stage( struct draw_context *context );
-extern struct draw_stage *draw_validate_stage( struct draw_context *context );
-
-
-extern void draw_free_temp_verts( struct draw_stage *stage );
-
-extern void draw_alloc_temp_verts( struct draw_stage *stage, unsigned nr );
extern void draw_reset_vertex_ids( struct draw_context *draw );
-extern int draw_vertex_cache_check_space( struct draw_context *draw,
- unsigned nr_verts );
-extern void draw_vertex_cache_invalidate( struct draw_context *draw );
-extern void draw_vertex_cache_unreference( struct draw_context *draw );
-extern void draw_vertex_cache_reset_vertex_ids( struct draw_context *draw );
+/*******************************************************************************
+ * Vertex processing (was passthrough) code:
+ */
+boolean draw_pt_init( struct draw_context *draw );
+void draw_pt_destroy( struct draw_context *draw );
+void draw_pt_reset_vertex_ids( struct draw_context *draw );
-extern void draw_update_vertex_fetch( struct draw_context *draw );
+/*******************************************************************************
+ * Primitive processing (pipelnie) code:
+ */
-extern boolean draw_need_pipeline(const struct draw_context *draw,
- unsigned prim );
+boolean draw_pipeline_init( struct draw_context *draw );
+void draw_pipeline_destroy( struct draw_context *draw );
+boolean draw_need_pipeline(const struct draw_context *draw,
+ unsigned prim );
-/* Passthrough mode (second attempt):
- */
-boolean draw_pt_init( struct draw_context *draw );
-void draw_pt_destroy( struct draw_context *draw );
-void draw_pt_reset_vertex_ids( struct draw_context *draw );
#define DRAW_FLUSH_STATE_CHANGE 0x8
#define DRAW_FLUSH_BACKEND 0x10
unsigned idx );
-/**
- * Get a writeable copy of a vertex.
- * \param stage drawing stage info
- * \param vert the vertex to copy (source)
- * \param idx index into stage's tmp[] array to put the copy (dest)
- * \return pointer to the copied vertex
- */
-static INLINE struct vertex_header *
-dup_vert( struct draw_stage *stage,
- const struct vertex_header *vert,
- unsigned idx )
-{
- struct vertex_header *tmp = stage->tmp[idx];
- const uint vsize = sizeof(struct vertex_header)
- + stage->draw->num_vs_outputs * 4 * sizeof(float);
- memcpy(tmp, vert, vsize);
- tmp->vertex_id = UNDEFINED_VERTEX_ID;
- return tmp;
-}
-
-static INLINE float
-dot4(const float *a, const float *b)
-{
- float result = (a[0]*b[0] +
- a[1]*b[1] +
- a[2]*b[2] +
- a[3]*b[3]);
-
- return result;
-}
#endif /* DRAW_PRIVATE_H */
draw_pt_arrays(draw, prim, start, count);
}
-
-/* Revamp me please:
- */
-void draw_do_flush( struct draw_context *draw, unsigned flags )
-{
- if (!draw->flushing)
- {
- draw->flushing = TRUE;
-
- if (flags >= DRAW_FLUSH_STATE_CHANGE) {
- draw->pipeline.first->flush( draw->pipeline.first, flags );
- draw->pipeline.first = draw->pipeline.validate;
- draw->reduced_prim = ~0;
- }
-
- draw->flushing = FALSE;
- }
-}
#include "draw/draw_private.h"
#include "draw/draw_vertex.h"
#include "draw/draw_pt.h"
+#include "draw/draw_pipe.h"
static void do_point( struct draw_context *draw,
const char *v0 )
+static INLINE float
+dot4(const float *a, const float *b)
+{
+ return (a[0]*b[0] +
+ a[1]*b[1] +
+ a[2]*b[2] +
+ a[3]*b[3]);
+}
+
+
+
static INLINE unsigned
compute_clipmask_gl(const float *clip, /*const*/ float plane[][4], unsigned nr)
{
assert(0);
}
}
-
- assert(vinfo->size * 4 <= MAX_VERTEX_SIZE);
}
*/
i915->draw = draw_create();
assert(i915->draw);
- if (GETENV("I915_VBUF")) {
+ if (!GETENV("I915_NO_VBUF")) {
draw_set_rasterize_stage(i915->draw, i915_draw_vbuf_stage(i915));
}
else {
**************************************************************************/
-#include "draw/draw_private.h"
+#include "draw/draw_pipe.h"
#include "pipe/p_util.h"
#include "i915_context.h"
const uint j = vinfo->src_index[i];
const float *attrib = vertex->data[j];
switch (vinfo->emit[i]) {
- case EMIT_OMIT:
- /* no-op */
- break;
case EMIT_1F:
OUT_BATCH( fui(attrib[0]) );
count++;
#include "sp_setup.h"
#include "sp_state.h"
#include "sp_prim_setup.h"
-#include "draw/draw_private.h"
+#include "draw/draw_pipe.h"
#include "draw/draw_vertex.h"
#include "pipe/p_util.h"
#include "cso_cache/cso_cache.h"
#include "draw/draw_context.h"
-#include "draw/draw_private.h"
+#include "draw/draw_pipe.h"
/**
#include "st_cb_rasterpos.h"
#include "st_draw.h"
#include "draw/draw_context.h"
-#include "draw/draw_private.h"
+#include "draw/draw_pipe.h"
#include "shader/prog_instruction.h"
#include "vbo/vbo.h"