panvk: Upload render state in panvk_shader
Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29161>
This commit is contained in:
committed by
Marge Bot
parent
384ebea7ac
commit
9c39185e20
@@ -28,7 +28,6 @@
|
||||
|
||||
struct panvk_pipeline_shader {
|
||||
struct panvk_shader *base;
|
||||
struct panvk_priv_mem rsd;
|
||||
|
||||
struct {
|
||||
struct panvk_priv_mem attribs;
|
||||
|
||||
@@ -75,15 +75,6 @@ init_pipeline_shader(struct panvk_pipeline *pipeline,
|
||||
compute_pipeline->local_size = shader->local_size;
|
||||
}
|
||||
|
||||
if (stage_info->stage != VK_SHADER_STAGE_FRAGMENT_BIT) {
|
||||
pshader->rsd = panvk_pool_alloc_desc(&dev->mempools.rw, RENDERER_STATE);
|
||||
|
||||
pan_pack(panvk_priv_mem_host_addr(pshader->rsd), RENDERER_STATE, cfg) {
|
||||
pan_shader_prepare_rsd(&pshader->info,
|
||||
panvk_shader_get_dev_addr(pshader->base), &cfg);
|
||||
}
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -94,8 +85,6 @@ cleanup_pipeline_shader(struct panvk_pipeline *pipeline,
|
||||
{
|
||||
struct panvk_device *dev = to_panvk_device(pipeline->base.device);
|
||||
|
||||
panvk_pool_free_mem(&dev->mempools.rw, pshader->rsd);
|
||||
|
||||
if (pshader->base != NULL)
|
||||
panvk_per_arch(shader_destroy)(dev, pshader->base, alloc);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,13 @@ panvk_per_arch(CmdDispatch)(VkCommandBuffer commandBuffer, uint32_t x,
|
||||
uint32_t y, uint32_t z)
|
||||
{
|
||||
VK_FROM_HANDLE(panvk_cmd_buffer, cmdbuf, commandBuffer);
|
||||
const struct panvk_compute_pipeline *pipeline =
|
||||
cmdbuf->state.compute.pipeline;
|
||||
|
||||
/* If there's no compute shader, we can skip the dispatch. */
|
||||
if (!panvk_priv_mem_dev_addr(pipeline->cs.base->rsd))
|
||||
return;
|
||||
|
||||
struct panvk_device *dev = to_panvk_device(cmdbuf->vk.base.device);
|
||||
struct panvk_physical_device *phys_dev =
|
||||
to_panvk_physical_device(dev->vk.physical);
|
||||
@@ -50,8 +57,6 @@ panvk_per_arch(CmdDispatch)(VkCommandBuffer commandBuffer, uint32_t x,
|
||||
&cmdbuf->state.compute.desc_state;
|
||||
struct panvk_shader_desc_state *cs_desc_state =
|
||||
&cmdbuf->state.compute.cs.desc;
|
||||
const struct panvk_compute_pipeline *pipeline =
|
||||
cmdbuf->state.compute.pipeline;
|
||||
|
||||
panvk_per_arch(cmd_alloc_tls_desc)(cmdbuf, false);
|
||||
dispatch.tsd = batch->tls.gpu;
|
||||
@@ -111,7 +116,7 @@ panvk_per_arch(CmdDispatch)(VkCommandBuffer commandBuffer, uint32_t x,
|
||||
}
|
||||
|
||||
pan_section_pack(job.cpu, COMPUTE_JOB, DRAW, cfg) {
|
||||
cfg.state = panvk_priv_mem_dev_addr(pipeline->cs.rsd);
|
||||
cfg.state = panvk_priv_mem_dev_addr(pipeline->cs.base->rsd);
|
||||
cfg.attributes = cs_desc_state->img_attrib_table;
|
||||
cfg.attribute_buffers =
|
||||
cs_desc_state->tables[PANVK_BIFROST_DESC_TABLE_IMG];
|
||||
|
||||
@@ -806,7 +806,7 @@ panvk_draw_prepare_vertex_job(struct panvk_cmd_buffer *cmdbuf,
|
||||
}
|
||||
|
||||
pan_section_pack(ptr.cpu, COMPUTE_JOB, DRAW, cfg) {
|
||||
cfg.state = panvk_priv_mem_dev_addr(pipeline->vs.rsd);
|
||||
cfg.state = panvk_priv_mem_dev_addr(pipeline->vs.base->rsd);
|
||||
cfg.attributes = draw->vs.attributes;
|
||||
cfg.attribute_buffers = draw->vs.attribute_bufs;
|
||||
cfg.varyings = draw->vs.varyings;
|
||||
@@ -1043,6 +1043,10 @@ panvk_cmd_draw(struct panvk_cmd_buffer *cmdbuf, struct panvk_draw_info *draw)
|
||||
const struct vk_rasterization_state *rs =
|
||||
&cmdbuf->vk.dynamic_graphics_state.rs;
|
||||
|
||||
/* If there's no vertex shader, we can skip the draw. */
|
||||
if (!panvk_priv_mem_dev_addr(pipeline->vs.base->rsd))
|
||||
return;
|
||||
|
||||
/* There are only 16 bits in the descriptor for the job ID. Each job has a
|
||||
* pilot shader dealing with descriptor copies, and we need one
|
||||
* <vertex,tiler> pair per draw.
|
||||
|
||||
@@ -123,6 +123,7 @@ struct panvk_shader {
|
||||
uint32_t bin_size;
|
||||
|
||||
struct panvk_priv_mem code_mem;
|
||||
struct panvk_priv_mem rsd;
|
||||
};
|
||||
|
||||
static inline mali_ptr
|
||||
|
||||
@@ -140,11 +140,23 @@ static VkResult
|
||||
panvk_shader_upload(struct panvk_device *dev, struct panvk_shader *shader,
|
||||
const VkAllocationCallbacks *pAllocator)
|
||||
{
|
||||
if (shader->bin_size > 0) {
|
||||
shader->code_mem = panvk_pool_upload_aligned(
|
||||
&dev->mempools.exec, shader->bin_ptr, shader->bin_size, 128);
|
||||
} else {
|
||||
shader->code_mem = (struct panvk_priv_mem){0};
|
||||
shader->code_mem = (struct panvk_priv_mem){0};
|
||||
shader->rsd = (struct panvk_priv_mem){0};
|
||||
|
||||
if (!shader->bin_size)
|
||||
return VK_SUCCESS;
|
||||
|
||||
shader->code_mem = panvk_pool_upload_aligned(
|
||||
&dev->mempools.exec, shader->bin_ptr, shader->bin_size, 128);
|
||||
|
||||
if (shader->info.stage == MESA_SHADER_FRAGMENT)
|
||||
return VK_SUCCESS;
|
||||
|
||||
shader->rsd = panvk_pool_alloc_desc(&dev->mempools.rw, RENDERER_STATE);
|
||||
|
||||
pan_pack(panvk_priv_mem_host_addr(shader->rsd), RENDERER_STATE, cfg) {
|
||||
pan_shader_prepare_rsd(&shader->info, panvk_shader_get_dev_addr(shader),
|
||||
&cfg);
|
||||
}
|
||||
|
||||
return VK_SUCCESS;
|
||||
@@ -394,6 +406,7 @@ panvk_per_arch(shader_destroy)(struct panvk_device *dev,
|
||||
struct panvk_shader *shader,
|
||||
const VkAllocationCallbacks *alloc)
|
||||
{
|
||||
panvk_pool_free_mem(&dev->mempools.rw, shader->rsd);
|
||||
panvk_pool_free_mem(&dev->mempools.rw, shader->desc_info.others.map);
|
||||
panvk_pool_free_mem(&dev->mempools.exec, shader->code_mem);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user