Clean-up and re-org of the main GLSL object types.
[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 struct gl_shader_program *
42 _mesa_new_shader_program(GLcontext *ctx, GLuint name);
43
44 extern void
45 _mesa_free_shader_program_data(GLcontext *ctx,
46 struct gl_shader_program *shProg);
47
48 extern void
49 _mesa_delete_shader_program(GLcontext *ctx, struct gl_shader_program *shProg);
50
51 extern struct gl_shader_program *
52 _mesa_lookup_shader_program(GLcontext *ctx, GLuint name);
53
54
55 extern struct gl_shader *
56 _mesa_new_shader(GLcontext *ctx, GLuint name, GLenum type);
57
58 extern struct gl_shader *
59 _mesa_lookup_shader(GLcontext *ctx, GLuint name);
60
61
62 /**
63 * API/Driver functions
64 */
65
66 extern void
67 _mesa_attach_shader(GLcontext *ctx, GLuint program, GLuint shader);
68
69 extern void
70 _mesa_bind_attrib_location(GLcontext *ctx, GLuint program, GLuint index,
71 const GLchar *name);
72
73 extern void
74 _mesa_compile_shader(GLcontext *ctx, GLuint shaderObj);
75
76 extern GLuint
77 _mesa_create_shader(GLcontext *ctx, GLenum type);
78
79 extern GLuint
80 _mesa_create_program(GLcontext *ctx);
81
82 extern void
83 _mesa_delete_program2(GLcontext *ctx, GLuint name);
84
85 extern void
86 _mesa_delete_shader(GLcontext *ctx, GLuint shader);
87
88 extern void
89 _mesa_detach_shader(GLcontext *ctx, GLuint program, GLuint shader);
90
91 extern void
92 _mesa_get_active_attrib(GLcontext *ctx, GLuint program, GLuint index,
93 GLsizei maxLength, GLsizei *length, GLint *size,
94 GLenum *type, GLchar *name);
95
96 extern void
97 _mesa_get_active_uniform(GLcontext *ctx, GLuint program, GLuint index,
98 GLsizei maxLength, GLsizei *length, GLint *size,
99 GLenum *type, GLchar *name);
100
101 extern void
102 _mesa_get_attached_shaders(GLcontext *ctx, GLuint program, GLsizei maxCount,
103 GLsizei *count, GLuint *obj);
104
105 extern GLint
106 _mesa_get_attrib_location(GLcontext *ctx, GLuint program,
107 const GLchar *name);
108
109 extern GLuint
110 _mesa_get_handle(GLcontext *ctx, GLenum pname);
111
112 extern void
113 _mesa_get_programiv(GLcontext *ctx, GLuint program,
114 GLenum pname, GLint *params);
115
116 extern void
117 _mesa_get_program_info_log(GLcontext *ctx, GLuint program, GLsizei bufSize,
118 GLsizei *length, GLchar *infoLog);
119
120 extern void
121 _mesa_get_shaderiv(GLcontext *ctx, GLuint shader, GLenum pname, GLint *params);
122
123 extern void
124 _mesa_get_shader_info_log(GLcontext *ctx, GLuint shader, GLsizei bufSize,
125 GLsizei *length, GLchar *infoLog);
126
127 extern void
128 _mesa_get_shader_source(GLcontext *ctx, GLuint shader, GLsizei maxLength,
129 GLsizei *length, GLchar *sourceOut);
130
131 extern void
132 _mesa_get_uniformfv(GLcontext *ctx, GLuint program, GLint location,
133 GLfloat *params);
134
135 extern GLint
136 _mesa_get_uniform_location(GLcontext *ctx, GLuint program, const GLchar *name);
137
138 extern GLboolean
139 _mesa_is_program(GLcontext *ctx, GLuint name);
140
141 extern GLboolean
142 _mesa_is_shader(GLcontext *ctx, GLuint name);
143
144 extern void
145 _mesa_link_program(GLcontext *ctx, GLuint program);
146
147 extern void
148 _mesa_shader_source(GLcontext *ctx, GLuint shader, const GLchar *source);
149
150 extern void
151 _mesa_uniform(GLcontext *ctx, GLint location, GLsizei count,
152 const GLvoid *values, GLenum type);
153
154 void
155 _mesa_uniform_matrix(GLcontext *ctx, GLint cols, GLint rows,
156 GLenum matrixType, GLint location, GLsizei count,
157 GLboolean transpose, const GLfloat *values);
158
159 extern void
160 _mesa_use_program(GLcontext *ctx, GLuint program);
161
162 extern void
163 _mesa_validate_program(GLcontext *ctx, GLuint program);
164
165
166 #endif /* SHADER_API_H */