aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/llvmpipe/lp_state_fs.c
diff options
context:
space:
mode:
authorRoland Scheidegger <[email protected]>2016-12-21 04:52:16 +0100
committerRoland Scheidegger <[email protected]>2017-01-05 23:59:38 +0100
commitdb7e786a2552d808e512ba33fbc9b19d8bb37108 (patch)
treedee13e7ebefbe6e98096a3a58a33c738267be9ef /src/gallium/drivers/llvmpipe/lp_state_fs.c
parenta8eeb089c0e2e171ffaf8cba3cd0e5aea97b388f (diff)
llvmpipe: (trivial) minimally simplify mask construction
simd instruction sets usually have comparisons for equal, not unequal. So use a different comparison against the mask itself - which also means we don't need a all-zero as well as a all-one (for the pxor) reg. Also add code to avoid scalar expansion of i1 values which we definitely shouldn't do. There's problems with this though with llvm select interaction, so it's disabled (basically using llvm select instead of intrinsics may still produce atrocious code, even in cases where we figured it should not, albeit I think this could probably be fixed with some better selection of optimization passes, but I have zero idea there really). Reviewed-by: Jose Fonseca <[email protected]>
Diffstat (limited to 'src/gallium/drivers/llvmpipe/lp_state_fs.c')
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 09108159feb..a36389ccc32 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -127,7 +127,7 @@ generate_quad_mask(struct gallivm_state *gallivm,
struct lp_type mask_type;
LLVMTypeRef i32t = LLVMInt32TypeInContext(gallivm->context);
LLVMValueRef bits[16];
- LLVMValueRef mask;
+ LLVMValueRef mask, bits_vec;
int shift, i;
/*
@@ -179,15 +179,15 @@ generate_quad_mask(struct gallivm_state *gallivm,
bits[4*i + 2] = LLVMConstInt(i32t, 1ULL << (j + 4), 0);
bits[4*i + 3] = LLVMConstInt(i32t, 1ULL << (j + 5), 0);
}
- mask = LLVMBuildAnd(builder, mask, LLVMConstVector(bits, fs_type.length), "");
+ bits_vec = LLVMConstVector(bits, fs_type.length);
+ mask = LLVMBuildAnd(builder, mask, bits_vec, "");
/*
- * mask = mask != 0 ? ~0 : 0
+ * mask = mask == bits ? ~0 : 0
*/
mask = lp_build_compare(gallivm,
- mask_type, PIPE_FUNC_NOTEQUAL,
- mask,
- lp_build_const_int_vec(gallivm, mask_type, 0));
+ mask_type, PIPE_FUNC_EQUAL,
+ mask, bits_vec);
return mask;
}
@@ -2476,8 +2476,10 @@ dump_fs_variant_key(const struct lp_fragment_shader_variant_key *key)
for (i = 0; i < key->nr_cbufs; ++i) {
debug_printf("cbuf_format[%u] = %s\n", i, util_format_name(key->cbuf_format[i]));
}
- if (key->depth.enabled) {
+ if (key->depth.enabled || key->stencil[0].enabled) {
debug_printf("depth.format = %s\n", util_format_name(key->zsbuf_format));
+ }
+ if (key->depth.enabled) {
debug_printf("depth.func = %s\n", util_dump_func(key->depth.func, TRUE));
debug_printf("depth.writemask = %u\n", key->depth.writemask);
}