diff options
author | Brian Paul <[email protected]> | 2010-03-18 11:31:38 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2010-03-18 11:31:38 -0600 |
commit | 521c61ff017ab15b829abbe9a98b179136a36009 (patch) | |
tree | 9e1d207b35b732e69d67933c16e586aea0f83677 /src/gallium/drivers | |
parent | ecf85c7d750478e433e640897bb25a18069f14de (diff) |
gallivm/llvmpipe: simplify front/back stencil ref value handling
Instead of passing an array, just pass two scalar values.
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_jit.c | 10 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_jit.h | 12 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_setup.c | 8 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_state_fs.c | 7 |
4 files changed, 23 insertions, 14 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c index 1eee9212e6f..927e472ff26 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.c +++ b/src/gallium/drivers/llvmpipe/lp_jit.c @@ -96,7 +96,8 @@ lp_jit_init_globals(struct llvmpipe_screen *screen) elem_types[LP_JIT_CTX_CONSTANTS] = LLVMPointerType(LLVMFloatType(), 0); elem_types[LP_JIT_CTX_ALPHA_REF] = LLVMFloatType(); - elem_types[LP_JIT_CTX_STENCIL_REF] = LLVMArrayType(LLVMInt8Type(), 2); + elem_types[LP_JIT_CTX_STENCIL_REF_FRONT] = LLVMInt32Type(); + elem_types[LP_JIT_CTX_STENCIL_REF_BACK] = LLVMInt32Type(); elem_types[LP_JIT_CTX_SCISSOR_XMIN] = LLVMFloatType(); elem_types[LP_JIT_CTX_SCISSOR_YMIN] = LLVMFloatType(); elem_types[LP_JIT_CTX_SCISSOR_XMAX] = LLVMFloatType(); @@ -113,9 +114,12 @@ lp_jit_init_globals(struct llvmpipe_screen *screen) LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, alpha_ref_value, screen->target, context_type, LP_JIT_CTX_ALPHA_REF); - LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, stencil_ref, + LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, stencil_ref_front, screen->target, context_type, - LP_JIT_CTX_STENCIL_REF); + LP_JIT_CTX_STENCIL_REF_FRONT); + LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, stencil_ref_back, + screen->target, context_type, + LP_JIT_CTX_STENCIL_REF_BACK); LP_CHECK_MEMBER_OFFSET(struct lp_jit_context, scissor_xmin, screen->target, context_type, LP_JIT_CTX_SCISSOR_XMIN); diff --git a/src/gallium/drivers/llvmpipe/lp_jit.h b/src/gallium/drivers/llvmpipe/lp_jit.h index 63e05c5d5e1..bbd0c9610de 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.h +++ b/src/gallium/drivers/llvmpipe/lp_jit.h @@ -84,7 +84,7 @@ struct lp_jit_context float alpha_ref_value; - uint8_t stencil_ref[2]; + uint32_t stencil_ref_front, stencil_ref_back; /** floats, not ints */ float scissor_xmin, scissor_ymin, scissor_xmax, scissor_ymax; @@ -103,7 +103,8 @@ struct lp_jit_context enum { LP_JIT_CTX_CONSTANTS = 0, LP_JIT_CTX_ALPHA_REF, - LP_JIT_CTX_STENCIL_REF, + LP_JIT_CTX_STENCIL_REF_FRONT, + LP_JIT_CTX_STENCIL_REF_BACK, LP_JIT_CTX_SCISSOR_XMIN, LP_JIT_CTX_SCISSOR_YMIN, LP_JIT_CTX_SCISSOR_XMAX, @@ -120,8 +121,11 @@ enum { #define lp_jit_context_alpha_ref_value(_builder, _ptr) \ lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_ALPHA_REF, "alpha_ref_value") -#define lp_jit_context_stencil_ref_values(_builder, _ptr) \ - lp_build_struct_get_ptr(_builder, _ptr, LP_JIT_CTX_STENCIL_REF, "stencil_ref") +#define lp_jit_context_stencil_ref_front_value(_builder, _ptr) \ + lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_STENCIL_REF_FRONT, "stencil_ref_front") + +#define lp_jit_context_stencil_ref_back_value(_builder, _ptr) \ + lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_STENCIL_REF_BACK, "stencil_ref_back") #define lp_jit_context_scissor_xmin_value(_builder, _ptr) \ lp_build_struct_get(_builder, _ptr, LP_JIT_CTX_SCISSOR_XMIN, "scissor_xmin") diff --git a/src/gallium/drivers/llvmpipe/lp_setup.c b/src/gallium/drivers/llvmpipe/lp_setup.c index bcc9d1fc1a4..fbb0d6f8a60 100644 --- a/src/gallium/drivers/llvmpipe/lp_setup.c +++ b/src/gallium/drivers/llvmpipe/lp_setup.c @@ -407,10 +407,10 @@ lp_setup_set_stencil_ref_values( struct lp_setup_context *setup, { 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]; + if (setup->fs.current.jit_context.stencil_ref_front != refs[0] || + setup->fs.current.jit_context.stencil_ref_back != refs[1]) { + setup->fs.current.jit_context.stencil_ref_front = refs[0]; + setup->fs.current.jit_context.stencil_ref_back = refs[1]; setup->dirty |= LP_SETUP_NEW_FS; } } diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c index 921c51fbe84..0f96654a673 100644 --- a/src/gallium/drivers/llvmpipe/lp_state_fs.c +++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c @@ -145,7 +145,7 @@ generate_depth_stencil(LLVMBuilderRef builder, const struct lp_fragment_shader_variant_key *key, struct lp_type src_type, struct lp_build_mask_context *mask, - LLVMValueRef stencil_refs, + LLVMValueRef stencil_refs[2], LLVMValueRef src, LLVMValueRef dst_ptr) { @@ -408,7 +408,7 @@ generate_fs(struct llvmpipe_context *lp, LLVMValueRef consts_ptr; LLVMValueRef outputs[PIPE_MAX_SHADER_OUTPUTS][NUM_CHANNELS]; LLVMValueRef z = interp->pos[2]; - LLVMValueRef stencil_refs; + LLVMValueRef stencil_refs[2]; struct lp_build_flow_context *flow; struct lp_build_mask_context mask; boolean early_depth_stencil_test; @@ -418,7 +418,8 @@ generate_fs(struct llvmpipe_context *lp, assert(i < 4); - stencil_refs = lp_jit_context_stencil_ref_values(builder, context_ptr); + stencil_refs[0] = lp_jit_context_stencil_ref_front_value(builder, context_ptr); + stencil_refs[1] = lp_jit_context_stencil_ref_back_value(builder, context_ptr); elem_type = lp_build_elem_type(type); vec_type = lp_build_vec_type(type); |