[Mesa-dev] [PATCH 1/6] i965/skl: Layout 3D textures the same as array textures

Neil Roberts neil at linux.intel.com
Wed Feb 25 04:42:39 PST 2015


Ben Widawsky <ben at bwidawsk.net> writes:

>> +      if (mt->target == GL_TEXTURE_3D)
>> +         depth = minify(depth, 1);
>>     }
>>  }
>
> assert(brw->gen >= 9)? (up to you, I'm very assert happy)

Yes, that seems like a good idea.

>>  
>> @@ -263,7 +266,7 @@ brw_miptree_layout_texture_array(struct brw_context *brw,
>>        if (mt->compressed)
>>           img_height /= mt->align_h;
>>  
>> -      for (int q = 0; q < mt->physical_depth0; q++) {
>> +      for (int q = 0; q < mt->level[level].depth; q++) {
>>           if (mt->array_layout == ALL_SLICES_AT_EACH_LOD) {
>>              intel_miptree_set_image_offset(mt, level, q, 0, q * img_height);
>>           } else {
>
> Can you remind me how you can have different depths per level? Assuming they're
> the same, I prefer this hunk removed because it's much clearer the old way in my
> opinion.

With 3D textures, unlike array textures, the depth is halved at each
mipmap level as well as the width and height so each mipmap level has a
different depth. I'm attaching an SVG which might make it clearer. I
guess that means that using the same layout for array textures and 3D
textures means that 3D textures will now have more unused space, but
that is what the hardware now wants so that's the way it has to be.

I originally didn't make this change and I thought maybe you could get
away with allocating the depth to be the same for each level even though
some of them won't be used but some later code gets very confused and
asserts.

Thanks for the review.

Regards,
- Neil

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 3d-texture-mipmaps.svg
Type: image/svg+xml
Size: 43470 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150225/e6cffb74/attachment-0001.svg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 472 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150225/e6cffb74/attachment-0001.sig>


More information about the mesa-dev mailing list