summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/lima/lima_texture.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/gallium/drivers/lima/lima_texture.h')
-rw-r--r--src/gallium/drivers/lima/lima_texture.h24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/gallium/drivers/lima/lima_texture.h b/src/gallium/drivers/lima/lima_texture.h
index 7f4b9ee5330..0a4afd9ed5a 100644
--- a/src/gallium/drivers/lima/lima_texture.h
+++ b/src/gallium/drivers/lima/lima_texture.h
@@ -44,9 +44,9 @@ typedef struct __attribute__((__packed__)) {
uint32_t unnorm_coords: 1;
uint32_t unknown_1_2: 1;
uint32_t texture_type: 3;
- uint32_t unknown_1_3: 12;
- uint32_t miplevels: 4;
- uint32_t min_mipfilter_1: 9; /* 0x0 for linear, 0x1ff for nearest */
+ uint32_t min_lod: 8; /* Fixed point, 4.4, unsigned */
+ uint32_t max_lod: 8; /* Fixed point, 4.4, unsigned */
+ uint32_t lod_bias: 9; /* Fixed point, signed, 1.4.4 */
uint32_t unknown_2_1: 3;
uint32_t has_stride: 1;
uint32_t min_mipfilter_2: 2; /* 0x3 for linear, 0x0 for nearest */
@@ -95,4 +95,22 @@ void lima_texture_desc_set_res(struct lima_context *ctx, lima_tex_desc *desc,
unsigned first_level, unsigned last_level);
void lima_update_textures(struct lima_context *ctx);
+
+static inline int16_t lima_float_to_fixed8(float f)
+{
+ return (int)(f * 16.0);
+}
+
+static inline float lima_fixed8_to_float(int16_t i)
+{
+ float sign = 1.0;
+
+ if (i > 0xff) {
+ i = 0x200 - i;
+ sign = -1;
+ }
+
+ return sign * (float)(i / 16.0);
+}
+
#endif