No benefits yet.
static void r300_blitter_save_states(struct r300_context* r300)
{
- util_blitter_save_blend(r300->blitter, r300->blend_state);
+ util_blitter_save_blend(r300->blitter, r300->blend_state.state);
util_blitter_save_depth_stencil_alpha(r300->blitter, r300->dsa_state);
util_blitter_save_rasterizer(r300->blitter, r300->rs_state);
util_blitter_save_fragment_shader(r300->blitter, r300->fs);
#include "r300_blit.h"
#include "r300_context.h"
+#include "r300_emit.h"
#include "r300_flush.h"
#include "r300_query.h"
#include "r300_render.h"
cs_context_copy->context.flush(&cs_context_copy->context, 0, NULL);
}
+#define R300_INIT_ATOM(name) \
+ r300->name##_state.state = NULL; \
+ r300->name##_state.emit = r300_emit_##name##_state; \
+ r300->name##_state.dirty = FALSE; \
+ insert_at_tail(&r300->atom_list, &r300->name##_state);
+
+static void r300_setup_atoms(struct r300_context* r300)
+{
+ make_empty_list(&r300->atom_list);
+ R300_INIT_ATOM(blend);
+}
+
struct pipe_context* r300_create_context(struct pipe_screen* screen,
struct radeon_winsys* radeon_winsys)
{
PIPE_BUFFER_USAGE_VERTEX, 4096);
make_empty_list(&r300->query_list);
+ r300_setup_atoms(r300);
+
r300_init_flush_functions(r300);
r300_init_query_functions(r300);
#include "pipe/p_context.h"
#include "pipe/p_inlines.h"
+struct r300_context;
+
struct r300_fragment_shader;
struct r300_vertex_shader;
+struct r300_atom {
+ struct r300_atom *prev, *next;
+ void* state;
+ void (*emit)(struct r300_context*, void*);
+ boolean dirty;
+};
+
struct r300_blend_state {
uint32_t blend_control; /* R300_RB3D_CBLEND: 0x4e04 */
uint32_t alpha_blend_control; /* R300_RB3D_ABLEND: 0x4e08 */
uint32_t z_buffer_top; /* R300_ZB_ZTOP: 0x4f14 */
};
-#define R300_NEW_BLEND 0x00000001
#define R300_NEW_BLEND_COLOR 0x00000002
#define R300_NEW_CLIP 0x00000004
#define R300_NEW_DSA 0x00000008
struct r300_vertex_info* vertex_info;
/* Various CSO state objects. */
+ /* Beginning of atom list. */
+ struct r300_atom atom_list;
/* Blend state. */
- struct r300_blend_state* blend_state;
+ struct r300_atom blend_state;
/* Blend color state. */
struct r300_blend_color_state* blend_color_state;
/* User clip planes. */
#include "util/u_format.h"
#include "util/u_math.h"
+#include "util/u_simple_list.h"
#include "r300_context.h"
#include "r300_cs.h"
#include "r300_texture.h"
#include "r300_vs.h"
-void r300_emit_blend_state(struct r300_context* r300,
- struct r300_blend_state* blend)
+void r300_emit_blend_state(struct r300_context* r300, void* state)
{
+ struct r300_blend_state* blend = (struct r300_blend_state*)state;
CS_LOCALS(r300);
BEGIN_CS(8);
OUT_CS_REG_SEQ(R300_RB3D_CBLEND, 3);
{
struct r300_screen* r300screen = r300_screen(r300->context.screen);
struct r300_texture* tex;
+ struct r300_atom* atom;
int i, dirty_tex = 0;
boolean invalid = FALSE;
r300->dirty_state &= ~R300_NEW_QUERY;
}
- if (r300->dirty_state & R300_NEW_BLEND) {
- r300_emit_blend_state(r300, r300->blend_state);
- r300->dirty_state &= ~R300_NEW_BLEND;
+ foreach(atom, &r300->atom_list) {
+ if (atom->dirty) {
+ atom->emit(r300, atom->state);
+ atom->dirty = FALSE;
+ }
}
if (r300->dirty_state & R300_NEW_BLEND_COLOR) {
void r300_emit_aos(struct r300_context* r300, unsigned offset);
void r300_emit_blend_state(struct r300_context* r300,
- struct r300_blend_state* blend);
+ void* blend);
void r300_emit_blend_color_state(struct r300_context* r300,
struct r300_blend_color_state* bc);
{
struct r300_context* r300 = r300_context(pipe);
- r300->blend_state = (struct r300_blend_state*)state;
- r300->dirty_state |= R300_NEW_BLEND;
+ r300->blend_state.state = state;
+ r300->blend_state.dirty = TRUE;
}
/* Free blend state. */
r300->dirty_state |= R300_NEW_SCISSOR;
}
r300->dirty_state |= R300_NEW_FRAMEBUFFERS;
- r300->dirty_state |= R300_NEW_BLEND;
r300->dirty_state |= R300_NEW_DSA;
+
+ r300->blend_state.dirty = TRUE;
}
/* Create fragment shader state. */