diff options
author | Roland Scheidegger <[email protected]> | 2013-06-19 23:42:28 +0200 |
---|---|---|
committer | Roland Scheidegger <[email protected]> | 2013-06-19 23:47:36 +0200 |
commit | 5c9aee111effea2f16437bb3c5b5ad5c69cd7aed (patch) | |
tree | 87d75dbc38613033372174bd3c6c60f57fd4066a /src/gallium/drivers | |
parent | dc5dc4fd943e1da5207e0489c355e9a7ba1dff87 (diff) |
llvmpipe: use 64bit counter for occlusion queries
Some APIs require 64bit and at least for 64bit archs the overhead
should be minimal.
Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/drivers')
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_bld_depth.c | 11 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_jit.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/llvmpipe/lp_jit.h | 2 |
3 files changed, 10 insertions, 5 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_bld_depth.c b/src/gallium/drivers/llvmpipe/lp_bld_depth.c index edb59cc8db6..79891cf5d83 100644 --- a/src/gallium/drivers/llvmpipe/lp_bld_depth.c +++ b/src/gallium/drivers/llvmpipe/lp_bld_depth.c @@ -429,7 +429,7 @@ get_s_shift_and_mask(const struct util_format_description *format_desc, * Test the depth mask. Add the number of channel which has none zero mask * into the occlusion counter. e.g. maskvalue is {-1, -1, -1, -1}. * The counter will add 4. - * TODO: could get that out of the loop, and need to use 64bit counter. + * TODO: could get that out of the fs loop. * * \param type holds element type of the mask vector. * \param maskvalue is the depth test mask. @@ -458,6 +458,7 @@ lp_build_occlusion_count(struct gallivm_state *gallivm, LLVMInt32TypeInContext(context), bits); count = lp_build_intrinsic_unary(builder, popcntintr, LLVMInt32TypeInContext(context), bits); + count = LLVMBuildZExt(builder, count, LLVMIntTypeInContext(context, 64), ""); } else if(util_cpu_caps.has_avx && type.length == 8) { const char *movmskintr = "llvm.x86.avx.movmsk.ps.256"; @@ -468,6 +469,7 @@ lp_build_occlusion_count(struct gallivm_state *gallivm, LLVMInt32TypeInContext(context), bits); count = lp_build_intrinsic_unary(builder, popcntintr, LLVMInt32TypeInContext(context), bits); + count = LLVMBuildZExt(builder, count, LLVMIntTypeInContext(context, 64), ""); } else { unsigned i; @@ -510,8 +512,11 @@ lp_build_occlusion_count(struct gallivm_state *gallivm, } count = lp_build_intrinsic_unary(builder, popcntintr, counttype, countd); - if (type.length > 4) { - count = LLVMBuildTrunc(builder, count, LLVMIntTypeInContext(context, 32), ""); + if (type.length > 8) { + count = LLVMBuildTrunc(builder, count, LLVMIntTypeInContext(context, 64), ""); + } + else if (type.length < 8) { + count = LLVMBuildZExt(builder, count, LLVMIntTypeInContext(context, 64), ""); } } newcount = LLVMBuildLoad(builder, counter, "origcount"); diff --git a/src/gallium/drivers/llvmpipe/lp_jit.c b/src/gallium/drivers/llvmpipe/lp_jit.c index f517b67fff6..fa0f128ee3f 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.c +++ b/src/gallium/drivers/llvmpipe/lp_jit.c @@ -195,7 +195,7 @@ lp_jit_create_types(struct lp_fragment_shader_variant *lp) LLVMTypeRef elem_types[LP_JIT_THREAD_DATA_COUNT]; LLVMTypeRef thread_data_type; - elem_types[LP_JIT_THREAD_DATA_COUNTER] = LLVMInt32TypeInContext(lc); + elem_types[LP_JIT_THREAD_DATA_COUNTER] = LLVMInt64TypeInContext(lc); thread_data_type = LLVMStructTypeInContext(lc, elem_types, Elements(elem_types), 0); diff --git a/src/gallium/drivers/llvmpipe/lp_jit.h b/src/gallium/drivers/llvmpipe/lp_jit.h index 2ecfde75a09..30cfaaef5d6 100644 --- a/src/gallium/drivers/llvmpipe/lp_jit.h +++ b/src/gallium/drivers/llvmpipe/lp_jit.h @@ -164,7 +164,7 @@ enum { struct lp_jit_thread_data { - uint32_t vis_counter; + uint64_t vis_counter; }; |