summaryrefslogtreecommitdiff
path: root/src/mesa/pipe
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r--src/mesa/pipe/draw/draw_clip.c35
-rw-r--r--src/mesa/pipe/draw/draw_context.h32
-rw-r--r--src/mesa/pipe/draw/draw_cull.c21
-rw-r--r--src/mesa/pipe/draw/draw_flatshade.c31
-rw-r--r--src/mesa/pipe/draw/draw_offset.c24
-rw-r--r--src/mesa/pipe/draw/draw_private.h138
-rw-r--r--src/mesa/pipe/draw/draw_twoside.c24
-rw-r--r--src/mesa/pipe/draw/draw_unfilled.c17
-rw-r--r--src/mesa/pipe/draw/draw_vb.c92
-rw-r--r--src/mesa/pipe/p_state.h2
-rw-r--r--src/mesa/pipe/softpipe/sp_context.c74
-rw-r--r--src/mesa/pipe/softpipe/sp_context.h27
-rw-r--r--src/mesa/pipe/softpipe/sp_headers.h21
-rw-r--r--src/mesa/pipe/softpipe/sp_prim_setup.c54
-rw-r--r--src/mesa/pipe/softpipe/sp_prim_setup.h6
-rw-r--r--src/mesa/pipe/softpipe/sp_state_blend.c2
-rw-r--r--src/mesa/pipe/softpipe/sp_state_clip.c32
-rw-r--r--src/mesa/pipe/softpipe/sp_state_derived.c16
-rw-r--r--src/mesa/pipe/softpipe/sp_state_sampler.c2
-rw-r--r--src/mesa/pipe/softpipe/sp_state_setup.c30
20 files changed, 355 insertions, 325 deletions
diff --git a/src/mesa/pipe/draw/draw_clip.c b/src/mesa/pipe/draw/draw_clip.c
index 304c43c3f4..10a6c1b823 100644
--- a/src/mesa/pipe/draw/draw_clip.c
+++ b/src/mesa/pipe/draw/draw_clip.c
@@ -28,18 +28,18 @@
/* Authors: Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "imports.h"
-#include "macros.h"
+#include "main/macros.h"
+#include "draw_private.h"
-#include "sp_context.h"
-#include "sp_prim.h"
struct clipper {
- struct prim_stage stage;
+ struct prim_stage stage; /**< base class */
GLuint active_user_planes;
+ GLfloat (*plane)[4];
};
+
/* This is a bit confusing:
*/
static INLINE struct clipper *clipper_stage( struct prim_stage *stage )
@@ -75,7 +75,7 @@ static void interp( struct clipper *clip,
const struct vertex_header *out,
const struct vertex_header *in )
{
- const GLuint nr_attrs = clip->stage.softpipe->nr_attrs;
+ const GLuint nr_attrs = clip->stage.draw->nr_attrs;
GLuint j;
/* Vertex header.
@@ -96,8 +96,8 @@ static void interp( struct clipper *clip,
*/
{
const GLfloat *pos = dst->clip;
- const GLfloat *scale = clip->stage.softpipe->viewport.scale;
- const GLfloat *trans = clip->stage.softpipe->viewport.translate;
+ const GLfloat *scale = clip->stage.draw->viewport.scale;
+ const GLfloat *trans = clip->stage.draw->viewport.translate;
GLfloat oow;
oow = 1.0 / pos[3];
@@ -225,7 +225,7 @@ do_clip_tri( struct prim_stage *stage,
while (clipmask && n >= 3) {
GLuint plane_idx = ffs(clipmask)-1;
- const GLfloat *plane = clipper->stage.softpipe->plane[plane_idx];
+ const GLfloat *plane = clipper->plane[plane_idx];
struct vertex_header *vert_prev = inlist[0];
GLfloat dp_prev = dot4( vert_prev->clip, plane );
GLuint outcount = 0;
@@ -314,7 +314,7 @@ do_clip_line( struct prim_stage *stage,
while (clipmask) {
GLuint plane_idx = ffs(clipmask)-1;
- const GLfloat *plane = clipper->stage.softpipe->plane[plane_idx];
+ const GLfloat *plane = clipper->plane[plane_idx];
clipmask &= ~(1<<plane_idx);
@@ -353,7 +353,7 @@ do_clip_line( struct prim_stage *stage,
static void clip_begin( struct prim_stage *stage )
{
struct clipper *clipper = clipper_stage(stage);
- GLuint nr = stage->softpipe->nr_planes;
+ GLuint nr = stage->draw->nr_planes;
/* Hacky bitmask to use when we hit CLIP_USER_BIT:
*/
@@ -379,6 +379,7 @@ clip_line( struct prim_stage *stage,
header->v[1]->clipmask);
if (clipmask == 0) {
+ /* no clipping needed */
stage->next->line( stage->next, header );
}
else if ((header->v[0]->clipmask &
@@ -397,6 +398,7 @@ clip_tri( struct prim_stage *stage,
header->v[2]->clipmask);
if (clipmask == 0) {
+ /* no clipping needed */
stage->next->tri( stage->next, header );
}
else if ((header->v[0]->clipmask &
@@ -406,24 +408,31 @@ clip_tri( struct prim_stage *stage,
}
}
+
static void clip_end( struct prim_stage *stage )
{
stage->next->end( stage->next );
}
-struct prim_stage *prim_clip( struct softpipe_context *softpipe )
+/**
+ * Allocate a new clipper stage.
+ * \return pointer to new stage object
+ */
+struct prim_stage *prim_clip( struct draw_context *draw )
{
struct clipper *clipper = CALLOC_STRUCT(clipper);
prim_alloc_tmps( &clipper->stage, MAX_CLIPPED_VERTICES );
- clipper->stage.softpipe = softpipe;
+ clipper->stage.draw = draw;
clipper->stage.begin = clip_begin;
clipper->stage.point = clip_point;
clipper->stage.line = clip_line;
clipper->stage.tri = clip_tri;
clipper->stage.end = clip_end;
+ clipper->plane = draw->plane;
+
return &clipper->stage;
}
diff --git a/src/mesa/pipe/draw/draw_context.h b/src/mesa/pipe/draw/draw_context.h
index a138f812fa..85f2ace75f 100644
--- a/src/mesa/pipe/draw/draw_context.h
+++ b/src/mesa/pipe/draw/draw_context.h
@@ -26,25 +26,42 @@
*
**************************************************************************/
+/**
+ * \brief Public interface into the drawing module.
+ */
+
/* Authors: Keith Whitwell <keith@tungstengraphics.com>
*/
-#ifndef G_DRAW_H
-#define G_DRAW_H
+
+#ifndef DRAW_CONTEXT_H
+#define DRAW_CONTEXT_H
+
#include "glheader.h"
#include "pipe/p_state.h"
+struct vertex_buffer;
struct draw_context;
+struct prim_stage;
+
-struct draw_context *draw_create( struct softpipe_context *softpipe );
+struct draw_context *draw_create( void );
void draw_destroy( struct draw_context *draw );
-void draw_set_viewport( struct draw_context *draw,
- const GLfloat *scale,
- const GLfloat *translate );
+void draw_set_viewport_state( struct draw_context *draw,
+ const struct pipe_viewport_state *viewport );
+
+void draw_set_clip_state( struct draw_context *pipe,
+ const struct pipe_clip_state *clip );
+
+void draw_set_setup_state( struct draw_context *draw,
+ const struct pipe_setup_state *setup );
+
+void draw_set_setup_stage( struct draw_context *draw,
+ struct prim_stage *stage );
void draw_set_vertex_attributes( struct draw_context *draw,
const GLuint *attrs,
@@ -53,4 +70,5 @@ void draw_set_vertex_attributes( struct draw_context *draw,
void draw_vb(struct draw_context *draw,
struct vertex_buffer *VB );
-#endif
+
+#endif /* DRAW_CONTEXT_H */
diff --git a/src/mesa/pipe/draw/draw_cull.c b/src/mesa/pipe/draw/draw_cull.c
index 63099fbee0..d27d33a40d 100644
--- a/src/mesa/pipe/draw/draw_cull.c
+++ b/src/mesa/pipe/draw/draw_cull.c
@@ -27,11 +27,10 @@
/* Authors: Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "imports.h"
+#include "main/imports.h"
#include "pipe/p_defines.h"
-#include "sp_context.h"
-#include "sp_prim.h"
+#include "draw_private.h"
@@ -52,7 +51,7 @@ static void cull_begin( struct prim_stage *stage )
{
struct cull_stage *cull = cull_stage(stage);
- cull->mode = stage->softpipe->setup.cull_mode;
+ cull->mode = stage->draw->setup.cull_mode;
stage->next->begin( stage->next );
}
@@ -76,10 +75,13 @@ static void cull_tri( struct prim_stage *stage,
_mesa_printf("%s %f\n", __FUNCTION__, header->det );
if (header->det != 0) {
+ /* non-zero area */
GLuint mode = (header->det < 0) ? PIPE_WINDING_CW : PIPE_WINDING_CCW;
- if ((mode & cull_stage(stage)->mode) == 0)
+ if ((mode & cull_stage(stage)->mode) == 0) {
+ /* triangle is not culled, pass to next stage */
stage->next->tri( stage->next, header );
+ }
}
}
@@ -97,18 +99,23 @@ static void cull_point( struct prim_stage *stage,
stage->next->point( stage->next, header );
}
+
static void cull_end( struct prim_stage *stage )
{
stage->next->end( stage->next );
}
-struct prim_stage *prim_cull( struct softpipe_context *softpipe )
+
+/**
+ * Create a new polygon culling stage.
+ */
+struct prim_stage *prim_cull( struct draw_context *draw )
{
struct cull_stage *cull = CALLOC_STRUCT(cull_stage);
prim_alloc_tmps( &cull->stage, 0 );
- cull->stage.softpipe = softpipe;
+ cull->stage.draw = draw;
cull->stage.next = NULL;
cull->stage.begin = cull_begin;
cull->stage.point = cull_point;
diff --git a/src/mesa/pipe/draw/draw_flatshade.c b/src/mesa/pipe/draw/draw_flatshade.c
index 3a7d9de466..004b5bdc96 100644
--- a/src/mesa/pipe/draw/draw_flatshade.c
+++ b/src/mesa/pipe/draw/draw_flatshade.c
@@ -27,12 +27,9 @@
/* Authors: Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "imports.h"
-#include "vf/vf.h"
-
-#include "sp_context.h"
-#include "sp_prim.h"
+#include "main/imports.h"
+#include "draw_private.h"
struct flatshade_stage {
@@ -67,11 +64,12 @@ static INLINE void copy_attr( GLuint attr,
}
}
-static void copy_colors( struct prim_stage *stage,
- struct vertex_header *dst,
- const struct vertex_header *src )
+
+static INLINE void copy_colors( struct prim_stage *stage,
+ struct vertex_header *dst,
+ const struct vertex_header *src )
{
- struct flatshade_stage *flatshade = flatshade_stage(stage);
+ const struct flatshade_stage *flatshade = flatshade_stage(stage);
const GLuint *lookup = flatshade->lookup;
copy_attr( lookup[VF_ATTRIB_COLOR0], dst, src );
@@ -81,8 +79,8 @@ static void copy_colors( struct prim_stage *stage,
}
-
-/* Flatshade tri. Required for clipping and when unfilled tris are
+/**
+ * Flatshade tri. Required for clipping and when unfilled tris are
* active, otherwise handled by hardware.
*/
static void flatshade_tri( struct prim_stage *stage,
@@ -102,7 +100,8 @@ static void flatshade_tri( struct prim_stage *stage,
}
-/* Flatshade line. Required for clipping.
+/**
+ * Flatshade line. Required for clipping.
*/
static void flatshade_line( struct prim_stage *stage,
struct prim_header *header )
@@ -124,18 +123,20 @@ static void flatshade_point( struct prim_stage *stage,
stage->next->point( stage->next, header );
}
+
static void flatshade_end( struct prim_stage *stage )
{
stage->next->end( stage->next );
}
-struct prim_stage *prim_flatshade( struct softpipe_context *softpipe )
+
+struct prim_stage *prim_flatshade( struct draw_context *draw )
{
struct flatshade_stage *flatshade = CALLOC_STRUCT(flatshade_stage);
prim_alloc_tmps( &flatshade->stage, 2 );
- flatshade->stage.softpipe = softpipe;
+ flatshade->stage.draw = draw;
flatshade->stage.next = NULL;
flatshade->stage.begin = flatshade_begin;
flatshade->stage.point = flatshade_point;
@@ -143,7 +144,7 @@ struct prim_stage *prim_flatshade( struct softpipe_context *softpipe )
flatshade->stage.tri = flatshade_tri;
flatshade->stage.end = flatshade_end;
- flatshade->lookup = softpipe->vf_attr_to_slot;
+ flatshade->lookup = draw->vf_attr_to_slot;
return &flatshade->stage;
}
diff --git a/src/mesa/pipe/draw/draw_offset.c b/src/mesa/pipe/draw/draw_offset.c
index 5fd6ac911a..0fa8cf29d3 100644
--- a/src/mesa/pipe/draw/draw_offset.c
+++ b/src/mesa/pipe/draw/draw_offset.c
@@ -27,11 +27,10 @@
/* Authors: Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "imports.h"
-#include "macros.h"
-#include "sp_context.h"
-#include "sp_prim.h"
+#include "main/imports.h"
+#include "main/macros.h"
+#include "draw_private.h"
@@ -56,14 +55,15 @@ static void offset_begin( struct prim_stage *stage )
{
struct offset_stage *offset = offset_stage(stage);
- offset->units = stage->softpipe->setup.offset_units;
- offset->scale = stage->softpipe->setup.offset_scale;
+ offset->units = stage->draw->setup.offset_units;
+ offset->scale = stage->draw->setup.offset_scale;
stage->next->begin( stage->next );
}
-/* Offset tri. Some hardware can handle this, but not usually when
+/**
+ * Offset tri Z. Some hardware can handle this, but not usually when
* doing unfilled rendering.
*/
static void do_offset_tri( struct prim_stage *stage,
@@ -92,8 +92,8 @@ static void do_offset_tri( struct prim_stage *stage,
GLfloat bc = b * inv_det;
GLfloat zoffset;
- if ( ac < 0.0f ) ac = -ac;
- if ( bc < 0.0f ) bc = -bc;
+ ac = FABSF(ac);
+ bc = FABSF(bc);
zoffset = offset->units + MAX2( ac, bc ) * offset->scale;
@@ -115,7 +115,7 @@ static void offset_tri( struct prim_stage *stage,
tmp.v[1] = dup_vert(stage, header->v[1], 1);
tmp.v[2] = dup_vert(stage, header->v[2], 2);
- do_offset_tri( stage->next, &tmp );
+ do_offset_tri( stage, &tmp );
}
@@ -139,13 +139,13 @@ static void offset_end( struct prim_stage *stage )
stage->next->end( stage->next );
}
-struct prim_stage *prim_offset( struct softpipe_context *softpipe )
+struct prim_stage *prim_offset( struct draw_context *draw )
{
struct offset_stage *offset = CALLOC_STRUCT(offset_stage);
prim_alloc_tmps( &offset->stage, 3 );
- offset->stage.softpipe = softpipe;
+ offset->stage.draw = draw;
offset->stage.next = NULL;
offset->stage.begin = offset_begin;
offset->stage.point = offset_point;
diff --git a/src/mesa/pipe/draw/draw_private.h b/src/mesa/pipe/draw/draw_private.h
index b6cbaae085..ac25628a08 100644
--- a/src/mesa/pipe/draw/draw_private.h
+++ b/src/mesa/pipe/draw/draw_private.h
@@ -25,32 +25,63 @@
*
**************************************************************************/
-/* Authors: Keith Whitwell <keith@tungstengraphics.com>
+/**
+ * Private data structures, etc for the draw module.
*/
-#ifndef G_PRIM_H
-#define G_PRIM_H
-#include "glheader.h"
-#include "sp_headers.h"
+/**
+ * Authors:
+ * Keith Whitwell <keith@tungstengraphics.com>
+ * Brian Paul
+ */
+
-struct softpipe_context;
+#ifndef DRAW_PRIVATE_H
+#define DRAW_PRIVATE_H
-struct prim_stage *prim_setup( struct softpipe_context *context );
-struct prim_stage *prim_unfilled( struct softpipe_context *context );
-struct prim_stage *prim_twoside( struct softpipe_context *context );
-struct prim_stage *prim_offset( struct softpipe_context *context );
-struct prim_stage *prim_clip( struct softpipe_context *context );
-struct prim_stage *prim_flatshade( struct softpipe_context *context );
-struct prim_stage *prim_cull( struct softpipe_context *context );
+#include "main/glheader.h"
+#include "pipe/p_state.h"
+#include "pipe/p_defines.h"
+#include "vf/vf.h"
-/* Internal structs and helpers for the primitive clip/setup pipeline:
+
+/**
+ * Basic vertex info.
+ * Carry some useful information around with the vertices in the prim pipe.
*/
-struct prim_stage {
- struct softpipe_context *softpipe;
+struct vertex_header {
+ GLuint clipmask:12;
+ GLuint edgeflag:1;
+ GLuint pad:19;
- struct prim_stage *next;
+ GLfloat clip[4];
+
+ GLfloat data[][4]; /* Note variable size */
+};
+
+
+/**
+ * Basic info for a point/line/triangle primitive.
+ */
+struct prim_header {
+ GLfloat det; /**< front/back face determinant */
+ struct vertex_header *v[3]; /**< 1 to 3 vertex pointers */
+};
+
+
+
+struct draw_context;
+
+/**
+ * Base class for all primitive drawing stages.
+ */
+struct prim_stage
+{
+ struct draw_context *draw; /**< parent context */
+
+ struct prim_stage *next; /**< next stage in pipeline */
struct vertex_header **tmp;
GLuint nr_tmps;
@@ -70,8 +101,72 @@ struct prim_stage {
};
+/**
+ * Private context for the drawing module.
+ */
+struct draw_context
+{
+ struct {
+ struct prim_stage *first; /**< one of the following */
+
+ /* stages (in logical order) */
+ struct prim_stage *flatshade;
+ struct prim_stage *clip;
+ struct prim_stage *cull;
+ struct prim_stage *twoside;
+ struct prim_stage *offset;
+ struct prim_stage *unfilled;
+ struct prim_stage *setup; /* aka render/rasterize */
+ } pipeline;
+
+ /* pipe state that we need: */
+ struct pipe_setup_state setup;
+ struct pipe_viewport_state viewport;
+
+ /* Clip derived state:
+ */
+ GLfloat plane[12][4];
+ GLuint nr_planes;
+
+ GLuint vf_attr_to_slot[PIPE_ATTRIB_MAX];
+
+ struct vf_attr_map attrs[VF_ATTRIB_MAX];
+ GLuint nr_attrs;
+ GLuint vertex_size; /**< in bytes */
+ struct vertex_fetch *vf;
+
+ GLubyte *verts;
+ GLuint nr_vertices;
+ GLboolean in_vb;
+
+ GLenum prim; /**< GL_POINTS, GL_LINE_STRIP, GL_QUADS, etc */
+
+ /* Helper for tnl:
+ */
+ GLvector4f header;
+};
+
+
-/* Get a writeable copy of a vertex:
+extern struct prim_stage *prim_unfilled( struct draw_context *context );
+extern struct prim_stage *prim_twoside( struct draw_context *context );
+extern struct prim_stage *prim_offset( struct draw_context *context );
+extern struct prim_stage *prim_clip( struct draw_context *context );
+extern struct prim_stage *prim_flatshade( struct draw_context *context );
+extern struct prim_stage *prim_cull( struct draw_context *context );
+
+
+extern void prim_free_tmps( struct prim_stage *stage );
+extern void prim_alloc_tmps( struct prim_stage *stage, GLuint 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 prim_stage *stage,
@@ -79,12 +174,9 @@ dup_vert( struct prim_stage *stage,
GLuint idx )
{
struct vertex_header *tmp = stage->tmp[idx];
- memcpy(tmp, vert, stage->softpipe->prim.vertex_size );
+ memcpy(tmp, vert, stage->draw->vertex_size );
return tmp;
}
-void prim_free_tmps( struct prim_stage *stage );
-void prim_alloc_tmps( struct prim_stage *stage, GLuint nr );
-
-#endif
+#endif /* DRAW_PRIVATE_H */
diff --git a/src/mesa/pipe/draw/draw_twoside.c b/src/mesa/pipe/draw/draw_twoside.c
index 5e9f218d1e..88e164ec5e 100644
--- a/src/mesa/pipe/draw/draw_twoside.c
+++ b/src/mesa/pipe/draw/draw_twoside.c
@@ -27,12 +27,10 @@
/* Authors: Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "imports.h"
-#include "vf/vf.h"
+#include "main/imports.h"
#include "pipe/p_defines.h"
-#include "sp_context.h"
-#include "sp_prim.h"
+#include "draw_private.h"
struct twoside_stage {
@@ -53,7 +51,7 @@ static void twoside_begin( struct prim_stage *stage )
{
struct twoside_stage *twoside = twoside_stage(stage);
- twoside->facing = (stage->softpipe->setup.front_winding == PIPE_WINDING_CW) ? -1 : 1;
+ twoside->facing = (stage->draw->setup.front_winding == PIPE_WINDING_CW) ? -1 : 1;
stage->next->begin( stage->next );
}
@@ -97,9 +95,11 @@ static void twoside_tri( struct prim_stage *stage,
struct twoside_stage *twoside = twoside_stage(stage);
if (header->det * twoside->facing < 0) {
+ /* this is a back-facing triangle */
struct prim_header tmp;
tmp.det = header->det;
+ /* copy back colors to front color slots */
tmp.v[0] = copy_bfc(twoside, header->v[0], 0);
tmp.v[1] = copy_bfc(twoside, header->v[1], 1);
tmp.v[2] = copy_bfc(twoside, header->v[2], 2);
@@ -115,6 +115,7 @@ static void twoside_tri( struct prim_stage *stage,
static void twoside_line( struct prim_stage *stage,
struct prim_header *header )
{
+ /* pass-through */
stage->next->line( stage->next, header );
}
@@ -122,23 +123,28 @@ static void twoside_line( struct prim_stage *stage,
static void twoside_point( struct prim_stage *stage,
struct prim_header *header )
{
+ /* pass-through */
stage->next->point( stage->next, header );
}
+
static void twoside_end( struct prim_stage *stage )
{
+ /* pass-through */
stage->next->end( stage->next );
}
-
-struct prim_stage *prim_twoside( struct softpipe_context *softpipe )
+/**
+ * Create twoside pipeline stage.
+ */
+struct prim_stage *prim_twoside( struct draw_context *draw )
{
struct twoside_stage *twoside = CALLOC_STRUCT(twoside_stage);
prim_alloc_tmps( &twoside->stage, 3 );
- twoside->stage.softpipe = softpipe;
+ twoside->stage.draw = draw;
twoside->stage.next = NULL;
twoside->stage.begin = twoside_begin;
twoside->stage.point = twoside_point;
@@ -146,7 +152,7 @@ struct prim_stage *prim_twoside( struct softpipe_context *softpipe )
twoside->stage.tri = twoside_tri;
twoside->stage.end = twoside_end;
- twoside->lookup = softpipe->vf_attr_to_slot;
+ twoside->lookup = draw->vf_attr_to_slot;
return &twoside->stage;
}
diff --git a/src/mesa/pipe/draw/draw_unfilled.c b/src/mesa/pipe/draw/draw_unfilled.c
index ab0dab09d4..a1d9d14352 100644
--- a/src/mesa/pipe/draw/draw_unfilled.c
+++ b/src/mesa/pipe/draw/draw_unfilled.c
@@ -27,11 +27,10 @@
/* Authors: Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "imports.h"
-#include "sp_context.h"
-#include "sp_prim.h"
+#include "main/imports.h"
#include "pipe/p_defines.h"
+#include "draw_private.h"
struct unfilled_stage {
@@ -51,8 +50,8 @@ static void unfilled_begin( struct prim_stage *stage )
{
struct unfilled_stage *unfilled = unfilled_stage(stage);
- unfilled->mode[0] = stage->softpipe->setup.fill_ccw;
- unfilled->mode[1] = stage->softpipe->setup.fill_cw;
+ unfilled->mode[0] = stage->draw->setup.fill_ccw;
+ unfilled->mode[1] = stage->draw->setup.fill_cw;
stage->next->begin( stage->next );
}
@@ -128,14 +127,14 @@ static void unfilled_tri( struct prim_stage *stage,
}
static void unfilled_line( struct prim_stage *stage,
- struct prim_header *header )
+ struct prim_header *header )
{
stage->next->line( stage->next, header );
}
static void unfilled_point( struct prim_stage *stage,
- struct prim_header *header )
+ struct prim_header *header )
{
stage->next->point( stage->next, header );
}
@@ -146,13 +145,13 @@ static void unfilled_end( struct prim_stage *stage )
stage->next->end( stage->next );
}
-struct prim_stage *prim_unfilled( struct softpipe_context *softpipe )
+struct prim_stage *prim_unfilled( struct draw_context *draw )
{
struct unfilled_stage *unfilled = CALLOC_STRUCT(unfilled_stage);
prim_alloc_tmps( &unfilled->stage, 0 );
- unfilled->stage.softpipe = softpipe;
+ unfilled->stage.draw = draw;
unfilled->stage.next = NULL;
unfilled->stage.tmp = NULL;
unfilled->stage.begin = unfilled_begin;
diff --git a/src/mesa/pipe/draw/draw_vb.c b/src/mesa/pipe/draw/draw_vb.c
index 3fc30dd203..66573a93fe 100644
--- a/src/mesa/pipe/draw/draw_vb.c
+++ b/src/mesa/pipe/draw/draw_vb.c
@@ -31,41 +31,22 @@
*/
#include "imports.h"
+#include "macros.h"
#include "tnl/t_context.h"
#include "vf/vf.h"
-#include "sp_context.h"
-#include "sp_prim.h"
-#include "sp_headers.h"
-#include "sp_draw.h"
+#include "pipe/softpipe/sp_context.h"
+#include "pipe/softpipe/sp_headers.h"
+#include "draw_private.h"
+#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.
*/
-struct draw_context
-{
- struct softpipe_context *softpipe;
-
- struct vf_attr_map attrs[VF_ATTRIB_MAX];
- GLuint nr_attrs;
- GLuint vertex_size;
- struct vertex_fetch *vf;
-
- GLubyte *verts;
- GLuint nr_vertices;
- GLboolean in_vb;
-
- GLenum prim;
-
- /* Helper for tnl:
- */
- GLvector4f header;
-};
-
-
static struct vertex_header *get_vertex( struct draw_context *pipe,
GLuint i )
{
@@ -80,7 +61,7 @@ static void draw_allocate_vertices( struct draw_context *draw,
draw->nr_vertices = nr_vertices;
draw->verts = MALLOC( nr_vertices * draw->vertex_size );
- draw->softpipe->prim.first->begin( draw->softpipe->prim.first );
+ draw->pipeline.first->begin( draw->pipeline.first );
}
static void draw_set_prim( struct draw_context *draw,
@@ -149,7 +130,7 @@ static void draw_indexed_prim( struct draw_context *draw,
const GLuint *elts,
GLuint count )
{
- struct prim_stage * const first = draw->softpipe->prim.first;
+ struct prim_stage * const first = draw->pipeline.first;
struct prim_header prim;
GLuint i;
@@ -299,7 +280,7 @@ static void draw_prim( struct draw_context *draw,
GLuint start,
GLuint count )
{
- struct prim_stage * const first = draw->softpipe->prim.first;
+ struct prim_stage * const first = draw->pipeline.first;
struct prim_header prim;
GLuint i;
@@ -442,7 +423,7 @@ static void draw_prim( struct draw_context *draw,
static void draw_release_vertices( struct draw_context *draw )
{
- draw->softpipe->prim.first->end( draw->softpipe->prim.first );
+ draw->pipeline.first->end( draw->pipeline.first );
FREE(draw->verts);
draw->verts = NULL;
@@ -636,35 +617,6 @@ void draw_vb(struct draw_context *draw,
draw->in_vb = 0;
}
-void draw_set_viewport( struct draw_context *draw,
- const GLfloat *scale,
- const GLfloat *translate )
-{
- assert(!draw->in_vb);
- vf_set_vp_scale_translate( draw->vf, scale, translate );
-}
-
-
-
-struct draw_context *draw_create( struct softpipe_context *softpipe )
-{
- struct draw_context *draw = CALLOC_STRUCT( draw_context );
- draw->softpipe = softpipe;
- draw->vf = vf_create( GL_TRUE );
-
- return draw;
-}
-
-
-void draw_destroy( struct draw_context *draw )
-{
- if (draw->header.storage)
- ALIGN_FREE( draw->header.storage );
-
- vf_destroy( draw->vf );
-
- FREE( draw );
-}
#define EMIT_ATTR( ATTR, STYLE ) \
do { \
@@ -695,3 +647,27 @@ void draw_set_vertex_attributes( struct draw_context *draw,
}
+#define MAX_VERTEX_SIZE ((2 + FRAG_ATTRIB_MAX) * 4 * sizeof(GLfloat))
+
+void prim_alloc_tmps( struct prim_stage *stage, GLuint nr )
+{
+ stage->nr_tmps = nr;
+
+ if (nr) {
+ GLubyte *store = MALLOC(MAX_VERTEX_SIZE * nr);
+ GLuint i;
+
+ stage->tmp = MALLOC(sizeof(struct vertex_header *) * nr);
+
+ for (i = 0; i < nr; i++)
+ stage->tmp[i] = (struct vertex_header *)(store + i * MAX_VERTEX_SIZE);
+ }
+}
+
+void prim_free_tmps( struct prim_stage *stage )
+{
+ if (stage->tmp) {
+ FREE(stage->tmp[0]);
+ FREE(stage->tmp);
+ }
+}
diff --git a/src/mesa/pipe/p_state.h b/src/mesa/pipe/p_state.h
index 9b4b336654..581ea5ddd8 100644
--- a/src/mesa/pipe/p_state.h
+++ b/src/mesa/pipe/p_state.h
@@ -48,6 +48,8 @@
#define PIPE_MAX_SAMPLERS 8
#define PIPE_MAX_CLIP_PLANES 6
#define PIPE_MAX_CONSTANT 32
+#define PIPE_ATTRIB_MAX 32
+
/* fwd decl */
diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c
index 6bd1d9f16e..9becab4918 100644
--- a/src/mesa/pipe/softpipe/sp_context.c
+++ b/src/mesa/pipe/softpipe/sp_context.c
@@ -29,14 +29,14 @@
* Keith Whitwell <keith@tungstengraphics.com>
*/
-#include "imports.h"
-#include "macros.h"
-
+#include "main/imports.h"
+#include "main/macros.h"
+#include "pipe/draw/draw_context.h"
#include "sp_context.h"
#include "sp_clear.h"
-#include "sp_prim.h"
#include "sp_state.h"
-#include "sp_draw.h"
+#include "sp_prim_setup.h"
+
static void softpipe_destroy( struct pipe_context *pipe )
{
@@ -44,7 +44,7 @@ static void softpipe_destroy( struct pipe_context *pipe )
draw_destroy( softpipe->draw );
- FREE( softpipe );
+ free( softpipe );
}
@@ -59,6 +59,7 @@ static void softpipe_draw_vb( struct pipe_context *pipe,
draw_vb( softpipe->draw, VB );
}
+
struct pipe_context *softpipe_create( void )
{
struct softpipe_context *softpipe = CALLOC_STRUCT(softpipe_context);
@@ -81,64 +82,17 @@ struct pipe_context *softpipe_create( void )
softpipe->pipe.draw_vb = softpipe_draw_vb;
softpipe->pipe.clear = softpipe_clear;
-
- softpipe->prim.setup = prim_setup( softpipe );
- softpipe->prim.unfilled = prim_unfilled( softpipe );
- softpipe->prim.twoside = prim_twoside( softpipe );
- softpipe->prim.offset = prim_offset( softpipe );
- softpipe->prim.clip = prim_clip( softpipe );
- softpipe->prim.flatshade = prim_flatshade( softpipe );
- softpipe->prim.cull = prim_cull( softpipe );
-
+ softpipe->quad.shade = sp_quad_shade_stage(softpipe);
+ softpipe->quad.alpha_test = sp_quad_alpha_test_stage(softpipe);
softpipe->quad.blend = sp_quad_blend_stage(softpipe);
softpipe->quad.depth_test = sp_quad_depth_test_stage(softpipe);
- softpipe->quad.shade = sp_quad_shade_stage(softpipe);
softpipe->quad.output = sp_quad_output_stage(softpipe);
- softpipe->draw = draw_create( softpipe );
-
- ASSIGN_4V( softpipe->plane[0], -1, 0, 0, 1 );
- ASSIGN_4V( softpipe->plane[1], 1, 0, 0, 1 );
- ASSIGN_4V( softpipe->plane[2], 0, -1, 0, 1 );
- ASSIGN_4V( softpipe->plane[3], 0, 1, 0, 1 );
- ASSIGN_4V( softpipe->plane[4], 0, 0, 1, 1 ); /* yes these are correct */
- ASSIGN_4V( softpipe->plane[5], 0, 0, -1, 1 ); /* mesa's a bit wonky */
- softpipe->nr_planes = 6;
+ /*
+ * Create drawing context and plug our render/setup stage into it.
+ */
+ softpipe->draw = draw_create();
+ draw_set_setup_stage(softpipe->draw, prim_setup(softpipe));
return &softpipe->pipe;
}
-
-
-
-
-
-
-#define MAX_VERTEX_SIZE ((2 + FRAG_ATTRIB_MAX) * 4 * sizeof(GLfloat))
-
-void prim_alloc_tmps( struct prim_stage *stage, GLuint nr )
-{
- stage->nr_tmps = nr;
-
- if (nr) {
- GLubyte *store = MALLOC(MAX_VERTEX_SIZE * nr);
- GLuint i;
-
- stage->tmp = MALLOC(sizeof(struct vertex_header *) * nr);
-
- for (i = 0; i < nr; i++)
- stage->tmp[i] = (struct vertex_header *)(store + i * MAX_VERTEX_SIZE);
- }
-}
-
-void prim_free_tmps( struct prim_stage *stage )
-{
- if (stage->tmp) {
- FREE(stage->tmp[0]);
- FREE(stage->tmp);
- }
-}
-
-
-
-
-
diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h
index 40688208e0..0c082978bd 100644
--- a/src/mesa/pipe/softpipe/sp_context.h
+++ b/src/mesa/pipe/softpipe/sp_context.h
@@ -55,7 +55,6 @@ enum interp_mode {
#define G_NEW_SETUP 0x2
#define G_NEW_FS 0x4
#define G_NEW_BLEND 0x8
-#define G_NEW_POINT 0x10
#define G_NEW_CLIP 0x20
#define G_NEW_SCISSOR 0x40
#define G_NEW_STIPPLE 0x80
@@ -66,12 +65,9 @@ enum interp_mode {
#define G_NEW_TEXTURE 0x1000
-#define PIPE_ATTRIB_MAX 32
-
struct softpipe_context {
struct pipe_context pipe;
-
/* The most recent drawing state as set by the driver:
*/
struct pipe_alpha_test_state alpha_test;
@@ -90,11 +86,6 @@ struct softpipe_context {
struct pipe_viewport_state viewport;
GLuint dirty;
- /* Clip derived state:
- */
- GLfloat plane[12][4];
- GLuint nr_planes;
-
/* Setup derived state. TODO: this should be passed in the program
* tokens as parameters to DECL instructions.
*
@@ -119,24 +110,6 @@ struct softpipe_context {
*/
GLubyte stipple_masks[16][16];
-
- /* The software clipper/setup engine.
- */
- struct {
- struct prim_stage *setup;
- struct prim_stage *unfilled;
- struct prim_stage *twoside;
- struct prim_stage *clip;
- struct prim_stage *flatshade;
- struct prim_stage *offset;
- struct prim_stage *cull;
-
- struct prim_stage *first;
-
- GLenum prim;
- GLuint vertex_size;
- } prim;
-
/*
* Software quad rendering pipeline
*/
diff --git a/src/mesa/pipe/softpipe/sp_headers.h b/src/mesa/pipe/softpipe/sp_headers.h
index 96ff52a453..561597d9e2 100644
--- a/src/mesa/pipe/softpipe/sp_headers.h
+++ b/src/mesa/pipe/softpipe/sp_headers.h
@@ -34,27 +34,6 @@
#define PRIM_LINE 2
#define PRIM_TRI 3
-struct prim_header {
- GLfloat det;
- struct vertex_header *v[3];
-};
-
-/* Carry some useful information around with the vertices in the prim
- * pipe.
- */
-struct vertex_header {
- GLuint clipmask:12;
- GLuint edgeflag:1;
- GLuint pad:19;
-
- GLfloat clip[4];
-
- GLfloat data[][4]; /* Note variable size */
-};
-
-
-
-
/* The rasterizer generates 2x2 quads of fragment and feeds them to
* the current fp_machine (see below).
diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.c b/src/mesa/pipe/softpipe/sp_prim_setup.c
index 3f4602feb0..ea10ef53a0 100644
--- a/src/mesa/pipe/softpipe/sp_prim_setup.c
+++ b/src/mesa/pipe/softpipe/sp_prim_setup.c
@@ -32,8 +32,10 @@
#include "macros.h"
#include "sp_context.h"
-#include "sp_prim.h"
+#include "sp_headers.h"
+#include "pipe/draw/draw_private.h"
#include "sp_quad.h"
+#include "sp_prim_setup.h"
@@ -66,7 +68,10 @@ struct edge {
* Also used for line drawing (taking some liberties).
*/
struct setup_stage {
- struct prim_stage stage; /**< This must be first */
+ struct prim_stage stage; /**< This must be first (base class) */
+
+ /*XXX NEW */
+ struct softpipe_context *softpipe;
/* Vertices are just an array of floats making up each attribute in
* turn. Currently fixed at 4 floats, but should change in time.
@@ -119,7 +124,9 @@ static inline GLint block( GLint x )
static void setup_begin( struct prim_stage *stage )
{
- setup_stage(stage)->quad.nr_attrs = stage->softpipe->nr_frag_attrs;
+ struct setup_stage *setup = setup_stage(stage);
+
+ setup->quad.nr_attrs = setup->softpipe->nr_frag_attrs;
}
@@ -133,7 +140,7 @@ static void run_shader_block( struct setup_stage *setup,
setup->quad.y0 = y;
setup->quad.mask = mask;
- quad_emit(setup->stage.softpipe, &setup->quad);
+ quad_emit(setup->/*stage.*/softpipe, &setup->quad);
}
@@ -387,7 +394,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->stage.softpipe->interp;
+ const enum interp_mode *interp = setup->/*stage.*/softpipe->interp;
GLuint slot, j;
/* z and w are done by linear interpolation:
@@ -462,15 +469,15 @@ static void subtriangle( struct setup_stage *setup,
/* scissor y:
*/
- if (setup->stage.softpipe->setup.scissor) {
+ if (setup->/*stage.*/softpipe->setup.scissor) {
start_y = sy;
finish_y = start_y + lines;
- if (start_y < setup->stage.softpipe->scissor.miny)
- start_y = setup->stage.softpipe->scissor.miny;
+ if (start_y < setup->/*stage.*/softpipe->scissor.miny)
+ start_y = setup->/*stage.*/softpipe->scissor.miny;
- if (finish_y > setup->stage.softpipe->scissor.maxy)
- finish_y = setup->stage.softpipe->scissor.maxy;
+ if (finish_y > setup->/*stage.*/softpipe->scissor.maxy)
+ finish_y = setup->/*stage.*/softpipe->scissor.maxy;
start_y -= sy;
finish_y -= sy;
@@ -495,12 +502,12 @@ static void subtriangle( struct setup_stage *setup,
/* scissor x:
*/
- if (setup->stage.softpipe->setup.scissor) {
- if (left < setup->stage.softpipe->scissor.minx)
- left = setup->stage.softpipe->scissor.minx;
+ if (setup->/*stage.*/softpipe->setup.scissor) {
+ if (left < setup->/*stage.*/softpipe->scissor.minx)
+ left = setup->/*stage.*/softpipe->scissor.minx;
- if (right > setup->stage.softpipe->scissor.maxx)
- right = setup->stage.softpipe->scissor.maxx;
+ if (right > setup->/*stage.*/softpipe->scissor.maxx)
+ right = setup->/*stage.*/softpipe->scissor.maxx;
}
if (left < right) {
@@ -604,7 +611,7 @@ line_persp_coeff(struct setup_stage *setup, GLuint slot, GLuint i)
static INLINE void
setup_line_coefficients(struct setup_stage *setup, struct prim_header *prim)
{
- const enum interp_mode *interp = setup->stage.softpipe->interp;
+ const enum interp_mode *interp = setup->/*stage.*/softpipe->interp;
GLuint slot, j;
/* use setup->vmin, vmax to point to vertices */
@@ -664,7 +671,7 @@ plot(struct setup_stage *setup, GLint x, GLint y)
/* flush prev quad, start new quad */
if (setup->quad.x0 != -1)
- quad_emit(setup->stage.softpipe, &setup->quad);
+ quad_emit(setup->/*stage.*/softpipe, &setup->quad);
setup->quad.x0 = quadX;
setup->quad.y0 = quadY;
@@ -767,7 +774,7 @@ setup_line(struct prim_stage *stage, struct prim_header *prim)
/* draw final quad */
if (setup->quad.mask) {
- quad_emit(setup->stage.softpipe, &setup->quad);
+ quad_emit(setup->/*stage.*/softpipe, &setup->quad);
}
}
@@ -782,8 +789,8 @@ setup_point(struct prim_stage *stage, struct prim_header *prim)
{
struct setup_stage *setup = setup_stage( stage );
/*XXX this should be a vertex attrib! */
- GLfloat halfSize = 0.5 * setup->stage.softpipe->setup.point_size;
- GLboolean round = setup->stage.softpipe->setup.point_smooth;
+ GLfloat halfSize = 0.5 * setup->/*stage.*/softpipe->setup.point_size;
+ GLboolean round = setup->/*stage.*/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];
@@ -822,7 +829,7 @@ setup_point(struct prim_stage *stage, struct prim_header *prim)
setup->quad.x0 = x - ix;
setup->quad.y0 = y - iy;
setup->quad.mask = (1 << ix) << (2 * iy);
- quad_emit(setup->stage.softpipe, &setup->quad);
+ quad_emit(setup->/*stage.*/softpipe, &setup->quad);
}
else {
const GLint ixmin = block((GLint) (x - halfSize));
@@ -882,7 +889,7 @@ setup_point(struct prim_stage *stage, struct prim_header *prim)
if (setup->quad.mask) {
setup->quad.x0 = ix;
setup->quad.y0 = iy;
- quad_emit( setup->stage.softpipe, &setup->quad );
+ quad_emit( setup->/*stage.*/softpipe, &setup->quad );
}
}
}
@@ -900,7 +907,8 @@ struct prim_stage *prim_setup( struct softpipe_context *softpipe )
{
struct setup_stage *setup = CALLOC_STRUCT(setup_stage);
- setup->stage.softpipe = softpipe;
+ setup->softpipe = softpipe;
+ setup->stage.draw = softpipe->draw;
setup->stage.begin = setup_begin;
setup->stage.point = setup_point;
setup->stage.line = setup_line;
diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.h b/src/mesa/pipe/softpipe/sp_prim_setup.h
index 40a70c543e..4d26c05458 100644
--- a/src/mesa/pipe/softpipe/sp_prim_setup.h
+++ b/src/mesa/pipe/softpipe/sp_prim_setup.h
@@ -37,11 +37,16 @@
#include "glheader.h"
#include "imports.h"
+#if 0
#include "s_tri_public.h"
+#endif
#include "s_context.h"
+extern struct prim_stage *prim_setup( struct softpipe_context *softpipe );
+
+#if 0 /* UNUSED? */
struct tri_context;
struct fp_context;
struct be_context;
@@ -119,3 +124,4 @@ void tri_rasterize_spans( struct tri_context *tri );
#endif
#endif
+#endif
diff --git a/src/mesa/pipe/softpipe/sp_state_blend.c b/src/mesa/pipe/softpipe/sp_state_blend.c
index 6ca42e8a01..e0ff549d70 100644
--- a/src/mesa/pipe/softpipe/sp_state_blend.c
+++ b/src/mesa/pipe/softpipe/sp_state_blend.c
@@ -31,8 +31,6 @@
#include "sp_context.h"
#include "sp_state.h"
-#include "sp_draw.h"
-
void softpipe_set_blend_state( struct pipe_context *pipe,
diff --git a/src/mesa/pipe/softpipe/sp_state_clip.c b/src/mesa/pipe/softpipe/sp_state_clip.c
index c907550019..3b69d3e7a7 100644
--- a/src/mesa/pipe/softpipe/sp_state_clip.c
+++ b/src/mesa/pipe/softpipe/sp_state_clip.c
@@ -31,8 +31,7 @@
#include "sp_context.h"
#include "sp_state.h"
-#include "sp_draw.h"
-
+#include "pipe/draw/draw_context.h"
void softpipe_set_clip_state( struct pipe_context *pipe,
@@ -40,10 +39,8 @@ void softpipe_set_clip_state( struct pipe_context *pipe,
{
struct softpipe_context *softpipe = softpipe_context(pipe);
- memcpy(&softpipe->plane[6], clip->ucp, clip->nr * sizeof(clip->ucp[0]));
-
- softpipe->nr_planes = 6 + clip->nr;
- softpipe->dirty |= G_NEW_CLIP;
+ /* pass the clip state to the draw module */
+ draw_set_clip_state(softpipe->draw, clip);
}
@@ -57,13 +54,32 @@ void softpipe_set_viewport_state( struct pipe_context *pipe,
struct softpipe_context *softpipe = softpipe_context(pipe);
softpipe->viewport = *viewport; /* struct copy */
+ softpipe->dirty |= G_NEW_VIEWPORT;
+
+ /* pass the viewport info to the draw module */
+ draw_set_viewport_state(softpipe->draw, viewport);
/* Using tnl/ and vf/ modules is temporary while getting started.
* Full pipe will have vertex shader, vertex fetch of its own.
*/
- draw_set_viewport( softpipe->draw, viewport->scale, viewport->translate );
- softpipe->dirty |= G_NEW_VIEWPORT;
}
+void softpipe_set_scissor_state( struct pipe_context *pipe,
+ const struct pipe_scissor_state *scissor )
+{
+ struct softpipe_context *softpipe = softpipe_context(pipe);
+
+ memcpy( &softpipe->scissor, scissor, sizeof(*scissor) );
+ softpipe->dirty |= G_NEW_SCISSOR;
+}
+
+
+void softpipe_set_polygon_stipple( struct pipe_context *pipe,
+ const struct pipe_poly_stipple *stipple )
+{
+ struct softpipe_context *softpipe = softpipe_context(pipe);
+ memcpy( &softpipe->poly_stipple, stipple, sizeof(*stipple) );
+ softpipe->dirty |= G_NEW_STIPPLE;
+}
diff --git a/src/mesa/pipe/softpipe/sp_state_derived.c b/src/mesa/pipe/softpipe/sp_state_derived.c
index 5aee4be6b8..4454dd9ba9 100644
--- a/src/mesa/pipe/softpipe/sp_state_derived.c
+++ b/src/mesa/pipe/softpipe/sp_state_derived.c
@@ -25,17 +25,17 @@
*
**************************************************************************/
-#include "glheader.h"
-#include "macros.h"
-#include "enums.h"
-#include "program.h"
+#include "main/glheader.h"
+#include "main/macros.h"
+#include "main/enums.h"
+#include "shader/program.h"
#include "vf/vf.h"
-
+#include "pipe/draw/draw_context.h"
#include "sp_context.h"
-#include "sp_draw.h"
#include "sp_state.h"
+
#define EMIT_ATTR( ATTR, FRAG_ATTR, INTERP ) \
do { \
slot_to_vf_attr[softpipe->nr_attrs] = ATTR; \
@@ -77,8 +77,8 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe )
softpipe->nr_attrs = 0;
memset(slot_to_vf_attr, 0, sizeof(slot_to_vf_attr));
- memset(softpipe->fp_attr_to_slot, 0, sizeof(softpipe->vf_attr_to_slot));
- memset(softpipe->vf_attr_to_slot, 0, sizeof(softpipe->fp_attr_to_slot));
+ memset(softpipe->fp_attr_to_slot, 0, sizeof(softpipe->fp_attr_to_slot));
+ memset(softpipe->vf_attr_to_slot, 0, sizeof(softpipe->vf_attr_to_slot));
/* TODO - Figure out if we need to do perspective divide, etc.
*/
diff --git a/src/mesa/pipe/softpipe/sp_state_sampler.c b/src/mesa/pipe/softpipe/sp_state_sampler.c
index 060e2c8c98..62ff5c50b8 100644
--- a/src/mesa/pipe/softpipe/sp_state_sampler.c
+++ b/src/mesa/pipe/softpipe/sp_state_sampler.c
@@ -28,11 +28,11 @@
/* Authors:
* Brian Paul
*/
+
#include "imports.h"
#include "sp_context.h"
#include "sp_state.h"
-#include "sp_draw.h"
diff --git a/src/mesa/pipe/softpipe/sp_state_setup.c b/src/mesa/pipe/softpipe/sp_state_setup.c
index 55803aeac5..2dea49c86d 100644
--- a/src/mesa/pipe/softpipe/sp_state_setup.c
+++ b/src/mesa/pipe/softpipe/sp_state_setup.c
@@ -28,11 +28,10 @@
#include "pipe/p_defines.h"
#include "sp_context.h"
#include "sp_state.h"
-#include "sp_prim.h"
-
-
+#include "pipe/draw/draw_context.h"
+#if 0
static void validate_prim_pipe( struct softpipe_context *softpipe )
{
struct prim_stage *next = softpipe->prim.setup;
@@ -87,6 +86,7 @@ static void validate_prim_pipe( struct softpipe_context *softpipe )
softpipe->prim.first = next;
}
+#endif
@@ -95,29 +95,15 @@ void softpipe_set_setup_state( struct pipe_context *pipe,
{
struct softpipe_context *softpipe = softpipe_context(pipe);
+ /* pass-through to draw module */
+ draw_set_setup_state(softpipe->draw, setup);
+
memcpy( &softpipe->setup, setup, sizeof(*setup) );
+#if 0
validate_prim_pipe( softpipe );
+#endif
softpipe->dirty |= G_NEW_SETUP;
}
-
-void softpipe_set_scissor_state( struct pipe_context *pipe,
- const struct pipe_scissor_state *scissor )
-{
- struct softpipe_context *softpipe = softpipe_context(pipe);
-
- memcpy( &softpipe->scissor, scissor, sizeof(*scissor) );
- softpipe->dirty |= G_NEW_SCISSOR;
-}
-
-
-void softpipe_set_polygon_stipple( struct pipe_context *pipe,
- const struct pipe_poly_stipple *stipple )
-{
- struct softpipe_context *softpipe = softpipe_context(pipe);
-
- memcpy( &softpipe->poly_stipple, stipple, sizeof(*stipple) );
- softpipe->dirty |= G_NEW_STIPPLE;
-}