radv: add UMR markers for the vertex prolog
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 15 Oct 2021 11:30:16 +0000 (13:30 +0200)
committerMarge Bot <emma+marge@anholt.net>
Tue, 4 Jan 2022 07:50:07 +0000 (07:50 +0000)
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13376>

src/amd/vulkan/radv_shader.c

index 97dd2b1..0eba1f2 100644 (file)
@@ -1973,11 +1973,12 @@ radv_create_trap_handler_shader(struct radv_device *device)
 static struct radv_shader_prolog *
 upload_vs_prolog(struct radv_device *device, struct radv_prolog_binary *bin, unsigned wave_size)
 {
+   uint32_t code_size = radv_get_shader_binary_size(bin->code_size);
    struct radv_shader_prolog *prolog = malloc(sizeof(struct radv_shader_prolog));
    if (!prolog)
       return NULL;
 
-   prolog->alloc = radv_alloc_shader_memory(device, bin->code_size, NULL);
+   prolog->alloc = radv_alloc_shader_memory(device, code_size, NULL);
    if (!prolog->alloc) {
       free(prolog);
       return NULL;
@@ -1988,6 +1989,11 @@ upload_vs_prolog(struct radv_device *device, struct radv_prolog_binary *bin, uns
 
    memcpy(dest_ptr, bin->data, bin->code_size);
 
+   /* Add end-of-code markers for the UMR disassembler. */
+   uint32_t *ptr32 = (uint32_t *)dest_ptr + bin->code_size / 4;
+   for (unsigned i = 0; i < DEBUGGER_NUM_MARKERS; i++)
+      ptr32[i] = DEBUGGER_END_OF_CODE_MARKER;
+
    prolog->rsrc1 = S_00B848_VGPRS((bin->num_vgprs - 1) / (wave_size == 32 ? 8 : 4)) |
                    S_00B228_SGPRS((bin->num_sgprs - 1) / 8);
    prolog->num_preserved_sgprs = bin->num_preserved_sgprs;