aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/pipe/i915simple/i915_state.c
diff options
context:
space:
mode:
authorZack Rusin <[email protected]>2007-09-21 07:06:19 -0400
committerZack Rusin <[email protected]>2007-09-21 07:06:19 -0400
commit42df29d3b9139f7b8bb757893bb8bf930585cc33 (patch)
treea4a30ea9df20a69011a030e18a94d5dd86576d7f /src/mesa/pipe/i915simple/i915_state.c
parent6cb87cf26f904b891faa42268f373864fa33541d (diff)
Convert i915 to use cso semantics of alpha_test.
Diffstat (limited to 'src/mesa/pipe/i915simple/i915_state.c')
-rw-r--r--src/mesa/pipe/i915simple/i915_state.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/mesa/pipe/i915simple/i915_state.c b/src/mesa/pipe/i915simple/i915_state.c
index 8bfd2da3b5c..5c6d37a4661 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,