mesa: undo split out of create shader code

This code was split out into a separate function to be used also
by GL_EXT_separate_shader_objects which has since been removed from
Mesa, so move it back.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
This commit is contained in:
Timothy Arceri 2015-08-13 23:26:01 +10:00
parent 4a0bea3863
commit fdacadc87c

View file

@ -1995,64 +1995,6 @@ _mesa_use_shader_program(struct gl_context *ctx, GLenum type,
}
static GLuint
_mesa_create_shader_program(struct gl_context* ctx, GLboolean separate,
GLenum type, GLsizei count,
const GLchar* const *strings)
{
const GLuint shader = create_shader(ctx, type);
GLuint program = 0;
/*
* According to OpenGL 4.5 and OpenGL ES 3.1 standards, section 7.3:
* GL_INVALID_VALUE should be generated if count < 0
*/
if (count < 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glCreateShaderProgram (count < 0)");
return program;
}
if (shader) {
_mesa_ShaderSource(shader, count, strings, NULL);
compile_shader(ctx, shader);
program = create_shader_program(ctx);
if (program) {
struct gl_shader_program *shProg;
struct gl_shader *sh;
GLint compiled = GL_FALSE;
shProg = _mesa_lookup_shader_program(ctx, program);
sh = _mesa_lookup_shader(ctx, shader);
shProg->SeparateShader = separate;
get_shaderiv(ctx, shader, GL_COMPILE_STATUS, &compiled);
if (compiled) {
attach_shader(ctx, program, shader);
link_program(ctx, program);
detach_shader(ctx, program, shader);
#if 0
/* Possibly... */
if (active-user-defined-varyings-in-linked-program) {
append-error-to-info-log;
shProg->LinkStatus = GL_FALSE;
}
#endif
}
if (sh->InfoLog)
ralloc_strcat(&shProg->InfoLog, sh->InfoLog);
}
delete_shader(ctx, shader);
}
return program;
}
/**
* Copy program-specific data generated by linking from the gl_shader_program
* object to a specific gl_program object.
@ -2120,7 +2062,56 @@ _mesa_CreateShaderProgramv(GLenum type, GLsizei count,
{
GET_CURRENT_CONTEXT(ctx);
return _mesa_create_shader_program(ctx, GL_TRUE, type, count, strings);
const GLuint shader = create_shader(ctx, type);
GLuint program = 0;
/*
* According to OpenGL 4.5 and OpenGL ES 3.1 standards, section 7.3:
* GL_INVALID_VALUE should be generated if count < 0
*/
if (count < 0) {
_mesa_error(ctx, GL_INVALID_VALUE, "glCreateShaderProgram (count < 0)");
return program;
}
if (shader) {
_mesa_ShaderSource(shader, count, strings, NULL);
compile_shader(ctx, shader);
program = create_shader_program(ctx);
if (program) {
struct gl_shader_program *shProg;
struct gl_shader *sh;
GLint compiled = GL_FALSE;
shProg = _mesa_lookup_shader_program(ctx, program);
sh = _mesa_lookup_shader(ctx, shader);
shProg->SeparateShader = GL_TRUE;
get_shaderiv(ctx, shader, GL_COMPILE_STATUS, &compiled);
if (compiled) {
attach_shader(ctx, program, shader);
link_program(ctx, program);
detach_shader(ctx, program, shader);
#if 0
/* Possibly... */
if (active-user-defined-varyings-in-linked-program) {
append-error-to-info-log;
shProg->LinkStatus = GL_FALSE;
}
#endif
}
if (sh->InfoLog)
ralloc_strcat(&shProg->InfoLog, sh->InfoLog);
}
delete_shader(ctx, shader);
}
return program;
}