mesa: undo split out of create shader code
authorTimothy Arceri <t_arceri@yahoo.com.au>
Thu, 13 Aug 2015 13:26:01 +0000 (23:26 +1000)
committerTimothy Arceri <t_arceri@yahoo.com.au>
Wed, 19 Aug 2015 00:38:56 +0000 (10:38 +1000)
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>
src/mesa/main/shaderapi.c

index 16222747905faab930ec1f498f28fdf6b530bfa5..b227c17548e1572a2e5d9e4b00a444c336bd553a 100644 (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;
 }