For cube maps, depth=1 in the hardware (but 6 in Gallium). Likewise for
cube map arrays, depth=n in the hardware (but 6n in Gallium). We need to
divide to compensate. This will be relevant for cube map arrays in the
future -- add the dimension XML for cube map arrays too.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18380>
<value name="2D Multisampled" value="4"/>
<value name="3D" value="5"/>
<value name="Cube" value="6"/>
+ <value name="Cube Array" value="7"/>
<value name="2D Array Multisampled" value="8"/>
</enum>
cfg.unk_mipmapped = rsrc->mipmapped;
cfg.srgb_2_channel = cfg.srgb && util_format_colormask(desc) == 0x3;
- if (state->target == PIPE_TEXTURE_3D)
+ if (state->target == PIPE_TEXTURE_3D) {
cfg.depth = u_minify(texture->depth0, level);
- else
- cfg.depth = state->u.tex.last_layer - state->u.tex.first_layer + 1;
+ } else {
+ unsigned layers = state->u.tex.last_layer - state->u.tex.first_layer + 1;
+
+ if ((state->target == PIPE_TEXTURE_CUBE) || (state->target == PIPE_TEXTURE_CUBE_ARRAY))
+ layers /= 6;
+
+ cfg.depth = layers;
+ }
if (rsrc->modifier == DRM_FORMAT_MOD_LINEAR) {
cfg.stride = ail_get_linear_stride_B(&rsrc->layout, level) - 16;