From 4b92c688a45480027390764b06077105298666c3 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Sat, 12 Mar 2011 06:11:18 +0100 Subject: r300g: implement fragment color clamping in the shader This finishes the implementation of the fragment color clamp control for ARB_color_buffer_float. I don't wanna keep this stuff in a branch... --- src/gallium/drivers/r300/r300_context.h | 2 ++ src/gallium/drivers/r300/r300_fs.c | 2 ++ src/gallium/drivers/r300/r300_state.c | 6 ++++++ 3 files changed, 10 insertions(+) (limited to 'src/gallium/drivers/r300') diff --git a/src/gallium/drivers/r300/r300_context.h b/src/gallium/drivers/r300/r300_context.h index 76ea5ee251..1624708710 100644 --- a/src/gallium/drivers/r300/r300_context.h +++ b/src/gallium/drivers/r300/r300_context.h @@ -65,6 +65,8 @@ struct r300_aa_state { }; struct r300_blend_state { + struct pipe_blend_state state; + uint32_t cb[8]; uint32_t cb_no_readwrite[8]; }; diff --git a/src/gallium/drivers/r300/r300_fs.c b/src/gallium/drivers/r300/r300_fs.c index cec7473009..4c502fefb3 100644 --- a/src/gallium/drivers/r300/r300_fs.c +++ b/src/gallium/drivers/r300/r300_fs.c @@ -149,6 +149,8 @@ static void get_external_state( unsigned i; unsigned char *swizzle; + state->frag_clamp = 0; + for (i = 0; i < texstate->sampler_state_count; i++) { struct r300_sampler_state *s = texstate->sampler_states[i]; struct r300_sampler_view *v = texstate->sampler_views[i]; diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c index 49c2b88350..f0830e13f0 100644 --- a/src/gallium/drivers/r300/r300_state.c +++ b/src/gallium/drivers/r300/r300_state.c @@ -195,6 +195,8 @@ static void* r300_create_blend_state(struct pipe_context* pipe, boolean clamp = TRUE; CB_LOCALS; + blend->state = *state; + if (state->rt[0].blend_enable) { unsigned eqRGB = state->rt[0].rgb_func; @@ -377,6 +379,10 @@ static void r300_bind_blend_state(struct pipe_context* pipe, struct r300_context* r300 = r300_context(pipe); UPDATE_STATE(state, r300->blend_state); + + if (r300->fs.state && r300_pick_fragment_shader(r300)) { + r300_mark_fs_code_dirty(r300); + } } /* Free blend state. */ -- cgit v1.2.3