Commit: a2d633316bb87df4f147d9b837d875d900225988
Author: Jacques Lucke
Date:   Thu Oct 4 18:53:40 2018 +0200
Branches: blender2.8
https://developer.blender.org/rBa2d633316bb87df4f147d9b837d875d900225988

Cleanup: Remove some unneeded code

Reviewers: fclem

Differential Revision: https://developer.blender.org/D3767

===================================================================

M       source/blender/draw/modes/shaders/paint_weight_frag.glsl
M       source/blender/gpu/CMakeLists.txt
M       source/blender/gpu/GPU_shader.h
M       source/blender/gpu/intern/gpu_shader.c
D       
source/blender/gpu/shaders/gpu_shader_multiply_and_blend_preprocessing.glsl

===================================================================

diff --git a/source/blender/draw/modes/shaders/paint_weight_frag.glsl 
b/source/blender/draw/modes/shaders/paint_weight_frag.glsl
index 668ca9e3c07..bb0834e9cd4 100644
--- a/source/blender/draw/modes/shaders/paint_weight_frag.glsl
+++ b/source/blender/draw/modes/shaders/paint_weight_frag.glsl
@@ -24,6 +24,6 @@ void main()
                color = mix(weight_color, colorVertexUnreferenced, alert * 
alert);
        }
 
-       /* See gpu_shader_multiply_and_blend_preprocessing.glsl */
-       fragColor = vec4(color.rgb * opacity + (1 - opacity), 1.0);
+       /* mix with 1.0 -> is like opacity when using multiply blend mode */
+       fragColor = vec4(mix(vec3(1.0), color.rgb, opacity), 1.0);
 }
diff --git a/source/blender/gpu/CMakeLists.txt 
b/source/blender/gpu/CMakeLists.txt
index e8ed5de82cb..e8c3a19b77e 100644
--- a/source/blender/gpu/CMakeLists.txt
+++ b/source/blender/gpu/CMakeLists.txt
@@ -140,7 +140,6 @@ data_to_c_simple(shaders/gpu_shader_diag_stripes_frag.glsl 
SRC)
 data_to_c_simple(shaders/gpu_shader_simple_lighting_frag.glsl SRC)
 data_to_c_simple(shaders/gpu_shader_simple_lighting_smooth_color_frag.glsl SRC)
 
data_to_c_simple(shaders/gpu_shader_simple_lighting_smooth_color_alpha_frag.glsl
 SRC)
-data_to_c_simple(shaders/gpu_shader_multiply_and_blend_preprocessing.glsl SRC)
 data_to_c_simple(shaders/gpu_shader_flat_color_frag.glsl SRC)
 data_to_c_simple(shaders/gpu_shader_flat_color_alpha_test_0_frag.glsl SRC)
 data_to_c_simple(shaders/gpu_shader_flat_id_frag.glsl SRC)
diff --git a/source/blender/gpu/GPU_shader.h b/source/blender/gpu/GPU_shader.h
index 86d68ebfc58..b53e6f108e7 100644
--- a/source/blender/gpu/GPU_shader.h
+++ b/source/blender/gpu/GPU_shader.h
@@ -118,7 +118,6 @@ typedef enum GPUBuiltinShader {
        GPU_SHADER_SIMPLE_LIGHTING_FLAT_COLOR,
        GPU_SHADER_SIMPLE_LIGHTING_SMOOTH_COLOR,
        GPU_SHADER_SIMPLE_LIGHTING_SMOOTH_COLOR_ALPHA,
-       GPU_SHADER_MULTIPLY_AND_BLEND_PREPROCESSING,
 
        /* for simple 2D drawing */
        /**
diff --git a/source/blender/gpu/intern/gpu_shader.c 
b/source/blender/gpu/intern/gpu_shader.c
index 4fa0fae4c87..274ad1c8c0c 100644
--- a/source/blender/gpu/intern/gpu_shader.c
+++ b/source/blender/gpu/intern/gpu_shader.c
@@ -64,7 +64,6 @@ extern char datatoc_gpu_shader_simple_lighting_frag_glsl[];
 extern char datatoc_gpu_shader_simple_lighting_flat_color_frag_glsl[];
 extern char datatoc_gpu_shader_simple_lighting_smooth_color_frag_glsl[];
 extern char datatoc_gpu_shader_simple_lighting_smooth_color_alpha_frag_glsl[];
-extern char datatoc_gpu_shader_multiply_and_blend_preprocessing_glsl[];
 extern char datatoc_gpu_shader_flat_color_frag_glsl[];
 extern char datatoc_gpu_shader_flat_color_alpha_test_0_frag_glsl[];
 extern char datatoc_gpu_shader_flat_id_frag_glsl[];
@@ -714,9 +713,6 @@ static const GPUShaderStages 
builtin_shader_stages[GPU_NUM_BUILTIN_SHADERS] = {
        [GPU_SHADER_SIMPLE_LIGHTING_SMOOTH_COLOR_ALPHA] =
                { datatoc_gpu_shader_3D_normal_smooth_color_vert_glsl,
                  
datatoc_gpu_shader_simple_lighting_smooth_color_alpha_frag_glsl },
-       [GPU_SHADER_MULTIPLY_AND_BLEND_PREPROCESSING] =
-               { datatoc_gpu_shader_3D_normal_smooth_color_vert_glsl,
-                 datatoc_gpu_shader_multiply_and_blend_preprocessing_glsl },
 
        [GPU_SHADER_2D_IMAGE_MASK_UNIFORM_COLOR] =
                { datatoc_gpu_shader_3D_image_vert_glsl,
diff --git 
a/source/blender/gpu/shaders/gpu_shader_multiply_and_blend_preprocessing.glsl 
b/source/blender/gpu/shaders/gpu_shader_multiply_and_blend_preprocessing.glsl
deleted file mode 100644
index 88d84aeaef6..00000000000
--- 
a/source/blender/gpu/shaders/gpu_shader_multiply_and_blend_preprocessing.glsl
+++ /dev/null
@@ -1,22 +0,0 @@
-uniform float opacity;
-
-in vec4 finalColor;
-out vec4 fragColor;
-
-/* Blend Mode goal:
- *     First multiply the foreground and background and then mix the result
- *     of that with the background based on a opacity value.
- *
- *     result = background * foreground * opacity + background * (1 - opacity)
- *            = background * (foreground * opacity + (1 - opacity))
- *                           <------------------------------------>
- *                                 computed in this shader
- *
- * Afterwards the background and the new foreground only have to be multiplied.
- */
-
-void main()
-{
-       fragColor = finalColor * opacity + (1 - opacity);
-       fragColor.a = finalColor.a;
-}

_______________________________________________
Bf-blender-cvs mailing list
Bf-blender-cvs@blender.org
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to