summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/pipe')
-rw-r--r--src/mesa/pipe/draw/draw_context.c16
-rw-r--r--src/mesa/pipe/draw/draw_context.h2
-rw-r--r--src/mesa/pipe/draw/draw_cull.c2
-rw-r--r--src/mesa/pipe/draw/draw_offset.c4
-rw-r--r--src/mesa/pipe/draw/draw_private.h2
-rw-r--r--src/mesa/pipe/draw/draw_twoside.c2
-rw-r--r--src/mesa/pipe/draw/draw_unfilled.c4
-rw-r--r--src/mesa/pipe/failover/fo_context.h8
-rw-r--r--src/mesa/pipe/failover/fo_state.c14
-rw-r--r--src/mesa/pipe/failover/fo_state_emit.c4
-rw-r--r--src/mesa/pipe/i915simple/i915_context.h4
-rw-r--r--src/mesa/pipe/i915simple/i915_state.c30
-rw-r--r--src/mesa/pipe/i915simple/i915_state_derived.c6
-rw-r--r--src/mesa/pipe/i915simple/i915_state_dynamic.c16
-rw-r--r--src/mesa/pipe/i915simple/i915_state_immediate.c30
-rw-r--r--src/mesa/pipe/p_context.h11
-rw-r--r--src/mesa/pipe/p_state.h4
-rw-r--r--src/mesa/pipe/softpipe/sp_context.c4
-rw-r--r--src/mesa/pipe/softpipe/sp_context.h4
-rw-r--r--src/mesa/pipe/softpipe/sp_prim_setup.c18
-rw-r--r--src/mesa/pipe/softpipe/sp_quad.c8
-rw-r--r--src/mesa/pipe/softpipe/sp_quad_coverage.c6
-rw-r--r--src/mesa/pipe/softpipe/sp_state.h12
-rw-r--r--src/mesa/pipe/softpipe/sp_state_derived.c10
-rw-r--r--src/mesa/pipe/softpipe/sp_state_setup.c26
25 files changed, 148 insertions, 99 deletions
diff --git a/src/mesa/pipe/draw/draw_context.c b/src/mesa/pipe/draw/draw_context.c
index 4498293e92b..f3236ad59e1 100644
--- a/src/mesa/pipe/draw/draw_context.c
+++ b/src/mesa/pipe/draw/draw_context.c
@@ -98,19 +98,19 @@ static void validate_pipeline( struct draw_context *draw )
* shorter pipelines for lines & points.
*/
- if (draw->setup.fill_cw != PIPE_POLYGON_MODE_FILL ||
- draw->setup.fill_ccw != PIPE_POLYGON_MODE_FILL) {
+ if (draw->rasterizer->fill_cw != PIPE_POLYGON_MODE_FILL ||
+ draw->rasterizer->fill_ccw != PIPE_POLYGON_MODE_FILL) {
draw->pipeline.unfilled->next = next;
next = draw->pipeline.unfilled;
}
- if (draw->setup.offset_cw ||
- draw->setup.offset_ccw) {
+ if (draw->rasterizer->offset_cw ||
+ draw->rasterizer->offset_ccw) {
draw->pipeline.offset->next = next;
next = draw->pipeline.offset;
}
- if (draw->setup.light_twoside) {
+ if (draw->rasterizer->light_twoside) {
draw->pipeline.twoside->next = next;
next = draw->pipeline.twoside;
}
@@ -134,7 +134,7 @@ static void validate_pipeline( struct draw_context *draw )
* this for clipped primitives, ie it is a part of the clip
* routine.
*/
- if (draw->setup.flatshade) {
+ if (draw->rasterizer->flatshade) {
draw->pipeline.flatshade->next = next;
next = draw->pipeline.flatshade;
}
@@ -161,9 +161,9 @@ void draw_set_feedback_state( struct draw_context *draw,
* This causes the drawing pipeline to be rebuilt.
*/
void draw_set_setup_state( struct draw_context *draw,
- const struct pipe_setup_state *setup )
+ const struct pipe_rasterizer_state *raster )
{
- draw->setup = *setup; /* struct copy */
+ draw->rasterizer = raster;
validate_pipeline( draw );
}
diff --git a/src/mesa/pipe/draw/draw_context.h b/src/mesa/pipe/draw/draw_context.h
index 2babc02f45f..2714252fc5d 100644
--- a/src/mesa/pipe/draw/draw_context.h
+++ b/src/mesa/pipe/draw/draw_context.h
@@ -87,7 +87,7 @@ void draw_set_feedback_state( struct draw_context *draw,
const struct pipe_feedback_state * );
void draw_set_setup_state( struct draw_context *draw,
- const struct pipe_setup_state *setup );
+ const struct pipe_rasterizer_state *raster );
void draw_set_setup_stage( struct draw_context *draw,
struct draw_stage *stage );
diff --git a/src/mesa/pipe/draw/draw_cull.c b/src/mesa/pipe/draw/draw_cull.c
index f3d56ad7197..f898834ba5d 100644
--- a/src/mesa/pipe/draw/draw_cull.c
+++ b/src/mesa/pipe/draw/draw_cull.c
@@ -54,7 +54,7 @@ static void cull_begin( struct draw_stage *stage )
{
struct cull_stage *cull = cull_stage(stage);
- cull->winding = stage->draw->setup.cull_mode;
+ cull->winding = stage->draw->rasterizer->cull_mode;
stage->next->begin( stage->next );
}
diff --git a/src/mesa/pipe/draw/draw_offset.c b/src/mesa/pipe/draw/draw_offset.c
index 4f653e8c542..6acc7cbcd29 100644
--- a/src/mesa/pipe/draw/draw_offset.c
+++ b/src/mesa/pipe/draw/draw_offset.c
@@ -57,8 +57,8 @@ static void offset_begin( struct draw_stage *stage )
struct offset_stage *offset = offset_stage(stage);
float mrd = 1.0f / 65535.0f; /* XXX this depends on depthbuffer bits! */
- offset->units = stage->draw->setup.offset_units * mrd;
- offset->scale = stage->draw->setup.offset_scale;
+ offset->units = stage->draw->rasterizer->offset_units * mrd;
+ offset->scale = stage->draw->rasterizer->offset_scale;
stage->next->begin( stage->next );
}
diff --git a/src/mesa/pipe/draw/draw_private.h b/src/mesa/pipe/draw/draw_private.h
index 8bcc3717c45..fb0aaff40d7 100644
--- a/src/mesa/pipe/draw/draw_private.h
+++ b/src/mesa/pipe/draw/draw_private.h
@@ -137,7 +137,7 @@ struct draw_context
} pipeline;
/* pipe state that we need: */
- struct pipe_setup_state setup;
+ const struct pipe_rasterizer_state *rasterizer;
struct pipe_feedback_state feedback;
struct pipe_viewport_state viewport;
struct pipe_vertex_buffer vertex_buffer[PIPE_ATTRIB_MAX];
diff --git a/src/mesa/pipe/draw/draw_twoside.c b/src/mesa/pipe/draw/draw_twoside.c
index 98eb088035a..3eb8cce6376 100644
--- a/src/mesa/pipe/draw/draw_twoside.c
+++ b/src/mesa/pipe/draw/draw_twoside.c
@@ -55,7 +55,7 @@ static void twoside_begin( struct draw_stage *stage )
* if the triangle is back-facing (negative).
* sign = -1 for CCW, +1 for CW
*/
- twoside->sign = (stage->draw->setup.front_winding == PIPE_WINDING_CCW) ? -1.0f : 1.0f;
+ twoside->sign = (stage->draw->rasterizer->front_winding == PIPE_WINDING_CCW) ? -1.0f : 1.0f;
stage->next->begin( stage->next );
}
diff --git a/src/mesa/pipe/draw/draw_unfilled.c b/src/mesa/pipe/draw/draw_unfilled.c
index b0d6f3d0655..2d374329d83 100644
--- a/src/mesa/pipe/draw/draw_unfilled.c
+++ b/src/mesa/pipe/draw/draw_unfilled.c
@@ -59,8 +59,8 @@ static void unfilled_begin( struct draw_stage *stage )
{
struct unfilled_stage *unfilled = unfilled_stage(stage);
- unfilled->mode[0] = stage->draw->setup.fill_ccw; /* front */
- unfilled->mode[1] = stage->draw->setup.fill_cw; /* back */
+ unfilled->mode[0] = stage->draw->rasterizer->fill_ccw; /* front */
+ unfilled->mode[1] = stage->draw->rasterizer->fill_cw; /* back */
stage->next->begin( stage->next );
}
diff --git a/src/mesa/pipe/failover/fo_context.h b/src/mesa/pipe/failover/fo_context.h
index 63ec7239abf..b05ceb88adf 100644
--- a/src/mesa/pipe/failover/fo_context.h
+++ b/src/mesa/pipe/failover/fo_context.h
@@ -37,7 +37,7 @@
#define FO_NEW_VIEWPORT 0x1
-#define FO_NEW_SETUP 0x2
+#define FO_NEW_RASTERIZER 0x2
#define FO_NEW_FRAGMENT_SHADER 0x4
#define FO_NEW_BLEND 0x8
#define FO_NEW_CLIP 0x10
@@ -66,9 +66,10 @@ struct failover_context {
/* The most recent drawing state as set by the driver:
*/
- const struct pipe_blend_state *blend;
- const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS];
+ const struct pipe_blend_state *blend;
+ const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS];
const struct pipe_depth_stencil_state *depth_stencil;
+ const struct pipe_rasterizer_state *rasterizer;
struct pipe_alpha_test_state alpha_test;
struct pipe_blend_color blend_color;
@@ -79,7 +80,6 @@ struct failover_context {
struct pipe_shader_state vertex_shader;
struct pipe_poly_stipple poly_stipple;
struct pipe_scissor_state scissor;
- struct pipe_setup_state setup;
struct pipe_mipmap_tree *texture[PIPE_MAX_SAMPLERS];
struct pipe_viewport_state viewport;
struct pipe_vertex_buffer vertex_buffer[PIPE_ATTRIB_MAX];
diff --git a/src/mesa/pipe/failover/fo_state.c b/src/mesa/pipe/failover/fo_state.c
index 43b9757b319..8e2b649590f 100644
--- a/src/mesa/pipe/failover/fo_state.c
+++ b/src/mesa/pipe/failover/fo_state.c
@@ -160,15 +160,15 @@ failover_set_polygon_stipple( struct pipe_context *pipe,
-static void
-failover_set_setup_state( struct pipe_context *pipe,
- const struct pipe_setup_state *setup )
+static void
+failover_bind_rasterizer_state( struct pipe_context *pipe,
+ const struct pipe_rasterizer_state *setup )
{
struct failover_context *failover = failover_context(pipe);
- failover->setup = *setup;
- failover->dirty |= FO_NEW_SETUP;
- failover->hw->set_setup_state( failover->hw, setup );
+ failover->rasterizer = setup;
+ failover->dirty |= FO_NEW_RASTERIZER;
+ failover->hw->bind_rasterizer_state( failover->hw, setup );
}
@@ -257,6 +257,7 @@ failover_init_state_functions( struct failover_context *failover )
failover->pipe.bind_blend_state = failover_bind_blend_state;
failover->pipe.bind_sampler_state = failover_bind_sampler_state;
failover->pipe.bind_depth_stencil_state = failover_bind_depth_stencil_state;
+ failover->pipe.bind_rasterizer_state = failover_bind_rasterizer_state;
failover->pipe.set_alpha_test_state = failover_set_alpha_test_state;
failover->pipe.set_blend_color = failover_set_blend_color;
@@ -267,7 +268,6 @@ failover_init_state_functions( struct failover_context *failover )
failover->pipe.set_vs_state = failover_set_vs_state;
failover->pipe.set_polygon_stipple = failover_set_polygon_stipple;
failover->pipe.set_scissor_state = failover_set_scissor_state;
- failover->pipe.set_setup_state = failover_set_setup_state;
failover->pipe.set_texture_state = failover_set_texture_state;
failover->pipe.set_viewport_state = failover_set_viewport_state;
failover->pipe.set_vertex_buffer = failover_set_vertex_buffer;
diff --git a/src/mesa/pipe/failover/fo_state_emit.c b/src/mesa/pipe/failover/fo_state_emit.c
index 3a1865d7668..1c9573a7b00 100644
--- a/src/mesa/pipe/failover/fo_state_emit.c
+++ b/src/mesa/pipe/failover/fo_state_emit.c
@@ -85,8 +85,8 @@ failover_state_emit( struct failover_context *failover )
if (failover->dirty & FO_NEW_STIPPLE)
failover->sw->set_polygon_stipple( failover->sw, &failover->poly_stipple );
- if (failover->dirty & FO_NEW_SETUP)
- failover->sw->set_setup_state( failover->sw, &failover->setup );
+ if (failover->dirty & FO_NEW_RASTERIZER)
+ failover->sw->bind_rasterizer_state( failover->sw, failover->rasterizer );
if (failover->dirty & FO_NEW_SCISSOR)
failover->sw->set_scissor_state( failover->sw, &failover->scissor );
diff --git a/src/mesa/pipe/i915simple/i915_context.h b/src/mesa/pipe/i915simple/i915_context.h
index 518f780449b..3fab821fde6 100644
--- a/src/mesa/pipe/i915simple/i915_context.h
+++ b/src/mesa/pipe/i915simple/i915_context.h
@@ -126,6 +126,7 @@ struct i915_context
const struct pipe_blend_state *blend;
const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS];
const struct pipe_depth_stencil_state *depth_stencil;
+ const struct pipe_rasterizer_state *rasterizer;
struct pipe_alpha_test_state alpha_test;
struct pipe_blend_color blend_color;
@@ -136,7 +137,6 @@ struct i915_context
struct pipe_shader_state fs;
struct pipe_poly_stipple poly_stipple;
struct pipe_scissor_state scissor;
- struct pipe_setup_state setup;
struct pipe_mipmap_tree *texture[PIPE_MAX_SAMPLERS];
struct pipe_viewport_state viewport;
struct pipe_vertex_buffer vertex_buffer[PIPE_ATTRIB_MAX];
@@ -159,7 +159,7 @@ struct i915_context
/* A flag for each state_tracker state object:
*/
#define I915_NEW_VIEWPORT 0x1
-#define I915_NEW_SETUP 0x2
+#define I915_NEW_RASTERIZER 0x2
#define I915_NEW_FS 0x4
#define I915_NEW_BLEND 0x8
#define I915_NEW_CLIP 0x10
diff --git a/src/mesa/pipe/i915simple/i915_state.c b/src/mesa/pipe/i915simple/i915_state.c
index 5ac2e27d1a6..00764902bc3 100644
--- a/src/mesa/pipe/i915simple/i915_state.c
+++ b/src/mesa/pipe/i915simple/i915_state.c
@@ -288,19 +288,36 @@ static void i915_set_viewport_state( struct pipe_context *pipe,
}
-static void i915_set_setup_state( struct pipe_context *pipe,
- const struct pipe_setup_state *setup )
+
+static const struct pipe_rasterizer_state *
+i915_create_rasterizer_state(struct pipe_context *pipe,
+ const struct pipe_rasterizer_state *setup)
+{
+ struct pipe_rasterizer_state *raster =
+ malloc(sizeof(struct pipe_rasterizer_state));
+ memcpy(raster, setup, sizeof(struct pipe_rasterizer_state));
+
+ return raster;
+}
+
+static void i915_bind_rasterizer_state( struct pipe_context *pipe,
+ const struct pipe_rasterizer_state *setup )
{
struct i915_context *i915 = i915_context(pipe);
- i915->setup = *setup;
+ i915->rasterizer = setup;
/* pass-through to draw module */
draw_set_setup_state(i915->draw, setup);
- i915->dirty |= I915_NEW_SETUP;
+ i915->dirty |= I915_NEW_RASTERIZER;
}
+static void i915_delete_rasterizer_state( struct pipe_context *pipe,
+ const struct pipe_rasterizer_state *setup )
+{
+ free((struct pipe_rasterizer_state*)setup);
+}
static void i915_set_vertex_buffer( struct pipe_context *pipe,
unsigned index,
@@ -338,6 +355,10 @@ i915_init_state_functions( struct i915_context *i915 )
i915->pipe.bind_depth_stencil_state = i915_bind_depth_stencil_state;
i915->pipe.delete_depth_stencil_state = i915_delete_depth_stencil_state;
+ i915->pipe.create_rasterizer_state = i915_create_rasterizer_state;
+ i915->pipe.bind_rasterizer_state = i915_bind_rasterizer_state;
+ i915->pipe.delete_rasterizer_state = i915_delete_rasterizer_state;
+
i915->pipe.set_alpha_test_state = i915_set_alpha_test_state;
i915->pipe.set_blend_color = i915_set_blend_color;
i915->pipe.set_clip_state = i915_set_clip_state;
@@ -348,7 +369,6 @@ i915_init_state_functions( struct i915_context *i915 )
i915->pipe.set_vs_state = i915_set_vs_state;
i915->pipe.set_polygon_stipple = i915_set_polygon_stipple;
i915->pipe.set_scissor_state = i915_set_scissor_state;
- i915->pipe.set_setup_state = i915_set_setup_state;
i915->pipe.set_texture_state = i915_set_texture_state;
i915->pipe.set_viewport_state = i915_set_viewport_state;
i915->pipe.set_vertex_buffer = i915_set_vertex_buffer;
diff --git a/src/mesa/pipe/i915simple/i915_state_derived.c b/src/mesa/pipe/i915simple/i915_state_derived.c
index 792bb93b170..504bc10a9e4 100644
--- a/src/mesa/pipe/i915simple/i915_state_derived.c
+++ b/src/mesa/pipe/i915simple/i915_state_derived.c
@@ -44,7 +44,7 @@ static void calculate_vertex_layout( struct i915_context *i915 )
{
const uint inputsRead = i915->fs.inputs_read;
const interp_mode colorInterp
- = i915->setup.flatshade ? INTERP_CONSTANT : INTERP_LINEAR;
+ = i915->rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR;
struct vertex_info *vinfo = &i915->current.vertex_info;
uint front0 = 0, back0 = 0, front1 = 0, back1 = 0;
boolean needW = 0;
@@ -103,7 +103,7 @@ static void calculate_vertex_layout( struct i915_context *i915 )
* lighting. Edgeflag is dealt with specially by setting bits in
* the vertex header.
*/
- if (i915->setup.light_twoside) {
+ if (i915->rasterizer->light_twoside) {
if (inputsRead & (1 << TGSI_ATTRIB_COLOR0)) {
back0 = draw_emit_vertex_attr(vinfo, TGSI_ATTRIB_BFC0,
FORMAT_OMIT, colorInterp);
@@ -142,7 +142,7 @@ static void calculate_vertex_layout( struct i915_context *i915 )
*/
void i915_update_derived( struct i915_context *i915 )
{
- if (i915->dirty & (I915_NEW_SETUP | I915_NEW_FS))
+ if (i915->dirty & (I915_NEW_RASTERIZER | I915_NEW_FS))
calculate_vertex_layout( i915 );
if (i915->dirty & (I915_NEW_SAMPLER | I915_NEW_TEXTURE))
diff --git a/src/mesa/pipe/i915simple/i915_state_dynamic.c b/src/mesa/pipe/i915simple/i915_state_dynamic.c
index 9140eee7c29..a9791962e2d 100644
--- a/src/mesa/pipe/i915simple/i915_state_dynamic.c
+++ b/src/mesa/pipe/i915simple/i915_state_dynamic.c
@@ -261,10 +261,10 @@ static void upload_DEPTHSCALE( struct i915_context *i915 )
memset( ds, 0, sizeof(ds) );
- /* I915_NEW_SETUP
+ /* I915_NEW_RASTERIZER
*/
ds[0].u = _3DSTATE_DEPTH_OFFSET_SCALE;
- ds[1].f = i915->setup.offset_scale;
+ ds[1].f = i915->rasterizer->offset_scale;
set_dynamic_indirect( i915,
I915_DYNAMIC_DEPTHSCALE_0,
@@ -273,7 +273,7 @@ static void upload_DEPTHSCALE( struct i915_context *i915 )
}
const struct i915_tracked_state i915_upload_DEPTHSCALE = {
- .dirty = I915_NEW_SETUP,
+ .dirty = I915_NEW_RASTERIZER,
.update = upload_DEPTHSCALE
};
@@ -298,9 +298,9 @@ static void upload_STIPPLE( struct i915_context *i915 )
st[0] = _3DSTATE_STIPPLE;
st[1] = 0;
- /* I915_NEW_SETUP
+ /* I915_NEW_RASTERIZER
*/
- if (i915->setup.poly_stipple_enable) {
+ if (i915->rasterizer->poly_stipple_enable) {
st[1] |= ST1_ENABLE;
}
@@ -333,7 +333,7 @@ static void upload_STIPPLE( struct i915_context *i915 )
const struct i915_tracked_state i915_upload_STIPPLE = {
- .dirty = I915_NEW_SETUP | I915_NEW_STIPPLE,
+ .dirty = I915_NEW_RASTERIZER | I915_NEW_STIPPLE,
.update = upload_STIPPLE
};
@@ -346,7 +346,7 @@ static void upload_SCISSOR_ENABLE( struct i915_context *i915 )
{
unsigned sc[1];
- if (i915->setup.scissor)
+ if (i915->rasterizer->scissor)
sc[0] = _3DSTATE_SCISSOR_ENABLE_CMD | ENABLE_SCISSOR_RECT;
else
sc[0] = _3DSTATE_SCISSOR_ENABLE_CMD | DISABLE_SCISSOR_RECT;
@@ -358,7 +358,7 @@ static void upload_SCISSOR_ENABLE( struct i915_context *i915 )
}
const struct i915_tracked_state i915_upload_SCISSOR_ENABLE = {
- .dirty = I915_NEW_SETUP,
+ .dirty = I915_NEW_RASTERIZER,
.update = upload_SCISSOR_ENABLE
};
diff --git a/src/mesa/pipe/i915simple/i915_state_immediate.c b/src/mesa/pipe/i915simple/i915_state_immediate.c
index 484913d308c..73508f557fa 100644
--- a/src/mesa/pipe/i915simple/i915_state_immediate.c
+++ b/src/mesa/pipe/i915simple/i915_state_immediate.c
@@ -62,8 +62,8 @@ static void upload_S2S4(struct i915_context *i915)
assert(LIS4); /* should never be zero? */
}
- /* I915_NEW_SETUP */
- switch (i915->setup.cull_mode) {
+ /* I915_NEW_RASTERIZER */
+ switch (i915->rasterizer->cull_mode) {
case PIPE_WINDING_NONE:
LIS4 |= S4_CULLMODE_NONE;
break;
@@ -78,25 +78,25 @@ static void upload_S2S4(struct i915_context *i915)
break;
}
- /* I915_NEW_SETUP */
+ /* I915_NEW_RASTERIZER */
{
- int line_width = CLAMP((int)(i915->setup.line_width * 2), 1, 0xf);
+ int line_width = CLAMP((int)(i915->rasterizer->line_width * 2), 1, 0xf);
LIS4 |= line_width << S4_LINE_WIDTH_SHIFT;
- if (i915->setup.line_smooth)
+ if (i915->rasterizer->line_smooth)
LIS4 |= S4_LINE_ANTIALIAS_ENABLE;
}
- /* I915_NEW_SETUP */
+ /* I915_NEW_RASTERIZER */
{
- int point_size = CLAMP((int) i915->setup.point_size, 1, 0xff);
+ int point_size = CLAMP((int) i915->rasterizer->point_size, 1, 0xff);
LIS4 |= point_size << S4_POINT_WIDTH_SHIFT;
}
- /* I915_NEW_SETUP */
- if (i915->setup.flatshade) {
+ /* I915_NEW_RASTERIZER */
+ if (i915->rasterizer->flatshade) {
LIS4 |= (S4_FLATSHADE_ALPHA |
S4_FLATSHADE_COLOR |
S4_FLATSHADE_SPECULAR);
@@ -114,7 +114,7 @@ static void upload_S2S4(struct i915_context *i915)
const struct i915_tracked_state i915_upload_S2S4 = {
- .dirty = I915_NEW_SETUP | I915_NEW_VERTEX_FORMAT,
+ .dirty = I915_NEW_RASTERIZER | I915_NEW_VERTEX_FORMAT,
.update = upload_S2S4
};
@@ -165,7 +165,7 @@ static void upload_S5( struct i915_context *i915 )
#if 0
- /* I915_NEW_SETUP */
+ /* I915_NEW_RASTERIZER */
if (i915->state.Polygon->OffsetFill) {
LIS5 |= S5_GLOBAL_DEPTH_OFFSET_ENABLE;
}
@@ -179,7 +179,7 @@ static void upload_S5( struct i915_context *i915 )
}
const struct i915_tracked_state i915_upload_S5 = {
- .dirty = (I915_NEW_DEPTH_STENCIL | I915_NEW_BLEND | I915_NEW_SETUP),
+ .dirty = (I915_NEW_DEPTH_STENCIL | I915_NEW_BLEND | I915_NEW_RASTERIZER),
.update = upload_S5
};
@@ -247,9 +247,9 @@ static void upload_S7( struct i915_context *i915 )
{
float LIS7;
- /* I915_NEW_SETUP
+ /* I915_NEW_RASTERIZER
*/
- LIS7 = i915->setup.offset_units; /* probably incorrect */
+ LIS7 = i915->rasterizer->offset_units; /* probably incorrect */
if (LIS7 != i915->current.immediate[I915_IMMEDIATE_S7]) {
i915->current.immediate[I915_IMMEDIATE_S7] = LIS7;
@@ -258,7 +258,7 @@ static void upload_S7( struct i915_context *i915 )
}
const struct i915_tracked_state i915_upload_S7 = {
- .dirty = I915_NEW_SETUP,
+ .dirty = I915_NEW_RASTERIZER,
.update = upload_S7
};
diff --git a/src/mesa/pipe/p_context.h b/src/mesa/pipe/p_context.h
index 488f0025311..dda758fe6ad 100644
--- a/src/mesa/pipe/p_context.h
+++ b/src/mesa/pipe/p_context.h
@@ -101,6 +101,14 @@ struct pipe_context {
void (*delete_sampler_state)(struct pipe_context *,
const struct pipe_sampler_state *);
+ const struct pipe_rasterizer_state *(*create_rasterizer_state)(
+ struct pipe_context *,
+ const struct pipe_rasterizer_state *);
+ void (*bind_rasterizer_state)(struct pipe_context *,
+ const struct pipe_rasterizer_state *);
+ void (*delete_rasterizer_state)(struct pipe_context *,
+ const struct pipe_rasterizer_state *);
+
const struct pipe_depth_stencil_state * (*create_depth_stencil_state)(
struct pipe_context *,
const struct pipe_depth_stencil_state *);
@@ -140,9 +148,6 @@ struct pipe_context {
void (*set_polygon_stipple)( struct pipe_context *,
const struct pipe_poly_stipple * );
- void (*set_setup_state)( struct pipe_context *,
- const struct pipe_setup_state * );
-
void (*set_scissor_state)( struct pipe_context *,
const struct pipe_scissor_state * );
diff --git a/src/mesa/pipe/p_state.h b/src/mesa/pipe/p_state.h
index 30e559b5948..048feede3ba 100644
--- a/src/mesa/pipe/p_state.h
+++ b/src/mesa/pipe/p_state.h
@@ -65,9 +65,9 @@ struct pipe_buffer_handle;
/**
- * Primitive (point/line/tri) setup info
+ * Primitive (point/line/tri) rasterization info
*/
-struct pipe_setup_state
+struct pipe_rasterizer_state
{
unsigned flatshade:1;
unsigned light_twoside:1;
diff --git a/src/mesa/pipe/softpipe/sp_context.c b/src/mesa/pipe/softpipe/sp_context.c
index 9a8b55bb0e3..7753ce40d75 100644
--- a/src/mesa/pipe/softpipe/sp_context.c
+++ b/src/mesa/pipe/softpipe/sp_context.c
@@ -259,6 +259,9 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys,
softpipe->pipe.create_depth_stencil_state = softpipe_create_depth_stencil_state;
softpipe->pipe.bind_depth_stencil_state = softpipe_bind_depth_stencil_state;
softpipe->pipe.delete_depth_stencil_state = softpipe_delete_depth_stencil_state;
+ softpipe->pipe.create_rasterizer_state = softpipe_create_rasterizer_state;
+ softpipe->pipe.bind_rasterizer_state = softpipe_bind_rasterizer_state;
+ softpipe->pipe.delete_rasterizer_state = softpipe_delete_rasterizer_state;
softpipe->pipe.set_alpha_test_state = softpipe_set_alpha_test_state;
softpipe->pipe.set_blend_color = softpipe_set_blend_color;
@@ -271,7 +274,6 @@ struct pipe_context *softpipe_create( struct pipe_winsys *pipe_winsys,
softpipe->pipe.set_vs_state = softpipe_set_vs_state;
softpipe->pipe.set_polygon_stipple = softpipe_set_polygon_stipple;
softpipe->pipe.set_scissor_state = softpipe_set_scissor_state;
- softpipe->pipe.set_setup_state = softpipe_set_setup_state;
softpipe->pipe.set_texture_state = softpipe_set_texture_state;
softpipe->pipe.set_viewport_state = softpipe_set_viewport_state;
diff --git a/src/mesa/pipe/softpipe/sp_context.h b/src/mesa/pipe/softpipe/sp_context.h
index 4cbb0f891ed..f1bb3d39a66 100644
--- a/src/mesa/pipe/softpipe/sp_context.h
+++ b/src/mesa/pipe/softpipe/sp_context.h
@@ -47,7 +47,7 @@ struct draw_stage;
#define SP_NEW_VIEWPORT 0x1
-#define SP_NEW_SETUP 0x2
+#define SP_NEW_RASTERIZER 0x2
#define SP_NEW_FS 0x4
#define SP_NEW_BLEND 0x8
#define SP_NEW_CLIP 0x10
@@ -73,6 +73,7 @@ struct softpipe_context {
const struct pipe_blend_state *blend;
const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS];
const struct pipe_depth_stencil_state *depth_stencil;
+ const struct pipe_rasterizer_state *rasterizer;
struct pipe_alpha_test_state alpha_test;
struct pipe_blend_color blend_color;
@@ -85,7 +86,6 @@ struct softpipe_context {
struct pipe_shader_state vs;
struct pipe_poly_stipple poly_stipple;
struct pipe_scissor_state scissor;
- struct pipe_setup_state setup;
struct pipe_mipmap_tree *texture[PIPE_MAX_SAMPLERS];
struct pipe_viewport_state viewport;
struct pipe_vertex_buffer vertex_buffer[PIPE_ATTRIB_MAX];
diff --git a/src/mesa/pipe/softpipe/sp_prim_setup.c b/src/mesa/pipe/softpipe/sp_prim_setup.c
index 83d317c36f7..c64a4e97081 100644
--- a/src/mesa/pipe/softpipe/sp_prim_setup.c
+++ b/src/mesa/pipe/softpipe/sp_prim_setup.c
@@ -351,7 +351,7 @@ static boolean setup_sort_vertices( struct setup_stage *setup,
* - the GLSL gl_FrontFacing fragment attribute (bool)
* - two-sided stencil test
*/
- setup->quad.facing = (prim->det > 0.0) ^ (setup->softpipe->setup.front_winding == PIPE_WINDING_CW);
+ setup->quad.facing = (prim->det > 0.0) ^ (setup->softpipe->rasterizer->front_winding == PIPE_WINDING_CW);
return TRUE;
}
@@ -830,10 +830,10 @@ setup_line(struct draw_stage *stage, struct prim_header *prim)
const int errorDec = error - dx;
for (i = 0; i < dx; i++) {
- if (!sp->setup.line_stipple_enable ||
+ if (!sp->rasterizer->line_stipple_enable ||
stipple_test(sp->line_stipple_counter,
- sp->setup.line_stipple_pattern,
- sp->setup.line_stipple_factor + 1)) {
+ sp->rasterizer->line_stipple_pattern,
+ sp->rasterizer->line_stipple_factor + 1)) {
plot(setup, x0, y0);
}
@@ -857,10 +857,10 @@ setup_line(struct draw_stage *stage, struct prim_header *prim)
const int errorDec = error - dy;
for (i = 0; i < dy; i++) {
- if (!sp->setup.line_stipple_enable ||
+ if (!sp->rasterizer->line_stipple_enable ||
stipple_test(sp->line_stipple_counter,
- sp->setup.line_stipple_pattern,
- sp->setup.line_stipple_factor + 1)) {
+ sp->rasterizer->line_stipple_pattern,
+ sp->rasterizer->line_stipple_factor + 1)) {
plot(setup, x0, y0);
}
@@ -899,8 +899,8 @@ setup_point(struct draw_stage *stage, struct prim_header *prim)
const int sizeAttr = setup->lookup[TGSI_ATTRIB_POINTSIZE];
const float halfSize
= sizeAttr ? (0.5f * v0->data[sizeAttr][0])
- : (0.5f * setup->softpipe->setup.point_size);
- const boolean round = setup->softpipe->setup.point_smooth;
+ : (0.5f * setup->softpipe->rasterizer->point_size);
+ const boolean round = setup->softpipe->rasterizer->point_smooth;
const float x = v0->data[TGSI_ATTRIB_POS][0];
const float y = v0->data[TGSI_ATTRIB_POS][1];
unsigned slot, j;
diff --git a/src/mesa/pipe/softpipe/sp_quad.c b/src/mesa/pipe/softpipe/sp_quad.c
index 1f45776d477..fc4f8328cf8 100644
--- a/src/mesa/pipe/softpipe/sp_quad.c
+++ b/src/mesa/pipe/softpipe/sp_quad.c
@@ -36,9 +36,9 @@ sp_build_quad_pipeline(struct softpipe_context *sp)
sp->quad.first = sp->quad.occlusion;
}
- if (sp->setup.poly_smooth ||
- sp->setup.line_smooth ||
- sp->setup.point_smooth) {
+ if (sp->rasterizer->poly_smooth ||
+ sp->rasterizer->line_smooth ||
+ sp->rasterizer->point_smooth) {
sp->quad.coverage->next = sp->quad.first;
sp->quad.first = sp->quad.coverage;
}
@@ -65,7 +65,7 @@ sp_build_quad_pipeline(struct softpipe_context *sp)
sp->quad.first = sp->quad.shade;
}
- if (sp->setup.poly_stipple_enable) {
+ if (sp->rasterizer->poly_stipple_enable) {
sp->quad.polygon_stipple->next = sp->quad.first;
sp->quad.first = sp->quad.polygon_stipple;
}
diff --git a/src/mesa/pipe/softpipe/sp_quad_coverage.c b/src/mesa/pipe/softpipe/sp_quad_coverage.c
index 8dfec593500..89f50bcca22 100644
--- a/src/mesa/pipe/softpipe/sp_quad_coverage.c
+++ b/src/mesa/pipe/softpipe/sp_quad_coverage.c
@@ -47,9 +47,9 @@ coverage_quad(struct quad_stage *qs, struct quad_header *quad)
{
struct softpipe_context *softpipe = qs->softpipe;
- if ((softpipe->setup.poly_smooth && quad->prim == PRIM_TRI) ||
- (softpipe->setup.line_smooth && quad->prim == PRIM_LINE) ||
- (softpipe->setup.point_smooth && quad->prim == PRIM_POINT)) {
+ if ((softpipe->rasterizer->poly_smooth && quad->prim == PRIM_TRI) ||
+ (softpipe->rasterizer->line_smooth && quad->prim == PRIM_LINE) ||
+ (softpipe->rasterizer->point_smooth && quad->prim == PRIM_POINT)) {
unsigned j;
for (j = 0; j < QUAD_SIZE; j++) {
assert(quad->coverage[j] >= 0.0);
diff --git a/src/mesa/pipe/softpipe/sp_state.h b/src/mesa/pipe/softpipe/sp_state.h
index caec3b4519a..62bd26c4dfe 100644
--- a/src/mesa/pipe/softpipe/sp_state.h
+++ b/src/mesa/pipe/softpipe/sp_state.h
@@ -50,7 +50,6 @@ void softpipe_bind_sampler_state(struct pipe_context *,
void softpipe_delete_sampler_state(struct pipe_context *,
const struct pipe_sampler_state *);
-
const struct pipe_depth_stencil_state *
softpipe_create_depth_stencil_state(struct pipe_context *,
const struct pipe_depth_stencil_state *);
@@ -59,6 +58,14 @@ void softpipe_bind_depth_stencil_state(struct pipe_context *,
void softpipe_delete_depth_stencil_state(struct pipe_context *,
const struct pipe_depth_stencil_state *);
+const struct pipe_rasterizer_state *
+softpipe_create_rasterizer_state(struct pipe_context *,
+ const struct pipe_rasterizer_state *);
+void softpipe_bind_rasterizer_state(struct pipe_context *,
+ const struct pipe_rasterizer_state *);
+void softpipe_delete_rasterizer_state(struct pipe_context *,
+ const struct pipe_rasterizer_state *);
+
void softpipe_set_framebuffer_state( struct pipe_context *,
const struct pipe_framebuffer_state * );
@@ -93,9 +100,6 @@ void softpipe_set_polygon_stipple( struct pipe_context *,
void softpipe_set_scissor_state( struct pipe_context *,
const struct pipe_scissor_state * );
-void softpipe_set_setup_state( struct pipe_context *,
- const struct pipe_setup_state * );
-
void softpipe_set_texture_state( struct pipe_context *,
unsigned unit,
struct pipe_mipmap_tree * );
diff --git a/src/mesa/pipe/softpipe/sp_state_derived.c b/src/mesa/pipe/softpipe/sp_state_derived.c
index 47743e185c2..8c6bacf65cf 100644
--- a/src/mesa/pipe/softpipe/sp_state_derived.c
+++ b/src/mesa/pipe/softpipe/sp_state_derived.c
@@ -45,7 +45,7 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe )
{
const uint inputsRead = softpipe->fs.inputs_read;
const interp_mode colorInterp
- = softpipe->setup.flatshade ? INTERP_CONSTANT : INTERP_LINEAR;
+ = softpipe->rasterizer->flatshade ? INTERP_CONSTANT : INTERP_LINEAR;
struct vertex_info *vinfo = &softpipe->vertex_info;
uint front0 = 0, back0 = 0, front1 = 0, back1 = 0;
uint i;
@@ -112,7 +112,7 @@ static void calculate_vertex_layout( struct softpipe_context *softpipe )
* lighting. Edgeflag is dealt with specially by setting bits in
* the vertex header.
*/
- if (softpipe->setup.light_twoside) {
+ if (softpipe->rasterizer->light_twoside) {
if (inputsRead & (1 << TGSI_ATTRIB_COLOR0)) {
back0 = draw_emit_vertex_attr(vinfo, TGSI_ATTRIB_BFC0,
FORMAT_OMIT, colorInterp);
@@ -160,7 +160,7 @@ compute_cliprect(struct softpipe_context *sp)
surfHeight = sp->scissor.maxy;
}
- if (sp->setup.scissor) {
+ if (sp->rasterizer->scissor) {
/* clip to scissor rect */
sp->cliprect.minx = MAX2(sp->scissor.minx, 0);
sp->cliprect.miny = MAX2(sp->scissor.miny, 0);
@@ -182,7 +182,7 @@ compute_cliprect(struct softpipe_context *sp)
*/
void softpipe_update_derived( struct softpipe_context *softpipe )
{
- if (softpipe->dirty & (SP_NEW_SETUP | SP_NEW_FS))
+ if (softpipe->dirty & (SP_NEW_RASTERIZER | SP_NEW_FS))
calculate_vertex_layout( softpipe );
if (softpipe->dirty & (SP_NEW_SCISSOR |
@@ -194,7 +194,7 @@ void softpipe_update_derived( struct softpipe_context *softpipe )
SP_NEW_DEPTH_STENCIL |
SP_NEW_ALPHA_TEST |
SP_NEW_FRAMEBUFFER |
- SP_NEW_SETUP |
+ SP_NEW_RASTERIZER |
SP_NEW_FS))
sp_build_quad_pipeline(softpipe);
diff --git a/src/mesa/pipe/softpipe/sp_state_setup.c b/src/mesa/pipe/softpipe/sp_state_setup.c
index 4715a26f553..67883963555 100644
--- a/src/mesa/pipe/softpipe/sp_state_setup.c
+++ b/src/mesa/pipe/softpipe/sp_state_setup.c
@@ -31,17 +31,35 @@
#include "pipe/draw/draw_context.h"
-void softpipe_set_setup_state( struct pipe_context *pipe,
- const struct pipe_setup_state *setup )
+
+const struct pipe_rasterizer_state *
+softpipe_create_rasterizer_state(struct pipe_context *pipe,
+ const struct pipe_rasterizer_state *setup)
+{
+ struct pipe_rasterizer_state *raster =
+ malloc(sizeof(struct pipe_rasterizer_state));
+ memcpy(raster, setup, sizeof(struct pipe_rasterizer_state));
+
+ return raster;
+}
+
+void softpipe_bind_rasterizer_state(struct pipe_context *pipe,
+ const struct pipe_rasterizer_state *setup)
{
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) );
+ softpipe->rasterizer = setup;
+
+ softpipe->dirty |= SP_NEW_RASTERIZER;
+}
- softpipe->dirty |= SP_NEW_SETUP;
+void softpipe_delete_rasterizer_state(struct pipe_context *pipe,
+ const struct pipe_rasterizer_state *rasterizer)
+{
+ free((struct pipe_rasterizer_state*)rasterizer);
}