diff options
author | Dave Airlie <[email protected]> | 2020-04-22 10:05:59 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2020-04-27 12:35:24 +1000 |
commit | 1f071db43a676c17c1765434ed0abfcf3d659815 (patch) | |
tree | 7cb800cb7fee31dbcefcf8c0d7f5d85e72ad4d0f /src/gallium/auxiliary | |
parent | fe5a8e1ace61cead276d0293c595536b1b9e48c8 (diff) |
llvmpipe: fix d32 unorm depth conversions.
When the depth value was 1.0 and was being converted to Z32_UNORM
the conversion would scale it up to INT32_MAX + 1 which would
cause FPToSI to give incorrect results, changing it to use
FPToUI for the unsigned 32-bit case only fixes it.
Fixes:
GTF-GL45.gtf30.GL3Tests.depth_texture.depth_texture_fbo_clear
Reviewed-by: Roland Scheidegger <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4574>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_conv.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_conv.c b/src/gallium/auxiliary/gallivm/lp_bld_conv.c index c688965a73e..579801ca93a 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_conv.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_conv.c @@ -321,7 +321,10 @@ lp_build_clamped_float_to_unsigned_norm(struct gallivm_state *gallivm, res = LLVMBuildFMul(builder, src, lp_build_const_vec(gallivm, src_type, scale), ""); - res = LLVMBuildFPToSI(builder, res, int_vec_type, ""); + if (!src_type.sign && src_type.width == 32) + res = LLVMBuildFPToUI(builder, res, int_vec_type, ""); + else + res = LLVMBuildFPToSI(builder, res, int_vec_type, ""); /* * Align the most significant bit to its final place. |