[Mesa-dev] [PATCH 7/9] panfrost: Implement command stream for linear cubemaps

Alyssa Rosenzweig alyssa at rosenzweig.io
Fri Mar 29 01:53:45 UTC 2019


Signed-off-by: Alyssa Rosenzweig <alyssa at rosenzweig.io>
---
 src/gallium/drivers/panfrost/pan_context.c  | 12 +++++++-----
 src/gallium/drivers/panfrost/pan_resource.c |  2 +-
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c
index b4a26f71dd3..fcd5f538938 100644
--- a/src/gallium/drivers/panfrost/pan_context.c
+++ b/src/gallium/drivers/panfrost/pan_context.c
@@ -1019,10 +1019,12 @@ panfrost_emit_for_draw(struct panfrost_context *ctx, bool with_vertex_data)
                                 struct pipe_resource *tex_rsrc = ctx->sampler_views[t][i]->base.texture;
                                 struct panfrost_resource *rsrc = (struct panfrost_resource *) tex_rsrc;
 
-                                /* Inject the address in. */
-                                for (int f = 0; f < tex_rsrc->array_size; ++f) {
-                                        for (int l = 0; l <= tex_rsrc->last_level; ++l) {
-                                                unsigned idx = f * (tex_rsrc->last_level + 1) + l;
+                                /* Inject the addresses in, interleaving cube
+                                 * faces and mip levels appropriately. */
+
+                                for (int l = 0; l <= tex_rsrc->last_level; ++l) {
+                                        for (int f = 0; f < tex_rsrc->array_size; ++f) {
+                                                unsigned idx = (l * tex_rsrc->array_size) + f;
 
                                                 ctx->sampler_views[t][i]->hw.swizzled_bitmaps[idx] =
                                                         rsrc->bo->gpu +
@@ -1957,7 +1959,7 @@ panfrost_create_sampler_view(
                         .format = format,
 
                         .usage1 = 0x0,
-                        .is_not_cubemap = 1,
+                        .is_not_cubemap = texture->target != PIPE_TEXTURE_CUBE,
 
                         .usage2 = usage2_layout
                 },
diff --git a/src/gallium/drivers/panfrost/pan_resource.c b/src/gallium/drivers/panfrost/pan_resource.c
index a1285f21541..e217b358ecf 100644
--- a/src/gallium/drivers/panfrost/pan_resource.c
+++ b/src/gallium/drivers/panfrost/pan_resource.c
@@ -391,7 +391,7 @@ panfrost_transfer_map(struct pipe_context *pctx,
         transfer->base.usage = usage;
         transfer->base.box = *box;
         transfer->base.stride = bo->slices[level].stride;
-        transfer->base.layer_stride = bytes_per_pixel * resource->width0; /* TODO: Cubemaps */
+        transfer->base.layer_stride = bo->cubemap_stride;
 
         pipe_resource_reference(&transfer->base.resource, resource);
 
-- 
2.20.1



More information about the mesa-dev mailing list