summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mesa/pipe/i915simple/i915_context.h8
-rw-r--r--src/mesa/pipe/i915simple/i915_state.c19
-rw-r--r--src/mesa/pipe/i915simple/i915_state_immediate.c10
3 files changed, 22 insertions, 15 deletions
diff --git a/src/mesa/pipe/i915simple/i915_context.h b/src/mesa/pipe/i915simple/i915_context.h
index 9958a8592d..dc19b6efeb 100644
--- a/src/mesa/pipe/i915simple/i915_context.h
+++ b/src/mesa/pipe/i915simple/i915_context.h
@@ -146,15 +146,19 @@ struct i915_sampler_state {
const struct pipe_sampler_state *templ;
};
+struct i915_alpha_test_state {
+ unsigned LIS6;
+};
+
struct i915_context
{
- struct pipe_context pipe;
+ struct pipe_context pipe;
struct i915_winsys *winsys;
struct draw_context *draw;
/* The most recent drawing state as set by the driver:
*/
- const struct pipe_alpha_test_state *alpha_test;
+ const struct i915_alpha_test_state *alpha_test;
const struct i915_blend_state *blend;
const struct i915_sampler_state *sampler[PIPE_MAX_SAMPLERS];
const struct i915_depth_stencil_state *depth_stencil;
diff --git a/src/mesa/pipe/i915simple/i915_state.c b/src/mesa/pipe/i915simple/i915_state.c
index 8bfd2da3b5..5c6d37a466 100644
--- a/src/mesa/pipe/i915simple/i915_state.c
+++ b/src/mesa/pipe/i915simple/i915_state.c
@@ -397,9 +397,19 @@ static void i915_delete_depth_stencil_state(struct pipe_context *pipe,
static void *
i915_create_alpha_test_state(struct pipe_context *pipe,
- const struct pipe_alpha_test_state *alpha)
+ const struct pipe_alpha_test_state *alpha_test)
{
- return 0;
+ struct i915_alpha_test_state *cso = calloc(1, sizeof(struct i915_alpha_test_state));
+
+ if (alpha_test->enabled) {
+ int test = i915_translate_compare_func(alpha_test->func);
+ ubyte refByte = float_to_ubyte(alpha_test->ref);
+
+ cso->LIS6 |= (S6_ALPHA_TEST_ENABLE |
+ (test << S6_ALPHA_TEST_FUNC_SHIFT) |
+ (((unsigned) refByte) << S6_ALPHA_REF_SHIFT));
+ }
+ return cso;
}
static void i915_bind_alpha_test_state(struct pipe_context *pipe,
@@ -407,7 +417,7 @@ static void i915_bind_alpha_test_state(struct pipe_context *pipe,
{
struct i915_context *i915 = i915_context(pipe);
- i915->alpha_test = (const struct pipe_alpha_test_state*)alpha;
+ i915->alpha_test = (const struct i915_alpha_test_state*)alpha;
i915->dirty |= I915_NEW_ALPHA_TEST;
}
@@ -415,6 +425,7 @@ static void i915_bind_alpha_test_state(struct pipe_context *pipe,
static void i915_delete_alpha_test_state(struct pipe_context *pipe,
void *alpha)
{
+ free(alpha);
}
static void i915_set_scissor_state( struct pipe_context *pipe,
@@ -650,7 +661,7 @@ static void i915_bind_rasterizer_state( struct pipe_context *pipe,
static void i915_delete_rasterizer_state(struct pipe_context *pipe,
void *setup)
{
- /* do nothing */
+ free(setup);
}
static void i915_set_vertex_buffer( struct pipe_context *pipe,
diff --git a/src/mesa/pipe/i915simple/i915_state_immediate.c b/src/mesa/pipe/i915simple/i915_state_immediate.c
index 014fddfdda..479d72a87f 100644
--- a/src/mesa/pipe/i915simple/i915_state_immediate.c
+++ b/src/mesa/pipe/i915simple/i915_state_immediate.c
@@ -121,15 +121,7 @@ static void upload_S6( struct i915_context *i915 )
/* I915_NEW_ALPHA_TEST
*/
- if (i915->alpha_test->enabled) {
- int test = i915_translate_compare_func(i915->alpha_test->func);
- ubyte refByte = float_to_ubyte(i915->alpha_test->ref);
-
-
- LIS6 |= (S6_ALPHA_TEST_ENABLE |
- (test << S6_ALPHA_TEST_FUNC_SHIFT) |
- (((unsigned) refByte) << S6_ALPHA_REF_SHIFT));
- }
+ LIS6 |= i915->alpha_test->LIS6;
/* I915_NEW_BLEND
*/