[Bf-blender-cvs] [5ed0944ce63] blender2.8: GPU: cleanup GLSL version and standard extensions

Mike Erwin noreply at git.blender.org
Fri May 19 00:31:40 CEST 2017


Commit: 5ed0944ce6381037ecbb361320a0ed3f64c9183b
Author: Mike Erwin
Date:   Thu May 18 15:47:32 2017 -0400
Branches: blender2.8
https://developer.blender.org/rB5ed0944ce6381037ecbb361320a0ed3f64c9183b

GPU: cleanup GLSL version and standard extensions

Now we always use GLSL 3.3, AKA #version 330. Most of the extensions we used are built into OpenGL 3.3 so we don't need them anymore.

Cleaned up comments related to GLSL version.

Part of T49012

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

M	source/blender/gpu/intern/gpu_shader.c

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

diff --git a/source/blender/gpu/intern/gpu_shader.c b/source/blender/gpu/intern/gpu_shader.c
index 0c294585aea..58610ee7f4b 100644
--- a/source/blender/gpu/intern/gpu_shader.c
+++ b/source/blender/gpu/intern/gpu_shader.c
@@ -191,33 +191,7 @@ static void shader_print_errors(const char *task, const char *log, const char **
 
 static const char *gpu_shader_version(void)
 {
-#ifdef WITH_LEGACY_OPENGL
-	if (GLEW_VERSION_3_3) {
-		if (GPU_legacy_support()) {
-			return "#version 330 compatibility\n";
-			/* highest version that is widely supported
-			 * gives us native geometry shaders!
-			 * use compatibility profile so we can continue using builtin shader input/output names
-			 */
-		}
-		else {
-			return "#version 130\n";
-			/* latest version that is compatible with existing shaders */
-		}
-	}
-	else if (GLEW_VERSION_3_0) {
-		return "#version 130\n";
-		/* GLSL 1.3 has modern syntax/keywords/datatypes so use if available
-		 * older features are deprecated but still available without compatibility extension or profile
-		 */
-	}
-	else {
-		return "#version 120\n";
-		/* minimum supported */
-	}
-#else
 	return "#version 330\n";
-#endif
 }
 
 static void gpu_shader_standard_extensions(char defines[MAX_EXT_DEFINE_LENGTH])
@@ -227,25 +201,9 @@ static void gpu_shader_standard_extensions(char defines[MAX_EXT_DEFINE_LENGTH])
 	 */
 
 	if (GLEW_ARB_texture_query_lod) {
-		/* a #version 400 feature, but we use #version 150 maximum so use extension */
+		/* a #version 400 feature, but we use #version 330 maximum so use extension */
 		strcat(defines, "#extension GL_ARB_texture_query_lod: enable\n");
 	}
-
-#ifdef WITH_LEGACY_OPENGL
-	if (GLEW_VERSION_3_1 && !GLEW_VERSION_3_2 && GLEW_ARB_compatibility) {
-		strcat(defines, "#extension GL_ARB_compatibility: enable\n");
-	}
-
-	if (!GLEW_VERSION_3_1) {
-		if (GLEW_ARB_draw_instanced) {
-			strcat(defines, "#extension GL_ARB_draw_instanced: enable\n");
-		}
-
-		if (!GLEW_VERSION_3_0) {
-			strcat(defines, "#extension GL_EXT_gpu_shader4: require\n");
-		}
-	}
-#endif
 }
 
 static void gpu_shader_standard_defines(char defines[MAX_DEFINE_LENGTH],
@@ -322,10 +280,6 @@ GPUShader *GPU_shader_create_ex(const char *vertexcode,
                                 const int flags)
 {
 #ifdef WITH_OPENSUBDIV
-	/* TODO(sergey): used to add #version 150 to the geometry shader.
-	 * Could safely be renamed to "use_geometry_code" since it's very
-	 * likely any of geometry code will want to use GLSL 1.5.
-	 */
 	bool use_opensubdiv = (flags & GPU_SHADER_FLAGS_SPECIAL_OPENSUBDIV) != 0;
 #else
 	UNUSED_VARS(flags);




More information about the Bf-blender-cvs mailing list