summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2015-04-08 12:49:24 -0700
committerEric Anholt <[email protected]>2015-04-13 22:34:06 -0700
commit44b63cf5c051f7eccfc1d7427247fd58dabb7761 (patch)
tree1e4736d5ef309074ba465c46a64bd0687213f5b9 /src
parentd04b07f8e2eb61bb389f2d6b8ed0a501952466ee (diff)
vc4: When asked to sample from a raster texture, make a shadow tiled copy.
So, it turns out my simulator doesn't *quite* match the hardware. And the errata about raster textures tells you most of what's wrong, but there's still stuff wrong after that. Instead, if we're asked to sample from raster, we'll just blit it to a tiled temporary. Raster textures should only be screen scanout, and word is that it's faster to copy to tiled using the tiling engine first than to texture from an entire raster texture, anyway.
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/vc4/vc4_state.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/gallium/drivers/vc4/vc4_state.c b/src/gallium/drivers/vc4/vc4_state.c
index 332f3108241..df75b6ec81b 100644
--- a/src/gallium/drivers/vc4/vc4_state.c
+++ b/src/gallium/drivers/vc4/vc4_state.c
@@ -516,6 +516,7 @@ vc4_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *prsc,
const struct pipe_sampler_view *cso)
{
struct pipe_sampler_view *so = malloc(sizeof(*so));
+ struct vc4_resource *rsc = vc4_resource(prsc);
if (!so)
return NULL;
@@ -527,8 +528,12 @@ vc4_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *prsc,
/* There is no hardware level clamping, and the start address of a
* texture may be misaligned, so in that case we have to copy to a
* temporary.
+ *
+ * Also, Raspberry Pi doesn't support sampling from raster textures,
+ * so we also have to copy to a temporary then.
*/
- if (so->u.tex.first_level) {
+ if (so->u.tex.first_level ||
+ rsc->vc4_format == VC4_TEXTURE_TYPE_RGBA32R) {
struct vc4_resource *shadow_parent = vc4_resource(prsc);
struct pipe_resource tmpl = shadow_parent->base.b;
struct vc4_resource *clone;
@@ -574,8 +579,10 @@ vc4_set_sampler_views(struct pipe_context *pctx, unsigned shader,
for (i = 0; i < nr; i++) {
if (views[i]) {
+ struct vc4_resource *rsc =
+ vc4_resource(views[i]->texture);
new_nr = i + 1;
- if (views[i]->u.tex.first_level != 0)
+ if (rsc->shadow_parent)
vc4_update_shadow_baselevel_texture(pctx, views[i]);
}
pipe_sampler_view_reference(&stage_tex->textures[i], views[i]);