mesa: add _mesa_InternalBind{ElementBuffer,VertexBuffers} for glthread
[mesa.git] / src / mesa / main / uniforms.c
index 28f530c4f68e94fd1f3bd227fc5bc57f4b666450..ba87d3900aff45ef4c30f3d1137ffc4a4776c76c 100644 (file)
@@ -38,7 +38,6 @@
 
 #include "main/glheader.h"
 #include "main/context.h"
-#include "main/dispatch.h"
 #include "main/shaderapi.h"
 #include "main/shaderobj.h"
 #include "main/uniforms.h"
@@ -102,13 +101,11 @@ _mesa_update_shader_textures_used(struct gl_shader_program *shProg,
                                   struct gl_program *prog)
 {
    GLbitfield mask = prog->SamplersUsed;
-   gl_shader_stage prog_stage =
+   ASSERTED gl_shader_stage prog_stage =
       _mesa_program_enum_to_shader_stage(prog->Target);
-   MAYBE_UNUSED struct gl_linked_shader *shader =
-      shProg->_LinkedShaders[prog_stage];
    GLuint s;
 
-   assert(shader);
+   assert(shProg->_LinkedShaders[prog_stage]);
 
    memset(prog->TexturesUsed, 0, sizeof(prog->TexturesUsed));
 
@@ -1008,7 +1005,7 @@ _mesa_GetUniformLocation(GLuint programObj, const GLcharARB *name)
 
    shProg = _mesa_lookup_shader_program_err(ctx, programObj,
                                            "glGetUniformLocation");
-   if (!shProg)
+   if (!shProg || !name)
       return -1;
 
    /* Page 80 (page 94 of the PDF) of the OpenGL 2.1 spec says:
@@ -1016,7 +1013,7 @@ _mesa_GetUniformLocation(GLuint programObj, const GLcharARB *name)
     *     "If program has not been successfully linked, the error
     *     INVALID_OPERATION is generated."
     */
-   if (shProg->data->LinkStatus == linking_failure) {
+   if (shProg->data->LinkStatus == LINKING_FAILURE) {
       _mesa_error(ctx, GL_INVALID_OPERATION,
                  "glGetUniformLocation(program not linked)");
       return -1;
@@ -1025,6 +1022,17 @@ _mesa_GetUniformLocation(GLuint programObj, const GLcharARB *name)
    return _mesa_program_resource_location(shProg, GL_UNIFORM, name);
 }
 
+GLint GLAPIENTRY
+_mesa_GetUniformLocation_no_error(GLuint programObj, const GLcharARB *name)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   struct gl_shader_program *shProg =
+      _mesa_lookup_shader_program(ctx, programObj);
+
+   return _mesa_program_resource_location(shProg, GL_UNIFORM, name);
+}
+
 GLuint GLAPIENTRY
 _mesa_GetUniformBlockIndex(GLuint program,
                           const GLchar *uniformBlockName)
@@ -1162,6 +1170,18 @@ shader_storage_block_binding(struct gl_context *ctx,
    }
 }
 
+void GLAPIENTRY
+_mesa_ShaderStorageBlockBinding_no_error(GLuint program,
+                                         GLuint shaderStorageBlockIndex,
+                                         GLuint shaderStorageBlockBinding)
+{
+   GET_CURRENT_CONTEXT(ctx);
+
+   struct gl_shader_program *shProg = _mesa_lookup_shader_program(ctx, program);
+   shader_storage_block_binding(ctx, shProg, shaderStorageBlockIndex,
+                                shaderStorageBlockBinding);
+}
+
 void GLAPIENTRY
 _mesa_ShaderStorageBlockBinding(GLuint program,
                                GLuint shaderStorageBlockIndex,