aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGregory Hainaut <[email protected]>2013-06-28 14:11:38 -0700
committerIan Romanick <[email protected]>2014-02-21 15:41:03 -0800
commit3659eade53848bcf76dec79170f2c3720fd02f7d (patch)
tree7181628474b30b1c2c3c71bbd3fcb6f9715d89df /src
parent8ed8592fd685727e568fc0d7f74b835efb03fbc4 (diff)
mesa/sso: Refactor implementation of _mesa_CreateShaderProgramEXT
This will allow the guts of the implementation to be shared with _mesa_CreateShaderProgramv. This was originally included in another patch, but it was split out by Ian Romanick. Reviewed-by: Ian Romanick <[email protected]> Reviewed-by: Jordan Justen <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/mesa/main/shaderapi.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/mesa/main/shaderapi.c b/src/mesa/main/shaderapi.c
index 79ef149d765..f981900f1b2 100644
--- a/src/mesa/main/shaderapi.c
+++ b/src/mesa/main/shaderapi.c
@@ -1832,19 +1832,16 @@ _mesa_ActiveProgramEXT(GLuint program)
return;
}
-
-/**
- * For GL_EXT_separate_shader_objects
- */
-GLuint GLAPIENTRY
-_mesa_CreateShaderProgramEXT(GLenum type, const GLchar *string)
+static GLuint
+_mesa_create_shader_program(struct gl_context* ctx, GLboolean separate,
+ GLenum type, GLsizei count, const GLchar* const *strings)
{
- GET_CURRENT_CONTEXT(ctx);
const GLuint shader = create_shader(ctx, type);
GLuint program = 0;
if (shader) {
- shader_source(ctx, shader, _mesa_strdup(string));
+ _mesa_ShaderSource(shader, count, strings, NULL);
+
compile_shader(ctx, shader);
program = create_shader_program(ctx);
@@ -1856,6 +1853,8 @@ _mesa_CreateShaderProgramEXT(GLenum type, const GLchar *string)
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);
@@ -1919,6 +1918,17 @@ _mesa_copy_linked_program_data(gl_shader_stage type,
/**
+ * For GL_EXT_separate_shader_objects
+ */
+GLuint GLAPIENTRY
+_mesa_CreateShaderProgramEXT(GLenum type, const GLchar *string)
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ return _mesa_create_shader_program(ctx, GL_FALSE, type, 1, &string);
+}
+
+/**
* ARB_separate_shader_objects: Compile & Link Program
*/
GLuint GLAPIENTRY