OpenSubdiv: Remove redundant section define from shader compilation
This commit is contained in:
@@ -208,26 +208,23 @@ struct OpenSubdiv_GLMeshFVarData
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
GLuint compileShader(GLenum shaderType,
|
GLuint compileShader(GLenum shaderType,
|
||||||
const char *section,
|
|
||||||
const char *version,
|
const char *version,
|
||||||
const char *define,
|
const char *define,
|
||||||
const char *source)
|
const char *source)
|
||||||
{
|
{
|
||||||
char sdefine[64];
|
|
||||||
sprintf(sdefine, "#define %s\n", section);
|
|
||||||
|
|
||||||
const char *sources[] = {
|
const char *sources[] = {
|
||||||
version,
|
version,
|
||||||
define,
|
define,
|
||||||
sdefine,
|
|
||||||
#ifdef SUPPORT_COLOR_MATERIAL
|
#ifdef SUPPORT_COLOR_MATERIAL
|
||||||
"#define SUPPORT_COLOR_MATERIAL\n",
|
"#define SUPPORT_COLOR_MATERIAL\n",
|
||||||
|
#else
|
||||||
|
"",
|
||||||
#endif
|
#endif
|
||||||
source,
|
source,
|
||||||
};
|
};
|
||||||
|
|
||||||
GLuint shader = glCreateShader(shaderType);
|
GLuint shader = glCreateShader(shaderType);
|
||||||
glShaderSource(shader, 5, sources, NULL);
|
glShaderSource(shader, 4, sources, NULL);
|
||||||
glCompileShader(shader);
|
glCompileShader(shader);
|
||||||
|
|
||||||
GLint status;
|
GLint status;
|
||||||
@@ -235,7 +232,7 @@ GLuint compileShader(GLenum shaderType,
|
|||||||
if (status == GL_FALSE) {
|
if (status == GL_FALSE) {
|
||||||
GLchar emsg[1024];
|
GLchar emsg[1024];
|
||||||
glGetShaderInfoLog(shader, sizeof(emsg), 0, emsg);
|
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, "Version: %s\n", version);
|
||||||
fprintf(stderr, "Defines: %s\n", define);
|
fprintf(stderr, "Defines: %s\n", define);
|
||||||
fprintf(stderr, "Source: %s\n", source);
|
fprintf(stderr, "Source: %s\n", source);
|
||||||
@@ -248,7 +245,6 @@ GLuint compileShader(GLenum shaderType,
|
|||||||
GLuint linkProgram(const char *version, const char *define)
|
GLuint linkProgram(const char *version, const char *define)
|
||||||
{
|
{
|
||||||
GLuint vertexShader = compileShader(GL_VERTEX_SHADER,
|
GLuint vertexShader = compileShader(GL_VERTEX_SHADER,
|
||||||
"VERTEX_SHADER",
|
|
||||||
version,
|
version,
|
||||||
define,
|
define,
|
||||||
datatoc_gpu_shader_opensubdiv_vertex_glsl);
|
datatoc_gpu_shader_opensubdiv_vertex_glsl);
|
||||||
@@ -256,7 +252,6 @@ GLuint linkProgram(const char *version, const char *define)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
GLuint geometryShader = compileShader(GL_GEOMETRY_SHADER,
|
GLuint geometryShader = compileShader(GL_GEOMETRY_SHADER,
|
||||||
"GEOMETRY_SHADER",
|
|
||||||
version,
|
version,
|
||||||
define,
|
define,
|
||||||
datatoc_gpu_shader_opensubdiv_geometry_glsl);
|
datatoc_gpu_shader_opensubdiv_geometry_glsl);
|
||||||
@@ -264,7 +259,6 @@ GLuint linkProgram(const char *version, const char *define)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
GLuint fragmentShader = compileShader(GL_FRAGMENT_SHADER,
|
GLuint fragmentShader = compileShader(GL_FRAGMENT_SHADER,
|
||||||
"FRAGMENT_SHADER",
|
|
||||||
version,
|
version,
|
||||||
define,
|
define,
|
||||||
datatoc_gpu_shader_opensubdiv_fragment_glsl );
|
datatoc_gpu_shader_opensubdiv_fragment_glsl );
|
||||||
|
Reference in New Issue
Block a user