(GLSL) CLeanups

This commit is contained in:
twinaphex 2016-04-13 06:52:36 +02:00
parent f2e3789c8e
commit b63a3f8fcc
1 changed files with 12 additions and 8 deletions

View File

@ -423,9 +423,12 @@ static GLuint gl_glsl_compile_program(glsl_shader_data_t *glsl,
const char *vertex, const char *vertex,
const char *fragment, unsigned i) const char *fragment, unsigned i)
{ {
GLuint vert = 0, frag = 0, prog = glCreateProgram(); GLuint vert = 0;
GLuint frag = 0;
GLuint prog = glCreateProgram();
if (!prog) if (!prog)
return 0; goto error;
if (vertex) if (vertex)
{ {
@ -436,7 +439,7 @@ static GLuint gl_glsl_compile_program(glsl_shader_data_t *glsl,
vert, "#define VERTEX\n#define PARAMETER_UNIFORM\n", vertex)) vert, "#define VERTEX\n#define PARAMETER_UNIFORM\n", vertex))
{ {
RARCH_ERR("Failed to compile vertex shader #%u\n", i); RARCH_ERR("Failed to compile vertex shader #%u\n", i);
return 0; goto error;
} }
glAttachShader(prog, vert); glAttachShader(prog, vert);
@ -450,7 +453,7 @@ static GLuint gl_glsl_compile_program(glsl_shader_data_t *glsl,
"#define FRAGMENT\n#define PARAMETER_UNIFORM\n", fragment)) "#define FRAGMENT\n#define PARAMETER_UNIFORM\n", fragment))
{ {
RARCH_ERR("Failed to compile fragment shader #%u\n", i); RARCH_ERR("Failed to compile fragment shader #%u\n", i);
return 0; goto error;
} }
glAttachShader(prog, frag); glAttachShader(prog, frag);
@ -460,10 +463,7 @@ static GLuint gl_glsl_compile_program(glsl_shader_data_t *glsl,
{ {
RARCH_LOG("Linking GLSL program.\n"); RARCH_LOG("Linking GLSL program.\n");
if (!gl_glsl_link_program(prog)) if (!gl_glsl_link_program(prog))
{ goto error;
RARCH_ERR("Failed to link program #%u.\n", i);
return 0;
}
/* Clean up dead memory. We're not going to relink the program. /* Clean up dead memory. We're not going to relink the program.
* Detaching first seems to kill some mobile drivers * Detaching first seems to kill some mobile drivers
@ -479,6 +479,10 @@ static GLuint gl_glsl_compile_program(glsl_shader_data_t *glsl,
} }
return prog; return prog;
error:
RARCH_ERR("Failed to link program #%u.\n", i);
return 0;
} }
static void gl_glsl_strip_parameter_pragmas(char *source) static void gl_glsl_strip_parameter_pragmas(char *source)