surface->format = v3d_get_rt_format(&screen->devinfo, psurf->format);
+ const struct util_format_description *desc =
+ util_format_description(psurf->format);
+
+ surface->swap_rb = (desc->swizzle[0] == PIPE_SWIZZLE_Z &&
+ psurf->format != PIPE_FORMAT_B5G6R5_UNORM);
+
if (util_format_is_depth_or_stencil(psurf->format)) {
switch (psurf->format) {
case PIPE_FORMAT_Z16_UNORM:
*/
uint8_t internal_bpp;
+ /**
+ * If the R and B channels should be swapped. On V3D 3.x, we do it in
+ * the shader and the blend equation. On V3D 4.1+, we can use the new
+ * TLB load/store flags instead of recompiling.
+ */
+ bool swap_rb;
+
uint32_t padded_height_of_output_image_in_uif_blocks;
/* If the resource being referenced is separate stencil, then this is
load.input_image_format = V3D_OUTPUT_IMAGE_FORMAT_S8;
else
load.input_image_format = surf->format;
+ load.r_b_swap = surf->swap_rb;
if (surf->tiling == VC5_TILING_UIF_NO_XOR ||
surf->tiling == VC5_TILING_UIF_XOR) {
else
store.output_image_format = surf->format;
+ store.r_b_swap = surf->swap_rb;
store.memory_format = surf->tiling;
if (surf->tiling == VC5_TILING_UIF_NO_XOR ||
struct pipe_surface *cbuf = v3d->framebuffer.cbufs[i];
if (!cbuf)
continue;
+ struct v3d_surface *v3d_cbuf = v3d_surface(cbuf);
const struct util_format_description *desc =
util_format_description(cbuf->format);
/* For BGRA8 formats (DRI window system default format), we
* need to swap R and B, since the HW's format is RGBA8.
*/
- if (desc->swizzle[0] == PIPE_SWIZZLE_Z &&
- cbuf->format != PIPE_FORMAT_B5G6R5_UNORM) {
+ if (v3d->screen->devinfo.ver < 42 && v3d_cbuf->swap_rb)
v3d->swap_color_rb |= 1 << i;
- }
if (desc->swizzle[3] == PIPE_SWIZZLE_1)
v3d->blend_dst_alpha_one |= 1 << i;