Commit 42df29d3 authored by Zack Rusin's avatar Zack Rusin

Convert i915 to use cso semantics of alpha_test.

parent 6cb87cf2
......@@ -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;
......
......@@ -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,
......
......@@ -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
*/
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment