panvk: Don't link the VS and FS shaders on v10

When IDVS+malloc is used, there's no linking involved (getting the
VS and FS shaders to agree on the varyings attributes), so we can
purely and simply skip this phase.

If we ever have to support the non-malloc or non-IDVS case, we'll need
to revisit the linking logic anyway, so let's kill the linking on v10
for now.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31911>
This commit is contained in:
Boris Brezillon 2024-11-08 12:02:11 +01:00 committed by Marge Bot
parent b07fd26211
commit 8b70f66440
4 changed files with 15 additions and 25 deletions

View file

@ -1516,16 +1516,6 @@ prepare_draw(struct panvk_cmd_buffer *cmdbuf, struct panvk_draw_info *draw)
/* FIXME: support non-IDVS. */
assert(idvs);
if (!cmdbuf->state.gfx.linked) {
result = panvk_per_arch(link_shaders)(&cmdbuf->desc_pool, vs, fs,
&cmdbuf->state.gfx.link);
if (result != VK_SUCCESS) {
vk_command_buffer_set_error(&cmdbuf->vk, result);
return result;
}
cmdbuf->state.gfx.linked = true;
}
result = update_tls(cmdbuf);
if (result != VK_SUCCESS)
return result;

View file

@ -75,8 +75,10 @@ struct panvk_cmd_graphics_state {
struct panvk_graphics_sysvals sysvals;
#if PAN_ARCH <= 7
struct panvk_shader_link link;
bool linked;
#endif
struct {
const struct panvk_shader *shader;

View file

@ -167,6 +167,13 @@ struct panvk_shader {
const char *asm_str;
};
static inline mali_ptr
panvk_shader_get_dev_addr(const struct panvk_shader *shader)
{
return shader != NULL ? panvk_priv_mem_dev_addr(shader->code_mem) : 0;
}
#if PAN_ARCH <= 7
struct panvk_shader_link {
struct {
struct panvk_priv_mem attribs;
@ -174,12 +181,6 @@ struct panvk_shader_link {
unsigned buf_strides[PANVK_VARY_BUF_MAX];
};
static inline mali_ptr
panvk_shader_get_dev_addr(const struct panvk_shader *shader)
{
return shader != NULL ? panvk_priv_mem_dev_addr(shader->code_mem) : 0;
}
VkResult panvk_per_arch(link_shaders)(struct panvk_pool *desc_pool,
const struct panvk_shader *vs,
const struct panvk_shader *fs,
@ -191,6 +192,7 @@ panvk_shader_link_cleanup(struct panvk_shader_link *link)
panvk_pool_free_mem(&link->vs.attribs);
panvk_pool_free_mem(&link->fs.attribs);
}
#endif
bool panvk_per_arch(nir_lower_descriptors)(
nir_shader *nir, struct panvk_device *dev,

View file

@ -1160,6 +1160,7 @@ panvk_shader_get_executable_internal_representations(
return incomplete_text ? VK_INCOMPLETE : vk_outarray_status(&out);
}
#if PAN_ARCH <= 7
static mali_pixel_format
get_varying_format(gl_shader_stage stage, gl_varying_slot loc,
enum pipe_format pfmt)
@ -1296,14 +1297,6 @@ panvk_per_arch(link_shaders)(struct panvk_pool *desc_pool,
assert(vs);
assert(vs->info.stage == MESA_SHADER_VERTEX);
if (PAN_ARCH >= 9) {
/* No need to calculate varying stride if there's no fragment shader. */
if (fs)
link->buf_strides[PANVK_VARY_BUF_GENERAL] =
MAX2(fs->info.varyings.input_count, vs->info.varyings.output_count);
return VK_SUCCESS;
}
collect_varyings_info(vs->info.varyings.output,
vs->info.varyings.output_count, &out_vars);
@ -1379,6 +1372,7 @@ panvk_per_arch(link_shaders)(struct panvk_pool *desc_pool,
memcpy(link->buf_strides, buf_strides, sizeof(link->buf_strides));
return VK_SUCCESS;
}
#endif
static const struct vk_shader_ops panvk_shader_ops = {
.destroy = panvk_shader_destroy,
@ -1401,13 +1395,15 @@ panvk_cmd_bind_shader(struct panvk_cmd_buffer *cmd, const gl_shader_stage stage,
break;
case MESA_SHADER_VERTEX:
cmd->state.gfx.vs.shader = shader;
#if PAN_ARCH <= 7
cmd->state.gfx.linked = false;
#endif
memset(&cmd->state.gfx.vs.desc, 0, sizeof(cmd->state.gfx.vs.desc));
break;
case MESA_SHADER_FRAGMENT:
cmd->state.gfx.fs.shader = shader;
cmd->state.gfx.linked = false;
#if PAN_ARCH <= 7
cmd->state.gfx.linked = false;
cmd->state.gfx.fs.rsd = 0;
#endif
memset(&cmd->state.gfx.fs.desc, 0, sizeof(cmd->state.gfx.fs.desc));