summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965
diff options
context:
space:
mode:
authorTopi Pohjolainen <[email protected]>2017-06-08 12:31:18 +0300
committerTopi Pohjolainen <[email protected]>2017-06-19 22:18:53 +0300
commit920c8e89c59e19b44f69b0acf5778d079a25e2a2 (patch)
tree42b137d52446409ec79a7365f652dfbd8699df11 /src/mesa/drivers/dri/i965
parenta52ee32a9a49b48c51a80b8a35aa26bd583cabb7 (diff)
i965/miptree: Clarify face/level/layer in slice copy
Reviewed-by: Jason Ekstrand <[email protected]> Signed-off-by: Topi Pohjolainen <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri/i965')
-rw-r--r--src/mesa/drivers/dri/i965/intel_mipmap_tree.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 02e74caa813..64f98ec67a2 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -1312,22 +1312,14 @@ static void
intel_miptree_copy_slice(struct brw_context *brw,
struct intel_mipmap_tree *dst_mt,
struct intel_mipmap_tree *src_mt,
- int level,
- int face,
- int depth)
+ unsigned level, unsigned slice)
{
mesa_format format = src_mt->format;
uint32_t width = minify(src_mt->physical_width0, level - src_mt->first_level);
uint32_t height = minify(src_mt->physical_height0, level - src_mt->first_level);
- int slice;
- if (face > 0)
- slice = face;
- else
- slice = depth;
-
- assert(depth < src_mt->level[level].depth);
+ assert(slice < src_mt->level[level].depth);
assert(src_mt->format == dst_mt->format);
if (dst_mt->compressed) {
@@ -1390,17 +1382,26 @@ intel_miptree_copy_teximage(struct brw_context *brw,
struct intel_texture_object *intel_obj =
intel_texture_object(intelImage->base.Base.TexObject);
int level = intelImage->base.Base.Level;
- int face = intelImage->base.Base.Face;
-
- GLuint depth;
- if (intel_obj->base.Target == GL_TEXTURE_1D_ARRAY)
- depth = intelImage->base.Base.Height;
- else
- depth = intelImage->base.Base.Depth;
+ const unsigned face = intelImage->base.Base.Face;
+ unsigned start_layer, end_layer;
+
+ if (intel_obj->base.Target == GL_TEXTURE_1D_ARRAY) {
+ assert(face == 0);
+ assert(intelImage->base.Base.Height);
+ start_layer = 0;
+ end_layer = intelImage->base.Base.Height - 1;
+ } else if (face > 0) {
+ start_layer = face;
+ end_layer = face;
+ } else {
+ assert(intelImage->base.Base.Depth);
+ start_layer = 0;
+ end_layer = intelImage->base.Base.Depth - 1;
+ }
if (!invalidate) {
- for (int slice = 0; slice < depth; slice++) {
- intel_miptree_copy_slice(brw, dst_mt, src_mt, level, face, slice);
+ for (unsigned i = start_layer; i <= end_layer; i++) {
+ intel_miptree_copy_slice(brw, dst_mt, src_mt, level, i);
}
}