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
**);
84 struct gl_program
*Program
;
87 struct gl2_program_intf
89 struct gl2_container_intf _container
;
90 GLboolean (* GetLinkStatus
) (struct gl2_program_intf
**);
91 GLboolean (* GetValidateStatus
) (struct gl2_program_intf
**);
92 GLvoid (* Link
) (struct gl2_program_intf
**);
93 GLvoid (* Validate
) (struct gl2_program_intf
**);
94 GLvoid (* UpdateFixedUniforms
) (struct gl2_program_intf
**);
95 GLvoid (* UpdateFixedAttrib
) (struct gl2_program_intf
**, GLuint
, GLvoid
*, GLuint
, GLuint
,
97 GLvoid (* UpdateFixedVarying
) (struct gl2_program_intf
**, GLuint
, GLvoid
*, GLuint
, GLuint
,
99 GLvoid (* GetTextureImageUsage
) (struct gl2_program_intf
**, GLbitfield
*);
100 GLboolean (* IsShaderPresent
) (struct gl2_program_intf
**, GLenum
);
101 GLvoid (* GetActiveUniform
) (struct gl2_program_intf
**, GLuint index
, GLsizei maxLength
,
102 GLsizei
*length
, GLint
*size
, GLenum
*type
, GLchar
*name
);
103 GLuint (* GetActiveUniformMaxLength
) (struct gl2_program_intf
**);
104 GLuint (* GetActiveUniformCount
) (struct gl2_program_intf
**);
105 GLint (* GetUniformLocation
) (struct gl2_program_intf
**, const GLchar
*name
);
106 GLboolean (* WriteUniform
) (struct gl2_program_intf
**, GLint loc
, GLsizei count
,
107 const GLvoid
*data
, GLenum type
);
108 GLboolean (* ReadUniform
) (struct gl2_program_intf
**, GLint loc
, GLsizei count
,
109 GLvoid
*data
, GLenum type
);
110 GLvoid (* GetActiveAttrib
) (struct gl2_program_intf
**, GLuint index
, GLsizei maxLength
,
111 GLsizei
*length
, GLint
*size
, GLenum
*type
, GLchar
*name
);
112 GLuint (* GetActiveAttribMaxLength
) (struct gl2_program_intf
**);
113 GLuint (* GetActiveAttribCount
) (struct gl2_program_intf
**);
114 GLint (* GetAttribLocation
) (struct gl2_program_intf
**, const GLchar
*name
);
115 GLvoid (* OverrideAttribBinding
) (struct gl2_program_intf
**, GLuint
, const GLchar
*);
116 GLvoid (* WriteAttrib
) (struct gl2_program_intf
**, GLuint
, const GLfloat
*);
117 GLvoid (* UpdateVarying
) (struct gl2_program_intf
**, GLuint
, GLfloat
*, GLboolean
);
118 struct gl_linked_program
*Linked
;
121 struct gl2_fragment_shader_intf
123 struct gl2_shader_intf _shader
;
126 struct gl2_vertex_shader_intf
128 struct gl2_shader_intf _shader
;
131 struct gl2_3dlabs_shhandle_intf
133 struct gl2_unknown_intf _unknown
;
134 GLvoid
*(* GetShHandle
) (struct gl2_3dlabs_shhandle_intf
**);
137 struct gl2_debug_intf
139 struct gl2_generic_intf _generic
;
140 GLvoid (* ClearDebugLog
) (struct gl2_debug_intf
**, GLenum logType
, GLenum shaderType
);
141 GLvoid (* GetDebugLog
) (struct gl2_debug_intf
**, GLenum logType
, GLenum shaderType
,
142 GLsizei maxLength
, GLsizei
*length
, GLcharARB
*infoLog
);
143 GLsizei (* GetDebugLogLength
) (struct gl2_debug_intf
**, GLenum logType
, GLenum shaderType
);
147 extern void GLAPIENTRY
148 _mesa_DeleteObjectARB(GLhandleARB obj
);
150 extern GLhandleARB GLAPIENTRY
151 _mesa_GetHandleARB(GLenum pname
);
153 extern void GLAPIENTRY
154 _mesa_DetachObjectARB (GLhandleARB
, GLhandleARB
);
156 extern GLhandleARB GLAPIENTRY
157 _mesa_CreateShaderObjectARB (GLenum
);
159 extern void GLAPIENTRY
160 _mesa_ShaderSourceARB (GLhandleARB
, GLsizei
, const GLcharARB
* *, const GLint
*);
162 extern void GLAPIENTRY
163 _mesa_CompileShaderARB (GLhandleARB
);
165 extern GLhandleARB GLAPIENTRY
166 _mesa_CreateProgramObjectARB (void);
168 extern void GLAPIENTRY
169 _mesa_AttachObjectARB (GLhandleARB
, GLhandleARB
);
171 extern void GLAPIENTRY
172 _mesa_LinkProgramARB (GLhandleARB
);
174 extern void GLAPIENTRY
175 _mesa_UseProgramObjectARB (GLhandleARB
);
177 extern void GLAPIENTRY
178 _mesa_ValidateProgramARB (GLhandleARB
);
180 extern void GLAPIENTRY
181 _mesa_Uniform1fARB (GLint
, GLfloat
);
183 extern void GLAPIENTRY
184 _mesa_Uniform2fARB (GLint
, GLfloat
, GLfloat
);
186 extern void GLAPIENTRY
187 _mesa_Uniform3fARB (GLint
, GLfloat
, GLfloat
, GLfloat
);
189 extern void GLAPIENTRY
190 _mesa_Uniform4fARB (GLint
, GLfloat
, GLfloat
, GLfloat
, GLfloat
);
192 extern void GLAPIENTRY
193 _mesa_Uniform1iARB (GLint
, GLint
);
195 extern void GLAPIENTRY
196 _mesa_Uniform2iARB (GLint
, GLint
, GLint
);
198 extern void GLAPIENTRY
199 _mesa_Uniform3iARB (GLint
, GLint
, GLint
, GLint
);
201 extern void GLAPIENTRY
202 _mesa_Uniform4iARB (GLint
, GLint
, GLint
, GLint
, GLint
);
204 extern void GLAPIENTRY
205 _mesa_Uniform1fvARB (GLint
, GLsizei
, const GLfloat
*);
207 extern void GLAPIENTRY
208 _mesa_Uniform2fvARB (GLint
, GLsizei
, const GLfloat
*);
210 extern void GLAPIENTRY
211 _mesa_Uniform3fvARB (GLint
, GLsizei
, const GLfloat
*);
213 extern void GLAPIENTRY
214 _mesa_Uniform4fvARB (GLint
, GLsizei
, const GLfloat
*);
216 extern void GLAPIENTRY
217 _mesa_Uniform1ivARB (GLint
, GLsizei
, const GLint
*);
219 extern void GLAPIENTRY
220 _mesa_Uniform2ivARB (GLint
, GLsizei
, const GLint
*);
222 extern void GLAPIENTRY
223 _mesa_Uniform3ivARB (GLint
, GLsizei
, const GLint
*);
225 extern void GLAPIENTRY
226 _mesa_Uniform4ivARB (GLint
, GLsizei
, const GLint
*);
228 extern void GLAPIENTRY
229 _mesa_UniformMatrix2fvARB (GLint
, GLsizei
, GLboolean
, const GLfloat
*);
231 extern void GLAPIENTRY
232 _mesa_UniformMatrix3fvARB (GLint
, GLsizei
, GLboolean
, const GLfloat
*);
234 extern void GLAPIENTRY
235 _mesa_UniformMatrix4fvARB (GLint
, GLsizei
, GLboolean
, const GLfloat
*);
237 extern void GLAPIENTRY
238 _mesa_GetObjectParameterfvARB (GLhandleARB
, GLenum
, GLfloat
*);
240 extern void GLAPIENTRY
241 _mesa_GetObjectParameterivARB (GLhandleARB
, GLenum
, GLint
*);
243 extern void GLAPIENTRY
244 _mesa_GetInfoLogARB (GLhandleARB
, GLsizei
, GLsizei
*, GLcharARB
*);
246 extern void GLAPIENTRY
247 _mesa_GetAttachedObjectsARB (GLhandleARB
, GLsizei
, GLsizei
*, GLhandleARB
*);
249 extern GLint GLAPIENTRY
250 _mesa_GetUniformLocationARB (GLhandleARB
, const GLcharARB
*);
252 extern void GLAPIENTRY
253 _mesa_GetActiveUniformARB (GLhandleARB
, GLuint
, GLsizei
, GLsizei
*, GLint
*, GLenum
*, GLcharARB
*);
255 extern void GLAPIENTRY
256 _mesa_GetUniformfvARB (GLhandleARB
, GLint
, GLfloat
*);
258 extern void GLAPIENTRY
259 _mesa_GetUniformivARB (GLhandleARB
, GLint
, GLint
*);
261 extern void GLAPIENTRY
262 _mesa_GetShaderSourceARB (GLhandleARB
, GLsizei
, GLsizei
*, GLcharARB
*);
264 #if FEATURE_ARB_vertex_shader
266 extern void GLAPIENTRY
267 _mesa_BindAttribLocationARB (GLhandleARB
, GLuint
, const GLcharARB
*);
269 extern void GLAPIENTRY
270 _mesa_GetActiveAttribARB (GLhandleARB
, GLuint
, GLsizei
, GLsizei
*, GLint
*, GLenum
*, GLcharARB
*);
272 extern GLint GLAPIENTRY
273 _mesa_GetAttribLocationARB (GLhandleARB
, const GLcharARB
*);
275 #endif /* FEATURE_ARB_vertex_shader */
279 extern void GLAPIENTRY
280 _mesa_AttachShader(GLuint program
, GLuint shader
);
282 extern GLuint GLAPIENTRY
283 _mesa_CreateShader(GLenum
);
285 extern GLuint GLAPIENTRY
286 _mesa_CreateProgram(void);
288 extern void GLAPIENTRY
289 _mesa_DeleteProgram(GLuint program
);
291 extern void GLAPIENTRY
292 _mesa_DeleteShader(GLuint shader
);
294 extern void GLAPIENTRY
295 _mesa_DetachShader(GLuint program
, GLuint shader
);
297 extern void GLAPIENTRY
298 _mesa_GetAttachedShaders(GLuint program
, GLsizei maxCount
,
299 GLsizei
*count
, GLuint
*obj
);
301 extern void GLAPIENTRY
302 _mesa_GetProgramiv(GLuint program
, GLenum pname
, GLint
*params
);
304 extern void GLAPIENTRY
305 _mesa_GetProgramInfoLog(GLuint program
, GLsizei bufSize
,
306 GLsizei
*length
, GLchar
*infoLog
);
308 extern void GLAPIENTRY
309 _mesa_GetShaderiv(GLuint shader
, GLenum pname
, GLint
*params
);
311 extern void GLAPIENTRY
312 _mesa_GetShaderInfoLog(GLuint shader
, GLsizei bufSize
,
313 GLsizei
*length
, GLchar
*infoLog
);
315 extern GLboolean GLAPIENTRY
316 _mesa_IsProgram(GLuint program
);
318 extern GLboolean GLAPIENTRY
319 _mesa_IsShader(GLuint shader
);
324 extern void GLAPIENTRY
325 _mesa_UniformMatrix2x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
326 const GLfloat
*value
);
328 extern void GLAPIENTRY
329 _mesa_UniformMatrix3x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
330 const GLfloat
*value
);
332 extern void GLAPIENTRY
333 _mesa_UniformMatrix2x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
334 const GLfloat
*value
);
336 extern void GLAPIENTRY
337 _mesa_UniformMatrix4x2fv(GLint location
, GLsizei count
, GLboolean transpose
,
338 const GLfloat
*value
);
340 extern void GLAPIENTRY
341 _mesa_UniformMatrix3x4fv(GLint location
, GLsizei count
, GLboolean transpose
,
342 const GLfloat
*value
);
344 extern void GLAPIENTRY
345 _mesa_UniformMatrix4x3fv(GLint location
, GLsizei count
, GLboolean transpose
,
346 const GLfloat
*value
);
349 extern struct gl_linked_program
*
350 _mesa_new_linked_program(GLcontext
*ctx
, GLuint name
);
352 extern struct gl_linked_program
*
353 _mesa_lookup_linked_program(GLcontext
*ctx
, GLuint name
);
355 extern struct gl_program
*
356 _mesa_lookup_shader(GLcontext
*ctx
, GLuint name
);
359 #endif /* FEATURE_ARB_shader_objects */
362 _mesa_init_shaderobjects (GLcontext
*ctx
);
364 #endif /* SHADEROBJECTS_H */