diff options
Diffstat (limited to 'source')
4 files changed, 13 insertions, 16 deletions
diff --git a/source/blender/draw/engines/image/image_drawing_mode.hh b/source/blender/draw/engines/image/image_drawing_mode.hh index 8762a02458f..8eb98b40492 100644 --- a/source/blender/draw/engines/image/image_drawing_mode.hh +++ b/source/blender/draw/engines/image/image_drawing_mode.hh @@ -90,7 +90,7 @@ template<typename TextureMethod> class ScreenSpaceDrawingMode : public AbstractD void add_shgroups(const IMAGE_InstanceData *instance_data) const { const ShaderParameters &sh_params = instance_data->sh_params; - GPUShader *shader = IMAGE_shader_image_get(false); + GPUShader *shader = IMAGE_shader_image_get(); DRWShadingGroup *shgrp = DRW_shgroup_create(shader, instance_data->passes.image_pass); DRW_shgroup_uniform_vec2_copy(shgrp, "farNearDistances", sh_params.far_near); diff --git a/source/blender/draw/engines/image/image_private.hh b/source/blender/draw/engines/image/image_private.hh index 05ed2881145..c8968ddf9c6 100644 --- a/source/blender/draw/engines/image/image_private.hh +++ b/source/blender/draw/engines/image/image_private.hh @@ -72,7 +72,7 @@ class AbstractDrawingMode { }; /* image_shader.c */ -GPUShader *IMAGE_shader_image_get(bool is_tiled_image); +GPUShader *IMAGE_shader_image_get(); void IMAGE_shader_library_ensure(); void IMAGE_shader_free(); diff --git a/source/blender/draw/engines/image/image_shader.cc b/source/blender/draw/engines/image/image_shader.cc index 1c6abf36505..77cbaeec5a4 100644 --- a/source/blender/draw/engines/image/image_shader.cc +++ b/source/blender/draw/engines/image/image_shader.cc @@ -41,13 +41,13 @@ extern char datatoc_engine_image_vert_glsl[]; namespace blender::draw::image_engine { struct IMAGE_Shaders { - GPUShader *image_sh[2]; + GPUShader *image_sh; }; static struct { IMAGE_Shaders shaders; DRWShaderLibrary *lib; -} e_data = {{{nullptr}}}; /* Engine data */ +} e_data = {{nullptr}}; /* Engine data */ void IMAGE_shader_library_ensure() { @@ -60,19 +60,17 @@ void IMAGE_shader_library_ensure() } } -GPUShader *IMAGE_shader_image_get(bool is_tiled_image) +GPUShader *IMAGE_shader_image_get() { - const int index = is_tiled_image ? 1 : 0; IMAGE_Shaders *sh_data = &e_data.shaders; - if (sh_data->image_sh[index] == nullptr) { - sh_data->image_sh[index] = DRW_shader_create_with_shaderlib( - datatoc_engine_image_vert_glsl, - nullptr, - datatoc_engine_image_frag_glsl, - e_data.lib, - is_tiled_image ? "#define TILED_IMAGE\n" : nullptr); + if (sh_data->image_sh == nullptr) { + sh_data->image_sh = DRW_shader_create_with_shaderlib(datatoc_engine_image_vert_glsl, + nullptr, + datatoc_engine_image_frag_glsl, + e_data.lib, + nullptr); } - return sh_data->image_sh[index]; + return sh_data->image_sh; } void IMAGE_shader_free() diff --git a/source/blender/draw/tests/shaders_test.cc b/source/blender/draw/tests/shaders_test.cc index 6f4dc226c84..b97298cbe95 100644 --- a/source/blender/draw/tests/shaders_test.cc +++ b/source/blender/draw/tests/shaders_test.cc @@ -185,8 +185,7 @@ static void test_image_glsl_shaders() { IMAGE_shader_library_ensure(); - EXPECT_NE(IMAGE_shader_image_get(false), nullptr); - EXPECT_NE(IMAGE_shader_image_get(true), nullptr); + EXPECT_NE(IMAGE_shader_image_get(), nullptr); IMAGE_shader_free(); } |