etnaviv: switch to U_FIXED(..) macro
Lets have a look at trace from blob (GC3000):
0x000b000b, /* [10080] NTE.SAMPLER[0].SIZE := WIDTH=11,HEIGHT=11 */
0x2001b86e, /* [10100] NTE.SAMPLER[0].LOG_SIZE := WIDTH=3.437500,HEIGHT=3.437500,ASTC=0,INT_FILTER=1,SRGB=0 */
If we ignore the WIDTH and HEIGHT outputs and only look at the raw value (0x2001b86e) we can see that 0x6e is used for WIDTH and HEIGHT.
Lets have a look at an other texutre size 180x180:
0x00b400b4, /* [10080] NTE.SAMPLER[0].SIZE := WIDTH=180,HEIGHT=180 */
0x2003bcef, /* [10100] NTE.SAMPLER[0].LOG_SIZE := WIDTH=7.468750,HEIGHT=7.468750,ASTC=0,INT_FILTER=1,SRGB=0 */
Lets use the same test on a different GPU that uses texture descriptors (GC7000):
[44] SIZE: 0x000b000b WIDTH=11,HEIGHT=11
...
[74] LOG_SIZE_EXT: 0x03750375 WIDTH=3.457031,HEIGHT=3.457031
If we ignore the WIDTH and HEIGHT outputs and only look at the raw value (0x03750375) we can see that 0x375 is used for WIDTH and HEIGHT.
Lets have a look at an other texutre size 180x180:
[44] SIZE: 0x00b400b4 WIDTH=180,HEIGHT=180
..
[74] LOG_SIZE_EXT: 0x077d077d WIDTH=7.488281,HEIGHT=7.488281
etnaviv creates the following values for the two texture sizes:
11 -> 0x6f
180 -> 0xf0
Lets switch to U_FIXED(..) which results in equal values.
Signed-off-by: Christian Gmeiner <cgmeiner@igalia.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24364>
This commit is contained in:
committed by
Marge Bot
parent
16915c7a71
commit
8bce68edf5
@@ -26,6 +26,7 @@
|
|||||||
#define H_ETNA_UTIL
|
#define H_ETNA_UTIL
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
#include "mesa/main/macros.h"
|
||||||
|
|
||||||
/* for conditionally setting boolean flag(s): */
|
/* for conditionally setting boolean flag(s): */
|
||||||
#define COND(bool, val) ((bool) ? (val) : 0)
|
#define COND(bool, val) ((bool) ? (val) : 0)
|
||||||
@@ -47,26 +48,14 @@ etna_cfloat_to_uint8(float f)
|
|||||||
static inline uint32_t
|
static inline uint32_t
|
||||||
etna_float_to_fixp55(float f)
|
etna_float_to_fixp55(float f)
|
||||||
{
|
{
|
||||||
if (f >= 15.953125f)
|
return U_FIXED(f, 5);
|
||||||
return 511;
|
|
||||||
|
|
||||||
if (f < -16.0f)
|
|
||||||
return 512;
|
|
||||||
|
|
||||||
return (int32_t)(f * 32.0f + 0.5f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* float to fixp 8.8 */
|
/* float to fixp 8.8 */
|
||||||
static inline uint32_t
|
static inline uint32_t
|
||||||
etna_float_to_fixp88(float f)
|
etna_float_to_fixp88(float f)
|
||||||
{
|
{
|
||||||
if (f >= (32767.0 - 1.0f) / 256.0f)
|
return U_FIXED(f, 8);
|
||||||
return 32767;
|
|
||||||
|
|
||||||
if (f < -16.0f)
|
|
||||||
return 32768;
|
|
||||||
|
|
||||||
return (int32_t)(f * 256.0f + 0.5f);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* texture size to log2 in fixp 5.5 format */
|
/* texture size to log2 in fixp 5.5 format */
|
||||||
|
|||||||
Reference in New Issue
Block a user