2 * Mesa 3-D graphics library
5 * Copyright (C) 2004-2006 Brian Paul All Rights Reserved.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the "Software"),
9 * to deal in the Software without restriction, including without limitation
10 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
11 * and/or sell copies of the Software, and to permit persons to whom the
12 * Software is furnished to do so, subject to the following conditions:
14 * The above copyright notice and this permission notice shall be included
15 * in all copies or substantial portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
18 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
20 * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
21 * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
22 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 #ifndef SHADEROBJECTS_H
26 #define SHADEROBJECTS_H
30 #if FEATURE_ARB_shader_objects
33 * gl2 unique interface identifier.
34 * Each gl2 interface has its own interface id used for object queries.
38 UIID_UNKNOWN
, /* supported by all objects */
39 UIID_GENERIC
, /* generic object */
40 UIID_CONTAINER
, /* contains generic objects */
41 UIID_SHADER
, /* shader object */
42 UIID_FRAGMENT_SHADER
, /* fragment shader */
43 UIID_VERTEX_SHADER
, /* vertex shader */
44 UIID_PROGRAM
, /* program object */
45 UIID_3DLABS_SHHANDLE
, /* encapsulates 3DLabs' ShHandle */
46 UIID_DEBUG
/* debug object */
49 struct gl2_unknown_intf
51 GLvoid (* AddRef
) (struct gl2_unknown_intf
**);
52 GLvoid (* Release
) (struct gl2_unknown_intf
**);
53 struct gl2_unknown_intf
**(* QueryInterface
) (struct gl2_unknown_intf
**, enum gl2_uiid uiid
);
56 struct gl2_generic_intf
58 struct gl2_unknown_intf _unknown
;
59 GLvoid (* Delete
) (struct gl2_generic_intf
**);
60 GLenum (* GetType
) (struct gl2_generic_intf
**);
61 GLhandleARB (* GetName
) (struct gl2_generic_intf
**);
62 GLboolean (* GetDeleteStatus
) (struct gl2_generic_intf
**);
63 GLvoid (* GetInfoLog
) (struct gl2_generic_intf
**, GLsizei
, GLcharARB
*);
64 GLsizei (* GetInfoLogLength
) (struct gl2_generic_intf
**);
67 struct gl2_container_intf
69 struct gl2_generic_intf _generic
;
70 GLboolean (* Attach
) (struct gl2_container_intf
**, struct gl2_generic_intf
**);
71 GLboolean (* Detach
) (struct gl2_container_intf
**, struct gl2_generic_intf
**);
72 GLsizei (* GetAttachedCount
) (struct gl2_container_intf
**);
73 struct gl2_generic_intf
**(* GetAttached
) (struct gl2_container_intf
**, GLuint
);
76 struct gl2_shader_intf
78 struct gl2_generic_intf _generic
;
79 GLenum (* GetSubType
) (struct gl2_shader_intf
**);
80 GLboolean (* GetCompileStatus
) (struct gl2_shader_intf
**);
81 GLvoid (* SetSource
) (struct gl2_shader_intf
**, GLcharARB
*, GLint
*, GLsizei
);
82 const GLcharARB
*(* GetSource
) (struct gl2_shader_intf
**);
83 GLvoid (* Compile
) (struct gl2_shader_intf
**);
86 struct gl2_program_intf
88 struct gl2_container_intf _container
;
89 GLboolean (* GetLinkStatus
) (struct gl2_program_intf
**);
90 GLboolean (* GetValidateStatus
) (struct gl2_program_intf
**);
91 GLvoid (* Link
) (struct gl2_program_intf
**);
92 GLvoid (* Validate
) (struct gl2_program_intf
**);
93 GLvoid (* UpdateFixedUniforms
) (struct gl2_program_intf
**);
94 GLvoid (* UpdateFixedAttrib
) (struct gl2_program_intf
**, GLuint
, GLvoid
*, GLuint
, GLuint
,
96 GLvoid (* UpdateFixedVarying
) (struct gl2_program_intf
**, GLuint
, GLvoid
*, GLuint
, GLuint
,
98 GLvoid (* GetTextureImageUsage
) (struct gl2_program_intf
**, GLbitfield
*);
99 GLboolean (* IsShaderPresent
) (struct gl2_program_intf
**, GLenum
);
100 GLvoid (* GetActiveUniform
) (struct gl2_program_intf
**, GLuint index
, GLsizei maxLength
,
101 GLsizei
*length
, GLint
*size
, GLenum
*type
, GLchar
*name
);
102 GLuint (* GetActiveUniformMaxLength
) (struct gl2_program_intf
**);
103 GLuint (* GetActiveUniformCount
) (struct gl2_program_intf
**);
104 GLint (* GetUniformLocation
) (struct gl2_program_intf
**, const GLchar
*name
);
105 GLboolean (* WriteUniform
) (struct gl2_program_intf
**, GLint loc
, GLsizei count
,
106 const GLvoid
*data
, GLenum type
);
107 GLvoid (* GetActiveAttrib
) (struct gl2_program_intf
**, GLuint index
, GLsizei maxLength
,
108 GLsizei
*length
, GLint
*size
, GLenum
*type
, GLchar
*name
);
109 GLuint (* GetActiveAttribMaxLength
) (struct gl2_program_intf
**);
110 GLuint (* GetActiveAttribCount
) (struct gl2_program_intf
**);
111 GLint (* GetAttribLocation
) (struct gl2_program_intf
**, const GLchar
*name
);
112 GLvoid (* OverrideAttribBinding
) (struct gl2_program_intf
**, GLuint
, const GLchar
*);
113 GLvoid (* WriteAttrib
) (struct gl2_program_intf
**, GLuint
, const GLfloat
*);
114 GLvoid (* UpdateVarying
) (struct gl2_program_intf
**, GLuint
, GLfloat
*, GLboolean
);
117 struct gl2_fragment_shader_intf
119 struct gl2_shader_intf _shader
;
122 struct gl2_vertex_shader_intf
124 struct gl2_shader_intf _shader
;
127 struct gl2_3dlabs_shhandle_intf
129 struct gl2_unknown_intf _unknown
;
130 GLvoid
*(* GetShHandle
) (struct gl2_3dlabs_shhandle_intf
**);
133 struct gl2_debug_intf
135 struct gl2_generic_intf _generic
;
136 GLvoid (* ClearDebugLog
) (struct gl2_debug_intf
**, GLenum logType
, GLenum shaderType
);
137 GLvoid (* GetDebugLog
) (struct gl2_debug_intf
**, GLenum logType
, GLenum shaderType
,
138 GLsizei maxLength
, GLsizei
*length
, GLcharARB
*infoLog
);
139 GLsizei (* GetDebugLogLength
) (struct gl2_debug_intf
**, GLenum logType
, GLenum shaderType
);
143 extern void GLAPIENTRY
144 _mesa_DeleteObjectARB(GLhandleARB obj
);
146 extern GLhandleARB GLAPIENTRY
147 _mesa_GetHandleARB(GLenum pname
);
149 extern void GLAPIENTRY
150 _mesa_DetachObjectARB (GLhandleARB
, GLhandleARB
);
152 extern GLhandleARB GLAPIENTRY
153 _mesa_CreateShaderObjectARB (GLenum
);
155 extern void GLAPIENTRY
156 _mesa_ShaderSourceARB (GLhandleARB
, GLsizei
, const GLcharARB
* *, const GLint
*);
158 extern void GLAPIENTRY
159 _mesa_CompileShaderARB (GLhandleARB
);
161 extern GLhandleARB GLAPIENTRY
162 _mesa_CreateProgramObjectARB (void);
164 extern void GLAPIENTRY
165 _mesa_AttachObjectARB (GLhandleARB
, GLhandleARB
);
167 extern void GLAPIENTRY
168 _mesa_LinkProgramARB (GLhandleARB
);
170 extern void GLAPIENTRY
171 _mesa_UseProgramObjectARB (GLhandleARB
);
173 extern void GLAPIENTRY
174 _mesa_ValidateProgramARB (GLhandleARB
);
176 extern void GLAPIENTRY
177 _mesa_Uniform1fARB (GLint
, GLfloat
);
179 extern void GLAPIENTRY
180 _mesa_Uniform2fARB (GLint
, GLfloat
, GLfloat
);
182 extern void GLAPIENTRY
183 _mesa_Uniform3fARB (GLint
, GLfloat
, GLfloat
, GLfloat
);
185 extern void GLAPIENTRY
186 _mesa_Uniform4fARB (GLint
, GLfloat
, GLfloat
, GLfloat
, GLfloat
);
188 extern void GLAPIENTRY
189 _mesa_Uniform1iARB (GLint
, GLint
);
191 extern void GLAPIENTRY
192 _mesa_Uniform2iARB (GLint
, GLint
, GLint
);
194 extern void GLAPIENTRY
195 _mesa_Uniform3iARB (GLint
, GLint
, GLint
, GLint
);
197 extern void GLAPIENTRY
198 _mesa_Uniform4iARB (GLint
, GLint
, GLint
, GLint
, GLint
);
200 extern void GLAPIENTRY
201 _mesa_Uniform1fvARB (GLint
, GLsizei
, const GLfloat
*);
203 extern void GLAPIENTRY
204 _mesa_Uniform2fvARB (GLint
, GLsizei
, const GLfloat
*);
206 extern void GLAPIENTRY
207 _mesa_Uniform3fvARB (GLint
, GLsizei
, const GLfloat
*);
209 extern void GLAPIENTRY
210 _mesa_Uniform4fvARB (GLint
, GLsizei
, const GLfloat
*);
212 extern void GLAPIENTRY
213 _mesa_Uniform1ivARB (GLint
, GLsizei
, const GLint
*);
215 extern void GLAPIENTRY
216 _mesa_Uniform2ivARB (GLint
, GLsizei
, const GLint
*);
218 extern void GLAPIENTRY
219 _mesa_Uniform3ivARB (GLint
, GLsizei
, const GLint
*);
221 extern void GLAPIENTRY
222 _mesa_Uniform4ivARB (GLint
, GLsizei
, const GLint
*);
224 extern void GLAPIENTRY
225 _mesa_UniformMatrix2fvARB (GLint
, GLsizei
, GLboolean
, const GLfloat
*);
227 extern void GLAPIENTRY
228 _mesa_UniformMatrix3fvARB (GLint
, GLsizei
, GLboolean
, const GLfloat
*);
230 extern void GLAPIENTRY
231 _mesa_UniformMatrix4fvARB (GLint
, GLsizei
, GLboolean
, const GLfloat
*);
233 extern void GLAPIENTRY
234 _mesa_GetObjectParameterfvARB (GLhandleARB
, GLenum
, GLfloat
*);
236 extern void GLAPIENTRY
237 _mesa_GetObjectParameterivARB (GLhandleARB
, GLenum
, GLint
*);
239 extern void GLAPIENTRY
240 _mesa_GetInfoLogARB (GLhandleARB
, GLsizei
, GLsizei
*, GLcharARB
*);
242 extern void GLAPIENTRY
243 _mesa_GetAttachedObjectsARB (GLhandleARB
, GLsizei
, GLsizei
*, GLhandleARB
*);
245 extern GLint GLAPIENTRY
246 _mesa_GetUniformLocationARB (GLhandleARB
, const GLcharARB
*);
248 extern void GLAPIENTRY
249 _mesa_GetActiveUniformARB (GLhandleARB
, GLuint
, GLsizei
, GLsizei
*, GLint
*, GLenum
*, GLcharARB
*);
251 extern void GLAPIENTRY
252 _mesa_GetUniformfvARB (GLhandleARB
, GLint
, GLfloat
*);
254 extern void GLAPIENTRY
255 _mesa_GetUniformivARB (GLhandleARB
, GLint
, GLint
*);
257 extern void GLAPIENTRY
258 _mesa_GetShaderSourceARB (GLhandleARB
, GLsizei
, GLsizei
*, GLcharARB
*);
260 #if FEATURE_ARB_vertex_shader
262 extern void GLAPIENTRY
263 _mesa_BindAttribLocationARB (GLhandleARB
, GLuint
, const GLcharARB
*);
265 extern void GLAPIENTRY
266 _mesa_GetActiveAttribARB (GLhandleARB
, GLuint
, GLsizei
, GLsizei
*, GLint
*, GLenum
*, GLcharARB
*);
268 extern GLint GLAPIENTRY
269 _mesa_GetAttribLocationARB (GLhandleARB
, const GLcharARB
*);
271 #endif /* FEATURE_ARB_vertex_shader */
275 extern void GLAPIENTRY
276 _mesa_AttachShader(GLuint program
, GLuint shader
);
278 extern GLuint GLAPIENTRY
279 _mesa_CreateShader(GLenum
);
281 extern GLuint GLAPIENTRY
282 _mesa_CreateProgram(void);
284 extern void GLAPIENTRY
285 _mesa_DeleteProgram(GLuint program
);
287 extern void GLAPIENTRY
288 _mesa_DeleteShader(GLuint shader
);
290 extern void GLAPIENTRY
291 _mesa_DetachShader(GLuint program
, GLuint shader
);
293 extern void GLAPIENTRY
294 _mesa_GetAttachedShaders(GLuint program
, GLsizei maxCount
,
295 GLsizei
*count
, GLuint
*obj
);
297 extern void GLAPIENTRY
298 _mesa_GetProgramiv(GLuint program
, GLenum pname
, GLint
*params
);
300 extern void GLAPIENTRY
301 _mesa_GetProgramInfoLog(GLuint program
, GLsizei bufSize
,
302 GLsizei
*length
, GLchar
*infoLog
);
304 extern void GLAPIENTRY
305 _mesa_GetShaderiv(GLuint shader
, GLenum pname
, GLint
*params
);
307 extern void GLAPIENTRY
308 _mesa_GetShaderInfoLog(GLuint shader
, GLsizei bufSize
,
309 GLsizei
*length
, GLchar
*infoLog
);
311 extern GLboolean GLAPIENTRY
312 _mesa_IsProgram2(GLuint program
);
314 extern GLboolean GLAPIENTRY
315 _mesa_IsShader(GLuint shader
);
318 #endif /* FEATURE_ARB_shader_objects */
321 _mesa_init_shaderobjects (GLcontext
*ctx
);
323 #endif /* SHADEROBJECTS_H */