--- /dev/null
+/*\r
+ * Mesa 3-D graphics library\r
+ * Version: 6.3\r
+ *\r
+ * Copyright (C) 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_3dlabs.c\r
+ * shader objects definitions for 3dlabs compiler\r
+ * \author Michal Krol\r
+ */\r
+\r
+\r
+#include "glheader.h"\r
+#include "shaderobjects.h"\r
+#include "context.h"\r
+#include "macros.h"\r
+#include "hash.h"\r
+\r
+\r
+struct gl2_unknown_obj\r
+{\r
+ GLuint reference_count;\r
+ void (* _destructor) (struct gl2_unknown_intf **);\r
+};\r
+\r
+struct gl2_unknown_impl\r
+{\r
+ struct gl2_unknown_intf *_vftbl;\r
+ struct gl2_unknown_obj _obj;\r
+};\r
+\r
+static void\r
+_unknown_destructor (struct gl2_unknown_intf **intf)\r
+{\r
+}\r
+\r
+static void\r
+_unknown_AddRef (struct gl2_unknown_intf **intf)\r
+{\r
+ struct gl2_unknown_impl *impl = (struct gl2_unknown_impl *) intf;\r
+\r
+ impl->_obj.reference_count++;\r
+}\r
+\r
+static void\r
+_unknown_Release (struct gl2_unknown_intf **intf)\r
+{\r
+ struct gl2_unknown_impl *impl = (struct gl2_unknown_impl *) intf;\r
+\r
+ impl->_obj.reference_count--;\r
+ if (impl->_obj.reference_count == 0)\r
+ {\r
+ impl->_obj._destructor (intf);\r
+ _mesa_free ((void *) intf);\r
+ }\r
+}\r
+\r
+static struct gl2_unknown_intf **\r
+_unknown_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid)\r
+{\r
+ if (uiid == UIID_UNKNOWN)\r
+ {\r
+ (**intf).AddRef (intf);\r
+ return intf;\r
+ }\r
+ return NULL;\r
+}\r
+\r
+static struct gl2_unknown_intf _unknown_vftbl = {\r
+ _unknown_AddRef,\r
+ _unknown_Release,\r
+ _unknown_QueryInterface\r
+};\r
+\r
+static void\r
+_unknown_constructor (struct gl2_unknown_impl *impl)\r
+{\r
+ impl->_vftbl = &_unknown_vftbl;\r
+ impl->_obj.reference_count = 1;\r
+ impl->_obj._destructor = _unknown_destructor;\r
+}\r
+\r
+struct gl2_generic_obj\r
+{\r
+ struct gl2_unknown_obj _unknown;\r
+ GLhandleARB name;\r
+ GLboolean delete_status;\r
+ GLcharARB *info_log;\r
+};\r
+\r
+struct gl2_generic_impl\r
+{\r
+ struct gl2_generic_intf *_vftbl;\r
+ struct gl2_generic_obj _obj;\r
+};\r
+\r
+static void\r
+_generic_destructor (struct gl2_unknown_intf **intf)\r
+{\r
+ GET_CURRENT_CONTEXT(ctx);\r
+ struct gl2_generic_impl *impl = (struct gl2_generic_impl *) intf;\r
+\r
+ _mesa_free ((void *) impl->_obj.info_log);\r
+\r
+ _glthread_LOCK_MUTEX (ctx->Shared->Mutex);\r
+ _mesa_HashRemove (ctx->Shared->GL2Objects, impl->_obj.name);\r
+ _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);\r
+\r
+ _unknown_destructor (intf);\r
+}\r
+\r
+static struct gl2_unknown_intf **\r
+_generic_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid)\r
+{\r
+ if (uiid == UIID_GENERIC)\r
+ {\r
+ (**intf).AddRef (intf);\r
+ return intf;\r
+ }\r
+ return _unknown_QueryInterface (intf, uiid);\r
+}\r
+\r
+static void\r
+_generic_Delete (struct gl2_generic_intf **intf)\r
+{\r
+ struct gl2_generic_impl *impl = (struct gl2_generic_impl *) intf;\r
+\r
+ if (impl->_obj.delete_status == GL_FALSE)\r
+ {\r
+ impl->_obj.delete_status = GL_TRUE;\r
+ (**intf)._unknown.Release ((struct gl2_unknown_intf **) intf);\r
+ }\r
+}\r
+\r
+static GLhandleARB\r
+_generic_GetName (struct gl2_generic_intf **intf)\r
+{\r
+ struct gl2_generic_impl *impl = (struct gl2_generic_impl *) intf;\r
+\r
+ return impl->_obj.name;\r
+}\r
+\r
+static GLboolean\r
+_generic_GetDeleteStatus (struct gl2_generic_intf **intf)\r
+{\r
+ struct gl2_generic_impl *impl = (struct gl2_generic_impl *) intf;\r
+\r
+ return impl->_obj.delete_status;\r
+}\r
+\r
+static const GLcharARB *\r
+_generic_GetInfoLog (struct gl2_generic_intf **intf)\r
+{\r
+ struct gl2_generic_impl *impl = (struct gl2_generic_impl *) intf;\r
+\r
+ return impl->_obj.info_log;\r
+}\r
+\r
+static struct gl2_generic_intf _generic_vftbl = {\r
+ _unknown_AddRef,\r
+ _unknown_Release,\r
+ _generic_QueryInterface,\r
+ _generic_Delete,\r
+ NULL,\r
+ _generic_GetName,\r
+ _generic_GetDeleteStatus,\r
+ _generic_GetInfoLog\r
+};\r
+\r
+static void\r
+_generic_constructor (struct gl2_generic_impl *impl)\r
+{\r
+ GET_CURRENT_CONTEXT(ctx);\r
+\r
+ _unknown_constructor ((struct gl2_unknown_impl *) impl);\r
+ impl->_vftbl = &_generic_vftbl;\r
+ impl->_obj._unknown._destructor = _generic_destructor;\r
+ impl->_obj.delete_status = GL_FALSE;\r
+ impl->_obj.info_log = NULL;\r
+\r
+ _glthread_LOCK_MUTEX (ctx->Shared->Mutex);\r
+ impl->_obj.name = _mesa_HashFindFreeKeyBlock (ctx->Shared->GL2Objects, 1);\r
+ _mesa_HashInsert (ctx->Shared->GL2Objects, impl->_obj.name, (void *) impl);\r
+ _glthread_UNLOCK_MUTEX (ctx->Shared->Mutex);\r
+}\r
+\r
+struct gl2_container_obj\r
+{\r
+ struct gl2_generic_obj _generic;\r
+ struct gl2_generic_intf ***attached;\r
+ GLuint attached_count;\r
+};\r
+\r
+struct gl2_container_impl\r
+{\r
+ struct gl2_container_intf *_vftbl;\r
+ struct gl2_container_obj _obj;\r
+};\r
+\r
+static void\r
+_container_destructor (struct gl2_unknown_intf **intf)\r
+{\r
+ struct gl2_container_impl *impl = (struct gl2_container_impl *) intf;\r
+ GLuint i;\r
+\r
+ for (i = 0; i < impl->_obj.attached_count; i++)\r
+ {\r
+ struct gl2_generic_intf **x = impl->_obj.attached[i];\r
+ (**x)._unknown.Release ((struct gl2_unknown_intf **) x);\r
+ }\r
+\r
+ _generic_destructor (intf);\r
+}\r
+\r
+static struct gl2_unknown_intf **\r
+_container_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid)\r
+{\r
+ if (uiid == UIID_CONTAINER)\r
+ {\r
+ (**intf).AddRef (intf);\r
+ return intf;\r
+ }\r
+ return _generic_QueryInterface (intf, uiid);\r
+}\r
+\r
+static GLboolean\r
+_container_Attach (struct gl2_container_intf **intf, struct gl2_generic_intf **att)\r
+{\r
+ GET_CURRENT_CONTEXT(ctx);\r
+ struct gl2_container_impl *impl = (struct gl2_container_impl *) intf;\r
+ GLuint i;\r
+\r
+ for (i = 0; i < impl->_obj.attached_count; i++)\r
+ if (impl->_obj.attached[i] == att)\r
+ {\r
+ _mesa_error (ctx, GL_INVALID_OPERATION, "_container_Attach");\r
+ return GL_FALSE;\r
+ }\r
+\r
+ impl->_obj.attached = (struct gl2_generic_intf ***) _mesa_realloc (impl->_obj.attached,\r
+ impl->_obj.attached_count * sizeof (*impl->_obj.attached), (impl->_obj.attached_count + 1) *\r
+ sizeof (*impl->_obj.attached));\r
+ if (impl->_obj.attached == NULL)\r
+ return GL_FALSE;\r
+\r
+ impl->_obj.attached[impl->_obj.attached_count] = att;\r
+ impl->_obj.attached_count++;\r
+ (**att)._unknown.AddRef ((struct gl2_unknown_intf **) att);\r
+ return GL_TRUE;\r
+}\r
+\r
+static GLboolean\r
+_container_Detach (struct gl2_container_intf **intf, struct gl2_generic_intf **att)\r
+{\r
+ GET_CURRENT_CONTEXT(ctx);\r
+ struct gl2_container_impl *impl = (struct gl2_container_impl *) intf;\r
+ GLuint i, j;\r
+\r
+ for (i = 0; i < impl->_obj.attached_count; i++)\r
+ if (impl->_obj.attached[i] == att)\r
+ {\r
+ for (j = i; j < impl->_obj.attached_count - 1; j++)\r
+ impl->_obj.attached[j] = impl->_obj.attached[j + 1];\r
+ impl->_obj.attached = (struct gl2_generic_intf ***) _mesa_realloc (impl->_obj.attached,\r
+ impl->_obj.attached_count * sizeof (*impl->_obj.attached),\r
+ (impl->_obj.attached_count - 1) * sizeof (*impl->_obj.attached));\r
+ impl->_obj.attached_count--;\r
+ (**att)._unknown.Release ((struct gl2_unknown_intf **) att);\r
+ return GL_TRUE;\r
+ }\r
+\r
+ _mesa_error (ctx, GL_INVALID_OPERATION, "_container_Detach");\r
+ return GL_FALSE;\r
+}\r
+\r
+static GLsizei\r
+_container_GetAttachedCount (struct gl2_container_intf **intf)\r
+{\r
+ struct gl2_container_impl *impl = (struct gl2_container_impl *) intf;\r
+\r
+ return impl->_obj.attached_count;\r
+}\r
+\r
+static struct gl2_generic_intf **\r
+_container_GetAttached (struct gl2_container_intf **intf, GLuint index)\r
+{\r
+ struct gl2_container_impl *impl = (struct gl2_container_impl *) intf;\r
+\r
+ (**impl->_obj.attached[index])._unknown.AddRef (\r
+ (struct gl2_unknown_intf **)impl->_obj.attached[index]);\r
+ return impl->_obj.attached[index];\r
+}\r
+\r
+static struct gl2_container_intf _container_vftbl = {\r
+ _unknown_AddRef,\r
+ _unknown_Release,\r
+ _container_QueryInterface,\r
+ _generic_Delete,\r
+ NULL,\r
+ _generic_GetName,\r
+ _generic_GetDeleteStatus,\r
+ _generic_GetInfoLog,\r
+ _container_Attach,\r
+ _container_Detach,\r
+ _container_GetAttachedCount,\r
+ _container_GetAttached\r
+};\r
+\r
+static void\r
+_container_constructor (struct gl2_container_impl *impl)\r
+{\r
+ _generic_constructor ((struct gl2_generic_impl *) impl);\r
+ impl->_vftbl = &_container_vftbl;\r
+ impl->_obj._generic._unknown._destructor = _container_destructor;\r
+ impl->_obj.attached = NULL;\r
+ impl->_obj.attached_count = 0;\r
+}\r
+\r
+struct gl2_shader_obj\r
+{\r
+ struct gl2_generic_obj _generic;\r
+ GLboolean compile_status;\r
+ GLcharARB *source;\r
+ GLint *offsets;\r
+ GLsizei offset_count;\r
+};\r
+\r
+struct gl2_shader_impl\r
+{\r
+ struct gl2_shader_intf *_vftbl;\r
+ struct gl2_shader_obj _obj;\r
+};\r
+\r
+static void\r
+_shader_destructor (struct gl2_unknown_intf **intf)\r
+{\r
+ struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf;\r
+\r
+ _mesa_free ((void *) impl->_obj.source);\r
+ _mesa_free ((void *) impl->_obj.offsets);\r
+ _generic_destructor (intf);\r
+}\r
+\r
+static struct gl2_unknown_intf **\r
+_shader_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid)\r
+{\r
+ if (uiid == UIID_SHADER)\r
+ {\r
+ (**intf).AddRef (intf);\r
+ return intf;\r
+ }\r
+ return _generic_QueryInterface (intf, uiid);\r
+}\r
+\r
+static GLenum\r
+_shader_GetType (struct gl2_generic_intf **intf)\r
+{\r
+ return GL_SHADER_OBJECT_ARB;\r
+}\r
+\r
+static GLboolean\r
+_shader_GetCompileStatus (struct gl2_shader_intf **intf)\r
+{\r
+ struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf;\r
+\r
+ return impl->_obj.compile_status;\r
+}\r
+\r
+static GLvoid\r
+_shader_SetSource (struct gl2_shader_intf **intf, GLcharARB *src, GLint *off, GLsizei cnt)\r
+{\r
+ struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf;\r
+\r
+ _mesa_free ((void *) impl->_obj.source);\r
+ impl->_obj.source = src;\r
+ _mesa_free ((void *) impl->_obj.offsets);\r
+ impl->_obj.offsets = off;\r
+ impl->_obj.offset_count = cnt;\r
+}\r
+\r
+static const GLcharARB *\r
+_shader_GetSource (struct gl2_shader_intf **intf)\r
+{\r
+ struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf;\r
+\r
+ return impl->_obj.source;\r
+}\r
+\r
+static GLvoid\r
+_shader_Compile (struct gl2_shader_intf **intf)\r
+{\r
+ struct gl2_shader_impl *impl = (struct gl2_shader_impl *) intf;\r
+\r
+ impl->_obj.compile_status = GL_FALSE;\r
+ _mesa_free ((void *) impl->_obj._generic.info_log);\r
+ impl->_obj._generic.info_log = NULL;\r
+\r
+ /* TODO compile */\r
+}\r
+\r
+static struct gl2_shader_intf _shader_vftbl = {\r
+ _unknown_AddRef,\r
+ _unknown_Release,\r
+ _shader_QueryInterface,\r
+ _generic_Delete,\r
+ _shader_GetType,\r
+ _generic_GetName,\r
+ _generic_GetDeleteStatus,\r
+ _generic_GetInfoLog,\r
+ NULL,\r
+ _shader_GetCompileStatus,\r
+ _shader_SetSource,\r
+ _shader_GetSource,\r
+ _shader_Compile\r
+};\r
+\r
+static void\r
+_shader_constructor (struct gl2_shader_impl *impl)\r
+{\r
+ _generic_constructor ((struct gl2_generic_impl *) impl);\r
+ impl->_vftbl = &_shader_vftbl;\r
+ impl->_obj._generic._unknown._destructor = _shader_destructor;\r
+ impl->_obj.compile_status = GL_FALSE;\r
+ impl->_obj.source = NULL;\r
+ impl->_obj.offsets = NULL;\r
+ impl->_obj.offset_count = 0;\r
+}\r
+\r
+struct gl2_program_obj\r
+{\r
+ struct gl2_container_obj _container;\r
+ GLboolean link_status;\r
+ GLboolean validate_status;\r
+};\r
+\r
+struct gl2_program_impl\r
+{\r
+ struct gl2_program_intf *_vftbl;\r
+ struct gl2_program_obj _obj;\r
+};\r
+\r
+static void\r
+_program_destructor (struct gl2_unknown_intf **intf)\r
+{\r
+ struct gl2_program_impl *impl = (struct gl2_program_impl *) intf;\r
+\r
+ _container_destructor (intf);\r
+}\r
+\r
+static struct gl2_unknown_intf **\r
+_program_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid)\r
+{\r
+ if (uiid == UIID_PROGRAM)\r
+ {\r
+ (**intf).AddRef (intf);\r
+ return intf;\r
+ }\r
+ return _container_QueryInterface (intf, uiid);\r
+}\r
+\r
+static GLenum\r
+_program_GetType (struct gl2_generic_intf **intf)\r
+{\r
+ return GL_PROGRAM_OBJECT_ARB;\r
+}\r
+\r
+static GLboolean\r
+_program_Attach (struct gl2_container_intf **intf, struct gl2_generic_intf **att)\r
+{\r
+ GET_CURRENT_CONTEXT(ctx);\r
+ struct gl2_unknown_intf **sha;\r
+\r
+ sha = (**att)._unknown.QueryInterface ((struct gl2_unknown_intf **) att, UIID_SHADER);\r
+ if (sha == NULL)\r
+ {\r
+ _mesa_error (ctx, GL_INVALID_OPERATION, "_program_Attach");\r
+ return GL_FALSE;\r
+ }\r
+\r
+ (**sha).Release (sha);\r
+ return _container_Attach (intf, att);\r
+}\r
+\r
+static GLboolean\r
+_program_GetLinkStatus (struct gl2_program_intf **intf)\r
+{\r
+ struct gl2_program_impl *impl = (struct gl2_program_impl *) intf;\r
+\r
+ return impl->_obj.link_status;\r
+}\r
+\r
+static GLboolean\r
+_program_GetValidateStatus (struct gl2_program_intf **intf)\r
+{\r
+ struct gl2_program_impl *impl = (struct gl2_program_impl *) intf;\r
+\r
+ return impl->_obj.validate_status;\r
+}\r
+\r
+static GLvoid\r
+_program_Link (struct gl2_program_intf **intf)\r
+{\r
+ struct gl2_program_impl *impl = (struct gl2_program_impl *) intf;\r
+\r
+ impl->_obj.link_status = GL_FALSE;\r
+ _mesa_free ((void *) impl->_obj._container._generic.info_log);\r
+ impl->_obj._container._generic.info_log = NULL;\r
+\r
+ /* TODO link */\r
+}\r
+\r
+static GLvoid\r
+_program_Validate (struct gl2_program_intf **intf)\r
+{\r
+ struct gl2_program_impl *impl = (struct gl2_program_impl *) intf;\r
+\r
+ impl->_obj.validate_status = GL_FALSE;\r
+\r
+ /* TODO validate */\r
+}\r
+\r
+static struct gl2_program_intf _program_vftbl = {\r
+ _unknown_AddRef,\r
+ _unknown_Release,\r
+ _program_QueryInterface,\r
+ _generic_Delete,\r
+ _program_GetType,\r
+ _generic_GetName,\r
+ _generic_GetDeleteStatus,\r
+ _generic_GetInfoLog,\r
+ _program_Attach,\r
+ _container_Detach,\r
+ _container_GetAttachedCount,\r
+ _container_GetAttached,\r
+ _program_GetLinkStatus,\r
+ _program_GetValidateStatus,\r
+ _program_Link,\r
+ _program_Validate\r
+};\r
+\r
+static void\r
+_program_constructor (struct gl2_program_impl *impl)\r
+{\r
+ _container_constructor ((struct gl2_container_impl *) impl);\r
+ impl->_vftbl = &_program_vftbl;\r
+ impl->_obj._container._generic._unknown._destructor = _program_destructor;\r
+ impl->_obj.link_status = GL_FALSE;\r
+ impl->_obj.validate_status = GL_FALSE;\r
+}\r
+\r
+struct gl2_fragment_shader_obj\r
+{\r
+ struct gl2_shader_obj _shader;\r
+};\r
+\r
+struct gl2_fragment_shader_impl\r
+{\r
+ struct gl2_fragment_shader_intf *_vftbl;\r
+ struct gl2_fragment_shader_obj _obj;\r
+};\r
+\r
+static void\r
+_fragment_shader_destructor (struct gl2_unknown_intf **intf)\r
+{\r
+ struct gl2_fragment_shader_impl *impl = (struct gl2_fragment_shader_impl *) intf;\r
+\r
+ /* TODO free fragment shader data */\r
+\r
+ _shader_destructor (intf);\r
+}\r
+\r
+static struct gl2_unknown_intf **\r
+_fragment_shader_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid)\r
+{\r
+ if (uiid == UIID_FRAGMENT_SHADER)\r
+ {\r
+ (**intf).AddRef (intf);\r
+ return intf;\r
+ }\r
+ return _shader_QueryInterface (intf, uiid);\r
+}\r
+\r
+static GLenum\r
+_fragment_shader_GetSubType (struct gl2_shader_intf **intf)\r
+{\r
+ return GL_FRAGMENT_SHADER_ARB;\r
+}\r
+\r
+static struct gl2_fragment_shader_intf _fragment_shader_vftbl = {\r
+ _unknown_AddRef,\r
+ _unknown_Release,\r
+ _fragment_shader_QueryInterface,\r
+ _generic_Delete,\r
+ _shader_GetType,\r
+ _generic_GetName,\r
+ _generic_GetDeleteStatus,\r
+ _generic_GetInfoLog,\r
+ _fragment_shader_GetSubType,\r
+ _shader_GetCompileStatus,\r
+ _shader_SetSource,\r
+ _shader_GetSource,\r
+ _shader_Compile\r
+};\r
+\r
+static void\r
+_fragment_shader_constructor (struct gl2_fragment_shader_impl *impl)\r
+{\r
+ _shader_constructor ((struct gl2_shader_impl *) impl);\r
+ impl->_vftbl = &_fragment_shader_vftbl;\r
+ impl->_obj._shader._generic._unknown._destructor = _fragment_shader_destructor;\r
+}\r
+\r
+struct gl2_vertex_shader_obj\r
+{\r
+ struct gl2_shader_obj _shader;\r
+};\r
+\r
+struct gl2_vertex_shader_impl\r
+{\r
+ struct gl2_vertex_shader_intf *_vftbl;\r
+ struct gl2_vertex_shader_obj _obj;\r
+};\r
+\r
+static void\r
+_vertex_shader_destructor (struct gl2_unknown_intf **intf)\r
+{\r
+ struct gl2_vertex_shader_impl *impl = (struct gl2_vertex_shader_impl *) intf;\r
+\r
+ /* TODO free vertex shader data */\r
+\r
+ _shader_destructor (intf);\r
+}\r
+\r
+static struct gl2_unknown_intf **\r
+_vertex_shader_QueryInterface (struct gl2_unknown_intf **intf, enum gl2_uiid uiid)\r
+{\r
+ if (uiid == UIID_VERTEX_SHADER)\r
+ {\r
+ (**intf).AddRef (intf);\r
+ return intf;\r
+ }\r
+ return _shader_QueryInterface (intf, uiid);\r
+}\r
+\r
+static GLenum\r
+_vertex_shader_GetSubType (struct gl2_shader_intf **intf)\r
+{\r
+ return GL_VERTEX_SHADER_ARB;\r
+}\r
+\r
+static struct gl2_vertex_shader_intf _vertex_shader_vftbl = {\r
+ _unknown_AddRef,\r
+ _unknown_Release,\r
+ _vertex_shader_QueryInterface,\r
+ _generic_Delete,\r
+ _shader_GetType,\r
+ _generic_GetName,\r
+ _generic_GetDeleteStatus,\r
+ _generic_GetInfoLog,\r
+ _vertex_shader_GetSubType,\r
+ _shader_GetCompileStatus,\r
+ _shader_SetSource,\r
+ _shader_GetSource,\r
+ _shader_Compile\r
+};\r
+\r
+static void\r
+_vertex_shader_constructor (struct gl2_vertex_shader_impl *impl)\r
+{\r
+ _shader_constructor ((struct gl2_shader_impl *) impl);\r
+ impl->_vftbl = &_vertex_shader_vftbl;\r
+ impl->_obj._shader._generic._unknown._destructor = _vertex_shader_destructor;\r
+}\r
+\r
+GLhandleARB\r
+_mesa_3dlabs_create_shader_object (GLenum shaderType)\r
+{\r
+ GET_CURRENT_CONTEXT(ctx);\r
+\r
+ switch (shaderType)\r
+ {\r
+ case GL_FRAGMENT_SHADER_ARB:\r
+ {\r
+ struct gl2_fragment_shader_impl *x = (struct gl2_fragment_shader_impl *) _mesa_malloc (\r
+ sizeof (struct gl2_fragment_shader_impl));\r
+\r
+ if (x != NULL)\r
+ {\r
+ _fragment_shader_constructor (x);\r
+ return x->_obj._shader._generic.name;\r
+ }\r
+ }\r
+ break;\r
+ case GL_VERTEX_SHADER_ARB:\r
+ {\r
+ struct gl2_vertex_shader_impl *x = (struct gl2_vertex_shader_impl *) _mesa_malloc (\r
+ sizeof (struct gl2_vertex_shader_impl));\r
+\r
+ if (x != NULL)\r
+ {\r
+ _vertex_shader_constructor (x);\r
+ return x->_obj._shader._generic.name;\r
+ }\r
+ }\r
+ break;\r
+ }\r
+\r
+ return 0;\r
+}\r
+\r
+GLhandleARB\r
+_mesa_3dlabs_create_program_object (void)\r
+{\r
+ GET_CURRENT_CONTEXT(ctx);\r
+ struct gl2_program_impl *x = (struct gl2_program_impl *) _mesa_malloc (sizeof (\r
+ struct gl2_program_impl));\r
+\r
+ if (x != NULL)\r
+ {\r
+ _program_constructor (x);\r
+ return x->_obj._container._generic.name;\r
+ }\r
+\r
+ return 0;\r
+}\r
+\r