diff options
author | Zack Rusin <zack@tungstengraphics.com> | 2007-09-21 07:06:19 -0400 |
---|---|---|
committer | Zack Rusin <zack@tungstengraphics.com> | 2007-09-21 07:06:19 -0400 |
commit | 42df29d3b9139f7b8bb757893bb8bf930585cc33 (patch) | |
tree | a4a30ea9df20a69011a030e18a94d5dd86576d7f /src | |
parent | 6cb87cf26f904b891faa42268f373864fa33541d (diff) |
Convert i915 to use cso semantics of alpha_test.
Diffstat (limited to 'src')
-rw-r--r-- | src/mesa/pipe/i915simple/i915_context.h | 8 | ||||
-rw-r--r-- | src/mesa/pipe/i915simple/i915_state.c | 19 | ||||
-rw-r--r-- | src/mesa/pipe/i915simple/i915_state_immediate.c | 10 |
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 */ |