summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2010-03-16 14:00:40 -0600
committerBrian Paul <[email protected]>2010-03-17 16:29:34 -0600
commiteee51147979208feffdf37c588ebbce4df6b40d6 (patch)
tree3700637ea30c706f1d1ffb577c26359595d772c4 /src
parent6379e47ebde2767ec88504313c4cf2d99ac44920 (diff)
llvmpipe: added stencil ref values to jit context state
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_jit.c27
-rw-r--r--src/gallium/drivers/llvmpipe/lp_jit.h17
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.c14
-rw-r--r--src/gallium/drivers/llvmpipe/lp_setup.h4
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_derived.c5
5 files changed, 48 insertions, 19 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c
index 4584135d335..0254272eeca 100644
--- a/src/gallium/drivers/llvmpipe/lp_jit.c
+++ b/src/gallium/drivers/llvmpipe/lp_jit.c
@@ -91,17 +91,18 @@ lp_jit_init_globals(struct llvmpipe_screen *screen)
/* struct lp_jit_context */
{
- LLVMTypeRef elem_types[8];
+ LLVMTypeRef elem_types[9];
LLVMTypeRef context_type;
elem_types[0] = LLVMPointerType(LLVMFloatType(), 0); /* constants */
elem_types[1] = LLVMFloatType(); /* alpha_ref_value */
- elem_types[2] = LLVMFloatType(); /* scissor_xmin */
- elem_types[3] = LLVMFloatType(); /* scissor_ymin */
- elem_types[4] = LLVMFloatType(); /* scissor_xmax */
- elem_types[5] = LLVMFloatType(); /* scissor_ymax */
- elem_types[6] = LLVMPointerType(LLVMInt8Type(), 0); /* blend_color */
- elem_types[7] = LLVMArrayType(texture_type, PIPE_MAX_SAMPLERS); /* textures */
+ elem_types[2] = LLVMArrayType(LLVMInt8Type(), 2); /* stencil_refs */
+ elem_types[3] = LLVMFloatType(); /* scissor_xmin */
+ elem_types[4] = LLVMFloatType(); /* scissor_ymin */
+ elem_types[5] = LLVMFloatType(); /* scissor_xmax */
+ elem_types[6] = LLVMFloatType(); /* scissor_ymax */
+ elem_types[7] = LLVMPointerType(LLVMInt8Type(), 0); /* blend_color */
+ elem_types[8] = LLVMArrayType(texture_type, PIPE_MAX_SAMPLERS); /* textures */
context_type = LLVMStructType(elem_types, Elements(elem_types), 0);
@@ -109,16 +110,18 @@ lp_jit_init_globals(struct llvmpipe_screen *screen)
screen->target, context_type, 0);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, alpha_ref_value,
screen->target, context_type, 1);
- LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, scissor_xmin,
+ LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, stencil_ref,
screen->target, context_type, 2);
- LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, scissor_ymin,
+ LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, scissor_xmin,
screen->target, context_type, 3);
- LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, scissor_xmax,
+ LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, scissor_ymin,
screen->target, context_type, 4);
- LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, scissor_ymax,
+ LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, scissor_xmax,
screen->target, context_type, 5);
- LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, blend_color,
+ LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, scissor_ymax,
screen->target, context_type, 6);
+ LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, blend_color,
+ screen->target, context_type, 7);
LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, textures,
screen->target, context_type,
LP_JIT_CONTEXT_TEXTURES_INDEX);
diff --git a/src/gallium/drivers/llvmpipe/lp_jit.h b/src/gallium/drivers/llvmpipe/lp_jit.h
index 13167ae3bf4..6864265ed02 100644
--- a/src/gallium/drivers/llvmpipe/lp_jit.h
+++ b/src/gallium/drivers/llvmpipe/lp_jit.h
@@ -84,6 +84,8 @@ struct lp_jit_context
float alpha_ref_value;
+ ubyte stencil_ref[2];
+
/** floats, not ints */
float scissor_xmin, scissor_ymin, scissor_xmax, scissor_ymax;
@@ -100,22 +102,25 @@ struct lp_jit_context
#define lp_jit_context_alpha_ref_value(_builder, _ptr) \
lp_build_struct_get(_builder, _ptr, 1, "alpha_ref_value")
+#define lp_jit_context_stencil_ref_value(_builder, _ptr) \
+ lp_build_struct_get(_builder, _ptr, 2, "stencil_ref_values")
+
#define lp_jit_context_scissor_xmin_value(_builder, _ptr) \
- lp_build_struct_get(_builder, _ptr, 2, "scissor_xmin")
+ lp_build_struct_get(_builder, _ptr, 3, "scissor_xmin")
#define lp_jit_context_scissor_ymin_value(_builder, _ptr) \
- lp_build_struct_get(_builder, _ptr, 3, "scissor_ymin")
+ lp_build_struct_get(_builder, _ptr, 4, "scissor_ymin")
#define lp_jit_context_scissor_xmax_value(_builder, _ptr) \
- lp_build_struct_get(_builder, _ptr, 4, "scissor_xmax")
+ lp_build_struct_get(_builder, _ptr, 5, "scissor_xmax")
#define lp_jit_context_scissor_ymax_value(_builder, _ptr) \
- lp_build_struct_get(_builder, _ptr, 5, "scissor_ymax")
+ lp_build_struct_get(_builder, _ptr, 6, "scissor_ymax")
#define lp_jit_context_blend_color(_builder, _ptr) \
- lp_build_struct_get(_builder, _ptr, 6, "blend_color")
+ lp_build_struct_get(_builder, _ptr, 7, "blend_color")
-#define LP_JIT_CONTEXT_TEXTURES_INDEX 7
+#define LP_JIT_CONTEXT_TEXTURES_INDEX 8
#define lp_jit_context_textures(_builder, _ptr) \
lp_build_struct_get_ptr(_builder, _ptr, LP_JIT_CONTEXT_TEXTURES_INDEX, "textures")
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c
index cd16b6b2d38..bcc9d1fc1a4 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.c
+++ b/src/gallium/drivers/llvmpipe/lp_setup.c
@@ -402,6 +402,20 @@ lp_setup_set_alpha_ref_value( struct lp_setup_context *setup,
}
void
+lp_setup_set_stencil_ref_values( struct lp_setup_context *setup,
+ const ubyte refs[2] )
+{
+ LP_DBG(DEBUG_SETUP, "%s %d %d\n", __FUNCTION__, refs[0], refs[1]);
+
+ if (setup->fs.current.jit_context.stencil_ref[0] != refs[0] ||
+ setup->fs.current.jit_context.stencil_ref[1] != refs[1]) {
+ setup->fs.current.jit_context.stencil_ref[0] = refs[0];
+ setup->fs.current.jit_context.stencil_ref[1] = refs[1];
+ setup->dirty |= LP_SETUP_NEW_FS;
+ }
+}
+
+void
lp_setup_set_blend_color( struct lp_setup_context *setup,
const struct pipe_blend_color *blend_color )
{
diff --git a/src/gallium/drivers/llvmpipe/lp_setup.h b/src/gallium/drivers/llvmpipe/lp_setup.h
index 414eaec98d1..dbfc1bf8d4c 100644
--- a/src/gallium/drivers/llvmpipe/lp_setup.h
+++ b/src/gallium/drivers/llvmpipe/lp_setup.h
@@ -113,6 +113,10 @@ lp_setup_set_alpha_ref_value( struct lp_setup_context *setup,
float alpha_ref_value );
void
+lp_setup_set_stencil_ref_values( struct lp_setup_context *setup,
+ const ubyte refs[2] );
+
+void
lp_setup_set_blend_color( struct lp_setup_context *setup,
const struct pipe_blend_color *blend_color );
diff --git a/src/gallium/drivers/llvmpipe/lp_state_derived.c b/src/gallium/drivers/llvmpipe/lp_state_derived.c
index 9c91ce9238f..777871638f6 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_derived.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_derived.c
@@ -174,9 +174,12 @@ void llvmpipe_update_derived( struct llvmpipe_context *llvmpipe )
if (llvmpipe->dirty & LP_NEW_SCISSOR)
lp_setup_set_scissor(llvmpipe->setup, &llvmpipe->scissor);
- if (llvmpipe->dirty & LP_NEW_DEPTH_STENCIL_ALPHA)
+ if (llvmpipe->dirty & LP_NEW_DEPTH_STENCIL_ALPHA) {
lp_setup_set_alpha_ref_value(llvmpipe->setup,
llvmpipe->depth_stencil->alpha.ref_value);
+ lp_setup_set_stencil_ref_values(llvmpipe->setup,
+ llvmpipe->stencil_ref.ref_value);
+ }
if (llvmpipe->dirty & LP_NEW_CONSTANTS)
lp_setup_set_fs_constants(llvmpipe->setup,