diff options
-rw-r--r-- | src/compiler/glsl/gl_nir_link_uniform_blocks.c | 5 | ||||
-rw-r--r-- | src/compiler/glsl/linker.cpp | 1 | ||||
-rw-r--r-- | src/compiler/glsl/serialize.cpp | 10 | ||||
-rw-r--r-- | src/mesa/main/mtypes.h | 1 |
4 files changed, 11 insertions, 6 deletions
diff --git a/src/compiler/glsl/gl_nir_link_uniform_blocks.c b/src/compiler/glsl/gl_nir_link_uniform_blocks.c index 53f03fe2a80..07f1614a40c 100644 --- a/src/compiler/glsl/gl_nir_link_uniform_blocks.c +++ b/src/compiler/glsl/gl_nir_link_uniform_blocks.c @@ -302,8 +302,10 @@ nir_interstage_cross_validate_uniform_blocks(struct gl_shader_program *prog, if (block_type == BLOCK_SSBO) prog->data->ShaderStorageBlocks = blks; - else + else { + prog->data->NumUniformBlocks = *num_blks; prog->data->UniformBlocks = blks; + } return true; } @@ -610,6 +612,7 @@ gl_nir_link_uniform_blocks(struct gl_context *ctx, linked->Program->sh.UniformBlocks = ralloc_array(linked, struct gl_uniform_block *, num_ubo_blocks); ralloc_steal(linked, ubo_blocks); + linked->Program->sh.NumUniformBlocks = num_ubo_blocks; for (unsigned i = 0; i < num_ubo_blocks; i++) { linked->Program->sh.UniformBlocks[i] = &ubo_blocks[i]; } diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index b3175090c71..a49c5e6ccc2 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -2568,6 +2568,7 @@ link_intrastage_shaders(void *mem_ctx, for (unsigned i = 0; i < num_ubo_blocks; i++) { linked->Program->sh.UniformBlocks[i] = &ubo_blocks[i]; } + linked->Program->sh.NumUniformBlocks = num_ubo_blocks; linked->Program->info.num_ubos = num_ubo_blocks; /* Copy ssbo blocks to linked shader list */ diff --git a/src/compiler/glsl/serialize.cpp b/src/compiler/glsl/serialize.cpp index d4aacc1cb95..2f68d1b9785 100644 --- a/src/compiler/glsl/serialize.cpp +++ b/src/compiler/glsl/serialize.cpp @@ -139,10 +139,10 @@ write_buffer_blocks(struct blob *metadata, struct gl_shader_program *prog) struct gl_program *glprog = sh->Program; - blob_write_uint32(metadata, glprog->info.num_ubos); + blob_write_uint32(metadata, glprog->sh.NumUniformBlocks); blob_write_uint32(metadata, glprog->info.num_ssbos); - for (unsigned j = 0; j < glprog->info.num_ubos; j++) { + for (unsigned j = 0; j < glprog->sh.NumUniformBlocks; j++) { uint32_t offset = glprog->sh.UniformBlocks[j] - prog->data->UniformBlocks; blob_write_uint32(metadata, offset); @@ -215,15 +215,15 @@ read_buffer_blocks(struct blob_reader *metadata, struct gl_program *glprog = sh->Program; - glprog->info.num_ubos = blob_read_uint32(metadata); + glprog->sh.NumUniformBlocks = blob_read_uint32(metadata); glprog->info.num_ssbos = blob_read_uint32(metadata); glprog->sh.UniformBlocks = - rzalloc_array(glprog, gl_uniform_block *, glprog->info.num_ubos); + rzalloc_array(glprog, gl_uniform_block *, glprog->sh.NumUniformBlocks); glprog->sh.ShaderStorageBlocks = rzalloc_array(glprog, gl_uniform_block *, glprog->info.num_ssbos); - for (unsigned j = 0; j < glprog->info.num_ubos; j++) { + for (unsigned j = 0; j < glprog->sh.NumUniformBlocks; j++) { uint32_t offset = blob_read_uint32(metadata); glprog->sh.UniformBlocks[j] = prog->data->UniformBlocks + offset; } diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index e334de0672d..a46eb72da9a 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -2182,6 +2182,7 @@ struct gl_program */ GLenum16 ImageAccess[MAX_IMAGE_UNIFORMS]; + GLuint NumUniformBlocks; struct gl_uniform_block **UniformBlocks; struct gl_uniform_block **ShaderStorageBlocks; |