Fix: VSE preview draw was not caching the OCIO GPU shader

IMB_colormanagement_setup_glsl_draw_to_scene_linear (only used by
VSE preview rendering) inside GPUShaderBinder::to_scene_linear_bind
was trying to cache the created OCIO GPU shader, but failed to actually
do it: it was querying scene_linear_cache, but putting the shader
into display_cache.

This lack of caching was costing around 1ms on each VSE preview draw.

Pull Request: https://projects.blender.org/blender/blender/pulls/144617
This commit is contained in:
Aras Pranckevicius
2025-08-15 15:15:08 +02:00
committed by Aras Pranckevicius
parent 3c3f21ec00
commit e5cc7ce59b

View File

@@ -427,20 +427,20 @@ bool GPUShaderBinder::to_scene_linear_bind(const StringRefNull from_colorspace,
display_parameters.use_predivide = use_predivide;
/* Attempt to get shader from the cache. */
internal::GPUDisplayShader *display_shader = scene_linear_cache_->get(display_parameters);
internal::GPUDisplayShader *shader = scene_linear_cache_->get(display_parameters);
if (!display_shader) {
display_shader = &display_cache_->create_default();
BLI_assert(display_shader);
if (!shader) {
shader = &scene_linear_cache_->create_default();
BLI_assert(shader);
display_shader->from_colorspace = display_parameters.from_colorspace;
shader->from_colorspace = display_parameters.from_colorspace;
if (display_shader->initialize_common()) {
construct_scene_linear_shader(*display_shader);
if (shader->initialize_common()) {
construct_scene_linear_shader(*shader);
}
}
return gpu_shader_bind(config_, *display_shader, display_parameters);
return gpu_shader_bind(config_, *shader, display_parameters);
}
void GPUShaderBinder::unbind() const