Commit: 3999910b199f099466bc405ae87cb940f2509efa
Author: Mike Erwin
Date:   Sun Oct 16 03:18:17 2016 -0400
Branches: blender2.8
https://developer.blender.org/rB3999910b199f099466bc405ae87cb940f2509efa

OpenGL: add GLSL #version 330, drop 140 and 150

GL 3.3 is the new minimum. Compatibility profile for now, core profile 
eventually. During development, GL 3.0 (on Mesa) and 2.1 (on Mac) will still 
work.

Part of T49012

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

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

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

diff --git a/source/blender/gpu/intern/gpu_extensions.c 
b/source/blender/gpu/intern/gpu_extensions.c
index 51f1ee2..52aab41 100644
--- a/source/blender/gpu/intern/gpu_extensions.c
+++ b/source/blender/gpu/intern/gpu_extensions.c
@@ -129,18 +129,18 @@ void GPU_get_dfdy_factors(float fac[2])
 void gpu_extensions_init(void)
 {
        /* during 2.8 development each platform has its own OpenGL minimum 
requirements
-        * final 2.8 release will be unified on OpenGL 3.2 core profile, no 
required extensions
+        * final 2.8 release will be unified on OpenGL 3.3 core profile, no 
required extensions
         * see developer.blender.org/T49012 for details
         */
 #ifdef _WIN32
-       BLI_assert(GLEW_VERSION_3_2);
+       BLI_assert(GLEW_VERSION_3_3);
 #elif defined(__APPLE__)
        BLI_assert(GLEW_VERSION_2_1 && GLEW_EXT_gpu_shader4
                                    && GLEW_ARB_framebuffer_object
                                    && GLEW_ARB_draw_elements_base_vertex
                                    && GLEW_APPLE_flush_buffer_range);
 #else
-       BLI_assert(GLEW_VERSION_3_2 || (GLEW_VERSION_3_0 && 
GLEW_ARB_draw_elements_base_vertex));
+       BLI_assert(GLEW_VERSION_3_3 || (GLEW_VERSION_3_0 && 
GLEW_ARB_draw_elements_base_vertex));
        /*           vendor driver  ||  Mesa compatibility profile */
 #endif
 
@@ -257,6 +257,8 @@ void gpu_extensions_exit(void)
 bool GPU_legacy_support(void)
 {
        /* return whether or not current GL context is compatible with legacy 
OpenGL */
+       /* (will be removed after switching to core profile) */
+
        static bool checked = false;
        static bool support = true;
 
diff --git a/source/blender/gpu/intern/gpu_shader.c 
b/source/blender/gpu/intern/gpu_shader.c
index cfc1e63..e57d137 100644
--- a/source/blender/gpu/intern/gpu_shader.c
+++ b/source/blender/gpu/intern/gpu_shader.c
@@ -132,12 +132,11 @@ static struct GPUShadersGlobal {
 
 static void shader_print_errors(const char *task, const char *log, const char 
**code, int totcode)
 {
-       int i;
        int line = 1;
 
        fprintf(stderr, "GPUShader: %s error:\n", task);
 
-       for (i = 0; i < totcode; i++) {
+       for (int i = 0; i < totcode; i++) {
                const char *c, *pos, *end = code[i] + strlen(code[i]);
 
                if (G.debug & G_DEBUG) {
@@ -160,9 +159,9 @@ static void shader_print_errors(const char *task, const 
char *log, const char **
 
 static const char *gpu_shader_version(void)
 {
-       if (GLEW_VERSION_3_2) {
-               if (GLEW_ARB_compatibility) {
-                       return "#version 150 compatibility\n";
+       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
@@ -173,16 +172,6 @@ static const char *gpu_shader_version(void)
                        /* latest version that is compatible with existing 
shaders */
                }
        }
-       else if (GLEW_VERSION_3_1) {
-               if (GLEW_ARB_compatibility) {
-                       return "#version 140\n";
-                       /* also need the ARB_compatibility extension, handled 
below */
-               }
-               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

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

Reply via email to