summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/r300/r300_blit.c2
-rw-r--r--src/gallium/drivers/r300/r300_context.c1
-rw-r--r--src/gallium/drivers/r300/r300_context.h3
-rw-r--r--src/gallium/drivers/r300/r300_emit.c36
-rw-r--r--src/gallium/drivers/r300/r300_emit.h2
-rw-r--r--src/gallium/drivers/r300/r300_render.c7
-rw-r--r--src/gallium/drivers/r300/r300_state.c13
-rw-r--r--src/gallium/drivers/r300/r300_state_derived.c2
8 files changed, 34 insertions, 32 deletions
diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c
index b2fec4a50bf..c14414fff6b 100644
--- a/src/gallium/drivers/r300/r300_blit.c
+++ b/src/gallium/drivers/r300/r300_blit.c
@@ -29,7 +29,7 @@ static void r300_blitter_save_states(struct r300_context* r300)
{
util_blitter_save_blend(r300->blitter, r300->blend_state.state);
util_blitter_save_depth_stencil_alpha(r300->blitter, r300->dsa_state.state);
- util_blitter_save_rasterizer(r300->blitter, r300->rs_state);
+ util_blitter_save_rasterizer(r300->blitter, r300->rs_state.state);
util_blitter_save_fragment_shader(r300->blitter, r300->fs);
util_blitter_save_vertex_shader(r300->blitter, r300->vs);
}
diff --git a/src/gallium/drivers/r300/r300_context.c b/src/gallium/drivers/r300/r300_context.c
index abd5d268747..9319b5ecfc4 100644
--- a/src/gallium/drivers/r300/r300_context.c
+++ b/src/gallium/drivers/r300/r300_context.c
@@ -124,6 +124,7 @@ static void r300_setup_atoms(struct r300_context* r300)
R300_INIT_ATOM(blend_color);
R300_INIT_ATOM(clip);
R300_INIT_ATOM(dsa);
+ R300_INIT_ATOM(rs);
}
struct pipe_context* r300_create_context(struct pipe_screen* screen,
diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h
index 56c49f7efa1..e8c56bbf874 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -147,7 +147,6 @@ struct r300_ztop_state {
#define R300_NEW_FRAMEBUFFERS 0x00000010
#define R300_NEW_FRAGMENT_SHADER 0x00000020
#define R300_NEW_FRAGMENT_SHADER_CONSTANTS 0x00000040
-#define R300_NEW_RASTERIZER 0x00000080
#define R300_NEW_RS_BLOCK 0x00000100
#define R300_NEW_SAMPLER 0x00000200
#define R300_ANY_NEW_SAMPLERS 0x0001fe00
@@ -295,7 +294,7 @@ struct r300_context {
/* Framebuffer state. We currently don't need our own version of this. */
struct pipe_framebuffer_state framebuffer_state;
/* Rasterizer state. */
- struct r300_rs_state* rs_state;
+ struct r300_atom rs_state;
/* RS block state. */
struct r300_rs_block* rs_block;
/* Sampler states. */
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index 27fb9aa9ba8..60e4a109d44 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -145,6 +145,9 @@ static const float * get_shader_constant(
struct rc_constant * constant,
struct r300_constant_buffer * externals)
{
+ struct r300_viewport_state* viewport =
+ (struct r300_viewport_state*)r300->viewport_state;
+ boolean vte_enabled = viewport->vte_control & ~R300_VTX_W0_FMT;
static float vec[4] = { 0.0, 0.0, 0.0, 1.0 };
struct pipe_texture *tex;
@@ -167,16 +170,17 @@ static const float * get_shader_constant(
/* Texture compare-fail value. */
/* XXX Since Gallium doesn't support GL_ARB_shadow_ambient,
- * this is always (0,0,0,0). */
+ * this is always (0,0,0,0), right? */
case RC_STATE_SHADOW_AMBIENT:
vec[3] = 0;
break;
case RC_STATE_R300_VIEWPORT_SCALE:
- if (r300->rs_state->enable_vte) {
- vec[0] = r300->viewport_state->xscale;
- vec[1] = r300->viewport_state->yscale;
- vec[2] = r300->viewport_state->zscale;
+ /* XXX argfl stop crossing state */
+ if (vte_enabled) {
+ vec[0] = viewport->xscale;
+ vec[1] = viewport->yscale;
+ vec[2] = viewport->zscale;
} else {
vec[0] = 1;
vec[1] = 1;
@@ -185,10 +189,10 @@ static const float * get_shader_constant(
break;
case RC_STATE_R300_VIEWPORT_OFFSET:
- if (r300->rs_state->enable_vte) {
- vec[0] = r300->viewport_state->xoffset;
- vec[1] = r300->viewport_state->yoffset;
- vec[2] = r300->viewport_state->zoffset;
+ if (vte_enabled) {
+ vec[0] = viewport->xoffset;
+ vec[1] = viewport->yoffset;
+ vec[2] = viewport->zoffset;
} else {
/* Zeros. */
}
@@ -576,8 +580,9 @@ void r300_emit_query_end(struct r300_context* r300)
r300_emit_query_finish(r300, query);
}
-void r300_emit_rs_state(struct r300_context* r300, struct r300_rs_state* rs)
+void r300_emit_rs_state(struct r300_context* r300, void* state)
{
+ struct r300_rs_state* rs = (struct r300_rs_state*)state;
CS_LOCALS(r300);
BEGIN_CS(22);
@@ -655,7 +660,8 @@ static void r300_emit_scissor_regs(struct r300_context* r300,
void r300_emit_scissor_state(struct r300_context* r300,
struct r300_scissor_state* scissor)
{
- if (r300->rs_state->rs.scissor) {
+ /* XXX argfl! */
+ if (((struct r300_rs_state*)r300->rs_state.state)->rs.scissor) {
r300_emit_scissor_regs(r300, &scissor->scissor);
} else {
r300_emit_scissor_regs(r300, &scissor->framebuffer);
@@ -926,7 +932,8 @@ void r300_emit_viewport_state(struct r300_context* r300,
OUT_CS_32F(viewport->zscale);
OUT_CS_32F(viewport->zoffset);
- if (r300->rs_state->enable_vte) {
+ /* XXX words fail me. */
+ if (((struct r300_rs_state*)r300->rs_state.state)->enable_vte) {
OUT_CS_REG(R300_VAP_VTE_CNTL, viewport->vte_control);
} else {
OUT_CS_REG(R300_VAP_VTE_CNTL, 0);
@@ -1100,11 +1107,6 @@ validate:
r300->dirty_state &= ~R300_NEW_FRAMEBUFFERS;
}
- if (r300->dirty_state & R300_NEW_RASTERIZER) {
- r300_emit_rs_state(r300, r300->rs_state);
- r300->dirty_state &= ~R300_NEW_RASTERIZER;
- }
-
if (r300->dirty_state & R300_NEW_RS_BLOCK) {
r300_emit_rs_block_state(r300, r300->rs_block);
r300->dirty_state &= ~R300_NEW_RS_BLOCK;
diff --git a/src/gallium/drivers/r300/r300_emit.h b/src/gallium/drivers/r300/r300_emit.h
index 0ccae0031bd..a6539b218b4 100644
--- a/src/gallium/drivers/r300/r300_emit.h
+++ b/src/gallium/drivers/r300/r300_emit.h
@@ -59,7 +59,7 @@ void r300_emit_query_begin(struct r300_context* r300,
void r300_emit_query_end(struct r300_context* r300);
-void r300_emit_rs_state(struct r300_context* r300, struct r300_rs_state* rs);
+void r300_emit_rs_state(struct r300_context* r300, void* state);
void r300_emit_rs_block_state(struct r300_context* r300,
struct r300_rs_block* rs);
diff --git a/src/gallium/drivers/r300/r300_render.c b/src/gallium/drivers/r300/r300_render.c
index a4ac9ad9a7b..7098f66f0c3 100644
--- a/src/gallium/drivers/r300/r300_render.c
+++ b/src/gallium/drivers/r300/r300_render.c
@@ -71,14 +71,15 @@ uint32_t r300_translate_primitive(unsigned prim)
static boolean r300_nothing_to_draw(struct r300_context *r300)
{
- return r300->rs_state->rs.scissor &&
+ return ((struct r300_rs_state*)r300->rs_state.state)->rs.scissor &&
r300->scissor_state->scissor.empty_area;
}
static uint32_t r300_provoking_vertex_fixes(struct r300_context *r300,
unsigned mode)
{
- uint32_t color_control = r300->rs_state->color_control;
+ struct r300_rs_state* rs = (struct r300_rs_state*)r300->rs_state.state;
+ uint32_t color_control = rs->color_control;
/* By default (see r300_state.c:r300_create_rs_state) color_control is
* initialized to provoking the first vertex.
@@ -98,7 +99,7 @@ static uint32_t r300_provoking_vertex_fixes(struct r300_context *r300,
* ~ C.
*/
- if (r300->rs_state->rs.flatshade_first) {
+ if (rs->rs.flatshade_first) {
switch (mode) {
case PIPE_PRIM_TRIANGLE_FAN:
color_control |= R300_GA_COLOR_CONTROL_PROVOKING_VERTEX_SECOND;
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 288b2149b50..8740a082b98 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -519,7 +519,8 @@ static void
r300_screen(r300->context.screen)->caps->is_r500);
/* Don't rely on the order of states being set for the first time. */
- if (!r300->rs_state || !r300->rs_state->rs.scissor) {
+ /* XXX ( >&) */
+ if (!r300->rs_state.state) {
r300->dirty_state |= R300_NEW_SCISSOR;
}
r300->dirty_state |= R300_NEW_FRAMEBUFFERS;
@@ -721,9 +722,10 @@ static void r300_bind_rs_state(struct pipe_context* pipe, void* state)
draw_set_rasterizer_state(r300->draw, &rs->rs);
}
- r300->rs_state = rs;
+ r300->rs_state.state = rs;
+ r300->rs_state.dirty = TRUE;
+
/* XXX Clean these up when we move to atom emits */
- r300->dirty_state |= R300_NEW_RASTERIZER;
r300->dirty_state |= R300_NEW_RS_BLOCK;
r300->dirty_state |= R300_NEW_SCISSOR;
r300->dirty_state |= R300_NEW_VIEWPORT;
@@ -868,10 +870,7 @@ static void r300_set_scissor_state(struct pipe_context* pipe,
r300_set_scissor_regs(state, &r300->scissor_state->scissor,
r300_screen(r300->context.screen)->caps->is_r500);
- /* Don't rely on the order of states being set for the first time. */
- if (!r300->rs_state || r300->rs_state->rs.scissor) {
- r300->dirty_state |= R300_NEW_SCISSOR;
- }
+ r300->dirty_state |= R300_NEW_SCISSOR;
}
static void r300_set_viewport_state(struct pipe_context* pipe,
diff --git a/src/gallium/drivers/r300/r300_state_derived.c b/src/gallium/drivers/r300/r300_state_derived.c
index a4029fca49f..e82aa07a625 100644
--- a/src/gallium/drivers/r300/r300_state_derived.c
+++ b/src/gallium/drivers/r300/r300_state_derived.c
@@ -139,7 +139,7 @@ static void r300_vertex_psc(struct r300_context* r300)
/* If TCL is bypassed, map vertex streams to equivalent VS output
* locations. */
- if (r300->rs_state->enable_vte) {
+ if (((struct r300_rs_state*)r300->rs_state.state)->enable_vte) {
stream_tab = identity;
} else {
stream_tab = r300->vs->stream_loc_notcl;