[Mesa-dev] [PATCH 87/87] glsl: don't lose sampler or image units when cache falls back
Timothy Arceri
timothy.arceri at collabora.com
Wed Jul 13 02:48:22 UTC 2016
The old linked shader is deleted so we need to make sure we hold onto
these values.
---
src/compiler/glsl/linker.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 8a1803c..637236f 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -4648,6 +4648,7 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog,
"type of shader\n");
}
+ unsigned char img_units[MAX_IMAGE_UNIFORMS];
gl_uniform_block **ubos[MESA_SHADER_STAGES];
gl_uniform_block **ssbos[MESA_SHADER_STAGES];
unsigned num_ubos[MESA_SHADER_STAGES];
@@ -4663,6 +4664,8 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog,
ssbos[i] = prog->_LinkedShaders[i]->ShaderStorageBlocks;
num_ubos[i] = prog->_LinkedShaders[i]->NumUniformBlocks;
num_ssbos[i] = prog->_LinkedShaders[i]->NumShaderStorageBlocks;
+ memcpy(img_units, prog->_LinkedShaders[i]->ImageUnits,
+ sizeof(img_units));
}
_mesa_delete_linked_shader(ctx, prog->_LinkedShaders[i]);
@@ -4715,6 +4718,11 @@ link_shaders(struct gl_context *ctx, struct gl_shader_program *prog,
prog->_LinkedShaders[stage]->NumUniformBlocks = num_ubos[stage];
prog->_LinkedShaders[stage]->NumShaderStorageBlocks =
num_ssbos[stage];
+ memcpy(prog->_LinkedShaders[stage]->ImageUnits, img_units,
+ sizeof(img_units));
+ memcpy(prog->_LinkedShaders[stage]->SamplerUnits,
+ prog->cache_progs[stage]->SamplerUnits,
+ sizeof(prog->_LinkedShaders[stage]->SamplerUnits));
}
}
}
--
2.7.4
More information about the mesa-dev
mailing list