[Bf-blender-cvs] [648f2a61ada] blender2.8: OpenGL: convert old texture2D calls in built-in shaders

Mike Erwin noreply at git.blender.org
Fri May 19 17:10:47 CEST 2017


Commit: 648f2a61ada53e07162efcf117e8b0269a55f5a8
Author: Mike Erwin
Date:   Fri May 19 11:02:32 2017 -0400
Branches: blender2.8
https://developer.blender.org/rB648f2a61ada53e07162efcf117e8b0269a55f5a8

OpenGL: convert old texture2D calls in built-in shaders

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

M	source/blender/gpu/shaders/gpu_shader_image_alpha_color_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_image_color_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_image_depth_linear_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_image_interlace_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_image_mask_uniform_color_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_image_modulate_alpha_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_image_rect_modulate_alpha_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_image_shuffle_color_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_text_frag.glsl

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

diff --git a/source/blender/gpu/shaders/gpu_shader_image_alpha_color_frag.glsl b/source/blender/gpu/shaders/gpu_shader_image_alpha_color_frag.glsl
index 84d8e2f8d57..727c3c0a832 100644
--- a/source/blender/gpu/shaders/gpu_shader_image_alpha_color_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_image_alpha_color_frag.glsl
@@ -1,12 +1,11 @@
 
 in vec2 texCoord_interp;
 out vec4 fragColor;
-#define texture2D texture
 
 uniform vec4 color;
 uniform sampler2D image;
 
 void main()
 {
-	fragColor = texture2D(image, texCoord_interp).r * color;
+	fragColor = texture(image, texCoord_interp).r * color;
 }
diff --git a/source/blender/gpu/shaders/gpu_shader_image_color_frag.glsl b/source/blender/gpu/shaders/gpu_shader_image_color_frag.glsl
index b94c814672f..ef8935cc7ba 100644
--- a/source/blender/gpu/shaders/gpu_shader_image_color_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_image_color_frag.glsl
@@ -1,12 +1,11 @@
 
 in vec2 texCoord_interp;
 out vec4 fragColor;
-#define texture2D texture
 
 uniform vec4 color;
 uniform sampler2D image;
 
 void main()
 {
-	fragColor = texture2D(image, texCoord_interp) * color;
+	fragColor = texture(image, texCoord_interp) * color;
 }
diff --git a/source/blender/gpu/shaders/gpu_shader_image_depth_linear_frag.glsl b/source/blender/gpu/shaders/gpu_shader_image_depth_linear_frag.glsl
index 3cd4b3f2fa0..bcbe1f577fd 100644
--- a/source/blender/gpu/shaders/gpu_shader_image_depth_linear_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_image_depth_linear_frag.glsl
@@ -1,7 +1,6 @@
 
 in vec2 texCoord_interp;
 out vec4 fragColor;
-#define texture2D texture
 
 uniform float znear;
 uniform float zfar;
