Argfl. Some of this code is so questionable.
FREE(r300->blend_color_state.state);
FREE(r300->clip_state.state);
FREE(r300->rs_block);
- FREE(r300->scissor_state);
+ FREE(r300->scissor_state.state);
FREE(r300->vertex_info);
FREE(r300->viewport_state.state);
FREE(r300->ztop_state.state);
R300_INIT_ATOM(clip);
R300_INIT_ATOM(dsa);
R300_INIT_ATOM(rs);
+ R300_INIT_ATOM(scissor);
R300_INIT_ATOM(viewport);
}
r300->blend_color_state.state = CALLOC_STRUCT(r300_blend_color_state);
r300->clip_state.state = CALLOC_STRUCT(pipe_clip_state);
r300->rs_block = CALLOC_STRUCT(r300_rs_block);
- r300->scissor_state = CALLOC_STRUCT(r300_scissor_state);
+ r300->scissor_state.state = CALLOC_STRUCT(r300_scissor_state);
r300->vertex_info = CALLOC_STRUCT(r300_vertex_info);
r300->viewport_state.state = CALLOC_STRUCT(r300_viewport_state);
r300->ztop_state.state = CALLOC_STRUCT(r300_ztop_state);
#define R300_NEW_RS_BLOCK 0x00000100
#define R300_NEW_SAMPLER 0x00000200
#define R300_ANY_NEW_SAMPLERS 0x0001fe00
-#define R300_NEW_SCISSOR 0x00020000
#define R300_NEW_TEXTURE 0x00040000
#define R300_ANY_NEW_TEXTURES 0x03fc0000
#define R300_NEW_VERTEX_FORMAT 0x04000000
struct r300_sampler_state* sampler_states[8];
int sampler_count;
/* Scissor state. */
- struct r300_scissor_state* scissor_state;
+ struct r300_atom scissor_state;
/* Texture states. */
struct r300_texture* textures[8];
int texture_count;
END_CS;
}
-void r300_emit_scissor_state(struct r300_context* r300,
- struct r300_scissor_state* scissor)
+void r300_emit_scissor_state(struct r300_context* r300, void* state)
{
+ struct r300_scissor_state* scissor = (struct r300_scissor_state*)state;
/* XXX argfl! */
if (((struct r300_rs_state*)r300->rs_state.state)->rs.scissor) {
r300_emit_scissor_regs(r300, &scissor->scissor);
r300->dirty_state &= ~R300_NEW_RS_BLOCK;
}
- if (r300->dirty_state & R300_NEW_SCISSOR) {
- r300_emit_scissor_state(r300, r300->scissor_state);
- r300->dirty_state &= ~R300_NEW_SCISSOR;
- }
-
/* Samplers and textures are tracked separately but emitted together. */
if (r300->dirty_state &
(R300_ANY_NEW_SAMPLERS | R300_ANY_NEW_TEXTURES)) {
void r300_emit_rs_block_state(struct r300_context* r300,
struct r300_rs_block* rs);
-void r300_emit_scissor_state(struct r300_context* r300,
- struct r300_scissor_state* scissor);
+void r300_emit_scissor_state(struct r300_context* r300, void* state);
void r300_emit_texture(struct r300_context* r300,
struct r300_sampler_state* sampler,
static boolean r300_nothing_to_draw(struct r300_context *r300)
{
return ((struct r300_rs_state*)r300->rs_state.state)->rs.scissor &&
- r300->scissor_state->scissor.empty_area;
+ ((struct r300_scissor_state*)r300->scissor_state.state)->scissor.empty_area;
}
static uint32_t r300_provoking_vertex_fixes(struct r300_context *r300,
const struct pipe_framebuffer_state* state)
{
struct r300_context* r300 = r300_context(pipe);
- struct pipe_scissor_state scissor;
+ struct r300_scissor_state* scissor =
+ (struct r300_scissor_state*)r300->scissor_state.state;
+ struct pipe_scissor_state pscissor;
if (r300->draw) {
draw_flush(r300->draw);
r300->framebuffer_state = *state;
- scissor.minx = scissor.miny = 0;
- scissor.maxx = state->width;
- scissor.maxy = state->height;
- r300_set_scissor_regs(&scissor, &r300->scissor_state->framebuffer,
+ /* XXX Arg. This is silly. */
+ pscissor.minx = pscissor.miny = 0;
+ pscissor.maxx = state->width;
+ pscissor.maxy = state->height;
+ r300_set_scissor_regs(&pscissor, &scissor->framebuffer,
r300_screen(r300->context.screen)->caps->is_r500);
/* Don't rely on the order of states being set for the first time. */
- /* XXX ( >&) */
- if (!r300->rs_state.state) {
- r300->dirty_state |= R300_NEW_SCISSOR;
- }
r300->dirty_state |= R300_NEW_FRAMEBUFFERS;
r300->blend_state.dirty = TRUE;
r300->dsa_state.dirty = TRUE;
+ r300->scissor_state.dirty = TRUE;
}
/* Create fragment shader state. */
r300->rs_state.state = rs;
r300->rs_state.dirty = TRUE;
/* XXX Why is this still needed, dammit!? */
+ r300->scissor_state.dirty = TRUE;
r300->viewport_state.dirty = TRUE;
/* XXX Clean these up when we move to atom emits */
r300->dirty_state |= R300_NEW_RS_BLOCK;
- r300->dirty_state |= R300_NEW_SCISSOR;
if (r300->fs && r300->fs->inputs.wpos != ATTR_UNUSED) {
r300->dirty_state |= R300_NEW_FRAGMENT_SHADER_CONSTANTS;
}
const struct pipe_scissor_state* state)
{
struct r300_context* r300 = r300_context(pipe);
+ struct r300_scissor_state* scissor =
+ (struct r300_scissor_state*)r300->scissor_state.state;
- r300_set_scissor_regs(state, &r300->scissor_state->scissor,
+ r300_set_scissor_regs(state, &scissor->scissor,
r300_screen(r300->context.screen)->caps->is_r500);
- r300->dirty_state |= R300_NEW_SCISSOR;
+ r300->scissor_state.dirty = TRUE;
}
static void r300_set_viewport_state(struct pipe_context* pipe,