[Bf-blender-cvs] [d3365c5] blender2.8: OpenGL: fix GPU_SHADER_TEXT on non-Mac

Mike Erwin noreply at git.blender.org
Tue Sep 20 16:13:17 CEST 2016


Commit: d3365c5c725e8876e0cb4bf82f8fee49ddea67d8
Author: Mike Erwin
Date:   Tue Sep 20 16:12:50 2016 +0200
Branches: blender2.8
https://developer.blender.org/rBd3365c5c725e8876e0cb4bf82f8fee49ddea67d8

OpenGL: fix GPU_SHADER_TEXT on non-Mac

Developed on Mac and committed quickly.. oops

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

M	source/blender/gpu/shaders/gpu_shader_text_frag.glsl
M	source/blender/gpu/shaders/gpu_shader_text_vert.glsl

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

diff --git a/source/blender/gpu/shaders/gpu_shader_text_frag.glsl b/source/blender/gpu/shaders/gpu_shader_text_frag.glsl
index c8c90d8..c169b31 100644
--- a/source/blender/gpu/shaders/gpu_shader_text_frag.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_text_frag.glsl
@@ -1,14 +1,21 @@
 
-flat varying vec4 color;
-noperspective varying vec2 texcoord;
+#if __VERSION__ == 120
+  flat varying vec4 color;
+  noperspective varying vec2 texcoord;
+  #define fragColor gl_FragColor
+#else
+  flat in vec4 color;
+  noperspective in vec2 texcoord;
+  out vec4 fragColor;
+#endif
 
 uniform sampler2D glyph;
 
 void main()
 {
 	// input color replaces texture color
-	gl_FragColor.rgb = color.rgb;
+	fragColor.rgb = color.rgb;
 
 	// modulate input alpha & texture alpha
-	gl_FragColor.a = color.a * texture2D(glyph, texcoord).a;
+	fragColor.a = color.a * texture2D(glyph, texcoord).a;
 }
diff --git a/source/blender/gpu/shaders/gpu_shader_text_vert.glsl b/source/blender/gpu/shaders/gpu_shader_text_vert.glsl
index 7247940..bdbffdf 100644
--- a/source/blender/gpu/shaders/gpu_shader_text_vert.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_text_vert.glsl
@@ -1,11 +1,15 @@
 
 // TODO(merwin):
-// - use modern GLSL
 // - uniform color, not per vertex
 // - generic attrib inputs (2D pos, tex coord)
 
-flat varying vec4 color;
-noperspective varying vec2 texcoord;
+#if __VERSION__ == 120
+  flat varying vec4 color;
+  noperspective varying vec2 texcoord;
+#else
+  flat out vec4 color;
+  noperspective out vec2 texcoord;
+#endif
 
 void main()
 {




More information about the Bf-blender-cvs mailing list