diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-05-01 17:13:02 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-05-01 17:13:02 +0300 |
commit | 503dc9770894b1e8cf03449abb1067f169add228 (patch) | |
tree | 58781e720486bd7df2b8570eec1dec3b7611c981 /source | |
parent | d540a858d8e22b36f4853582bfe92d594183ef36 (diff) | |
parent | b7f3ebe014a250c417f7d0810aa102067979477d (diff) |
Merge branch 'blender-v2.93-release'
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/gpu/intern/gpu_shader.cc | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/source/blender/gpu/intern/gpu_shader.cc b/source/blender/gpu/intern/gpu_shader.cc index bb657ff1645..75fe7652715 100644 --- a/source/blender/gpu/intern/gpu_shader.cc +++ b/source/blender/gpu/intern/gpu_shader.cc @@ -57,6 +57,8 @@ static CLG_LogRef LOG = {"gpu.shader"}; using namespace blender; using namespace blender::gpu; +static bool gpu_shader_srgb_uniform_dirty_get(); + /* -------------------------------------------------------------------- */ /** \name Debug functions * \{ */ @@ -501,9 +503,13 @@ void GPU_shader_bind(GPUShader *gpu_shader) GPU_matrix_bind(gpu_shader); GPU_shader_set_srgb_uniform(gpu_shader); } - - if (GPU_matrix_dirty_get()) { - GPU_matrix_bind(gpu_shader); + else { + if (gpu_shader_srgb_uniform_dirty_get()) { + GPU_shader_set_srgb_uniform(gpu_shader); + } + if (GPU_matrix_dirty_get()) { + GPU_matrix_bind(gpu_shader); + } } } @@ -715,6 +721,12 @@ void GPU_shader_uniform_4fv_array(GPUShader *sh, const char *name, int len, cons * \{ */ static int g_shader_builtin_srgb_transform = 0; +static bool g_shader_builtin_srgb_is_dirty = false; + +static bool gpu_shader_srgb_uniform_dirty_get(void) +{ + return g_shader_builtin_srgb_is_dirty; +} void GPU_shader_set_srgb_uniform(GPUShader *shader) { @@ -722,11 +734,15 @@ void GPU_shader_set_srgb_uniform(GPUShader *shader) if (loc != -1) { GPU_shader_uniform_vector_int(shader, loc, 1, 1, &g_shader_builtin_srgb_transform); } + g_shader_builtin_srgb_is_dirty = false; } void GPU_shader_set_framebuffer_srgb_target(int use_srgb_to_linear) { - g_shader_builtin_srgb_transform = use_srgb_to_linear; + if (g_shader_builtin_srgb_transform != use_srgb_to_linear) { + g_shader_builtin_srgb_transform = use_srgb_to_linear; + g_shader_builtin_srgb_is_dirty = true; + } } /** \} */ |