radv: Add radv_shader_reupload

Used for relocating RT shaders with capture/replay.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23516>
This commit is contained in:
Friedrich Vock 2023-06-01 22:24:45 +02:00 committed by Marge Bot
parent 744357477e
commit 878a731c77
2 changed files with 23 additions and 0 deletions

View file

@ -2073,6 +2073,26 @@ radv_shader_create(struct radv_device *device, const struct radv_shader_binary *
return shader;
}
bool
radv_shader_reupload(struct radv_device *device, struct radv_shader *shader)
{
if (device->shader_use_invisible_vram) {
struct radv_shader_dma_submission *submission =
radv_shader_dma_get_submission(device, shader->bo, shader->va, shader->code_size);
if (!submission)
return false;
memcpy(submission->ptr, shader->code, shader->code_size);
if (!radv_shader_dma_submit(device, submission, &shader->upload_seq))
return false;
} else {
void *dest_ptr = shader->alloc->arena->ptr + shader->alloc->offset;
memcpy(dest_ptr, shader->code, shader->code_size);
}
return true;
}
static bool
radv_shader_part_binary_upload(struct radv_device *device, const struct radv_shader_part_binary *bin,
struct radv_shader_part *shader_part)

View file

@ -685,6 +685,9 @@ bool radv_can_dump_shader_stats(struct radv_device *device, nir_shader *nir);
VkResult radv_dump_shader_stats(struct radv_device *device, struct radv_pipeline *pipeline, struct radv_shader *shader,
gl_shader_stage stage, FILE *output);
/* Returns true on success and false on failure */
bool radv_shader_reupload(struct radv_device *device, struct radv_shader *shader);
extern const struct vk_pipeline_cache_object_ops radv_shader_ops;
static inline struct radv_shader *