@@ -9,7 +8,7 @@ uniform sampler2D image;
 
 void main()
 {
-	float depth = texture2D(image, texCoord_interp).r;
+	float depth = texture(image, texCoord_interp).r;
 
 	/* normalize */
 	fragColor.rgb = vec3((2.0f * znear) / (zfar + znear - (depth * (zfar - znear))));
diff --git a/source/blender/gpu/shaders/gpu_shader_image_interlace_frag.glsl b/source/blender/gpu/shaders/gpu_shader_image_interlace_frag.glsl
index 2445b0206ec..ca73fa56e06 100644
--- a/source/blender/gpu/shaders/gpu_shader_image_interlace_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_image_interlace_frag.glsl
@@ -6,7 +6,6 @@
 
 :n vec2 texCoord_interp;
 out vec4 fragColor;
-#define texture2DRect texture
 
 uniform int interlace_id;
 uniform sampler2DRect image_a;
@@ -28,8 +27,8 @@ bool interlace()
 void main()
 {
 	if (interlace()) {
-		fragColor = texture2DRect(image_a, texCoord_interp);
+		fragColor = texture(image_a, texCoord_interp);
 	} else {
-		fragColor = texture2DRect(image_b, texCoord_interp);
+		fragColor = texture(image_b, texCoord_interp);
 	}
 }
diff --git a/source/blender/gpu/shaders/gpu_shader_image_mask_uniform_color_frag.glsl b/source/blender/gpu/shaders/gpu_shader_image_mask_uniform_color_frag.glsl
index 14f3f465a0a..4a45d03175e 100644
--- a/source/blender/gpu/shaders/gpu_shader_image_mask_uniform_color_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_image_mask_uniform_color_frag.glsl
@@ -1,13 +1,12 @@
 
 in vec2 texCoord_interp;
 out vec4 fragColor;
-#define texture2D texture
 
 uniform sampler2D image;
 uniform vec4 color;
 
 void main()
 {
-	fragColor.a = texture2D(image, texCoord_interp).a * color.a;
+	fragColor.a = texture(image, texCoord_interp).a * color.a;
 	fragColor.rgb = color.rgb;
 }
diff --git a/source/blender/gpu/shaders/gpu_shader_image_modulate_alpha_frag.glsl b/source/blender/gpu/shaders/gpu_shader_image_modulate_alpha_frag.glsl
index 80b078975f0..51092d56e5e 100644
--- a/source/blender/gpu/shaders/gpu_shader_image_modulate_alpha_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_image_modulate_alpha_frag.glsl
@@ -1,13 +1,12 @@
 
 in vec2 texCoord_interp;
 out vec4 fragColor;
-#define texture2D texture
 
 uniform float alpha;
 uniform sampler2D image;
 
 void main()
 {
-	fragColor = texture2D(image, texCoord_interp);
+	fragColor = texture(image, texCoord_interp);
 	fragColor.a *= alpha;
 }
diff --git a/source/blender/gpu/shaders/gpu_shader_image_rect_modulate_alpha_frag.glsl b/source/blender/gpu/shaders/gpu_shader_image_rect_modulate_alpha_frag.glsl
index cb7b85f8a5b..7d9ce9d2003 100644
--- a/source/blender/gpu/shaders/gpu_shader_image_rect_modulate_alpha_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_image_rect_modulate_alpha_frag.glsl
@@ -1,13 +1,12 @@
 
 in vec2 texCoord_interp;
 out vec4 fragColor;
-#define texture2DRect texture
 
 uniform float alpha;
 uniform sampler2DRect image;
 
 void main()
 {
-	fragColor = texture2DRect(image, texCoord_interp);
+	fragColor = texture(image, texCoord_interp);
 	fragColor.a *= alpha;
 }
diff --git a/source/blender/gpu/shaders/gpu_shader_image_shuffle_color_frag.glsl b/source/blender/gpu/shaders/gpu_shader_image_shuffle_color_frag.glsl
index aa3b8bd2727..64662247d69 100644
--- a/source/blender/gpu/shaders/gpu_shader_image_shuffle_color_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_image_shuffle_color_frag.glsl
@@ -1,7 +1,6 @@
 
 in vec2 texCoord_interp;
 out vec4 fragColor;
-#define texture2D texture
 
 uniform sampler2D image;
 uniform vec4 color;
@@ -9,7 +8,7 @@ uniform vec4 shuffle;
 
 void main()
 {
-	vec4 sample = texture2D(image, texCoord_interp);
+	vec4 sample = texture(image, texCoord_interp);
 	fragColor = vec4(sample.r * shuffle.r +
 	                 sample.g * shuffle.g +
 	                 sample.b * shuffle.b +
diff --git a/source/blender/gpu/shaders/gpu_shader_text_frag.glsl b/source/blender/gpu/shaders/gpu_shader_text_frag.glsl
index 1654d3bb016..7ff90ad4f21 100644
--- a/source/blender/gpu/shaders/gpu_shader_text_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_text_frag.glsl
@@ -2,7 +2,6 @@
 flat in vec4 color_flat;
 noperspective in vec2 texCoord_interp;
 out vec4 fragColor;
-#define texture2D texture
 
 uniform sampler2D glyph;
 
@@ -12,5 +11,5 @@ void main()
 	fragColor.rgb = color_flat.rgb;
 
 	// modulate input alpha & texture alpha
-	fragColor.a = color_flat.a * texture2D(glyph, texCoord_interp).r;
+	fragColor.a = color_flat.a * texture(glyph, texCoord_interp).r;
 }




More information about the Bf-blender-cvs mailing list