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