panfrost: Don't use DECODE_FIXED16 for sample position
authorAlyssa Rosenzweig <alyssa@collabora.com>
Wed, 28 Dec 2022 20:53:41 +0000 (15:53 -0500)
committerMarge Bot <emma+marge@anholt.net>
Sat, 11 Mar 2023 06:30:02 +0000 (06:30 +0000)
Strictly this is a signed fixed-point, anyway.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20445>

src/panfrost/lib/pan_samples.c

index 18205f2..f23810d 100644 (file)
@@ -60,6 +60,12 @@ struct mali_sample_positions {
 #define SAMPLE8(x, y) SAMPLE16((x)*2, (y)*2)
 #define SAMPLE4(x, y) SAMPLE16((x)*4, (y)*4)
 
+static float
+decode_position(int16_t raw)
+{
+   return ((float)raw) / 256.0;
+}
+
 /* clang-format off */
 const struct mali_sample_positions sample_position_lut[] = {
    [MALI_SAMPLE_PATTERN_SINGLE_SAMPLED] = {
@@ -155,6 +161,6 @@ panfrost_query_sample_position(enum mali_sample_pattern pattern,
    struct mali_sample_position pos =
       sample_position_lut[pattern].positions[sample_idx];
 
-   out[0] = DECODE_FIXED_16(pos.x);
-   out[1] = DECODE_FIXED_16(pos.y);
+   out[0] = decode_position(pos.x);
+   out[1] = decode_position(pos.y);
 }