Commit: f3058c1b664135fcad08f9e45ea64b3f55543b94
Author: Sergey Sharybin
Date:   Fri Sep 16 12:28:06 2016 +0200
Branches: master
https://developer.blender.org/rBf3058c1b664135fcad08f9e45ea64b3f55543b94

OpenSubdiv: Remove redundant section define from shader compilation

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

M       intern/opensubdiv/opensubdiv_gpu_capi.cc

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

diff --git a/intern/opensubdiv/opensubdiv_gpu_capi.cc 
b/intern/opensubdiv/opensubdiv_gpu_capi.cc
index da4a937..c36eaae 100644
--- a/intern/opensubdiv/opensubdiv_gpu_capi.cc
+++ b/intern/opensubdiv/opensubdiv_gpu_capi.cc
@@ -208,26 +208,23 @@ struct OpenSubdiv_GLMeshFVarData
 namespace {
 
 GLuint compileShader(GLenum shaderType,
-                     const char *section,
                      const char *version,
                      const char *define,
                      const char *source)
 {
-       char sdefine[64];
-       sprintf(sdefine, "#define %s\n", section);
-
        const char *sources[] = {
                version,
                define,
-               sdefine,
 #ifdef SUPPORT_COLOR_MATERIAL
                "#define SUPPORT_COLOR_MATERIAL\n",
+#else
+               "",
 #endif
                source,
        };
 
        GLuint shader = glCreateShader(shaderType);
-       glShaderSource(shader, 5, sources, NULL);
+       glShaderSource(shader, 4, sources, NULL);
        glCompileShader(shader);
 
        GLint status;
@@ -235,7 +232,7 @@ GLuint compileShader(GLenum shaderType,
        if (status == GL_FALSE) {
                GLchar emsg[1024];
                glGetShaderInfoLog(shader, sizeof(emsg), 0, emsg);
-               fprintf(stderr, "Error compiling GLSL %s: %s\n", section, emsg);
+               fprintf(stderr, "Error compiling GLSL: %s\n", emsg);
                fprintf(stderr, "Version: %s\n", version);
                fprintf(stderr, "Defines: %s\n", define);
                fprintf(stderr, "Source: %s\n", source);
@@ -248,7 +245,6 @@ GLuint compileShader(GLenum shaderType,
 GLuint linkProgram(const char *version, const char *define)
 {
        GLuint vertexShader = compileShader(GL_VERTEX_SHADER,
-                                           "VERTEX_SHADER",
                                            version,
                                            define,
                                            
datatoc_gpu_shader_opensubdiv_vertex_glsl);
@@ -256,7 +252,6 @@ GLuint linkProgram(const char *version, const char *define)
                return 0;
        }
        GLuint geometryShader = compileShader(GL_GEOMETRY_SHADER,
-                                             "GEOMETRY_SHADER",
                                              version,
                                              define,
                                              
datatoc_gpu_shader_opensubdiv_geometry_glsl);
@@ -264,7 +259,6 @@ GLuint linkProgram(const char *version, const char *define)
                return 0;
        }
        GLuint fragmentShader = compileShader(GL_FRAGMENT_SHADER,
-                                             "FRAGMENT_SHADER",
                                              version,
                                              define,
                                              
datatoc_gpu_shader_opensubdiv_fragment_glsl );

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

Reply via email to