summaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/i915simple
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/pipe/i915simple')
-rw-r--r--src/mesa/pipe/i915simple/i915_context.h22
-rw-r--r--src/mesa/pipe/i915simple/i915_state.c44
-rw-r--r--src/mesa/pipe/i915simple/i915_state_dynamic.c24
-rw-r--r--src/mesa/pipe/i915simple/i915_state_immediate.c22
4 files changed, 59 insertions, 53 deletions
diff --git a/src/mesa/pipe/i915simple/i915_context.h b/src/mesa/pipe/i915simple/i915_context.h
index 51baa281ec5..518f780449b 100644
--- a/src/mesa/pipe/i915simple/i915_context.h
+++ b/src/mesa/pipe/i915simple/i915_context.h
@@ -125,19 +125,18 @@ struct i915_context
*/
const struct pipe_blend_state *blend;
const struct pipe_sampler_state *sampler[PIPE_MAX_SAMPLERS];
+ const struct pipe_depth_stencil_state *depth_stencil;
struct pipe_alpha_test_state alpha_test;
struct pipe_blend_color blend_color;
struct pipe_clear_color_state clear_color;
struct pipe_clip_state clip;
struct pipe_constant_buffer constants[PIPE_SHADER_TYPES];
- struct pipe_depth_state depth_test;
struct pipe_framebuffer_state framebuffer;
struct pipe_shader_state fs;
struct pipe_poly_stipple poly_stipple;
struct pipe_scissor_state scissor;
struct pipe_setup_state setup;
- struct pipe_stencil_state stencil;
struct pipe_mipmap_tree *texture[PIPE_MAX_SAMPLERS];
struct pipe_viewport_state viewport;
struct pipe_vertex_buffer vertex_buffer[PIPE_ATTRIB_MAX];
@@ -163,16 +162,15 @@ struct i915_context
#define I915_NEW_SETUP 0x2
#define I915_NEW_FS 0x4
#define I915_NEW_BLEND 0x8
-#define I915_NEW_CLIP 0x10
-#define I915_NEW_SCISSOR 0x20
-#define I915_NEW_STIPPLE 0x40
-#define I915_NEW_FRAMEBUFFER 0x80
-#define I915_NEW_ALPHA_TEST 0x100
-#define I915_NEW_DEPTH_TEST 0x200
-#define I915_NEW_SAMPLER 0x400
-#define I915_NEW_TEXTURE 0x800
-#define I915_NEW_STENCIL 0x1000
-#define I915_NEW_CONSTANTS 0x2000
+#define I915_NEW_CLIP 0x10
+#define I915_NEW_SCISSOR 0x20
+#define I915_NEW_STIPPLE 0x40
+#define I915_NEW_FRAMEBUFFER 0x80
+#define I915_NEW_ALPHA_TEST 0x100
+#define I915_NEW_DEPTH_STENCIL 0x200
+#define I915_NEW_SAMPLER 0x400
+#define I915_NEW_TEXTURE 0x800
+#define I915_NEW_CONSTANTS 0x1000
/* Driver's internally generated state flags:
diff --git a/src/mesa/pipe/i915simple/i915_state.c b/src/mesa/pipe/i915simple/i915_state.c
index 10060b45a4f..5ac2e27d1a6 100644
--- a/src/mesa/pipe/i915simple/i915_state.c
+++ b/src/mesa/pipe/i915simple/i915_state.c
@@ -107,38 +107,44 @@ static void i915_delete_sampler_state(struct pipe_context *pipe,
/** XXX move someday? Or consolidate all these simple state setters
* into one file.
*/
-static void i915_set_depth_test_state(struct pipe_context *pipe,
- const struct pipe_depth_state *depth)
-{
- struct i915_context *i915 = i915_context(pipe);
- i915->depth_test = *depth;
+static const struct pipe_depth_stencil_state *
+i915_create_depth_stencil_state(struct pipe_context *pipe,
+ const struct pipe_depth_stencil_state *depth_stencil)
+{
+ struct pipe_depth_stencil_state *new_ds =
+ malloc(sizeof(struct pipe_depth_stencil_state));
+ memcpy(new_ds, depth_stencil, sizeof(struct pipe_depth_stencil_state));
- i915->dirty |= I915_NEW_DEPTH_TEST;
+ return new_ds;
}
-static void i915_set_alpha_test_state(struct pipe_context *pipe,
- const struct pipe_alpha_test_state *alpha)
+static void i915_bind_depth_stencil_state(struct pipe_context *pipe,
+ const struct pipe_depth_stencil_state *depth_stencil)
{
struct i915_context *i915 = i915_context(pipe);
- i915->alpha_test = *alpha;
+ i915->depth_stencil = depth_stencil;
- i915->dirty |= I915_NEW_ALPHA_TEST;
+ i915->dirty |= I915_NEW_DEPTH_STENCIL;
}
-static void i915_set_stencil_state(struct pipe_context *pipe,
- const struct pipe_stencil_state *stencil)
+static void i915_delete_depth_stencil_state(struct pipe_context *pipe,
+ const struct pipe_depth_stencil_state *depth_stencil)
+{
+ free((struct pipe_depth_stencil_state *)depth_stencil);
+}
+
+static void i915_set_alpha_test_state(struct pipe_context *pipe,
+ const struct pipe_alpha_test_state *alpha)
{
struct i915_context *i915 = i915_context(pipe);
- i915->stencil = *stencil;
+ i915->alpha_test = *alpha;
- i915->dirty |= I915_NEW_STENCIL;
+ i915->dirty |= I915_NEW_ALPHA_TEST;
}
-
-
static void i915_set_scissor_state( struct pipe_context *pipe,
const struct pipe_scissor_state *scissor )
{
@@ -328,19 +334,21 @@ i915_init_state_functions( struct i915_context *i915 )
i915->pipe.bind_sampler_state = i915_bind_sampler_state;
i915->pipe.delete_sampler_state = i915_delete_sampler_state;
+ i915->pipe.create_depth_stencil_state = i915_create_depth_stencil_state;
+ i915->pipe.bind_depth_stencil_state = i915_bind_depth_stencil_state;
+ i915->pipe.delete_depth_stencil_state = i915_delete_depth_stencil_state;
+
i915->pipe.set_alpha_test_state = i915_set_alpha_test_state;
i915->pipe.set_blend_color = i915_set_blend_color;
i915->pipe.set_clip_state = i915_set_clip_state;
i915->pipe.set_clear_color_state = i915_set_clear_color_state;
i915->pipe.set_constant_buffer = i915_set_constant_buffer;
- i915->pipe.set_depth_state = i915_set_depth_test_state;
i915->pipe.set_framebuffer_state = i915_set_framebuffer_state;
i915->pipe.set_fs_state = i915_set_fs_state;
i915->pipe.set_vs_state = i915_set_vs_state;
i915->pipe.set_polygon_stipple = i915_set_polygon_stipple;
i915->pipe.set_scissor_state = i915_set_scissor_state;
i915->pipe.set_setup_state = i915_set_setup_state;
- i915->pipe.set_stencil_state = i915_set_stencil_state;
i915->pipe.set_texture_state = i915_set_texture_state;
i915->pipe.set_viewport_state = i915_set_viewport_state;
i915->pipe.set_vertex_buffer = i915_set_vertex_buffer;
diff --git a/src/mesa/pipe/i915simple/i915_state_dynamic.c b/src/mesa/pipe/i915simple/i915_state_dynamic.c
index 49a30fac115..9140eee7c29 100644
--- a/src/mesa/pipe/i915simple/i915_state_dynamic.c
+++ b/src/mesa/pipe/i915simple/i915_state_dynamic.c
@@ -68,8 +68,8 @@ static void upload_MODES4( struct i915_context *i915 )
/* I915_NEW_STENCIL */
{
- int testmask = i915->stencil.value_mask[0] & 0xff;
- int writemask = i915->stencil.write_mask[0] & 0xff;
+ int testmask = i915->depth_stencil->stencil.value_mask[0] & 0xff;
+ int writemask = i915->depth_stencil->stencil.write_mask[0] & 0xff;
modes4 |= (_3DSTATE_MODES_4_CMD |
ENABLE_STENCIL_TEST_MASK |
@@ -94,7 +94,7 @@ static void upload_MODES4( struct i915_context *i915 )
}
const struct i915_tracked_state i915_upload_MODES4 = {
- .dirty = I915_NEW_BLEND | I915_NEW_STENCIL,
+ .dirty = I915_NEW_BLEND | I915_NEW_DEPTH_STENCIL,
.update = upload_MODES4
};
@@ -112,14 +112,14 @@ static void upload_BFO( struct i915_context *i915 )
/* _NEW_STENCIL
*/
- if (i915->stencil.back_enabled) {
- int test = i915_translate_compare_func(i915->stencil.back_func);
- int fop = i915_translate_stencil_op(i915->stencil.back_fail_op);
- int dfop = i915_translate_stencil_op(i915->stencil.back_zfail_op);
- int dpop = i915_translate_stencil_op(i915->stencil.back_zpass_op);
- int ref = i915->stencil.ref_value[1] & 0xff;
- int tmask = i915->stencil.value_mask[1] & 0xff;
- int wmask = i915->stencil.write_mask[1] & 0xff;
+ if (i915->depth_stencil->stencil.back_enabled) {
+ int test = i915_translate_compare_func(i915->depth_stencil->stencil.back_func);
+ int fop = i915_translate_stencil_op(i915->depth_stencil->stencil.back_fail_op);
+ int dfop = i915_translate_stencil_op(i915->depth_stencil->stencil.back_zfail_op);
+ int dpop = i915_translate_stencil_op(i915->depth_stencil->stencil.back_zpass_op);
+ int ref = i915->depth_stencil->stencil.ref_value[1] & 0xff;
+ int tmask = i915->depth_stencil->stencil.value_mask[1] & 0xff;
+ int wmask = i915->depth_stencil->stencil.write_mask[1] & 0xff;
bf[0] = (_3DSTATE_BACKFACE_STENCIL_OPS |
BFO_ENABLE_STENCIL_FUNCS |
@@ -157,7 +157,7 @@ static void upload_BFO( struct i915_context *i915 )
}
const struct i915_tracked_state i915_upload_BFO = {
- .dirty = I915_NEW_STENCIL,
+ .dirty = I915_NEW_DEPTH_STENCIL,
.update = upload_BFO
};
diff --git a/src/mesa/pipe/i915simple/i915_state_immediate.c b/src/mesa/pipe/i915simple/i915_state_immediate.c
index aaca534f5ad..484913d308c 100644
--- a/src/mesa/pipe/i915simple/i915_state_immediate.c
+++ b/src/mesa/pipe/i915simple/i915_state_immediate.c
@@ -128,12 +128,12 @@ static void upload_S5( struct i915_context *i915 )
unsigned LIS5 = 0;
/* I915_NEW_STENCIL */
- if (i915->stencil.front_enabled) {
- int test = i915_translate_compare_func(i915->stencil.front_func);
- int fop = i915_translate_stencil_op(i915->stencil.front_fail_op);
- int dfop = i915_translate_stencil_op(i915->stencil.front_zfail_op);
- int dpop = i915_translate_stencil_op(i915->stencil.front_zpass_op);
- int ref = i915->stencil.ref_value[0] & 0xff;
+ if (i915->depth_stencil->stencil.front_enabled) {
+ int test = i915_translate_compare_func(i915->depth_stencil->stencil.front_func);
+ int fop = i915_translate_stencil_op(i915->depth_stencil->stencil.front_fail_op);
+ int dfop = i915_translate_stencil_op(i915->depth_stencil->stencil.front_zfail_op);
+ int dpop = i915_translate_stencil_op(i915->depth_stencil->stencil.front_zpass_op);
+ int ref = i915->depth_stencil->stencil.ref_value[0] & 0xff;
LIS5 |= (S5_STENCIL_TEST_ENABLE |
S5_STENCIL_WRITE_ENABLE |
@@ -179,7 +179,7 @@ static void upload_S5( struct i915_context *i915 )
}
const struct i915_tracked_state i915_upload_S5 = {
- .dirty = (I915_NEW_STENCIL | I915_NEW_BLEND | I915_NEW_SETUP),
+ .dirty = (I915_NEW_DEPTH_STENCIL | I915_NEW_BLEND | I915_NEW_SETUP),
.update = upload_S5
};
@@ -219,13 +219,13 @@ static void upload_S6( struct i915_context *i915 )
/* I915_NEW_DEPTH
*/
- if (i915->depth_test.enabled) {
- int func = i915_translate_compare_func(i915->depth_test.func);
+ if (i915->depth_stencil->depth.enabled) {
+ int func = i915_translate_compare_func(i915->depth_stencil->depth.func);
LIS6 |= (S6_DEPTH_TEST_ENABLE |
(func << S6_DEPTH_TEST_FUNC_SHIFT));
- if (i915->depth_test.writemask)
+ if (i915->depth_stencil->depth.writemask)
LIS6 |= S6_DEPTH_WRITE_ENABLE;
}
@@ -236,7 +236,7 @@ static void upload_S6( struct i915_context *i915 )
}
const struct i915_tracked_state i915_upload_S6 = {
- .dirty = I915_NEW_ALPHA_TEST | I915_NEW_BLEND | I915_NEW_DEPTH_TEST,
+ .dirty = I915_NEW_ALPHA_TEST | I915_NEW_BLEND | I915_NEW_DEPTH_STENCIL,
.update = upload_S6
};