gallium/radeon: make S_FIXED function signed and move it to shared code
authorMarek Olšák <marek.olsak@amd.com>
Tue, 25 Jul 2017 15:29:58 +0000 (17:29 +0200)
committerMarek Olšák <marek.olsak@amd.com>
Wed, 26 Jul 2017 17:53:26 +0000 (19:53 +0200)
This fixes a bug uncovered by:
    2412c4c81ea0488df865817a0de91ec46e359b72
    util: Make CLAMP turn NaN into MIN.

Cc: 17.2 <mesa-stable@lists.freedesktop.org>
Reviewed-by: Roland Scheidegger <sroland@vmware.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle@amd.com>
src/gallium/drivers/r600/r600_pipe.h
src/gallium/drivers/radeon/r600_pipe_common.h
src/gallium/drivers/radeonsi/si_state.c

index 3fa7d77d37e8b665f5b0e9b171745f6c286ce4ca..c9294a7c58d721119da14e6f826cf06ec711adcf 100644 (file)
@@ -925,10 +925,6 @@ static inline void radeon_set_ctl_const(struct radeon_winsys_cs *cs, unsigned re
 /*
  * common helpers
  */
-static inline uint32_t S_FIXED(float value, uint32_t frac_bits)
-{
-       return value * (1 << frac_bits);
-}
 
 /* 12.4 fixed-point */
 static inline unsigned r600_pack_float_12p4(float x)
index 5c761f3ee4f2d135355d7a2e17ef4643d85cf392..c2fb3690d2bea8760f40236ebae22c8276146ab3 100644 (file)
@@ -1006,4 +1006,9 @@ vi_dcc_enabled(struct r600_texture *tex, unsigned level)
        (((unsigned)(s2x) & 0xf) << 16) | (((unsigned)(s2y) & 0xf) << 20) |        \
         (((unsigned)(s3x) & 0xf) << 24) | (((unsigned)(s3y) & 0xf) << 28))
 
+static inline int S_FIXED(float value, unsigned frac_bits)
+{
+       return value * (1 << frac_bits);
+}
+
 #endif
index 7e3d1a02e0734e412eac37bafa2ec5c4727fc702..42d81e744699ed6b1764d12a20713a34467b88fa 100644 (file)
@@ -74,11 +74,6 @@ static unsigned si_map_swizzle(unsigned swizzle)
        }
 }
 
-static uint32_t S_FIXED(float value, uint32_t frac_bits)
-{
-       return value * (1 << frac_bits);
-}
-
 /* 12.4 fixed-point */
 static unsigned si_pack_float_12p4(float x)
 {