diff options
-rw-r--r-- | src/compiler/glsl/shader_cache.cpp | 48 |
1 files changed, 42 insertions, 6 deletions
diff --git a/src/compiler/glsl/shader_cache.cpp b/src/compiler/glsl/shader_cache.cpp index a9bb7715ef9..b76b4cb33fc 100644 --- a/src/compiler/glsl/shader_cache.cpp +++ b/src/compiler/glsl/shader_cache.cpp @@ -446,8 +446,8 @@ write_uniform_remap_table_entry(struct blob *metadata, } static void -write_uniform_remap_table(struct blob *metadata, - struct gl_shader_program *prog) +write_uniform_remap_tables(struct blob *metadata, + struct gl_shader_program *prog) { blob_write_uint32(metadata, prog->NumUniformRemapTable); @@ -455,6 +455,20 @@ write_uniform_remap_table(struct blob *metadata, write_uniform_remap_table_entry(metadata, prog->data->UniformStorage, prog->UniformRemapTable[i]); } + + for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) { + struct gl_linked_shader *sh = prog->_LinkedShaders[i]; + if (sh) { + struct gl_program *glprog = sh->Program; + blob_write_uint32(metadata, glprog->sh.NumSubroutineUniformRemapTable); + + for (unsigned j = 0; j < glprog->sh.NumSubroutineUniformRemapTable; j++) { + write_uniform_remap_table_entry(metadata, + prog->data->UniformStorage, + glprog->sh.SubroutineUniformRemapTable[j]); + } + } + } } static void @@ -474,8 +488,8 @@ read_uniform_remap_table_entry(struct blob_reader *metadata, } static void -read_uniform_remap_table(struct blob_reader *metadata, - struct gl_shader_program *prog) +read_uniform_remap_tables(struct blob_reader *metadata, + struct gl_shader_program *prog) { prog->NumUniformRemapTable = blob_read_uint32(metadata); @@ -489,6 +503,28 @@ read_uniform_remap_table(struct blob_reader *metadata, read_uniform_remap_table_entry(metadata, prog->data->UniformStorage, &prog->UniformRemapTable[i], type); } + + for (unsigned i = 0; i < MESA_SHADER_STAGES; i++) { + struct gl_linked_shader *sh = prog->_LinkedShaders[i]; + if (sh) { + struct gl_program *glprog = sh->Program; + glprog->sh.NumSubroutineUniformRemapTable = blob_read_uint32(metadata); + + glprog->sh.SubroutineUniformRemapTable = + rzalloc_array(glprog, struct gl_uniform_storage *, + glprog->sh.NumSubroutineUniformRemapTable); + + for (unsigned j = 0; j < glprog->sh.NumSubroutineUniformRemapTable; j++) { + enum uniform_remap_type type = + (enum uniform_remap_type) blob_read_uint32(metadata); + + read_uniform_remap_table_entry(metadata, + prog->data->UniformStorage, + &glprog->sh.SubroutineUniformRemapTable[j], + type); + } + } + } } struct whte_closure @@ -918,7 +954,7 @@ shader_cache_write_program_metadata(struct gl_context *ctx, write_xfb(metadata, prog); - write_uniform_remap_table(metadata, prog); + write_uniform_remap_tables(metadata, prog); write_subroutines(metadata, prog); @@ -1027,7 +1063,7 @@ shader_cache_read_program_metadata(struct gl_context *ctx, read_xfb(&metadata, prog); - read_uniform_remap_table(&metadata, prog); + read_uniform_remap_tables(&metadata, prog); read_subroutines(&metadata, prog); |