summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/i915
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/i915')
-rw-r--r--src/gallium/drivers/i915/i915_context.h1
-rw-r--r--src/gallium/drivers/i915/i915_state.c22
-rw-r--r--src/gallium/drivers/i915/i915_state_dynamic.c9
-rw-r--r--src/gallium/drivers/i915/i915_state_immediate.c2
4 files changed, 26 insertions, 8 deletions
diff --git a/src/gallium/drivers/i915/i915_context.h b/src/gallium/drivers/i915/i915_context.h
index 1479d2201a..da769e7b29 100644
--- a/src/gallium/drivers/i915/i915_context.h
+++ b/src/gallium/drivers/i915/i915_context.h
@@ -232,6 +232,7 @@ struct i915_context
struct i915_fragment_shader *fs;
struct pipe_blend_color blend_color;
+ struct pipe_stencil_ref stencil_ref;
struct pipe_clip_state clip;
/* XXX unneded */
struct pipe_buffer *constants[PIPE_SHADER_TYPES];
diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c
index beb26e996a..62169918e2 100644
--- a/src/gallium/drivers/i915/i915_state.c
+++ b/src/gallium/drivers/i915/i915_state.c
@@ -190,7 +190,7 @@ static void i915_delete_blend_state(struct pipe_context *pipe, void *blend)
}
static void i915_set_blend_color( struct pipe_context *pipe,
- const struct pipe_blend_color *blend_color )
+ const struct pipe_blend_color *blend_color )
{
struct i915_context *i915 = i915_context(pipe);
draw_flush(i915->draw);
@@ -200,6 +200,17 @@ static void i915_set_blend_color( struct pipe_context *pipe,
i915->dirty |= I915_NEW_BLEND;
}
+static void i915_set_stencil_ref( struct pipe_context *pipe,
+ const struct pipe_stencil_ref *stencil_ref )
+{
+ struct i915_context *i915 = i915_context(pipe);
+ draw_flush(i915->draw);
+
+ i915->stencil_ref = *stencil_ref;
+
+ i915->dirty |= I915_NEW_DEPTH_STENCIL;
+}
+
static void *
i915_create_sampler_state(struct pipe_context *pipe,
const struct pipe_sampler_state *sampler)
@@ -217,10 +228,10 @@ i915_create_sampler_state(struct pipe_context *pipe,
minFilt = translate_img_filter( sampler->min_img_filter );
magFilt = translate_img_filter( sampler->mag_img_filter );
- if (sampler->max_anisotropy > 1.0)
+ if (sampler->max_anisotropy > 1)
minFilt = magFilt = FILTER_ANISOTROPIC;
- if (sampler->max_anisotropy > 2.0) {
+ if (sampler->max_anisotropy > 2) {
cso->state[0] |= SS2_MAX_ANISO_4;
}
@@ -334,11 +345,9 @@ i915_create_depth_stencil_state(struct pipe_context *pipe,
int fop = i915_translate_stencil_op(depth_stencil->stencil[0].fail_op);
int dfop = i915_translate_stencil_op(depth_stencil->stencil[0].zfail_op);
int dpop = i915_translate_stencil_op(depth_stencil->stencil[0].zpass_op);
- int ref = depth_stencil->stencil[0].ref_value & 0xff;
cso->stencil_LIS5 |= (S5_STENCIL_TEST_ENABLE |
S5_STENCIL_WRITE_ENABLE |
- (ref << S5_STENCIL_REF_SHIFT) |
(test << S5_STENCIL_TEST_FUNC_SHIFT) |
(fop << S5_STENCIL_FAIL_SHIFT) |
(dfop << S5_STENCIL_PASS_Z_FAIL_SHIFT) |
@@ -350,7 +359,6 @@ i915_create_depth_stencil_state(struct pipe_context *pipe,
int fop = i915_translate_stencil_op(depth_stencil->stencil[1].fail_op);
int dfop = i915_translate_stencil_op(depth_stencil->stencil[1].zfail_op);
int dpop = i915_translate_stencil_op(depth_stencil->stencil[1].zpass_op);
- int ref = depth_stencil->stencil[1].ref_value & 0xff;
int tmask = depth_stencil->stencil[1].valuemask & 0xff;
int wmask = depth_stencil->stencil[1].writemask & 0xff;
@@ -359,7 +367,6 @@ i915_create_depth_stencil_state(struct pipe_context *pipe,
BFO_ENABLE_STENCIL_TWO_SIDE |
BFO_ENABLE_STENCIL_REF |
BFO_STENCIL_TWO_SIDE |
- (ref << BFO_STENCIL_REF_SHIFT) |
(test << BFO_STENCIL_TEST_SHIFT) |
(fop << BFO_STENCIL_FAIL_SHIFT) |
(dfop << BFO_STENCIL_PASS_Z_FAIL_SHIFT) |
@@ -777,6 +784,7 @@ i915_init_state_functions( struct i915_context *i915 )
i915->base.delete_vs_state = i915_delete_vs_state;
i915->base.set_blend_color = i915_set_blend_color;
+ i915->base.set_stencil_ref = i915_set_stencil_ref;
i915->base.set_clip_state = i915_set_clip_state;
i915->base.set_constant_buffer = i915_set_constant_buffer;
i915->base.set_framebuffer_state = i915_set_framebuffer_state;
diff --git a/src/gallium/drivers/i915/i915_state_dynamic.c b/src/gallium/drivers/i915/i915_state_dynamic.c
index 86126a5a15..9c6723b391 100644
--- a/src/gallium/drivers/i915/i915_state_dynamic.c
+++ b/src/gallium/drivers/i915/i915_state_dynamic.c
@@ -94,9 +94,16 @@ const struct i915_tracked_state i915_upload_MODES4 = {
static void upload_BFO( struct i915_context *i915 )
{
+ unsigned bfo[2];
+ bfo[0] = i915->depth_stencil->bfo[0];
+ bfo[1] = i915->depth_stencil->bfo[1];
+ /* I don't get it only allowed to set a ref mask when the enable bit is set? */
+ if (bfo[0] & BFO_ENABLE_STENCIL_REF) {
+ bfo[0] |= i915->stencil_ref.ref_value[1] << BFO_STENCIL_REF_SHIFT;
+ }
set_dynamic_indirect( i915,
I915_DYNAMIC_BFO_0,
- &(i915->depth_stencil->bfo[0]),
+ &(bfo[0]),
2 );
}
diff --git a/src/gallium/drivers/i915/i915_state_immediate.c b/src/gallium/drivers/i915/i915_state_immediate.c
index 8c16bb4e27..d2c6f15143 100644
--- a/src/gallium/drivers/i915/i915_state_immediate.c
+++ b/src/gallium/drivers/i915/i915_state_immediate.c
@@ -129,6 +129,8 @@ static void upload_S5( struct i915_context *i915 )
unsigned LIS5 = 0;
LIS5 |= i915->depth_stencil->stencil_LIS5;
+ /* hope it's safe to set stencil ref value even if stencil test is disabled? */
+ LIS5 |= i915->stencil_ref.ref_value[0] << S5_STENCIL_REF_SHIFT;
LIS5 |= i915->blend->LIS5;