forked from bartvdbraak/blender
OpenSubdiv: Remove redundant section define from shader compilation
This commit is contained in:
parent
a27b54f6e2
commit
f3058c1b66
@ -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 );
|
||||
|
Loading…
Reference in New Issue
Block a user