panvk: minor clean up to prepare_blend

Sort the dirty states and make it clear that we use
panvk_rendering_state.

Constify color_attachment_samples for panvk_per_arch(blend_emit_descs).

Signed-off-by: Chia-I Wu <olvaffe@gmail.com>
Reviewed-by: Benjamin Lee <benjamin.lee@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32267>
This commit is contained in:
Chia-I Wu 2024-11-20 12:32:07 -08:00 committed by Marge Bot
parent fc50fb35b0
commit e6f0c473ca
3 changed files with 16 additions and 12 deletions

View File

@ -488,9 +488,9 @@ index_size_to_index_type(uint32_t size)
static VkResult
prepare_blend(struct panvk_cmd_buffer *cmdbuf)
{
bool dirty = dyn_gfx_state_dirty(cmdbuf, CB_LOGIC_OP_ENABLE) ||
bool dirty = dyn_gfx_state_dirty(cmdbuf, MS_ALPHA_TO_ONE_ENABLE) ||
dyn_gfx_state_dirty(cmdbuf, CB_LOGIC_OP_ENABLE) ||
dyn_gfx_state_dirty(cmdbuf, CB_LOGIC_OP) ||
dyn_gfx_state_dirty(cmdbuf, MS_ALPHA_TO_ONE_ENABLE) ||
dyn_gfx_state_dirty(cmdbuf, CB_ATTACHMENT_COUNT) ||
dyn_gfx_state_dirty(cmdbuf, CB_COLOR_WRITE_ENABLES) ||
dyn_gfx_state_dirty(cmdbuf, CB_BLEND_ENABLES) ||
@ -511,6 +511,7 @@ prepare_blend(struct panvk_cmd_buffer *cmdbuf)
const struct panvk_shader *fs = cmdbuf->state.gfx.fs.shader;
const struct pan_shader_info *fs_info = fs ? &fs->info : NULL;
mali_ptr fs_code = panvk_shader_get_dev_addr(fs);
const struct panvk_rendering_state *render = &cmdbuf->state.gfx.render;
struct panfrost_ptr ptr =
panvk_cmd_alloc_desc_array(cmdbuf, bd_count, BLEND);
struct mali_blend_packed *bds = ptr.cpu;
@ -518,10 +519,9 @@ prepare_blend(struct panvk_cmd_buffer *cmdbuf)
if (bd_count && !ptr.gpu)
return VK_ERROR_OUT_OF_DEVICE_MEMORY;
panvk_per_arch(blend_emit_descs)(
dev, dyns, cmdbuf->state.gfx.render.color_attachments.fmts,
cmdbuf->state.gfx.render.color_attachments.samples, fs_info, fs_code, bds,
&cmdbuf->state.gfx.cb.info);
panvk_per_arch(blend_emit_descs)(dev, dyns, render->color_attachments.fmts,
render->color_attachments.samples, fs_info,
fs_code, bds, &cmdbuf->state.gfx.cb.info);
cs_move64_to(b, cs_sr_reg64(b, 50), ptr.gpu | bd_count);
return VK_SUCCESS;

View File

@ -30,7 +30,8 @@ struct panvk_blend_info {
VkResult panvk_per_arch(blend_emit_descs)(
struct panvk_device *dev, const struct vk_dynamic_graphics_state *dy,
const VkFormat *color_attachment_formats, uint8_t *color_attachment_samples,
const VkFormat *color_attachment_formats,
const uint8_t *color_attachment_samples,
const struct pan_shader_info *fs_info, mali_ptr fs_code,
struct mali_blend_packed *bds, struct panvk_blend_info *blend_info);

View File

@ -298,11 +298,14 @@ blend_needs_shader(const struct pan_blend_state *state, unsigned rt_idx,
}
VkResult
panvk_per_arch(blend_emit_descs)(
struct panvk_device *dev, const struct vk_dynamic_graphics_state *dyns,
const VkFormat *color_attachment_formats, uint8_t *color_attachment_samples,
const struct pan_shader_info *fs_info, mali_ptr fs_code,
struct mali_blend_packed *bds, struct panvk_blend_info *blend_info)
panvk_per_arch(blend_emit_descs)(struct panvk_device *dev,
const struct vk_dynamic_graphics_state *dyns,
const VkFormat *color_attachment_formats,
const uint8_t *color_attachment_samples,
const struct pan_shader_info *fs_info,
mali_ptr fs_code,
struct mali_blend_packed *bds,
struct panvk_blend_info *blend_info)
{
const struct vk_color_blend_state *cb = &dyns->cb;
struct pan_blend_state bs = {