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_program(struct gl_context *ctx, struct gl_shader_program *shProg); 55 56 extern void 57 _mesa_active_program(struct gl_context *ctx, struct gl_shader_program *shProg, 58 const char *caller); 59 60 extern void 61 _mesa_compile_shader(struct gl_context *ctx, struct gl_shader *sh); 62 63 extern void 64 _mesa_link_program(struct gl_context *ctx, struct gl_shader_program *sh_prog); 65 66 extern unsigned 67 _mesa_count_active_attribs(struct gl_shader_program *shProg); 68 69 extern size_t 70 _mesa_longest_attribute_name_length(struct gl_shader_program *shProg); 71 72 extern void 73 _mesa_shader_write_subroutine_indices(struct gl_context *ctx, 74 gl_shader_stage stage); 75 extern void GLAPIENTRY 76 _mesa_AttachObjectARB(GLhandleARB, GLhandleARB); 77 78 extern void GLAPIENTRY 79 _mesa_CompileShader(GLuint); 80 81 extern GLhandleARB GLAPIENTRY 82 _mesa_CreateProgramObjectARB(void); 83 84 extern GLhandleARB GLAPIENTRY 85 _mesa_CreateShaderObjectARB(GLenum type); 86 87 extern void GLAPIENTRY 88 _mesa_DeleteObjectARB(GLhandleARB obj); 89 90 extern void GLAPIENTRY 91 _mesa_DetachObjectARB(GLhandleARB, GLhandleARB); 92 93 extern void GLAPIENTRY 94 _mesa_GetAttachedObjectsARB(GLhandleARB, GLsizei, GLsizei *, GLhandleARB *); 95 96 extern GLint GLAPIENTRY 97 _mesa_GetFragDataLocation(GLuint program, const GLchar *name); 98 99 extern GLint GLAPIENTRY 100 _mesa_GetFragDataIndex(GLuint program, const GLchar *name); 101 102 extern GLhandleARB GLAPIENTRY 103 _mesa_GetHandleARB(GLenum pname); 104 105 extern void GLAPIENTRY 106 _mesa_GetInfoLogARB(GLhandleARB, GLsizei, GLsizei *, GLcharARB *); 107 108 extern void GLAPIENTRY 109 _mesa_GetObjectParameterfvARB(GLhandleARB, GLenum, GLfloat *); 110 111 extern void GLAPIENTRY 112 _mesa_GetObjectParameterivARB(GLhandleARB, GLenum, GLint *); 113 114 extern void GLAPIENTRY 115 _mesa_GetShaderSource(GLuint, GLsizei, GLsizei *, GLchar *); 116 117 extern GLboolean GLAPIENTRY 118 _mesa_IsProgram(GLuint name); 119 120 extern GLboolean GLAPIENTRY 121 _mesa_IsShader(GLuint name); 122 123 extern void GLAPIENTRY 124 _mesa_LinkProgram(GLuint programObj); 125 126 extern void GLAPIENTRY 127 _mesa_ShaderSource(GLuint, GLsizei, const GLchar* const *, const GLint *); 128 129 extern void GLAPIENTRY 130 _mesa_UseProgram(GLuint); 131 132 extern void GLAPIENTRY 133 _mesa_ValidateProgram(GLuint); 134 135 136 extern void GLAPIENTRY 137 _mesa_BindAttribLocation(GLuint program, GLuint, const GLchar *); 138 139 extern void GLAPIENTRY 140 _mesa_BindFragDataLocation(GLuint program, GLuint colorNumber, 141 const GLchar *name); 142 143 extern void GLAPIENTRY 144 _mesa_BindFragDataLocationIndexed(GLuint program, GLuint colorNumber, 145 GLuint index, const GLchar *name); 146 147 extern void GLAPIENTRY 148 _mesa_GetActiveAttrib(GLuint, GLuint, GLsizei, GLsizei *, GLint *, 149 GLenum *, GLchar *); 150 151 extern GLint GLAPIENTRY 152 _mesa_GetAttribLocation(GLuint, const GLchar *); 153 154 155 156 extern void GLAPIENTRY 157 _mesa_AttachShader(GLuint program, GLuint shader); 158 159 extern GLuint GLAPIENTRY 160 _mesa_CreateShader(GLenum); 161 162 extern GLuint GLAPIENTRY 163 _mesa_CreateProgram(void); 164 165 extern void GLAPIENTRY 166 _mesa_DeleteProgram(GLuint program); 167 168 extern void GLAPIENTRY 169 _mesa_DeleteShader(GLuint shader); 170 171 extern void GLAPIENTRY 172 _mesa_DetachShader(GLuint program, GLuint shader); 173 174 extern void GLAPIENTRY 175 _mesa_GetAttachedShaders(GLuint program, GLsizei maxCount, 176 GLsizei *count, GLuint *obj); 177 178 extern void GLAPIENTRY 179 _mesa_GetProgramiv(GLuint program, GLenum pname, GLint *params); 180 181 extern void GLAPIENTRY 182 _mesa_GetProgramInfoLog(GLuint program, GLsizei bufSize, 183 GLsizei *length, GLchar *infoLog); 184 185 extern void GLAPIENTRY 186 _mesa_GetShaderiv(GLuint shader, GLenum pname, GLint *params); 187 188 extern void GLAPIENTRY 189 _mesa_GetShaderInfoLog(GLuint shader, GLsizei bufSize, 190 GLsizei *length, GLchar *infoLog); 191 192 193 extern void GLAPIENTRY 194 _mesa_GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, 195 GLint *range, GLint *precision); 196 197 extern void GLAPIENTRY 198 _mesa_ReleaseShaderCompiler(void); 199 200 extern void GLAPIENTRY 201 _mesa_ShaderBinary(GLint n, const GLuint *shaders, GLenum binaryformat, 202 const void* binary, GLint length); 203 204 extern void GLAPIENTRY 205 _mesa_GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei *length, 206 GLenum *binaryFormat, GLvoid *binary); 207 208 extern void GLAPIENTRY 209 _mesa_ProgramBinary(GLuint program, GLenum binaryFormat, 210 const GLvoid *binary, GLsizei length); 211 212 extern void GLAPIENTRY 213 _mesa_ProgramParameteri(GLuint program, GLenum pname, GLint value); 214 215 void 216 _mesa_use_shader_program(struct gl_context *ctx, GLenum type, 217 struct gl_shader_program *shProg, 218 struct gl_pipeline_object *shTarget); 219 220 extern void 221 _mesa_copy_linked_program_data(const struct gl_shader_program *src, 222 struct gl_linked_shader *dst_sh); 223 224 extern bool 225 _mesa_validate_shader_target(const struct gl_context *ctx, GLenum type); 226 227 228 /* GL_ARB_separate_shader_objects */ 229 extern GLuint GLAPIENTRY 230 _mesa_CreateShaderProgramv(GLenum type, GLsizei count, 231 const GLchar* const *strings); 232 233 /* GL_ARB_program_resource_query */ 234 extern const char* 235 _mesa_program_resource_name(struct gl_program_resource *res); 236 237 extern unsigned 238 _mesa_program_resource_array_size(struct gl_program_resource *res); 239 240 extern GLuint 241 _mesa_program_resource_index(struct gl_shader_program *shProg, 242 struct gl_program_resource *res); 243 244 extern struct gl_program_resource * 245 _mesa_program_resource_find_name(struct gl_shader_program *shProg, 246 GLenum programInterface, const char *name, 247 unsigned *array_index); 248 249 extern struct gl_program_resource * 250 _mesa_program_resource_find_index(struct gl_shader_program *shProg, 251 GLenum programInterface, GLuint index); 252 253 extern bool 254 _mesa_get_program_resource_name(struct gl_shader_program *shProg, 255 GLenum programInterface, GLuint index, 256 GLsizei bufSize, GLsizei *length, 257 GLchar *name, const char *caller); 258 259 extern unsigned 260 _mesa_program_resource_name_len(struct gl_program_resource *res); 261 262 extern GLint 263 _mesa_program_resource_location(struct gl_shader_program *shProg, 264 GLenum programInterface, const char *name); 265 266 extern GLint 267 _mesa_program_resource_location_index(struct gl_shader_program *shProg, 268 GLenum programInterface, const char *name); 269 270 extern unsigned 271 _mesa_program_resource_prop(struct gl_shader_program *shProg, 272 struct gl_program_resource *res, GLuint index, 273 const GLenum prop, GLint *val, const char *caller); 274 275 extern void 276 _mesa_get_program_resourceiv(struct gl_shader_program *shProg, 277 GLenum programInterface, GLuint index, 278 GLsizei propCount, const GLenum *props, 279 GLsizei bufSize, GLsizei *length, 280 GLint *params); 281 282 /* GL_ARB_tessellation_shader */ 283 extern void GLAPIENTRY 284 _mesa_PatchParameteri(GLenum pname, GLint value); 285 286 extern void GLAPIENTRY 287 _mesa_PatchParameterfv(GLenum pname, const GLfloat *values); 288 289 /* GL_ARB_shader_subroutine */ 290 void 291 _mesa_shader_program_init_subroutine_defaults(struct gl_context *ctx, 292 struct gl_shader_program *shProg); 293 294 extern GLint GLAPIENTRY 295 _mesa_GetSubroutineUniformLocation(GLuint program, GLenum shadertype, 296 const GLchar *name); 297 298 extern GLuint GLAPIENTRY 299 _mesa_GetSubroutineIndex(GLuint program, GLenum shadertype, 300 const GLchar *name); 301 302 extern GLvoid GLAPIENTRY 303 _mesa_GetActiveSubroutineUniformiv(GLuint program, GLenum shadertype, 304 GLuint index, GLenum pname, GLint *values); 305 306 extern GLvoid GLAPIENTRY 307 _mesa_GetActiveSubroutineUniformName(GLuint program, GLenum shadertype, 308 GLuint index, GLsizei bufsize, 309 GLsizei *length, GLchar *name); 310 311 extern GLvoid GLAPIENTRY 312 _mesa_GetActiveSubroutineName(GLuint program, GLenum shadertype, 313 GLuint index, GLsizei bufsize, 314 GLsizei *length, GLchar *name); 315 316 extern GLvoid GLAPIENTRY 317 _mesa_UniformSubroutinesuiv(GLenum shadertype, GLsizei count, 318 const GLuint *indices); 319 320 extern GLvoid GLAPIENTRY 321 _mesa_GetUniformSubroutineuiv(GLenum shadertype, GLint location, 322 GLuint *params); 323 324 extern GLvoid GLAPIENTRY 325 _mesa_GetProgramStageiv(GLuint program, GLenum shadertype, 326 GLenum pname, GLint *values); 327 328 #ifdef __cplusplus 329 } 330 #endif 331 332 #endif /* SHADERAPI_H */ 333