1 /*
2  * Mesa 3-D graphics library
3  *
4  * Copyright (C) 2004-2007  Brian Paul   All Rights Reserved.
5  * Copyright (C) 2010  VMware, Inc.  All Rights Reserved.
6  *
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:
13  *
14  * The above copyright notice and this permission notice shall be included
15  * in all copies or substantial portions of the Software.
16  *
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  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
21  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
22  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23  * OTHER DEALINGS IN THE SOFTWARE.
24  */
25 
26 
27 #ifndef SHADERAPI_H
28 #define SHADERAPI_H
29 
30 
31 #include "glheader.h"
32 
33 
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
37 
38 
39 struct _glapi_table;
40 struct gl_context;
41 struct gl_shader_program;
42 
43 extern GLbitfield
44 _mesa_get_shader_flags(void);
45 
46 extern const char *
47 _mesa_get_shader_capture_path(void);
48 
49 extern void
50 _mesa_copy_string(GLchar *dst, GLsizei maxLength,
51                   GLsizei *length, const GLchar *src);
52 
53 extern void
54 _mesa_use_shader_program(struct gl_context *ctx,
55                          struct gl_shader_program *shProg);
56 
57 extern void
58 _mesa_active_program(struct gl_context *ctx, struct gl_shader_program *shProg,
59 		     const char *caller);
60 
61 extern void
62 _mesa_compile_shader(struct gl_context *ctx, struct gl_shader *sh);
63 
64 extern void
65 _mesa_link_program(struct gl_context *ctx, struct gl_shader_program *sh_prog);
66 
67 extern unsigned
68 _mesa_count_active_attribs(struct gl_shader_program *shProg);
69 
70 extern size_t
71 _mesa_longest_attribute_name_length(struct gl_shader_program *shProg);
72 
73 extern void
74 _mesa_shader_write_subroutine_indices(struct gl_context *ctx,
75                                       gl_shader_stage stage);
76 
77 void GLAPIENTRY
78 _mesa_AttachObjectARB_no_error(GLhandleARB, GLhandleARB);
79 
80 extern void GLAPIENTRY
81 _mesa_AttachObjectARB(GLhandleARB, GLhandleARB);
82 
83 extern void  GLAPIENTRY
84 _mesa_CompileShader(GLuint);
85 
86 extern GLhandleARB GLAPIENTRY
87 _mesa_CreateProgramObjectARB(void);
88 
89 GLhandleARB GLAPIENTRY
90 _mesa_CreateShaderObjectARB_no_error(GLenum type);
91 
92 extern GLhandleARB GLAPIENTRY
93 _mesa_CreateShaderObjectARB(GLenum type);
94 
95 extern void GLAPIENTRY
96 _mesa_DeleteObjectARB(GLhandleARB obj);
97 
98 void GLAPIENTRY
99 _mesa_DetachObjectARB_no_error(GLhandleARB, GLhandleARB);
100 
101 extern void GLAPIENTRY
102 _mesa_DetachObjectARB(GLhandleARB, GLhandleARB);
103 
104 extern void GLAPIENTRY
105 _mesa_GetAttachedObjectsARB(GLhandleARB, GLsizei, GLsizei *, GLhandleARB *);
106 
107 extern GLint GLAPIENTRY
108 _mesa_GetFragDataLocation(GLuint program, const GLchar *name);
109 
110 extern GLint GLAPIENTRY
111 _mesa_GetFragDataIndex(GLuint program, const GLchar *name);
112 
113 extern GLhandleARB GLAPIENTRY
114 _mesa_GetHandleARB(GLenum pname);
115 
116 extern void GLAPIENTRY
117 _mesa_GetInfoLogARB(GLhandleARB, GLsizei, GLsizei *, GLcharARB *);
118 
119 extern void GLAPIENTRY
120 _mesa_GetObjectParameterfvARB(GLhandleARB, GLenum, GLfloat *);
121 
122 extern void GLAPIENTRY
123 _mesa_GetObjectParameterivARB(GLhandleARB, GLenum, GLint *);
124 
125 extern void GLAPIENTRY
126 _mesa_GetShaderSource(GLuint, GLsizei, GLsizei *, GLchar *);
127 
128 extern GLboolean GLAPIENTRY
129 _mesa_IsProgram(GLuint name);
130 
131 extern GLboolean GLAPIENTRY
132 _mesa_IsShader(GLuint name);
133 
134 void GLAPIENTRY
135 _mesa_LinkProgram_no_error(GLuint programObj);
136 
137 extern void GLAPIENTRY
138 _mesa_LinkProgram(GLuint programObj);
139 
140 void GLAPIENTRY
141 _mesa_ShaderSource_no_error(GLuint, GLsizei, const GLchar* const *,
142                             const GLint *);
143 
144 extern void GLAPIENTRY
145 _mesa_ShaderSource(GLuint, GLsizei, const GLchar* const *, const GLint *);
146 
147 void GLAPIENTRY
148 _mesa_UseProgram_no_error(GLuint);
149 extern void GLAPIENTRY
150 _mesa_UseProgram(GLuint);
151 
152 extern void GLAPIENTRY
153 _mesa_ValidateProgram(GLuint);
154 
155 
156 void GLAPIENTRY
157 _mesa_BindAttribLocation_no_error(GLuint program, GLuint, const GLchar *);
158 
159 extern void GLAPIENTRY
160 _mesa_BindAttribLocation(GLuint program, GLuint, const GLchar *);
161 
162 extern void GLAPIENTRY
163 _mesa_BindFragDataLocation(GLuint program, GLuint colorNumber,
164                            const GLchar *name);
165 
166 extern void GLAPIENTRY
167 _mesa_BindFragDataLocationIndexed(GLuint program, GLuint colorNumber,
168                                   GLuint index, const GLchar *name);
169 
170 extern void GLAPIENTRY
171 _mesa_BindFragDataLocation_no_error(GLuint program, GLuint colorNumber,
172                                     const GLchar *name);
173 
174 extern void GLAPIENTRY
175 _mesa_BindFragDataLocationIndexed_no_error(GLuint program, GLuint colorNumber,
176                                            GLuint index, const GLchar *name);
177 
178 extern void GLAPIENTRY
179 _mesa_GetActiveAttrib(GLuint, GLuint, GLsizei, GLsizei *, GLint *,
180                          GLenum *, GLchar *);
181 
182 extern GLint GLAPIENTRY
183 _mesa_GetAttribLocation(GLuint, const GLchar *);
184 
185 void GLAPIENTRY
186 _mesa_AttachShader_no_error(GLuint program, GLuint shader);
187 
188 extern void GLAPIENTRY
189 _mesa_AttachShader(GLuint program, GLuint shader);
190 
191 GLuint GLAPIENTRY
192 _mesa_CreateShader_no_error(GLenum);
193 
194 extern GLuint GLAPIENTRY
195 _mesa_CreateShader(GLenum);
196 
197 extern GLuint GLAPIENTRY
198 _mesa_CreateProgram(void);
199 
200 extern void GLAPIENTRY
201 _mesa_DeleteProgram(GLuint program);
202 
203 extern void GLAPIENTRY
204 _mesa_DeleteShader(GLuint shader);
205 
206 void GLAPIENTRY
207 _mesa_DetachShader_no_error(GLuint program, GLuint shader);
208 
209 extern void GLAPIENTRY
210 _mesa_DetachShader(GLuint program, GLuint shader);
211 
212 extern void GLAPIENTRY
213 _mesa_GetAttachedShaders(GLuint program, GLsizei maxCount,
214                          GLsizei *count, GLuint *obj);
215 
216 extern void GLAPIENTRY
217 _mesa_GetProgramiv(GLuint program, GLenum pname, GLint *params);
218 
219 extern void GLAPIENTRY
220 _mesa_GetProgramInfoLog(GLuint program, GLsizei bufSize,
221                         GLsizei *length, GLchar *infoLog);
222 
223 extern void GLAPIENTRY
224 _mesa_GetShaderiv(GLuint shader, GLenum pname, GLint *params);
225 
226 extern void GLAPIENTRY
227 _mesa_GetShaderInfoLog(GLuint shader, GLsizei bufSize,
228                        GLsizei *length, GLchar *infoLog);
229 
230 
231 extern void GLAPIENTRY
232 _mesa_GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype,
233                                GLint *range, GLint *precision);
234 
235 extern void GLAPIENTRY
236 _mesa_ReleaseShaderCompiler(void);
237 
238 extern void GLAPIENTRY
239 _mesa_ShaderBinary(GLint n, const GLuint *shaders, GLenum binaryformat,
240                    const void* binary, GLint length);
241 
242 extern void GLAPIENTRY
243 _mesa_GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length,
244                        GLenum *binaryFormat, GLvoid *binary);
245 
246 extern void GLAPIENTRY
247 _mesa_ProgramBinary(GLuint program, GLenum binaryFormat,
248                     const GLvoid *binary, GLsizei length);
249 
250 void GLAPIENTRY
251 _mesa_ProgramParameteri_no_error(GLuint program, GLenum pname, GLint value);
252 
253 extern void GLAPIENTRY
254 _mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value);
255 
256 void
257 _mesa_use_program(struct gl_context *ctx, gl_shader_stage stage,
258                   struct gl_shader_program *shProg, struct gl_program *prog,
259                   struct gl_pipeline_object *shTarget);
260 
261 extern void
262 _mesa_copy_linked_program_data(const struct gl_shader_program *src,
263                                struct gl_linked_shader *dst_sh);
264 
265 extern bool
266 _mesa_validate_shader_target(const struct gl_context *ctx, GLenum type);
267 
268 
269 /* GL_ARB_separate_shader_objects */
270 extern GLuint GLAPIENTRY
271 _mesa_CreateShaderProgramv(GLenum type, GLsizei count,
272                            const GLchar* const *strings);
273 
274 /* GL_ARB_program_resource_query */
275 extern const char*
276 _mesa_program_resource_name(struct gl_program_resource *res);
277 
278 extern unsigned
279 _mesa_program_resource_array_size(struct gl_program_resource *res);
280 
281 extern GLuint
282 _mesa_program_resource_index(struct gl_shader_program *shProg,
283                              struct gl_program_resource *res);
284 
285 extern struct gl_program_resource *
286 _mesa_program_resource_find_name(struct gl_shader_program *shProg,
287                                  GLenum programInterface, const char *name,
288                                  unsigned *array_index);
289 
290 extern struct gl_program_resource *
291 _mesa_program_resource_find_index(struct gl_shader_program *shProg,
292                                   GLenum programInterface, GLuint index);
293 
294 extern bool
295 _mesa_get_program_resource_name(struct gl_shader_program *shProg,
296                                 GLenum programInterface, GLuint index,
297                                 GLsizei bufSize, GLsizei *length,
298                                 GLchar *name, const char *caller);
299 
300 extern unsigned
301 _mesa_program_resource_name_len(struct gl_program_resource *res);
302 
303 extern GLint
304 _mesa_program_resource_location(struct gl_shader_program *shProg,
305                                 GLenum programInterface, const char *name);
306 
307 extern GLint
308 _mesa_program_resource_location_index(struct gl_shader_program *shProg,
309                                       GLenum programInterface, const char *name);
310 
311 extern unsigned
312 _mesa_program_resource_prop(struct gl_shader_program *shProg,
313                             struct gl_program_resource *res, GLuint index,
314                             const GLenum prop, GLint *val, const char *caller);
315 
316 extern void
317 _mesa_get_program_resourceiv(struct gl_shader_program *shProg,
318                              GLenum programInterface, GLuint index,
319                              GLsizei propCount, const GLenum *props,
320                              GLsizei bufSize, GLsizei *length,
321                              GLint *params);
322 
323 /* GL_ARB_tessellation_shader */
324 void GLAPIENTRY
325 _mesa_PatchParameteri_no_error(GLenum pname, GLint value);
326 
327 extern void GLAPIENTRY
328 _mesa_PatchParameteri(GLenum pname, GLint value);
329 
330 extern void GLAPIENTRY
331 _mesa_PatchParameterfv(GLenum pname, const GLfloat *values);
332 
333 /* GL_ARB_shader_subroutine */
334 void
335 _mesa_program_init_subroutine_defaults(struct gl_context *ctx,
336                                        struct gl_program *prog);
337 
338 extern GLint GLAPIENTRY
339 _mesa_GetSubroutineUniformLocation(GLuint program, GLenum shadertype,
340                                    const GLchar *name);
341 
342 extern GLuint GLAPIENTRY
343 _mesa_GetSubroutineIndex(GLuint program, GLenum shadertype,
344                          const GLchar *name);
345 
346 extern GLvoid GLAPIENTRY
347 _mesa_GetActiveSubroutineUniformiv(GLuint program, GLenum shadertype,
348                                    GLuint index, GLenum pname, GLint *values);
349 
350 extern GLvoid GLAPIENTRY
351 _mesa_GetActiveSubroutineUniformName(GLuint program, GLenum shadertype,
352                                      GLuint index, GLsizei bufsize,
353                                      GLsizei *length, GLchar *name);
354 
355 extern GLvoid GLAPIENTRY
356 _mesa_GetActiveSubroutineName(GLuint program, GLenum shadertype,
357                               GLuint index, GLsizei bufsize,
358                               GLsizei *length, GLchar *name);
359 
360 extern GLvoid GLAPIENTRY
361 _mesa_UniformSubroutinesuiv(GLenum shadertype, GLsizei count,
362                             const GLuint *indices);
363 
364 extern GLvoid GLAPIENTRY
365 _mesa_GetUniformSubroutineuiv(GLenum shadertype, GLint location,
366                               GLuint *params);
367 
368 extern GLvoid GLAPIENTRY
369 _mesa_GetProgramStageiv(GLuint program, GLenum shadertype,
370                         GLenum pname, GLint *values);
371 
372 #ifdef __cplusplus
373 }
374 #endif
375 
376 #endif /* SHADERAPI_H */
377