radv: store the total radv_shader_part_binary size
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>
Fri, 10 Mar 2023 14:44:13 +0000 (15:44 +0100)
committerMarge Bot <emma+marge@anholt.net>
Tue, 21 Mar 2023 13:53:59 +0000 (13:53 +0000)
Similar to radv_shader. This will be used for the shaders cache.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21897>

src/amd/vulkan/radv_shader.c
src/amd/vulkan/radv_shader.h

index f8a67e5..ec7be44 100644 (file)
@@ -2786,6 +2786,7 @@ static void radv_aco_build_shader_part(void **bin,
 
    part_binary->num_sgprs = num_sgprs;
    part_binary->num_vgprs = num_vgprs;
+   part_binary->total_size = size;
    part_binary->code_size = code_size * sizeof(uint32_t);
    memcpy(part_binary->data, code, part_binary->code_size);
    if (disasm_size) {
index 4ae59c0..8d52659 100644 (file)
@@ -466,6 +466,10 @@ struct radv_shader_part_binary {
    uint8_t num_vgprs;
    unsigned code_size;
    unsigned disasm_size;
+
+   /* Self-referential size so we avoid consistency issues. */
+   uint32_t total_size;
+
    uint8_t data[0];
 };