summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/r300
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/r300')
-rw-r--r--src/gallium/drivers/r300/r300_blit.c1
-rw-r--r--src/gallium/drivers/r300/r300_context.h2
-rw-r--r--src/gallium/drivers/r300/r300_emit.c5
-rw-r--r--src/gallium/drivers/r300/r300_state.c16
-rw-r--r--src/gallium/drivers/r300/r300_state_inlines.h10
5 files changed, 24 insertions, 10 deletions
diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c
index cdedb302209..faaf9523cb2 100644
--- a/src/gallium/drivers/r300/r300_blit.c
+++ b/src/gallium/drivers/r300/r300_blit.c
@@ -27,6 +27,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_stencil_ref(r300->blitter, &(r300->stencil_ref));
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.h b/src/gallium/drivers/r300/r300_context.h
index 84617578128..ba64b3eb725 100644
--- a/src/gallium/drivers/r300/r300_context.h
+++ b/src/gallium/drivers/r300/r300_context.h
@@ -318,6 +318,8 @@ struct r300_context {
struct pipe_vertex_element vertex_element[PIPE_MAX_ATTRIBS];
int vertex_element_count;
+ struct pipe_stencil_ref stencil_ref;
+
/* Bitmask of dirty state objects. */
uint32_t dirty_state;
/* Flag indicating whether or not the HW is dirty. */
diff --git a/src/gallium/drivers/r300/r300_emit.c b/src/gallium/drivers/r300/r300_emit.c
index de6ba651d14..d31336ed76f 100644
--- a/src/gallium/drivers/r300/r300_emit.c
+++ b/src/gallium/drivers/r300/r300_emit.c
@@ -114,6 +114,7 @@ void r300_emit_dsa_state(struct r300_context* r300, void* state)
struct r300_screen* r300screen = r300_screen(r300->context.screen);
struct pipe_framebuffer_state* fb =
(struct pipe_framebuffer_state*)r300->fb_state.state;
+ struct pipe_stencil_ref stencil_ref = r300->stencil_ref;
CS_LOCALS(r300);
BEGIN_CS(r300screen->caps->is_r500 ? 8 : 6);
@@ -128,10 +129,10 @@ void r300_emit_dsa_state(struct r300_context* r300, void* state)
OUT_CS(0);
}
- OUT_CS(dsa->stencil_ref_mask);
+ OUT_CS(dsa->stencil_ref_mask | stencil_ref.ref_value[0]);
if (r300screen->caps->is_r500) {
- OUT_CS_REG(R500_ZB_STENCILREFMASK_BF, dsa->stencil_ref_bf);
+ OUT_CS_REG(R500_ZB_STENCILREFMASK_BF, dsa->stencil_ref_bf | stencil_ref.ref_value[1]);
}
END_CS;
}
diff --git a/src/gallium/drivers/r300/r300_state.c b/src/gallium/drivers/r300/r300_state.c
index 99ecae9f5f8..4d158cff7c7 100644
--- a/src/gallium/drivers/r300/r300_state.c
+++ b/src/gallium/drivers/r300/r300_state.c
@@ -425,7 +425,7 @@ static void*
(r300_translate_stencil_op(state->stencil[0].zfail_op) <<
R300_S_FRONT_ZFAIL_OP_SHIFT);
- dsa->stencil_ref_mask = (state->stencil[0].ref_value) |
+ dsa->stencil_ref_mask =
(state->stencil[0].valuemask << R300_STENCILMASK_SHIFT) |
(state->stencil[0].writemask << R300_STENCILWRITEMASK_SHIFT);
@@ -444,7 +444,7 @@ static void*
if (caps->is_r500)
{
dsa->z_buffer_control |= R500_STENCIL_REFMASK_FRONT_BACK;
- dsa->stencil_ref_bf = (state->stencil[1].ref_value) |
+ dsa->stencil_ref_bf =
(state->stencil[1].valuemask <<
R300_STENCILMASK_SHIFT) |
(state->stencil[1].writemask <<
@@ -488,6 +488,14 @@ static void r300_delete_dsa_state(struct pipe_context* pipe,
FREE(state);
}
+static void r300_set_stencil_ref(struct pipe_context* pipe,
+ const struct pipe_stencil_ref* sr)
+{
+ struct r300_context* r300 = r300_context(pipe);
+ r300->stencil_ref = *sr;
+ r300->dsa_state.dirty = TRUE;
+}
+
static void
r300_set_framebuffer_state(struct pipe_context* pipe,
const struct pipe_framebuffer_state* state)
@@ -794,7 +802,7 @@ static void*
sampler->filter0 |= r300_translate_tex_filters(state->min_img_filter,
state->mag_img_filter,
state->min_mip_filter,
- state->max_anisotropy > 1.0);
+ state->max_anisotropy > 0);
/* Unfortunately, r300-r500 don't support floating-point mipmap lods. */
/* We must pass these to the emit function to clamp them properly. */
@@ -1112,6 +1120,8 @@ void r300_init_state_functions(struct r300_context* r300)
r300->context.bind_depth_stencil_alpha_state = r300_bind_dsa_state;
r300->context.delete_depth_stencil_alpha_state = r300_delete_dsa_state;
+ r300->context.set_stencil_ref = r300_set_stencil_ref;
+
r300->context.set_framebuffer_state = r300_set_framebuffer_state;
r300->context.create_fs_state = r300_create_fs_state;
diff --git a/src/gallium/drivers/r300/r300_state_inlines.h b/src/gallium/drivers/r300/r300_state_inlines.h
index 5df6815221f..779ba2c7be4 100644
--- a/src/gallium/drivers/r300/r300_state_inlines.h
+++ b/src/gallium/drivers/r300/r300_state_inlines.h
@@ -312,15 +312,15 @@ static INLINE uint32_t r300_translate_tex_filters(int min, int mag, int mip,
return retval;
}
-static INLINE uint32_t r300_anisotropy(float max_aniso)
+static INLINE uint32_t r300_anisotropy(unsigned max_aniso)
{
- if (max_aniso >= 16.0f) {
+ if (max_aniso >= 16) {
return R300_TX_MAX_ANISO_16_TO_1;
- } else if (max_aniso >= 8.0f) {
+ } else if (max_aniso >= 8) {
return R300_TX_MAX_ANISO_8_TO_1;
- } else if (max_aniso >= 4.0f) {
+ } else if (max_aniso >= 4) {
return R300_TX_MAX_ANISO_4_TO_1;
- } else if (max_aniso >= 2.0f) {
+ } else if (max_aniso >= 2) {
return R300_TX_MAX_ANISO_2_TO_1;
} else {
return R300_TX_MAX_ANISO_1_TO_1;