27e5870d70566d155dbcfdad4777d6aa1b9e6683
[mesa.git] / src / mesa / shader / shader_api.h
1 /*
2 * Mesa 3-D graphics library
3 * Version: 6.5
4 *
5 * Copyright (C) 2004-2006 Brian Paul 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 * 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.
23 */
24
25
26 #ifndef SHADER_API_H
27 #define SHADER_API_H
28
29
30 #include "glheader.h"
31 #include "mtypes.h"
32
33
34 /**
35 * Internal functions
36 */
37
38 extern void
39 _mesa_init_shader_state(GLcontext * ctx);
40
41 extern void
42 _mesa_free_shader_state(GLcontext *ctx);
43
44 extern struct gl_shader_program *
45 _mesa_new_shader_program(GLcontext *ctx, GLuint name);
46
47 extern void
48 _mesa_clear_shader_program_data(GLcontext *ctx,
49 struct gl_shader_program *shProg);
50
51 extern void
52 _mesa_free_shader_program_data(GLcontext *ctx,
53 struct gl_shader_program *shProg);
54
55 extern void
56 _mesa_free_shader_program(GLcontext *ctx, struct gl_shader_program *shProg);
57
58 extern void
59 _mesa_reference_shader_program(GLcontext *ctx,
60 struct gl_shader_program **ptr,
61 struct gl_shader_program *shProg);
62
63 extern struct gl_shader_program *
64 _mesa_lookup_shader_program(GLcontext *ctx, GLuint name);
65
66
67 extern struct gl_shader *
68 _mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type);
69
70 extern void
71 _mesa_free_shader(GLcontext *ctx, struct gl_shader *sh);
72
73 extern void
74 _mesa_reference_shader(GLcontext *ctx, struct gl_shader **ptr,
75 struct gl_shader *sh);
76
77 extern struct gl_shader *
78 _mesa_lookup_shader(GLcontext *ctx, GLuint name);
79
80
81 /**
82 * API/Driver functions
83 */
84
85 extern void
86 _mesa_attach_shader(GLcontext *ctx, GLuint program, GLuint shader);
87
88 extern void
89 _mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index,
90 const GLchar *name);
91
92 extern void
93 _mesa_compile_shader(GLcontext *ctx, GLuint shaderObj);
94
95 extern GLuint
96 _mesa_create_shader(GLcontext *ctx, GLenum type);
97
98 extern GLuint
99 _mesa_create_program(GLcontext *ctx);
100
101 extern void
102 _mesa_delete_program2(GLcontext *ctx, GLuint name);
103
104 extern void
105 _mesa_delete_shader(GLcontext *ctx, GLuint shader);
106
107 extern void
108 _mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader);
109
110 extern void
111 _mesa_get_active_attrib(GLcontext *ctx, GLuint program, GLuint index,
112 GLsizei maxLength, GLsizei *length, GLint *size,
113 GLenum *type, GLchar *name);
114
115 extern void
116 _mesa_get_active_uniform(GLcontext *ctx, GLuint program, GLuint index,
117 GLsizei maxLength, GLsizei *length, GLint *size,
118 GLenum *type, GLchar *name);
119
120 extern void
121 _mesa_get_attached_shaders(GLcontext *ctx, GLuint program, GLsizei maxCount,
122 GLsizei *count, GLuint *obj);
123
124 extern GLint
125 _mesa_get_attrib_location(GLcontext *ctx, GLuint program,
126 const GLchar *name);
127
128 extern GLuint
129 _mesa_get_handle(GLcontext *ctx, GLenum pname);
130
131 extern void
132 _mesa_get_programiv(GLcontext *ctx, GLuint program,
133 GLenum pname, GLint *params);
134
135 extern void
136 _mesa_get_program_info_log(GLcontext *ctx, GLuint program, GLsizei bufSize,
137 GLsizei *length, GLchar *infoLog);
138
139 extern void
140 _mesa_get_shaderiv(GLcontext *ctx, GLuint shader, GLenum pname, GLint *params);
141
142 extern void
143 _mesa_get_shader_info_log(GLcontext *ctx, GLuint shader, GLsizei bufSize,
144 GLsizei *length, GLchar *infoLog);
145
146 extern void
147 _mesa_get_shader_source(GLcontext *ctx, GLuint shader, GLsizei maxLength,
148 GLsizei *length, GLchar *sourceOut);
149
150 extern void
151 _mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location,
152 GLfloat *params);
153
154 extern GLint
155 _mesa_get_uniform_location(GLcontext *ctx, GLuint program, const GLchar *name);
156
157 extern GLboolean
158 _mesa_is_program(GLcontext *ctx, GLuint name);
159
160 extern GLboolean
161 _mesa_is_shader(GLcontext *ctx, GLuint name);
162
163 extern void
164 _mesa_link_program(GLcontext *ctx, GLuint program);
165
166 extern void
167 _mesa_shader_source(GLcontext *ctx, GLuint shader, const GLchar *source);
168
169 extern void
170 _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count,
171 const GLvoid *values, GLenum type);
172
173 void
174 _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows,
175 GLenum matrixType, GLint location, GLsizei count,
176 GLboolean transpose, const GLfloat *values);
177
178 extern void
179 _mesa_use_program(GLcontext *ctx, GLuint program);
180
181 extern void
182 _mesa_validate_program(GLcontext *ctx, GLuint program);
183
184
185 #endif /* SHADER_API_H */