if (!formats[format].present)
return WZYX;
+ /* It seems CCU ignores swap and always uses WZYX when tiled. TP, on the
+ * other hand, always respects swap. We should return WZYX such that CCU
+ * and TP agree each other.
+ */
if (tile_mode)
return WZYX;
}
}
+ /* format is PIPE_FORMAT_X24S8_UINT when texturing the stencil aspect of
+ * PIPE_FORMAT_Z24_UNORM_S8_UINT. Because we map the format to
+ * FMT6_8_8_8_8_UINT, return XYZW such that the stencil value is in X
+ * component.
+ *
+ * We used to return WZYX and apply swizzles. That required us to
+ * un-swizzle the user-specified border color, which could not be done for
+ * turnip.
+ */
+ if (format == PIPE_FORMAT_X24S8_UINT)
+ return XYZW;
+
return fd6_pipe2swap(format, tile_mode);
}
break;
case PIPE_FORMAT_X24S8_UINT:
if (!has_z24uint_s8uint) {
- /* using FMT6_8_8_8_8_UINT, so need to pick out the W channel and
- * swizzle (0,0,1) in the rest (see "Conversion to RGBA").
+ /* using FMT6_8_8_8_8_UINT/XYZW so need to swizzle (0,0,1) in the
+ * rest (see "Conversion to RGBA").
*/
- format_swiz[0] = PIPE_SWIZZLE_W;
format_swiz[1] = PIPE_SWIZZLE_0;
format_swiz[2] = PIPE_SWIZZLE_0;
format_swiz[3] = PIPE_SWIZZLE_1;
args->format == PIPE_FORMAT_Z24X8_UNORM ||
args->format == PIPE_FORMAT_X24S8_UINT);
- if (args->format == PIPE_FORMAT_X24S8_UINT && has_z24uint_s8uint)
+ if (args->format == PIPE_FORMAT_X24S8_UINT && has_z24uint_s8uint) {
texture_format = FMT6_Z24_UINT_S8_UINT;
+ swap = WZYX;
+ }
if (texture_format == FMT6_Z24_UNORM_S8_UINT_AS_R8G8B8A8 && !ubwc_enabled)
texture_format = FMT6_8_8_8_8_UNORM;
if (i % 2 == 1 && att->format == VK_FORMAT_D24_UNORM_S8_UINT) {
/* note this works because spec says fb and input attachments
* must use identity swizzle
+ *
+ * Also we clear swap to WZYX. This is because the view might have
+ * picked XYZW to work better with border colors.
*/
dst[0] &= ~(A6XX_TEX_CONST_0_FMT__MASK |
+ A6XX_TEX_CONST_0_SWAP__MASK |
A6XX_TEX_CONST_0_SWIZ_X__MASK | A6XX_TEX_CONST_0_SWIZ_Y__MASK |
A6XX_TEX_CONST_0_SWIZ_Z__MASK | A6XX_TEX_CONST_0_SWIZ_W__MASK);
if (!cmd->device->physical_device->info->a6xx.has_z24uint_s8uint) {
* stencil border color value in bc->ui[0] but according
* to desc->swizzle and desc->channel, the .x/.w component
* is NONE and the stencil value is in the y component.
- * Meanwhile the hardware wants this in the .w component
- * for x24s8 and the .x component for x32_s8x24.
+ * Meanwhile the hardware wants this in the .x component
+ * for x24s8 and x32_s8x24.
*/
if ((format == PIPE_FORMAT_X24S8_UINT) ||
(format == PIPE_FORMAT_X32_S8X24_UINT)) {
if (j == 0) {
c = 1;
- cd = (format == PIPE_FORMAT_X32_S8X24_UINT) ? 0 : 3;
+ cd = 0;
} else {
continue;
}