r300g: Atomize blend color.
This commit is contained in:
parent
d496399156
commit
9d3db601c7
|
@ -70,7 +70,7 @@ static void r300_destroy_context(struct pipe_context* context)
|
|||
FREE(query);
|
||||
}
|
||||
|
||||
FREE(r300->blend_color_state);
|
||||
FREE(r300->blend_color_state.state);
|
||||
FREE(r300->rs_block);
|
||||
FREE(r300->scissor_state);
|
||||
FREE(r300->vertex_info);
|
||||
|
@ -118,6 +118,7 @@ static void r300_setup_atoms(struct r300_context* r300)
|
|||
{
|
||||
make_empty_list(&r300->atom_list);
|
||||
R300_INIT_ATOM(blend);
|
||||
R300_INIT_ATOM(blend_color);
|
||||
}
|
||||
|
||||
struct pipe_context* r300_create_context(struct pipe_screen* screen,
|
||||
|
@ -168,7 +169,7 @@ struct pipe_context* r300_create_context(struct pipe_screen* screen,
|
|||
r300->shader_hash_table = util_hash_table_create(r300_shader_key_hash,
|
||||
r300_shader_key_compare);
|
||||
|
||||
r300->blend_color_state = CALLOC_STRUCT(r300_blend_color_state);
|
||||
r300->blend_color_state.state = CALLOC_STRUCT(r300_blend_color_state);
|
||||
r300->rs_block = CALLOC_STRUCT(r300_rs_block);
|
||||
r300->scissor_state = CALLOC_STRUCT(r300_scissor_state);
|
||||
r300->vertex_info = CALLOC_STRUCT(r300_vertex_info);
|
||||
|
|
|
@ -144,7 +144,6 @@ struct r300_ztop_state {
|
|||
uint32_t z_buffer_top; /* R300_ZB_ZTOP: 0x4f14 */
|
||||
};
|
||||
|
||||
#define R300_NEW_BLEND_COLOR 0x00000002
|
||||
#define R300_NEW_CLIP 0x00000004
|
||||
#define R300_NEW_DSA 0x00000008
|
||||
#define R300_NEW_FRAMEBUFFERS 0x00000010
|
||||
|
@ -286,7 +285,7 @@ struct r300_context {
|
|||
/* Blend state. */
|
||||
struct r300_atom blend_state;
|
||||
/* Blend color state. */
|
||||
struct r300_blend_color_state* blend_color_state;
|
||||
struct r300_atom blend_color_state;
|
||||
/* User clip planes. */
|
||||
struct pipe_clip_state clip_state;
|
||||
/* Shader constants. */
|
||||
|
|
|
@ -58,9 +58,9 @@ void r300_emit_blend_state(struct r300_context* r300, void* state)
|
|||
END_CS;
|
||||
}
|
||||
|
||||
void r300_emit_blend_color_state(struct r300_context* r300,
|
||||
struct r300_blend_color_state* bc)
|
||||
void r300_emit_blend_color_state(struct r300_context* r300, void* state)
|
||||
{
|
||||
struct r300_blend_color_state* bc = (struct r300_blend_color_state*)state;
|
||||
struct r300_screen* r300screen = r300_screen(r300->context.screen);
|
||||
CS_LOCALS(r300);
|
||||
|
||||
|
@ -1069,11 +1069,6 @@ validate:
|
|||
}
|
||||
}
|
||||
|
||||
if (r300->dirty_state & R300_NEW_BLEND_COLOR) {
|
||||
r300_emit_blend_color_state(r300, r300->blend_color_state);
|
||||
r300->dirty_state &= ~R300_NEW_BLEND_COLOR;
|
||||
}
|
||||
|
||||
if (r300->dirty_state & R300_NEW_CLIP) {
|
||||
r300_emit_clip_state(r300, &r300->clip_state);
|
||||
r300->dirty_state &= ~R300_NEW_CLIP;
|
||||
|
|
|
@ -31,11 +31,9 @@ struct r300_vertex_program_code;
|
|||
|
||||
void r300_emit_aos(struct r300_context* r300, unsigned offset);
|
||||
|
||||
void r300_emit_blend_state(struct r300_context* r300,
|
||||
void* blend);
|
||||
void r300_emit_blend_state(struct r300_context* r300, void* state);
|
||||
|
||||
void r300_emit_blend_color_state(struct r300_context* r300,
|
||||
struct r300_blend_color_state* bc);
|
||||
void r300_emit_blend_color_state(struct r300_context* r300, void* state);
|
||||
|
||||
void r300_emit_clip_state(struct r300_context* r300,
|
||||
struct pipe_clip_state* clip);
|
||||
|
|
|
@ -340,20 +340,22 @@ static void r300_set_blend_color(struct pipe_context* pipe,
|
|||
const struct pipe_blend_color* color)
|
||||
{
|
||||
struct r300_context* r300 = r300_context(pipe);
|
||||
struct r300_blend_color_state* state =
|
||||
(struct r300_blend_color_state*)r300->blend_color_state.state;
|
||||
union util_color uc;
|
||||
|
||||
util_pack_color(color->color, PIPE_FORMAT_A8R8G8B8_UNORM, &uc);
|
||||
r300->blend_color_state->blend_color = uc.ui;
|
||||
state->blend_color = uc.ui;
|
||||
|
||||
/* XXX if FP16 blending is enabled, we should use the FP16 format */
|
||||
r300->blend_color_state->blend_color_red_alpha =
|
||||
state->blend_color_red_alpha =
|
||||
float_to_fixed10(color->color[0]) |
|
||||
(float_to_fixed10(color->color[3]) << 16);
|
||||
r300->blend_color_state->blend_color_green_blue =
|
||||
state->blend_color_green_blue =
|
||||
float_to_fixed10(color->color[2]) |
|
||||
(float_to_fixed10(color->color[1]) << 16);
|
||||
|
||||
r300->dirty_state |= R300_NEW_BLEND_COLOR;
|
||||
r300->blend_color_state.dirty = TRUE;
|
||||
}
|
||||
|
||||
static void r300_set_clip_state(struct pipe_context* pipe,
|
||||
|
|
Loading…
Reference in New Issue