summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-07-25 17:29:58 +0200
committerEmil Velikov <[email protected]>2017-08-03 00:19:06 +0100
commitd0e3c153a98112109485df08c612b980ff588542 (patch)
tree698da220da5994a4d6b563308739cd1dcce0d6eb
parenta50cb9a09498594313c7ba1389db608085e7f0c2 (diff)
gallium/radeon: make S_FIXED function signed and move it to shared code
This fixes a bug uncovered by: 2412c4c81ea0488df865817a0de91ec46e359b72 util: Make CLAMP turn NaN into MIN. Cc: 17.2 <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Nicolai Hähnle <[email protected]> (cherry picked from commit 433f6f7ac9ed6624fec02cc055c3bfa247dba185)
-rw-r--r--src/gallium/drivers/r600/r600_pipe.h4
-rw-r--r--src/gallium/drivers/radeon/r600_pipe_common.h5
-rw-r--r--src/gallium/drivers/radeonsi/si_state.c5
3 files changed, 5 insertions, 9 deletions
diff --git a/src/gallium/drivers/r600/r600_pipe.h b/src/gallium/drivers/r600/r600_pipe.h
index 7f1ecc278b6..b3ee0ea2e70 100644
--- a/src/gallium/drivers/r600/r600_pipe.h
+++ b/src/gallium/drivers/r600/r600_pipe.h
@@ -920,10 +920,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)
diff --git a/src/gallium/drivers/radeon/r600_pipe_common.h b/src/gallium/drivers/radeon/r600_pipe_common.h
index fbd0ac7e16c..bd542e50071 100644
--- a/src/gallium/drivers/radeon/r600_pipe_common.h
+++ b/src/gallium/drivers/radeon/r600_pipe_common.h
@@ -987,4 +987,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
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index a98f5c77a20..59f71e82743 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -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)
{