struct pipe_sampler_view base;
uint32_t texture_p0;
uint32_t texture_p1;
+ bool force_first_level;
};
struct vc4_sampler_state {
}
}
+ if (c->key->tex[unit].forced_first_level) {
+ lod = qir_uniform_f(c, c->key->tex[unit].forced_first_level);
+ is_txl = true;
+ is_txb = false;
+ }
+
struct qreg texture_u[] = {
qir_uniform(c, QUNIFORM_TEXTURE_CONFIG_P0, unit),
qir_uniform(c, QUNIFORM_TEXTURE_CONFIG_P1, unit),
{
for (int i = 0; i < texstate->num_textures; i++) {
struct pipe_sampler_view *sampler = texstate->textures[i];
+ struct vc4_sampler_view *vc4_sampler = vc4_sampler_view(sampler);
struct pipe_sampler_state *sampler_state =
texstate->samplers[i];
key->tex[i].compare_func = sampler_state->compare_func;
key->tex[i].wrap_s = sampler_state->wrap_s;
key->tex[i].wrap_t = sampler_state->wrap_t;
+ if (vc4_sampler->force_first_level) {
+ key->tex[i].forced_first_level =
+ sampler->u.tex.first_level;
+ }
}
}
unsigned compare_func:3;
unsigned wrap_s:3;
unsigned wrap_t:3;
+ unsigned forced_first_level:8;
};
struct {
uint16_t msaa_width, msaa_height;
if (shadow->writes == orig->writes && orig->bo->private)
return;
- perf_debug("Updating shadow texture due to %s\n",
+ perf_debug("Updating %dx%d@%d shadow texture due to %s\n",
+ orig->base.b.width0, orig->base.b.height0,
+ view->u.tex.first_level,
view->u.tex.first_level ? "base level" : "raster layout");
for (int i = 0; i <= shadow->base.b.last_level; i++) {
* Also, Raspberry Pi doesn't support sampling from raster textures,
* so we also have to copy to a temporary then.
*/
- if (cso->u.tex.first_level ||
+ if ((cso->u.tex.first_level &&
+ (cso->u.tex.first_level != cso->u.tex.last_level)) ||
rsc->vc4_format == VC4_TEXTURE_TYPE_RGBA32R) {
struct vc4_resource *shadow_parent = vc4_resource(prsc);
struct pipe_resource tmpl = shadow_parent->base.b;
clone->writes = shadow_parent->writes - 1;
assert(clone->vc4_format != VC4_TEXTURE_TYPE_RGBA32R);
+ } else if (cso->u.tex.first_level) {
+ so->force_first_level = true;
}
so->base.texture = prsc;
so->base.reference.count = 1;
so->texture_p0 =
(VC4_SET_FIELD(rsc->slices[0].offset >> 12, VC4_TEX_P0_OFFSET) |
VC4_SET_FIELD(rsc->vc4_format & 15, VC4_TEX_P0_TYPE) |
- VC4_SET_FIELD(cso->u.tex.last_level -
+ VC4_SET_FIELD(so->force_first_level ?
+ cso->u.tex.last_level :
+ cso->u.tex.last_level -
cso->u.tex.first_level, VC4_TEX_P0_MIPLVLS) |
VC4_SET_FIELD(cso->target == PIPE_TEXTURE_CUBE,
VC4_TEX_P0_CMMODE));