Commit 62ff2e00 authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

panwrap: min_lod, max_lod fields

parent 8d7dab5c
......@@ -522,12 +522,30 @@ struct mali_texture_descriptor {
#define MALI_FILTER_NAME(filter) (filter ? "MALI_GL_NEAREST" : "MALI_GL_LINEAR")
/* Used for lod encoding. Thanks @urjaman for pointing out these routines can
* be cleaned up a lot. */
#define DECODE_FIXED_16(x) ((float) (x / 256.0))
static inline uint16_t
FIXED_16(float x) {
/* Clamp inputs, accounting for float error */
float max_lod = (32.0 - (1.0/512.0));
x = ((x > max_lod) ? max_lod : ((x < 0.0) ? 0.0 : x));
return (int) (x * 256.0);
}
struct mali_sampler_descriptor {
uint32_t filter_mode;
/* Who knows? ("Someone under NDA" "Um, who else?" "You, in the future,
* I hope?") */
uint32_t unknown1;
/* Fixed point. Upper 8-bits is before the decimal point, although it
* caps [0-31]. Lower 8-bits is after the decimal point: int(round(x *
* 256)) */
uint16_t min_lod;
uint16_t max_lod;
/* All one word in reality, but packed a bit */
......
......@@ -847,7 +847,8 @@ panwrap_replay_vertex_or_tiler_job_mdg(const struct mali_job_descriptor_header *
MALI_FILTER_NAME(s->filter_mode & MALI_GL_TEX_MAG_MASK),
s->filter_mode & ~3);
panwrap_prop("unknown1 = 0x%" PRIx32, s->unknown1);
panwrap_prop("min_lod = FIXED_16(%f)", DECODE_FIXED_16(s->min_lod));
panwrap_prop("max_lod = FIXED_16(%f)", DECODE_FIXED_16(s->max_lod));
panwrap_prop("wrap_s = %s", panwrap_wrap_mode_name(s->wrap_s));
panwrap_prop("wrap_t = %s", panwrap_wrap_mode_name(s->wrap_t));
......
......@@ -1385,8 +1385,9 @@ panfrost_create_sampler_state(
cso->border_color.f[2],
cso->border_color.f[3]
},
.min_lod = FIXED_16(0.0),
.max_lod = FIXED_16(0.25),
.unknown2 = 1,
.unknown1 = 0x10000,
};
so->hw = sampler_descriptor;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment