v3d: Fix handling of texture first_layer offsets for 3D textures.
authorEric Anholt <eric@anholt.net>
Tue, 4 Dec 2018 22:18:45 +0000 (14:18 -0800)
committerEric Anholt <eric@anholt.net>
Sat, 8 Dec 2018 00:48:23 +0000 (16:48 -0800)
I think this bug predated adding v3d_layer_offset().  Noticed during an
unrelated refactor.

src/gallium/drivers/v3d/v3dx_state.c

index 0d1a74091d5bcfd2376bf7080092e390d7917c7d..cf64fc42452a38562adbb730aee4cf8dc36514c5 100644 (file)
@@ -753,11 +753,11 @@ v3d_create_sampler_view(struct pipe_context *pctx, struct pipe_resource *prsc,
                  * at state create time, so any time this sampler view is used
                  * we need to add the texture to the job.
                  */
-                tex.texture_base_pointer = cl_address(NULL,
-                                                      rsc->bo->offset +
-                                                      rsc->slices[0].offset +
-                                                      cso->u.tex.first_layer *
-                                                      rsc->cube_map_stride),
+                tex.texture_base_pointer =
+                        cl_address(NULL,
+                                   rsc->bo->offset +
+                                   v3d_layer_offset(prsc, 0,
+                                                    cso->u.tex.first_layer));
 
                 tex.swizzle_r = translate_swizzle(so->swizzle[0]);
                 tex.swizzle_g = translate_swizzle(so->swizzle[1]);