Mesa (master): llvmpipe: fix denorm handling for r11g11b10_float format when blending
Roland Scheidegger
sroland at kemper.freedesktop.org
Fri Jan 31 18:52:09 UTC 2014
Module: Mesa
Branch: master
Commit: 1d53603f1fb49dd839e427f161a8912cf58d80c8
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1d53603f1fb49dd839e427f161a8912cf58d80c8
Author: Roland Scheidegger <sroland at vmware.com>
Date: Fri Jan 31 19:47:37 2014 +0100
llvmpipe: fix denorm handling for r11g11b10_float format when blending
The code re-enabling denorms for small float formats did not recognize
this format due to format handling hacks (mainly, the lp_type doesn't have
the floating bit set).
Reviewed-by: Jose Fonseca <jfonseca at vmware.com>
---
src/gallium/drivers/llvmpipe/lp_state_fs.c | 17 +++++++++++++++--
1 file changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index a24fecd..2f9f907 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -1089,6 +1089,19 @@ scale_bits(struct gallivm_state *gallivm,
return result;
}
+/**
+ * If RT is a smallfloat (needing denorms) format
+ */
+static INLINE int
+have_smallfloat_format(struct lp_type dst_type,
+ enum pipe_format format)
+{
+ return ((dst_type.floating && dst_type.width != 32) ||
+ /* due to format handling hacks this format doesn't have floating set
+ * here (and actually has width set to 32 too) so special case this. */
+ (format == PIPE_FORMAT_R11G11B10_FLOAT));
+}
+
/**
* Convert from memory format to blending format
@@ -1593,7 +1606,7 @@ generate_unswizzled_blend(struct gallivm_state *gallivm,
* this, otherwise half-float format conversions won't work
* (again due to llvm bug #6393).
*/
- if (dst_type.floating && dst_type.width != 32) {
+ if (have_smallfloat_format(dst_type, out_format)) {
/* We need to make sure that denorms are ok for half float
conversions */
fpstate = lp_build_fpstate_get(gallivm);
@@ -2091,7 +2104,7 @@ generate_unswizzled_blend(struct gallivm_state *gallivm,
dst, dst_type, dst_count, dst_alignment);
}
- if (dst_type.floating && dst_type.width != 32) {
+ if (have_smallfloat_format(dst_type, out_format)) {
lp_build_fpstate_set(gallivm, fpstate);
}
More information about the mesa-commit
mailing list