-/*\r
- * Mesa 3-D graphics library\r
- * Version: 6.3\r
- *\r
- * Copyright (C) 2004-2005 Brian Paul All Rights Reserved.\r
- *\r
- * Permission is hereby granted, free of charge, to any person obtaining a\r
- * copy of this software and associated documentation files (the "Software"),\r
- * to deal in the Software without restriction, including without limitation\r
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,\r
- * and/or sell copies of the Software, and to permit persons to whom the\r
- * Software is furnished to do so, subject to the following conditions:\r
- *\r
- * The above copyright notice and this permission notice shall be included\r
- * in all copies or substantial portions of the Software.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS\r
- * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\r
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL\r
- * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN\r
- * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\r
- * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
- */\r
-\r
-/**\r
- * \file shaderobjects.c\r
- * ARB_shader_objects state management functions\r
- * \author Michal Krol\r
- */\r
-\r
+/*
+ * Mesa 3-D graphics library
+ * Version: 6.3
+ *
+ * Copyright (C) 2004-2005 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/**
+ * \file shaderobjects.c
+ * ARB_shader_objects state management functions
+ * \author Michal Krol
+ */
+
#include "glheader.h"
-#include "shaderobjects.h"\r
+#include "shaderobjects.h"
#include "shaderobjects_3dlabs.h"
#include "context.h"
-#include "macros.h"\r
-#include "hash.h"\r
-\r
-\r
+#include "macros.h"
+#include "hash.h"
+
+
void GLAPIENTRY
_mesa_DeleteObjectARB (GLhandleARB obj)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
- struct gl2_unknown_intf **unk;\r
- struct gl2_generic_intf **gen;\r
-\r
- _glthread_LOCK_MUTEX (ctx->Shared->Mutex);\r
- unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, obj);\r
- _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);\r
-\r
- if (unk == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glDeleteObjectARB");\r
- return;\r
- }\r
-\r
- gen = (struct gl2_generic_intf **) (**unk).QueryInterface (unk, UIID_GENERIC);\r
- if (gen == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glDeleteObjectARB");\r
- return;\r
- }\r
-\r
- (**gen).Delete (gen);\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl2_unknown_intf **unk;
+ struct gl2_generic_intf **gen;
+
+ _glthread_LOCK_MUTEX (ctx->Shared->Mutex);
+ unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, obj);
+ _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);
+
+ if (unk == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_VALUE, "glDeleteObjectARB");
+ return;
+ }
+
+ gen = (struct gl2_generic_intf **) (**unk).QueryInterface (unk, UIID_GENERIC);
+ if (gen == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_VALUE, "glDeleteObjectARB");
+ return;
+ }
+
+ (**gen).Delete (gen);
(**gen)._unknown.Release ((struct gl2_unknown_intf **) gen);
}
GLhandleARB GLAPIENTRY
_mesa_GetHandleARB (GLenum pname)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
-\r
- switch (pname)\r
- {\r
- case GL_PROGRAM_OBJECT_ARB:\r
- if (ctx->ShaderObjects.current_program != NULL)\r
- return (**ctx->ShaderObjects.current_program)._container._generic.GetName (\r
- (struct gl2_generic_intf **) ctx->ShaderObjects.current_program);\r
- break;\r
- }\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ switch (pname)
+ {
+ case GL_PROGRAM_OBJECT_ARB:
+ if (ctx->ShaderObjects.current_program != NULL)
+ return (**ctx->ShaderObjects.current_program)._container._generic.GetName (
+ (struct gl2_generic_intf **) ctx->ShaderObjects.current_program);
+ break;
+ }
return 0;
}
void GLAPIENTRY
_mesa_DetachObjectARB (GLhandleARB containerObj, GLhandleARB attachedObj)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
- struct gl2_unknown_intf **unkc, **unka;\r
- struct gl2_container_intf **con;\r
- struct gl2_generic_intf **att;\r
-\r
- _glthread_LOCK_MUTEX (ctx->Shared->Mutex);\r
- unkc = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, containerObj);\r
- unka = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, attachedObj);\r
- _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);\r
-\r
- if (unkc == NULL || unka == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glDetachObjectARB");\r
- return;\r
- }\r
-\r
- con = (struct gl2_container_intf **) (**unkc).QueryInterface (unkc, UIID_CONTAINER);\r
- if (con == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glDetachObjectARB");\r
- return;\r
- }\r
-\r
- att = (struct gl2_generic_intf **) (**unka).QueryInterface (unka, UIID_GENERIC);\r
- if (att == NULL)\r
- {\r
- (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con);\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glDetachObjectARB");\r
- return;\r
- }\r
-\r
- if ((**con).Detach (con, att) == GL_FALSE)\r
- {\r
- (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con);\r
- (**att)._unknown.Release ((struct gl2_unknown_intf **) att);\r
- return;\r
- }\r
-\r
- (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con);\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl2_unknown_intf **unkc, **unka;
+ struct gl2_container_intf **con;
+ struct gl2_generic_intf **att;
+
+ _glthread_LOCK_MUTEX (ctx->Shared->Mutex);
+ unkc = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, containerObj);
+ unka = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, attachedObj);
+ _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);
+
+ if (unkc == NULL || unka == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_VALUE, "glDetachObjectARB");
+ return;
+ }
+
+ con = (struct gl2_container_intf **) (**unkc).QueryInterface (unkc, UIID_CONTAINER);
+ if (con == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glDetachObjectARB");
+ return;
+ }
+
+ att = (struct gl2_generic_intf **) (**unka).QueryInterface (unka, UIID_GENERIC);
+ if (att == NULL)
+ {
+ (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con);
+ _mesa_error (ctx, GL_INVALID_VALUE, "glDetachObjectARB");
+ return;
+ }
+
+ if ((**con).Detach (con, att) == GL_FALSE)
+ {
+ (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con);
+ (**att)._unknown.Release ((struct gl2_unknown_intf **) att);
+ return;
+ }
+
+ (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con);
(**att)._unknown.Release ((struct gl2_unknown_intf **) att);
}
GLhandleARB GLAPIENTRY
_mesa_CreateShaderObjectARB (GLenum shaderType)
-{\r
+{
return _mesa_3dlabs_create_shader_object (shaderType);
}
void GLAPIENTRY
-_mesa_ShaderSourceARB (GLhandleARB shaderObj, GLsizei count, const GLcharARB **string,\r
+_mesa_ShaderSourceARB (GLhandleARB shaderObj, GLsizei count, const GLcharARB **string,
const GLint *length)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
- struct gl2_unknown_intf **unk;\r
- struct gl2_shader_intf **sha;\r
- GLint *offsets;\r
- GLsizei i;\r
- GLcharARB *source;\r
-\r
- _glthread_LOCK_MUTEX (ctx->Shared->Mutex);\r
- unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, shaderObj);\r
- _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);\r
-\r
- if (unk == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glShaderSourceARB");\r
- return;\r
- }\r
-\r
- sha = (struct gl2_shader_intf **) (**unk).QueryInterface (unk, UIID_SHADER);\r
- if (sha == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glShaderSourceARB");\r
- return;\r
- }\r
-\r
- /* this array holds offsets of where the appropriate string ends, thus the last\r
- element will be set to the total length of the source code */\r
- offsets = (GLint *) _mesa_malloc (count * sizeof (GLint));\r
- if (offsets == NULL)\r
- {\r
- (**sha)._generic._unknown.Release ((struct gl2_unknown_intf **) sha);\r
- _mesa_error (ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB");\r
- return;\r
- }\r
-\r
- for (i = 0; i < count; i++)\r
- {\r
- if (length == NULL || length[i] < 0)\r
- offsets[i] = _mesa_strlen (string[i]);\r
- else\r
- offsets[i] = length[i];\r
- /* accumulate string lengths */\r
- if (i > 0)\r
- offsets[i] += offsets[i - 1];\r
- }\r
-\r
- source = (GLcharARB *) _mesa_malloc ((offsets[count - 1] + 1) * sizeof (GLcharARB));\r
- if (source == NULL)\r
- {\r
- _mesa_free ((void *) offsets);\r
- (**sha)._generic._unknown.Release ((struct gl2_unknown_intf **) sha);\r
- _mesa_error (ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB");\r
- return;\r
- }\r
-\r
- for (i = 0; i < count; i++)\r
- {\r
- GLint start = (i > 0) ? offsets[i - 1] : 0;\r
- _mesa_memcpy (source + start, string[i], (offsets[i] - start) * sizeof (GLcharARB));\r
- }\r
- source[offsets[count - 1]] = '\0';\r
-\r
- (**sha).SetSource (sha, source, offsets, count);\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl2_unknown_intf **unk;
+ struct gl2_shader_intf **sha;
+ GLint *offsets;
+ GLsizei i;
+ GLcharARB *source;
+
+ _glthread_LOCK_MUTEX (ctx->Shared->Mutex);
+ unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, shaderObj);
+ _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);
+
+ if (unk == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_VALUE, "glShaderSourceARB");
+ return;
+ }
+
+ sha = (struct gl2_shader_intf **) (**unk).QueryInterface (unk, UIID_SHADER);
+ if (sha == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glShaderSourceARB");
+ return;
+ }
+
+ /* this array holds offsets of where the appropriate string ends, thus the last
+ element will be set to the total length of the source code */
+ offsets = (GLint *) _mesa_malloc (count * sizeof (GLint));
+ if (offsets == NULL)
+ {
+ (**sha)._generic._unknown.Release ((struct gl2_unknown_intf **) sha);
+ _mesa_error (ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB");
+ return;
+ }
+
+ for (i = 0; i < count; i++)
+ {
+ if (length == NULL || length[i] < 0)
+ offsets[i] = _mesa_strlen (string[i]);
+ else
+ offsets[i] = length[i];
+ /* accumulate string lengths */
+ if (i > 0)
+ offsets[i] += offsets[i - 1];
+ }
+
+ source = (GLcharARB *) _mesa_malloc ((offsets[count - 1] + 1) * sizeof (GLcharARB));
+ if (source == NULL)
+ {
+ _mesa_free ((void *) offsets);
+ (**sha)._generic._unknown.Release ((struct gl2_unknown_intf **) sha);
+ _mesa_error (ctx, GL_OUT_OF_MEMORY, "glShaderSourceARB");
+ return;
+ }
+
+ for (i = 0; i < count; i++)
+ {
+ GLint start = (i > 0) ? offsets[i - 1] : 0;
+ _mesa_memcpy (source + start, string[i], (offsets[i] - start) * sizeof (GLcharARB));
+ }
+ source[offsets[count - 1]] = '\0';
+
+ (**sha).SetSource (sha, source, offsets, count);
(**sha)._generic._unknown.Release ((struct gl2_unknown_intf **) sha);
}
void GLAPIENTRY
_mesa_CompileShaderARB (GLhandleARB shaderObj)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
- struct gl2_unknown_intf **unk;\r
- struct gl2_shader_intf **sha;\r
-\r
- _glthread_LOCK_MUTEX (ctx->Shared->Mutex);\r
- unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, shaderObj);\r
- _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);\r
-\r
- if (unk == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glCompileShaderARB");\r
- return;\r
- }\r
-\r
- sha = (struct gl2_shader_intf **) (**unk).QueryInterface (unk, UIID_SHADER);\r
- if (sha == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glCompileShaderARB");\r
- return;\r
- }\r
-\r
- (**sha).Compile (sha);\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl2_unknown_intf **unk;
+ struct gl2_shader_intf **sha;
+
+ _glthread_LOCK_MUTEX (ctx->Shared->Mutex);
+ unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, shaderObj);
+ _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);
+
+ if (unk == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_VALUE, "glCompileShaderARB");
+ return;
+ }
+
+ sha = (struct gl2_shader_intf **) (**unk).QueryInterface (unk, UIID_SHADER);
+ if (sha == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glCompileShaderARB");
+ return;
+ }
+
+ (**sha).Compile (sha);
(**sha)._generic._unknown.Release ((struct gl2_unknown_intf **) sha);
}
void GLAPIENTRY
_mesa_AttachObjectARB (GLhandleARB containerObj, GLhandleARB obj)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
- struct gl2_unknown_intf **unkc, **unka;\r
- struct gl2_container_intf **con;\r
- struct gl2_generic_intf **att;\r
-\r
- _glthread_LOCK_MUTEX (ctx->Shared->Mutex);\r
- unkc = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, containerObj);\r
- unka = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, obj);\r
- _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);\r
-\r
- if (unkc == NULL || unka == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glAttachObjectARB");\r
- return;\r
- }\r
-\r
- con = (struct gl2_container_intf **) (**unkc).QueryInterface (unkc, UIID_CONTAINER);\r
- if (con == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glAttachObjectARB");\r
- return;\r
- }\r
-\r
- att = (struct gl2_generic_intf **) (**unka).QueryInterface (unka, UIID_GENERIC);\r
- if (att == NULL)\r
- {\r
- (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con);\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glAttachObjectARB");\r
- return;\r
- }\r
-\r
- if (!(**con).Attach (con, att))\r
- {\r
- (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con);\r
- (**att)._unknown.Release ((struct gl2_unknown_intf **) att);\r
- return;\r
- }\r
-\r
- (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con);\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl2_unknown_intf **unkc, **unka;
+ struct gl2_container_intf **con;
+ struct gl2_generic_intf **att;
+
+ _glthread_LOCK_MUTEX (ctx->Shared->Mutex);
+ unkc = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, containerObj);
+ unka = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, obj);
+ _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);
+
+ if (unkc == NULL || unka == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_VALUE, "glAttachObjectARB");
+ return;
+ }
+
+ con = (struct gl2_container_intf **) (**unkc).QueryInterface (unkc, UIID_CONTAINER);
+ if (con == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_VALUE, "glAttachObjectARB");
+ return;
+ }
+
+ att = (struct gl2_generic_intf **) (**unka).QueryInterface (unka, UIID_GENERIC);
+ if (att == NULL)
+ {
+ (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con);
+ _mesa_error (ctx, GL_INVALID_VALUE, "glAttachObjectARB");
+ return;
+ }
+
+ if (!(**con).Attach (con, att))
+ {
+ (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con);
+ (**att)._unknown.Release ((struct gl2_unknown_intf **) att);
+ return;
+ }
+
+ (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con);
(**att)._unknown.Release ((struct gl2_unknown_intf **) att);
}
void GLAPIENTRY
_mesa_LinkProgramARB (GLhandleARB programObj)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
- struct gl2_unknown_intf **unk;\r
- struct gl2_program_intf **pro;\r
-\r
- _glthread_LOCK_MUTEX (ctx->Shared->Mutex);\r
- unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj);\r
- _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);\r
-\r
- if (unk == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glLinkProgramARB");\r
- return;\r
- }\r
-\r
- pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM);\r
- if (pro == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glLinkProgramARB");\r
- return;\r
- }\r
-\r
- if (pro == ctx->ShaderObjects.current_program)\r
- {\r
- /* TODO re-install executable program */\r
- }\r
-\r
- (**pro).Link (pro);\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl2_unknown_intf **unk;
+ struct gl2_program_intf **pro;
+
+ _glthread_LOCK_MUTEX (ctx->Shared->Mutex);
+ unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj);
+ _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);
+
+ if (unk == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_VALUE, "glLinkProgramARB");
+ return;
+ }
+
+ pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM);
+ if (pro == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glLinkProgramARB");
+ return;
+ }
+
+ if (pro == ctx->ShaderObjects.current_program)
+ {
+ /* TODO re-install executable program */
+ }
+
+ (**pro).Link (pro);
(**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro);
}
void GLAPIENTRY
_mesa_UseProgramObjectARB (GLhandleARB programObj)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
- struct gl2_program_intf **pro;\r
-\r
- if (programObj == 0)\r
- {\r
- pro = NULL;\r
- }\r
- else\r
- {\r
- struct gl2_unknown_intf **unk;\r
-\r
- _glthread_LOCK_MUTEX (ctx->Shared->Mutex);\r
- unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj);\r
- _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);\r
-\r
- if (unk == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glUseProgramObjectARB");\r
- return;\r
- }\r
-\r
- pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM);\r
- if (pro == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glUseProgramObjectARB");\r
- return;\r
- }\r
-\r
- if ((**pro).GetLinkStatus (pro) == GL_FALSE)\r
- {\r
- (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro);\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glUseProgramObjectARB");\r
- return;\r
- }\r
- }\r
-\r
- if (ctx->ShaderObjects.current_program != NULL)\r
- {\r
- (**ctx->ShaderObjects.current_program)._container._generic._unknown.Release (\r
- (struct gl2_unknown_intf **) ctx->ShaderObjects.current_program);\r
- }\r
-\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl2_program_intf **pro;
+
+ if (programObj == 0)
+ {
+ pro = NULL;
+ }
+ else
+ {
+ struct gl2_unknown_intf **unk;
+
+ _glthread_LOCK_MUTEX (ctx->Shared->Mutex);
+ unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj);
+ _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);
+
+ if (unk == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_VALUE, "glUseProgramObjectARB");
+ return;
+ }
+
+ pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM);
+ if (pro == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glUseProgramObjectARB");
+ return;
+ }
+
+ if ((**pro).GetLinkStatus (pro) == GL_FALSE)
+ {
+ (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro);
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glUseProgramObjectARB");
+ return;
+ }
+ }
+
+ if (ctx->ShaderObjects.current_program != NULL)
+ {
+ (**ctx->ShaderObjects.current_program)._container._generic._unknown.Release (
+ (struct gl2_unknown_intf **) ctx->ShaderObjects.current_program);
+ }
+
ctx->ShaderObjects.current_program = pro;
}
void GLAPIENTRY
_mesa_ValidateProgramARB (GLhandleARB programObj)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
- struct gl2_unknown_intf **unk;\r
- struct gl2_program_intf **pro;\r
-\r
- _glthread_LOCK_MUTEX (ctx->Shared->Mutex);\r
- unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj);\r
- _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);\r
-\r
- if (unk == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glValidateProgramARB");\r
- return;\r
- }\r
-\r
- pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM);\r
- if (pro == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glValidateProgramARB");\r
- return;\r
- }\r
-\r
- (**pro).Validate (pro);\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl2_unknown_intf **unk;
+ struct gl2_program_intf **pro;
+
+ _glthread_LOCK_MUTEX (ctx->Shared->Mutex);
+ unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj);
+ _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);
+
+ if (unk == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_VALUE, "glValidateProgramARB");
+ return;
+ }
+
+ pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM);
+ if (pro == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glValidateProgramARB");
+ return;
+ }
+
+ (**pro).Validate (pro);
(**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro);
-}\r
-\r
-/*\r
-Errors TODO\r
-\r
- The error INVALID_OPERATION is generated by the Uniform*ARB if the\r
- number of values loaded results in exceeding the declared extent of a\r
- uniform.\r
-\r
- The error INVALID_OPERATION is generated by the Uniform*ARB commands if\r
- the size does not match the size of the uniform declared in the shader.\r
-\r
- The error INVALID_OPERATION is generated by the Uniform*ARB commands if\r
- the type does not match the type of the uniform declared in the shader,\r
- if the uniform is not of type Boolean.\r
-\r
- The error INVALID_OPERATION is generated by the Uniform*ARB commands if\r
- <location> does not exist for the program object currently in use.\r
-\r
- The error INVALID_OPERATION is generated if a uniform command other than\r
- Uniform1i{v}ARB is used to load a sampler value.\r
-\r
-\r
+}
+
+/*
+Errors TODO
+
+ The error INVALID_OPERATION is generated by the Uniform*ARB if the
+ number of values loaded results in exceeding the declared extent of a
+ uniform.
+
+ The error INVALID_OPERATION is generated by the Uniform*ARB commands if
+ the size does not match the size of the uniform declared in the shader.
+
+ The error INVALID_OPERATION is generated by the Uniform*ARB commands if
+ the type does not match the type of the uniform declared in the shader,
+ if the uniform is not of type Boolean.
+
+ The error INVALID_OPERATION is generated by the Uniform*ARB commands if
+ <location> does not exist for the program object currently in use.
+
+ The error INVALID_OPERATION is generated if a uniform command other than
+ Uniform1i{v}ARB is used to load a sampler value.
+
+
*/
void GLAPIENTRY
_mesa_Uniform1fARB (GLint location, GLfloat v0)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
-\r
- if (ctx->ShaderObjects.current_program == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform1fARB");\r
- return;\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (ctx->ShaderObjects.current_program == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform1fARB");
+ return;
}
}
void GLAPIENTRY
_mesa_Uniform2fARB (GLint location, GLfloat v0, GLfloat v1)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
-\r
- if (ctx->ShaderObjects.current_program == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform2fARB");\r
- return;\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (ctx->ShaderObjects.current_program == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform2fARB");
+ return;
}
}
void GLAPIENTRY
_mesa_Uniform3fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
-\r
- if (ctx->ShaderObjects.current_program == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform3fARB");\r
- return;\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (ctx->ShaderObjects.current_program == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform3fARB");
+ return;
}
}
void GLAPIENTRY
_mesa_Uniform4fARB (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
-\r
- if (ctx->ShaderObjects.current_program == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform4fARB");\r
- return;\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (ctx->ShaderObjects.current_program == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform4fARB");
+ return;
}
}
void GLAPIENTRY
_mesa_Uniform1iARB (GLint location, GLint v0)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
-\r
- if (ctx->ShaderObjects.current_program == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform1iARB");\r
- return;\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (ctx->ShaderObjects.current_program == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform1iARB");
+ return;
}
}
void GLAPIENTRY
_mesa_Uniform2iARB (GLint location, GLint v0, GLint v1)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
-\r
- if (ctx->ShaderObjects.current_program == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform2iARB");\r
- return;\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (ctx->ShaderObjects.current_program == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform2iARB");
+ return;
}
}
void GLAPIENTRY
_mesa_Uniform3iARB (GLint location, GLint v0, GLint v1, GLint v2)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
-\r
- if (ctx->ShaderObjects.current_program == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform3iARB");\r
- return;\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (ctx->ShaderObjects.current_program == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform3iARB");
+ return;
}
}
void GLAPIENTRY
_mesa_Uniform4iARB (GLint location, GLint v0, GLint v1, GLint v2, GLint v3)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
-\r
- if (ctx->ShaderObjects.current_program == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform4iARB");\r
- return;\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (ctx->ShaderObjects.current_program == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform4iARB");
+ return;
}
}
void GLAPIENTRY
_mesa_Uniform1fvARB (GLint location, GLsizei count, const GLfloat *value)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
-\r
- if (ctx->ShaderObjects.current_program == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform1fvARB");\r
- return;\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (ctx->ShaderObjects.current_program == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform1fvARB");
+ return;
}
}
void GLAPIENTRY
_mesa_Uniform2fvARB (GLint location, GLsizei count, const GLfloat *value)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
-\r
- if (ctx->ShaderObjects.current_program == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform2fvARB");\r
- return;\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (ctx->ShaderObjects.current_program == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform2fvARB");
+ return;
}
}
void GLAPIENTRY
_mesa_Uniform3fvARB (GLint location, GLsizei count, const GLfloat *value)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
-\r
- if (ctx->ShaderObjects.current_program == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform3fvARB");\r
- return;\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (ctx->ShaderObjects.current_program == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform3fvARB");
+ return;
}
}
void GLAPIENTRY
_mesa_Uniform4fvARB (GLint location, GLsizei count, const GLfloat *value)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
-\r
- if (ctx->ShaderObjects.current_program == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform4fvARB");\r
- return;\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (ctx->ShaderObjects.current_program == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform4fvARB");
+ return;
}
}
void GLAPIENTRY
_mesa_Uniform1ivARB (GLint location, GLsizei count, const GLint *value)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
-\r
- if (ctx->ShaderObjects.current_program == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform1ivARB");\r
- return;\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (ctx->ShaderObjects.current_program == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform1ivARB");
+ return;
}
}
void GLAPIENTRY
_mesa_Uniform2ivARB (GLint location, GLsizei count, const GLint *value)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
-\r
- if (ctx->ShaderObjects.current_program == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform2ivARB");\r
- return;\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (ctx->ShaderObjects.current_program == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform2ivARB");
+ return;
}
}
void GLAPIENTRY
_mesa_Uniform3ivARB (GLint location, GLsizei count, const GLint *value)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
-\r
- if (ctx->ShaderObjects.current_program == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform3ivARB");\r
- return;\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (ctx->ShaderObjects.current_program == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform3ivARB");
+ return;
}
}
void GLAPIENTRY
_mesa_Uniform4ivARB (GLint location, GLsizei count, const GLint *value)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
-\r
- if (ctx->ShaderObjects.current_program == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform4ivARB");\r
- return;\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (ctx->ShaderObjects.current_program == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glUniform4ivARB");
+ return;
}
}
void GLAPIENTRY
_mesa_UniformMatrix2fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
-\r
- if (ctx->ShaderObjects.current_program == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glUniformMatrix2fvARB");\r
- return;\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (ctx->ShaderObjects.current_program == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glUniformMatrix2fvARB");
+ return;
}
}
void GLAPIENTRY
_mesa_UniformMatrix3fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
-\r
- if (ctx->ShaderObjects.current_program == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glUniformMatrix3fvARB");\r
- return;\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (ctx->ShaderObjects.current_program == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glUniformMatrix3fvARB");
+ return;
}
}
void GLAPIENTRY
_mesa_UniformMatrix4fvARB (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
-\r
- if (ctx->ShaderObjects.current_program == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glUniformMatrix4fvARB");\r
- return;\r
- }
-}\r
-\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+
+ if (ctx->ShaderObjects.current_program == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glUniformMatrix4fvARB");
+ return;
+ }
+}
+
+static GLboolean
+_mesa_get_object_parameter (GLhandleARB obj, GLenum pname, GLvoid *params, GLboolean *integral,
+ GLint *size)
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl2_unknown_intf **unk;
+ struct gl2_generic_intf **gen;
+ struct gl2_shader_intf **sha;
+ struct gl2_program_intf **pro;
+ GLint *ipar = (GLint *) params;
+ /*GLfloat *fpar = (GLfloat *) params;*/
+ GLboolean success = GL_TRUE;
+
+ _glthread_LOCK_MUTEX (ctx->Shared->Mutex);
+ unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, obj);
+ _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);
+
+ if (unk == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_VALUE, "glGetObjectParameterivARB");
+ return GL_FALSE;
+ }
+
+ gen = (struct gl2_generic_intf **) (**unk).QueryInterface (unk, UIID_GENERIC);
+ if (gen == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB");
+ return GL_FALSE;
+ }
+
+ sha = (struct gl2_shader_intf **) (**unk).QueryInterface (unk, UIID_SHADER);
+ pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM);
+
+ /* set default values */
+ *integral = GL_TRUE; /* indicates param type, TRUE: GLint, FALSE: GLfloat */
+ *size = 1; /* param array size */
+
+ switch (pname)
+ {
+ case GL_OBJECT_TYPE_ARB:
+ *ipar = (**gen).GetType (gen);
+ break;
+ case GL_OBJECT_SUBTYPE_ARB:
+ if (sha != NULL)
+ *ipar = (**sha).GetSubType (sha);
+ else {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB");
+ success = GL_FALSE;
+ }
+ break;
+ case GL_OBJECT_DELETE_STATUS_ARB:
+ *ipar = (**gen).GetDeleteStatus (gen);
+ break;
+ case GL_OBJECT_COMPILE_STATUS_ARB:
+ if (sha != NULL)
+ *ipar = (**sha).GetCompileStatus (sha);
+ else {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB");
+ success = GL_FALSE;
+ }
+ break;
+ case GL_OBJECT_LINK_STATUS_ARB:
+ if (pro != NULL)
+ *ipar = (**pro).GetLinkStatus (pro);
+ else {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB");
+ success = GL_FALSE;
+ }
+ break;
+ case GL_OBJECT_VALIDATE_STATUS_ARB:
+ if (pro != NULL)
+ *ipar = (**pro).GetValidateStatus (pro);
+ else {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB");
+ success = GL_FALSE;
+ }
+ break;
+ case GL_OBJECT_INFO_LOG_LENGTH_ARB:
+ {
+ const GLcharARB *info = (**gen).GetInfoLog (gen);
+ if (info == NULL)
+ *ipar = 0;
+ else
+ *ipar = _mesa_strlen (info) + 1;
+ }
+ break;
+ case GL_OBJECT_ATTACHED_OBJECTS_ARB:
+ if (pro != NULL)
+ *ipar = (**pro)._container.GetAttachedCount ((struct gl2_container_intf **) pro);
+ else {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB");
+ success = GL_FALSE;
+ }
+ break;
+ case GL_OBJECT_ACTIVE_UNIFORMS_ARB:
+ if (pro != NULL)
+ *ipar = 0; /* TODO */
+ else {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB");
+ success = GL_FALSE;
+ }
+ break;
+ case GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB:
+ if (pro != NULL)
+ *ipar = 0; /* TODO */
+ else {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB");
+ success = GL_FALSE;
+ }
+ break;
+ case GL_OBJECT_SHADER_SOURCE_LENGTH_ARB:
+ if (sha != NULL) {
+ const GLcharARB *src = (**sha).GetSource (sha);
+ if (src == NULL)
+ *ipar = 0;
+ else
+ *ipar = _mesa_strlen (src) + 1;
+ } else {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB");
+ success = GL_FALSE;
+ }
+ break;
+ default:
+ _mesa_error (ctx, GL_INVALID_ENUM, "glGetObjectParameterivARB");
+ success = GL_FALSE;
+ break;
+ }
+
+ (**gen)._unknown.Release ((struct gl2_unknown_intf **) gen);
+ if (sha != NULL)
+ (**sha)._generic._unknown.Release ((struct gl2_unknown_intf **) sha);
+ if (pro != NULL)
+ (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro);
+
+ return success;
+}
+
void GLAPIENTRY
_mesa_GetObjectParameterfvARB (GLhandleARB obj, GLenum pname, GLfloat *params)
-{\r
- GLint iparams;\r
-\r
- /* NOTE we are assuming here that all parameters are one-element wide */\r
-\r
- _mesa_GetObjectParameterivARB (obj, pname, &iparams);\r
- *params = (GLfloat) iparams;
+{
+ GLboolean integral;
+ GLint size, i;
+
+ assert (sizeof (GLfloat) == sizeof (GLint));
+
+ if (_mesa_get_object_parameter (obj, pname, (GLvoid *) params, &integral, &size) != GL_FALSE)
+ if (integral != GL_FALSE)
+ for (i = 0; i < size; i++)
+ params[i] = (GLfloat) ((GLint *) params)[i];
}
void GLAPIENTRY
_mesa_GetObjectParameterivARB (GLhandleARB obj, GLenum pname, GLint *params)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
- struct gl2_unknown_intf **unk;\r
- struct gl2_generic_intf **gen;\r
- struct gl2_shader_intf **sha;\r
- struct gl2_program_intf **pro;\r
-\r
- _glthread_LOCK_MUTEX (ctx->Shared->Mutex);\r
- unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, obj);\r
- _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);\r
-\r
- if (unk == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glGetObjectParameterivARB");\r
- return;\r
- }\r
-\r
- gen = (struct gl2_generic_intf **) (**unk).QueryInterface (unk, UIID_GENERIC);\r
- if (gen == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB");\r
- return;\r
- }\r
-\r
- sha = (struct gl2_shader_intf **) (**unk).QueryInterface (unk, UIID_SHADER);\r
- pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM);\r
-\r
- /* NOTE this function is called by GetObjectParameterfv so watch out with types and sizes */\r
-\r
- switch (pname)\r
- {\r
- case GL_OBJECT_TYPE_ARB:\r
- *params = (**gen).GetType (gen);\r
- break;\r
- case GL_OBJECT_SUBTYPE_ARB:\r
- if (sha != NULL)\r
- *params = (**sha).GetSubType (sha);\r
- else\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB");\r
- break;\r
- case GL_OBJECT_DELETE_STATUS_ARB:\r
- *params = (**gen).GetDeleteStatus (gen);\r
- break;\r
- case GL_OBJECT_COMPILE_STATUS_ARB:\r
- if (sha != NULL)\r
- *params = (**sha).GetCompileStatus (sha);\r
- else\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB");\r
- break;\r
- case GL_OBJECT_LINK_STATUS_ARB:\r
- if (pro != NULL)\r
- *params = (**pro).GetLinkStatus (pro);\r
- else\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB");\r
- break;\r
- case GL_OBJECT_VALIDATE_STATUS_ARB:\r
- if (pro != NULL)\r
- *params = (**pro).GetValidateStatus (pro);\r
- else\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB");\r
- break;\r
- case GL_OBJECT_INFO_LOG_LENGTH_ARB:\r
- {\r
- const GLcharARB *info = (**gen).GetInfoLog (gen);\r
- if (info == NULL)\r
- *params = 0;\r
- else\r
- *params = _mesa_strlen (info) + 1;\r
- }\r
- break;\r
- case GL_OBJECT_ATTACHED_OBJECTS_ARB:\r
- if (pro != NULL)\r
- *params = (**pro)._container.GetAttachedCount ((struct gl2_container_intf **) pro);\r
- else\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB");\r
- break;\r
- case GL_OBJECT_ACTIVE_UNIFORMS_ARB:\r
- *params = 0; /* TODO */\r
- break;\r
- case GL_OBJECT_ACTIVE_UNIFORM_MAX_LENGTH_ARB:\r
- *params = 0; /* TODO */\r
- break;\r
- case GL_OBJECT_SHADER_SOURCE_LENGTH_ARB:\r
- if (sha != NULL)\r
- {\r
- const GLcharARB *src = (**sha).GetSource (sha);\r
- if (src == NULL)\r
- *params = 0;\r
- else\r
- *params = _mesa_strlen (src) + 1;\r
- }\r
- else\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glGetObjectParameterivARB");\r
- break;\r
- }\r
-\r
- (**gen)._unknown.Release ((struct gl2_unknown_intf **) gen);\r
- if (sha != NULL)\r
- (**sha)._generic._unknown.Release ((struct gl2_unknown_intf **) sha);\r
- if (pro != NULL)\r
- (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro);
+{
+ GLboolean integral;
+ GLint size, i;
+
+ assert (sizeof (GLfloat) == sizeof (GLint));
+
+ if (_mesa_get_object_parameter (obj, pname, (GLvoid *) params, &integral, &size) != GL_FALSE)
+ if (integral == GL_FALSE)
+ for (i = 0; i < size; i++)
+ params[i] = (GLint) ((GLfloat *) params)[i];
+}
+
+static void
+_mesa_get_string (const GLcharARB *src, GLsizei maxLength, GLsizei *length, GLcharARB *str)
+{
+ GLsizei len;
+
+ if (src == NULL)
+ src = "";
+
+ len = _mesa_strlen (src);
+ if (len > maxLength)
+ {
+ len = maxLength;
+ /* allocate space for null termination */
+ if (len > 0)
+ len--;
+ }
+
+ _mesa_memcpy (str, src, len * sizeof (GLcharARB));
+ if (maxLength > 0)
+ str[len] = '\0';
+
+ if (length != NULL)
+ *length = len;
}
void GLAPIENTRY
_mesa_GetInfoLogARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *infoLog)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
- struct gl2_unknown_intf **unk;\r
- struct gl2_generic_intf **gen;\r
- const GLcharARB *info;\r
- GLsizei len;\r
-\r
- _glthread_LOCK_MUTEX (ctx->Shared->Mutex);\r
- unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, obj);\r
- _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);\r
-\r
- if (unk == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glGetInfoLogARB");\r
- return;\r
- }\r
-\r
- gen = (struct gl2_generic_intf **) (**unk).QueryInterface (unk, UIID_GENERIC);\r
- if (gen == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glGetInfoLogARB");\r
- return;\r
- }\r
-\r
- info = (**gen).GetInfoLog (gen);\r
- if (info == NULL)\r
- info = "";\r
- (**gen)._unknown.Release ((struct gl2_unknown_intf **) gen);\r
-\r
- len = _mesa_strlen (info);\r
- if (len > maxLength)\r
- {\r
- len = maxLength;\r
- /* allocate space for null termination */\r
- if (len > 0)\r
- len--;\r
- }\r
-\r
- _mesa_memcpy (infoLog, info, len * sizeof (GLcharARB));\r
- if (maxLength > 0)\r
- infoLog[len] = '\0';\r
-\r
- if (length != NULL)\r
- *length = len;
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl2_unknown_intf **unk;
+ struct gl2_generic_intf **gen;
+
+ _glthread_LOCK_MUTEX (ctx->Shared->Mutex);
+ unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, obj);
+ _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);
+
+ if (unk == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_VALUE, "glGetInfoLogARB");
+ return;
+ }
+
+ gen = (struct gl2_generic_intf **) (**unk).QueryInterface (unk, UIID_GENERIC);
+ if (gen == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glGetInfoLogARB");
+ return;
+ }
+
+ _mesa_get_string ((**gen).GetInfoLog (gen), maxLength, length, infoLog);
+
+ (**gen)._unknown.Release ((struct gl2_unknown_intf **) gen);
}
void GLAPIENTRY
_mesa_GetAttachedObjectsARB (GLhandleARB containerObj, GLsizei maxCount, GLsizei *count, GLhandleARB *obj)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
- struct gl2_unknown_intf **unk;\r
- struct gl2_container_intf **con;\r
- GLsizei cnt, i;\r
-\r
- _glthread_LOCK_MUTEX (ctx->Shared->Mutex);\r
- unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, containerObj);\r
- _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);\r
-\r
- if (unk == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glGetAttachedObjectsARB");\r
- return;\r
- }\r
-\r
- con = (struct gl2_container_intf **) (**unk).QueryInterface (unk, UIID_CONTAINER);\r
- if (con == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glGetAttachedObjectsARB");\r
- return;\r
- }\r
-\r
- cnt = (**con).GetAttachedCount (con);\r
- if (cnt > maxCount)\r
- cnt = maxCount;\r
-\r
- for (i = 0; i < cnt; i++)\r
- {\r
- struct gl2_generic_intf **x = (**con).GetAttached (con, i);\r
- obj[i] = (**x).GetName (x);\r
- (**x)._unknown.Release ((struct gl2_unknown_intf **) x);\r
- }\r
-\r
- (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con);\r
-\r
- if (count != NULL)\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl2_unknown_intf **unk;
+ struct gl2_container_intf **con;
+ GLsizei cnt, i;
+
+ _glthread_LOCK_MUTEX (ctx->Shared->Mutex);
+ unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, containerObj);
+ _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);
+
+ if (unk == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_VALUE, "glGetAttachedObjectsARB");
+ return;
+ }
+
+ con = (struct gl2_container_intf **) (**unk).QueryInterface (unk, UIID_CONTAINER);
+ if (con == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glGetAttachedObjectsARB");
+ return;
+ }
+
+ cnt = (**con).GetAttachedCount (con);
+ if (cnt > maxCount)
+ cnt = maxCount;
+
+ for (i = 0; i < cnt; i++)
+ {
+ struct gl2_generic_intf **x = (**con).GetAttached (con, i);
+ obj[i] = (**x).GetName (x);
+ (**x)._unknown.Release ((struct gl2_unknown_intf **) x);
+ }
+
+ (**con)._generic._unknown.Release ((struct gl2_unknown_intf **) con);
+
+ if (count != NULL)
*count = cnt;
}
GLint GLAPIENTRY
_mesa_GetUniformLocationARB (GLhandleARB programObj, const GLcharARB *name)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
- struct gl2_unknown_intf **unk;\r
- struct gl2_program_intf **pro;\r
- GLint loc = -1;\r
-\r
- _glthread_LOCK_MUTEX (ctx->Shared->Mutex);\r
- unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj);\r
- _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);\r
-\r
- if (unk == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glGetUniformLocationARB");\r
- return -1;\r
- }\r
-\r
- pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM);\r
- if (pro == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glGetUniformLocationARB");\r
- return -1;\r
- }\r
-\r
- if ((**pro).GetLinkStatus (pro) == GL_FALSE)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glGetUniformLocationARB");\r
- (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro);\r
- return -1;\r
- }\r
-\r
- /* TODO */\r
-\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl2_unknown_intf **unk;
+ struct gl2_program_intf **pro;
+ GLint loc = -1;
+
+ _glthread_LOCK_MUTEX (ctx->Shared->Mutex);
+ unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj);
+ _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);
+
+ if (unk == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_VALUE, "glGetUniformLocationARB");
+ return -1;
+ }
+
+ pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM);
+ if (pro == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glGetUniformLocationARB");
+ return -1;
+ }
+
+ if ((**pro).GetLinkStatus (pro) == GL_FALSE)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glGetUniformLocationARB");
+ (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro);
+ return -1;
+ }
+
+ /* TODO */
+
(**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro);
return loc;
}
void GLAPIENTRY
_mesa_GetActiveUniformARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
- struct gl2_unknown_intf **unk;\r
- struct gl2_program_intf **pro;\r
-\r
- _glthread_LOCK_MUTEX (ctx->Shared->Mutex);\r
- unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj);\r
- _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);\r
-\r
- if (unk == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glGetActiveUniformARB");\r
- return;\r
- }\r
-\r
- pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM);\r
- if (pro == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_OPERATION, "glGetActiveUniformARB");\r
- return;\r
- }\r
-\r
-/* if (index >= val (OBJECT_ACTIVE_ATTRIBUTES_ARB))\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glGetActiveUniformARB");\r
- (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro);\r
- return;\r
- }*/\r
-\r
- /* TODO */\r
-\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl2_unknown_intf **unk;
+ struct gl2_program_intf **pro;
+
+ _glthread_LOCK_MUTEX (ctx->Shared->Mutex);
+ unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj);
+ _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);
+
+ if (unk == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_VALUE, "glGetActiveUniformARB");
+ return;
+ }
+
+ pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM);
+ if (pro == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glGetActiveUniformARB");
+ return;
+ }
+
+/* if (index >= val (OBJECT_ACTIVE_ATTRIBUTES_ARB))
+ {
+ _mesa_error (ctx, GL_INVALID_VALUE, "glGetActiveUniformARB");
+ (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro);
+ return;
+ }*/
+
+ /* TODO */
+
(**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro);
}
void GLAPIENTRY
_mesa_GetUniformfvARB (GLhandleARB programObj, GLint location, GLfloat *params)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
- struct gl2_unknown_intf **unk;\r
- struct gl2_program_intf **pro;\r
-\r
- _glthread_LOCK_MUTEX (ctx->Shared->Mutex);\r
- unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj);\r
- _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);\r
-\r
- if (unk == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glGetUniformfvARB");\r
- return;\r
- }\r
-\r
- pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM);\r
- if (pro == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glGetUniformfvARB");\r
- return;\r
- }\r
-\r
- /* TODO */\r
-\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl2_unknown_intf **unk;
+ struct gl2_program_intf **pro;
+
+ _glthread_LOCK_MUTEX (ctx->Shared->Mutex);
+ unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj);
+ _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);
+
+ if (unk == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_VALUE, "glGetUniformfvARB");
+ return;
+ }
+
+ pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM);
+ if (pro == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glGetUniformfvARB");
+ return;
+ }
+
+ if ((**pro).GetLinkStatus (pro) == GL_FALSE)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glGetUniformfvARB");
+ (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro);
+ return;
+ }
+
+ /* TODO validate location (OPERATION) */
+
+ /* TODO */
+
(**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro);
}
void GLAPIENTRY
_mesa_GetUniformivARB (GLhandleARB programObj, GLint location, GLint *params)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
- struct gl2_unknown_intf **unk;\r
- struct gl2_program_intf **pro;\r
-\r
- _glthread_LOCK_MUTEX (ctx->Shared->Mutex);\r
- unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj);\r
- _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);\r
-\r
- if (unk == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glGetUniformivARB");\r
- return;\r
- }\r
-\r
- pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM);\r
- if (pro == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glGetUniformivARB");\r
- return;\r
- }\r
-\r
- /* TODO */\r
-\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl2_unknown_intf **unk;
+ struct gl2_program_intf **pro;
+
+ _glthread_LOCK_MUTEX (ctx->Shared->Mutex);
+ unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj);
+ _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);
+
+ if (unk == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_VALUE, "glGetUniformivARB");
+ return;
+ }
+
+ pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM);
+ if (pro == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glGetUniformivARB");
+ return;
+ }
+
+ if ((**pro).GetLinkStatus (pro) == GL_FALSE)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glGetUniformivARB");
+ (**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro);
+ return;
+ }
+
+ /* TODO validate location (GL_INVALID_OPERATION) */
+
+ /* TODO */
+
(**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro);
}
void GLAPIENTRY
_mesa_GetShaderSourceARB (GLhandleARB obj, GLsizei maxLength, GLsizei *length, GLcharARB *source)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
- struct gl2_unknown_intf **unk;\r
- struct gl2_shader_intf **sha;\r
- const GLcharARB *src;\r
- GLsizei len;\r
-\r
- _glthread_LOCK_MUTEX (ctx->Shared->Mutex);\r
- unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, obj);\r
- _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);\r
-\r
- if (unk == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glGetShaderSourceARB");\r
- return;\r
- }\r
-\r
- sha = (struct gl2_shader_intf **) (**unk).QueryInterface (unk, UIID_SHADER);\r
- if (sha == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glGetShaderSourceARB");\r
- return;\r
- }\r
-\r
- src = (**sha).GetSource (sha);\r
- if (src == NULL)\r
- src = "";\r
- (**sha)._generic._unknown.Release ((struct gl2_unknown_intf **) sha);\r
-\r
- len = _mesa_strlen (src);\r
- if (len > maxLength)\r
- {\r
- len = maxLength;\r
- /* allocate space for null termination */\r
- if (len > 0)\r
- len--;\r
- }\r
-\r
- _mesa_memcpy (source, src, len * sizeof (GLcharARB));\r
- if (maxLength > 0)\r
- source[len] = '\0';\r
-\r
- if (length != NULL)\r
- *length = len;
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl2_unknown_intf **unk;
+ struct gl2_shader_intf **sha;
+
+ _glthread_LOCK_MUTEX (ctx->Shared->Mutex);
+ unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, obj);
+ _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);
+
+ if (unk == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_VALUE, "glGetShaderSourceARB");
+ return;
+ }
+
+ sha = (struct gl2_shader_intf **) (**unk).QueryInterface (unk, UIID_SHADER);
+ if (sha == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_OPERATION, "glGetShaderSourceARB");
+ return;
+ }
+
+ _mesa_get_string ((**sha).GetSource (sha), maxLength, length, source);
+
+ (**sha)._generic._unknown.Release ((struct gl2_unknown_intf **) sha);
}
/* GL_ARB_vertex_shader */
void GLAPIENTRY
_mesa_BindAttribLocationARB (GLhandleARB programObj, GLuint index, const GLcharARB *name)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
- struct gl2_unknown_intf **unk;\r
- struct gl2_program_intf **pro;\r
-\r
- _glthread_LOCK_MUTEX (ctx->Shared->Mutex);\r
- unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj);\r
- _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);\r
-\r
- if (unk == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glBindAttribLocationARB");\r
- return;\r
- }\r
-\r
- pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM);\r
- if (pro == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glBindAttribLocationARB");\r
- return;\r
- }\r
-\r
- /* TODO */\r
-\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl2_unknown_intf **unk;
+ struct gl2_program_intf **pro;
+
+ _glthread_LOCK_MUTEX (ctx->Shared->Mutex);
+ unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj);
+ _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);
+
+ if (unk == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_VALUE, "glBindAttribLocationARB");
+ return;
+ }
+
+ pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM);
+ if (pro == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_VALUE, "glBindAttribLocationARB");
+ return;
+ }
+
+ /* TODO */
+
(**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro);
}
void GLAPIENTRY
_mesa_GetActiveAttribARB (GLhandleARB programObj, GLuint index, GLsizei maxLength, GLsizei *length, GLint *size, GLenum *type, GLcharARB *name)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
- struct gl2_unknown_intf **unk;\r
- struct gl2_program_intf **pro;\r
-\r
- _glthread_LOCK_MUTEX (ctx->Shared->Mutex);\r
- unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj);\r
- _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);\r
-\r
- if (unk == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glGetActiveAttribARB");\r
- return;\r
- }\r
-\r
- pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM);\r
- if (pro == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glGetActiveAttribARB");\r
- return;\r
- }\r
-\r
- /* TODO */\r
-\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl2_unknown_intf **unk;
+ struct gl2_program_intf **pro;
+
+ _glthread_LOCK_MUTEX (ctx->Shared->Mutex);
+ unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj);
+ _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);
+
+ if (unk == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_VALUE, "glGetActiveAttribARB");
+ return;
+ }
+
+ pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM);
+ if (pro == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_VALUE, "glGetActiveAttribARB");
+ return;
+ }
+
+ /* TODO */
+
(**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro);
}
GLint GLAPIENTRY
_mesa_GetAttribLocationARB (GLhandleARB programObj, const GLcharARB *name)
-{\r
- GET_CURRENT_CONTEXT(ctx);\r
- struct gl2_unknown_intf **unk;\r
- struct gl2_program_intf **pro;\r
- GLint loc = 0;\r
-\r
- _glthread_LOCK_MUTEX (ctx->Shared->Mutex);\r
- unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj);\r
- _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);\r
-\r
- if (unk == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glGetAttribLocationARB");\r
- return 0;\r
- }\r
-\r
- pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM);\r
- if (pro == NULL)\r
- {\r
- _mesa_error (ctx, GL_INVALID_VALUE, "glGetAttribLocationARB");\r
- return 0;\r
- }\r
-\r
- /* TODO */\r
-\r
+{
+ GET_CURRENT_CONTEXT(ctx);
+ struct gl2_unknown_intf **unk;
+ struct gl2_program_intf **pro;
+ GLint loc = 0;
+
+ _glthread_LOCK_MUTEX (ctx->Shared->Mutex);
+ unk = (struct gl2_unknown_intf **) _mesa_HashLookup (ctx->Shared->GL2Objects, programObj);
+ _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);
+
+ if (unk == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_VALUE, "glGetAttribLocationARB");
+ return 0;
+ }
+
+ pro = (struct gl2_program_intf **) (**unk).QueryInterface (unk, UIID_PROGRAM);
+ if (pro == NULL)
+ {
+ _mesa_error (ctx, GL_INVALID_VALUE, "glGetAttribLocationARB");
+ return 0;
+ }
+
+ /* TODO */
+
(**pro)._container._generic._unknown.Release ((struct gl2_unknown_intf **) pro);
return loc;
}
-void\r
+void
_mesa_init_shaderobjects (GLcontext *ctx)
-{\r
+{
ctx->ShaderObjects.current_program = NULL;
+
+ _mesa_init_shaderobjects_3dlabs (ctx);
}
-\r
+