turnip: compute render_components/srgb_cntl at renderpass creation time
Signed-off-by: Jonathan Marek <jonathan@marek.ca> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4581>
This commit is contained in:
committed by
Marge Bot
parent
d80fb02430
commit
b6455e9a6a
@@ -421,8 +421,6 @@ tu6_emit_mrt(struct tu_cmd_buffer *cmd,
|
||||
struct tu_cs *cs)
|
||||
{
|
||||
const struct tu_framebuffer *fb = cmd->state.framebuffer;
|
||||
unsigned char mrt_comp[MAX_RTS] = { 0 };
|
||||
unsigned srgb_cntl = 0;
|
||||
|
||||
for (uint32_t i = 0; i < subpass->color_count; ++i) {
|
||||
uint32_t a = subpass->color_attachments[i].attachment;
|
||||
@@ -431,10 +429,6 @@ tu6_emit_mrt(struct tu_cmd_buffer *cmd,
|
||||
|
||||
const struct tu_image_view *iview = fb->attachments[a].attachment;
|
||||
|
||||
mrt_comp[i] = 0xf;
|
||||
|
||||
if (vk_format_is_srgb(iview->vk_format))
|
||||
srgb_cntl |= (1 << i);
|
||||
|
||||
struct tu_native_format format =
|
||||
tu6_format_image(iview->image, iview->vk_format, iview->base_mip);
|
||||
@@ -462,32 +456,14 @@ tu6_emit_mrt(struct tu_cmd_buffer *cmd,
|
||||
}
|
||||
|
||||
tu_cs_emit_regs(cs,
|
||||
A6XX_RB_SRGB_CNTL(.dword = srgb_cntl));
|
||||
A6XX_RB_SRGB_CNTL(.dword = subpass->srgb_cntl));
|
||||
tu_cs_emit_regs(cs,
|
||||
A6XX_SP_SRGB_CNTL(.dword = subpass->srgb_cntl));
|
||||
|
||||
tu_cs_emit_regs(cs,
|
||||
A6XX_SP_SRGB_CNTL(.dword = srgb_cntl));
|
||||
|
||||
A6XX_RB_RENDER_COMPONENTS(.dword = subpass->render_components));
|
||||
tu_cs_emit_regs(cs,
|
||||
A6XX_RB_RENDER_COMPONENTS(
|
||||
.rt0 = mrt_comp[0],
|
||||
.rt1 = mrt_comp[1],
|
||||
.rt2 = mrt_comp[2],
|
||||
.rt3 = mrt_comp[3],
|
||||
.rt4 = mrt_comp[4],
|
||||
.rt5 = mrt_comp[5],
|
||||
.rt6 = mrt_comp[6],
|
||||
.rt7 = mrt_comp[7]));
|
||||
|
||||
tu_cs_emit_regs(cs,
|
||||
A6XX_SP_FS_RENDER_COMPONENTS(
|
||||
.rt0 = mrt_comp[0],
|
||||
.rt1 = mrt_comp[1],
|
||||
.rt2 = mrt_comp[2],
|
||||
.rt3 = mrt_comp[3],
|
||||
.rt4 = mrt_comp[4],
|
||||
.rt5 = mrt_comp[5],
|
||||
.rt6 = mrt_comp[6],
|
||||
.rt7 = mrt_comp[7]));
|
||||
A6XX_SP_FS_RENDER_COMPONENTS(.dword = subpass->render_components));
|
||||
|
||||
tu_cs_emit_regs(cs, A6XX_GRAS_MAX_LAYER_INDEX(fb->layers - 1));
|
||||
}
|
||||
|
||||
@@ -39,8 +39,8 @@ static void update_samples(struct tu_subpass *subpass,
|
||||
#define GMEM_ALIGN 0x4000
|
||||
|
||||
static void
|
||||
compute_gmem_offsets(struct tu_render_pass *pass,
|
||||
const struct tu_physical_device *phys_dev)
|
||||
create_render_pass_common(struct tu_render_pass *pass,
|
||||
const struct tu_physical_device *phys_dev)
|
||||
{
|
||||
/* calculate total bytes per pixel */
|
||||
uint32_t cpp_total = 0;
|
||||
@@ -84,6 +84,24 @@ compute_gmem_offsets(struct tu_render_pass *pass,
|
||||
}
|
||||
|
||||
pass->gmem_pixels = pixels;
|
||||
|
||||
for (uint32_t i = 0; i < pass->subpass_count; i++) {
|
||||
struct tu_subpass *subpass = &pass->subpasses[i];
|
||||
|
||||
subpass->srgb_cntl = 0;
|
||||
subpass->render_components = 0;
|
||||
|
||||
for (uint32_t i = 0; i < subpass->color_count; ++i) {
|
||||
uint32_t a = subpass->color_attachments[i].attachment;
|
||||
if (a == VK_ATTACHMENT_UNUSED)
|
||||
continue;
|
||||
|
||||
subpass->render_components |= 0xf << (i * 4);
|
||||
|
||||
if (vk_format_is_srgb(pass->attachments[a].format))
|
||||
subpass->srgb_cntl |= 1 << i;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
VkResult
|
||||
@@ -209,7 +227,7 @@ tu_CreateRenderPass(VkDevice _device,
|
||||
|
||||
*pRenderPass = tu_render_pass_to_handle(pass);
|
||||
|
||||
compute_gmem_offsets(pass, device->physical_device);
|
||||
create_render_pass_common(pass, device->physical_device);
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
@@ -338,7 +356,7 @@ tu_CreateRenderPass2(VkDevice _device,
|
||||
|
||||
*pRenderPass = tu_render_pass_to_handle(pass);
|
||||
|
||||
compute_gmem_offsets(pass, device->physical_device);
|
||||
create_render_pass_common(pass, device->physical_device);
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -1648,6 +1648,10 @@ struct tu_subpass
|
||||
struct tu_subpass_attachment depth_stencil_attachment;
|
||||
|
||||
VkSampleCountFlagBits samples;
|
||||
|
||||
/* pre-filled register values */
|
||||
uint32_t render_components;
|
||||
uint32_t srgb_cntl;
|
||||
};
|
||||
|
||||
struct tu_render_pass_attachment
|
||||
|
||||
Reference in New Issue
Block a user