1bf215546Sopenharmony_ci/* 2bf215546Sopenharmony_ci * Mesa 3-D graphics library 3bf215546Sopenharmony_ci * 4bf215546Sopenharmony_ci * Copyright (C) 2004-2007 Brian Paul All Rights Reserved. 5bf215546Sopenharmony_ci * Copyright (C) 2010 VMware, Inc. All Rights Reserved. 6bf215546Sopenharmony_ci * 7bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a 8bf215546Sopenharmony_ci * copy of this software and associated documentation files (the "Software"), 9bf215546Sopenharmony_ci * to deal in the Software without restriction, including without limitation 10bf215546Sopenharmony_ci * the rights to use, copy, modify, merge, publish, distribute, sublicense, 11bf215546Sopenharmony_ci * and/or sell copies of the Software, and to permit persons to whom the 12bf215546Sopenharmony_ci * Software is furnished to do so, subject to the following conditions: 13bf215546Sopenharmony_ci * 14bf215546Sopenharmony_ci * The above copyright notice and this permission notice shall be included 15bf215546Sopenharmony_ci * in all copies or substantial portions of the Software. 16bf215546Sopenharmony_ci * 17bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 18bf215546Sopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 19bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 20bf215546Sopenharmony_ci * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 21bf215546Sopenharmony_ci * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 22bf215546Sopenharmony_ci * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23bf215546Sopenharmony_ci * OTHER DEALINGS IN THE SOFTWARE. 24bf215546Sopenharmony_ci */ 25bf215546Sopenharmony_ci 26bf215546Sopenharmony_ci 27bf215546Sopenharmony_ci#ifndef SHADERAPI_H 28bf215546Sopenharmony_ci#define SHADERAPI_H 29bf215546Sopenharmony_ci 30bf215546Sopenharmony_ci 31bf215546Sopenharmony_ci#include "glheader.h" 32bf215546Sopenharmony_ci#include "compiler/shader_enums.h" 33bf215546Sopenharmony_ci#include "util/mesa-sha1.h" 34bf215546Sopenharmony_ci 35bf215546Sopenharmony_ci#ifdef __cplusplus 36bf215546Sopenharmony_ciextern "C" { 37bf215546Sopenharmony_ci#endif 38bf215546Sopenharmony_ci 39bf215546Sopenharmony_cistruct hash_entry; 40bf215546Sopenharmony_cistruct _glapi_table; 41bf215546Sopenharmony_cistruct gl_context; 42bf215546Sopenharmony_cistruct gl_linked_shader; 43bf215546Sopenharmony_cistruct gl_pipeline_object; 44bf215546Sopenharmony_cistruct gl_program; 45bf215546Sopenharmony_cistruct gl_program_resource; 46bf215546Sopenharmony_cistruct gl_shader; 47bf215546Sopenharmony_cistruct gl_shader_program; 48bf215546Sopenharmony_cistruct gl_resource_name; 49bf215546Sopenharmony_cistruct gl_shared_state; 50bf215546Sopenharmony_cistruct gl_uniform_block; 51bf215546Sopenharmony_ci 52bf215546Sopenharmony_ciextern GLbitfield 53bf215546Sopenharmony_ci_mesa_get_shader_flags(void); 54bf215546Sopenharmony_ci 55bf215546Sopenharmony_ciextern const char * 56bf215546Sopenharmony_ci_mesa_get_shader_capture_path(void); 57bf215546Sopenharmony_ci 58bf215546Sopenharmony_ciextern void 59bf215546Sopenharmony_ci_mesa_copy_string(GLchar *dst, GLsizei maxLength, 60bf215546Sopenharmony_ci GLsizei *length, const GLchar *src); 61bf215546Sopenharmony_ci 62bf215546Sopenharmony_ciextern void 63bf215546Sopenharmony_ci_mesa_use_shader_program(struct gl_context *ctx, 64bf215546Sopenharmony_ci struct gl_shader_program *shProg); 65bf215546Sopenharmony_ci 66bf215546Sopenharmony_ciextern void 67bf215546Sopenharmony_ci_mesa_active_program(struct gl_context *ctx, struct gl_shader_program *shProg, 68bf215546Sopenharmony_ci const char *caller); 69bf215546Sopenharmony_ci 70bf215546Sopenharmony_ciextern void 71bf215546Sopenharmony_ci_mesa_compile_shader(struct gl_context *ctx, struct gl_shader *sh); 72bf215546Sopenharmony_ci 73bf215546Sopenharmony_ciextern void 74bf215546Sopenharmony_ci_mesa_link_program(struct gl_context *ctx, struct gl_shader_program *sh_prog); 75bf215546Sopenharmony_ci 76bf215546Sopenharmony_ciextern unsigned 77bf215546Sopenharmony_ci_mesa_count_active_attribs(struct gl_shader_program *shProg); 78bf215546Sopenharmony_ci 79bf215546Sopenharmony_ciextern size_t 80bf215546Sopenharmony_ci_mesa_longest_attribute_name_length(struct gl_shader_program *shProg); 81bf215546Sopenharmony_ci 82bf215546Sopenharmony_ciextern void 83bf215546Sopenharmony_ci_mesa_shader_write_subroutine_indices(struct gl_context *ctx, 84bf215546Sopenharmony_ci gl_shader_stage stage); 85bf215546Sopenharmony_ci 86bf215546Sopenharmony_civoid 87bf215546Sopenharmony_ci_mesa_use_program(struct gl_context *ctx, gl_shader_stage stage, 88bf215546Sopenharmony_ci struct gl_shader_program *shProg, struct gl_program *prog, 89bf215546Sopenharmony_ci struct gl_pipeline_object *shTarget); 90bf215546Sopenharmony_ci 91bf215546Sopenharmony_ciextern void 92bf215546Sopenharmony_ci_mesa_copy_linked_program_data(const struct gl_shader_program *src, 93bf215546Sopenharmony_ci struct gl_linked_shader *dst_sh); 94bf215546Sopenharmony_ci 95bf215546Sopenharmony_ciextern bool 96bf215546Sopenharmony_ci_mesa_validate_shader_target(const struct gl_context *ctx, GLenum type); 97bf215546Sopenharmony_ci 98bf215546Sopenharmony_ci 99bf215546Sopenharmony_ci/* GL_ARB_program_resource_query */ 100bf215546Sopenharmony_ciextern const char* 101bf215546Sopenharmony_ci_mesa_program_resource_name(struct gl_program_resource *res); 102bf215546Sopenharmony_ci 103bf215546Sopenharmony_ciint 104bf215546Sopenharmony_ci_mesa_program_resource_name_length(struct gl_program_resource *res); 105bf215546Sopenharmony_ci 106bf215546Sopenharmony_cibool 107bf215546Sopenharmony_ci_mesa_program_get_resource_name(struct gl_program_resource *res, 108bf215546Sopenharmony_ci struct gl_resource_name *out); 109bf215546Sopenharmony_ci 110bf215546Sopenharmony_ciextern unsigned 111bf215546Sopenharmony_ci_mesa_program_resource_array_size(struct gl_program_resource *res); 112bf215546Sopenharmony_ci 113bf215546Sopenharmony_ciextern GLuint 114bf215546Sopenharmony_ci_mesa_program_resource_index(struct gl_shader_program *shProg, 115bf215546Sopenharmony_ci struct gl_program_resource *res); 116bf215546Sopenharmony_ci 117bf215546Sopenharmony_ciextern struct gl_program_resource * 118bf215546Sopenharmony_ci_mesa_program_resource_find_name(struct gl_shader_program *shProg, 119bf215546Sopenharmony_ci GLenum programInterface, const char *name, 120bf215546Sopenharmony_ci unsigned *array_index); 121bf215546Sopenharmony_ci 122bf215546Sopenharmony_ciextern struct gl_program_resource * 123bf215546Sopenharmony_ci_mesa_program_resource_find_index(struct gl_shader_program *shProg, 124bf215546Sopenharmony_ci GLenum programInterface, GLuint index); 125bf215546Sopenharmony_ci 126bf215546Sopenharmony_ciextern struct gl_program_resource * 127bf215546Sopenharmony_ci_mesa_program_resource_find_active_variable(struct gl_shader_program *shProg, 128bf215546Sopenharmony_ci GLenum programInterface, 129bf215546Sopenharmony_ci const struct gl_uniform_block *block, 130bf215546Sopenharmony_ci unsigned index); 131bf215546Sopenharmony_ci 132bf215546Sopenharmony_ciextern bool 133bf215546Sopenharmony_ci_mesa_get_program_resource_name(struct gl_shader_program *shProg, 134bf215546Sopenharmony_ci GLenum programInterface, GLuint index, 135bf215546Sopenharmony_ci GLsizei bufSize, GLsizei *length, 136bf215546Sopenharmony_ci GLchar *name, bool glthread, 137bf215546Sopenharmony_ci const char *caller); 138bf215546Sopenharmony_ci 139bf215546Sopenharmony_ciextern unsigned 140bf215546Sopenharmony_ci_mesa_program_resource_name_length_array(struct gl_program_resource *res); 141bf215546Sopenharmony_ci 142bf215546Sopenharmony_ciextern GLint 143bf215546Sopenharmony_ci_mesa_program_resource_location(struct gl_shader_program *shProg, 144bf215546Sopenharmony_ci GLenum programInterface, const char *name); 145bf215546Sopenharmony_ci 146bf215546Sopenharmony_ciextern GLint 147bf215546Sopenharmony_ci_mesa_program_resource_location_index(struct gl_shader_program *shProg, 148bf215546Sopenharmony_ci GLenum programInterface, const char *name); 149bf215546Sopenharmony_ci 150bf215546Sopenharmony_ciextern unsigned 151bf215546Sopenharmony_ci_mesa_program_resource_prop(struct gl_shader_program *shProg, 152bf215546Sopenharmony_ci struct gl_program_resource *res, GLuint index, 153bf215546Sopenharmony_ci const GLenum prop, GLint *val, bool glthread, 154bf215546Sopenharmony_ci const char *caller); 155bf215546Sopenharmony_ci 156bf215546Sopenharmony_ciextern void 157bf215546Sopenharmony_ci_mesa_get_program_resourceiv(struct gl_shader_program *shProg, 158bf215546Sopenharmony_ci GLenum programInterface, GLuint index, 159bf215546Sopenharmony_ci GLsizei propCount, const GLenum *props, 160bf215546Sopenharmony_ci GLsizei bufSize, GLsizei *length, 161bf215546Sopenharmony_ci GLint *params); 162bf215546Sopenharmony_ci 163bf215546Sopenharmony_ciextern void 164bf215546Sopenharmony_ci_mesa_get_program_interfaceiv(struct gl_shader_program *shProg, 165bf215546Sopenharmony_ci GLenum programInterface, GLenum pname, 166bf215546Sopenharmony_ci GLint *params); 167bf215546Sopenharmony_ci 168bf215546Sopenharmony_ciextern void 169bf215546Sopenharmony_ci_mesa_program_resource_hash_destroy(struct gl_shader_program *shProg); 170bf215546Sopenharmony_ci 171bf215546Sopenharmony_ciextern void 172bf215546Sopenharmony_ci_mesa_create_program_resource_hash(struct gl_shader_program *shProg); 173bf215546Sopenharmony_ci 174bf215546Sopenharmony_ci/* GL_ARB_shader_subroutine */ 175bf215546Sopenharmony_civoid 176bf215546Sopenharmony_ci_mesa_program_init_subroutine_defaults(struct gl_context *ctx, 177bf215546Sopenharmony_ci struct gl_program *prog); 178bf215546Sopenharmony_ci 179bf215546Sopenharmony_ciGLcharARB * 180bf215546Sopenharmony_ci_mesa_read_shader_source(const gl_shader_stage stage, const char *source, 181bf215546Sopenharmony_ci const uint8_t sha1[SHA1_DIGEST_LENGTH]); 182bf215546Sopenharmony_ci 183bf215546Sopenharmony_civoid 184bf215546Sopenharmony_ci_mesa_dump_shader_source(const gl_shader_stage stage, const char *source, 185bf215546Sopenharmony_ci const uint8_t sha1[SHA1_DIGEST_LENGTH]); 186bf215546Sopenharmony_ci 187bf215546Sopenharmony_civoid 188bf215546Sopenharmony_ci_mesa_init_shader_includes(struct gl_shared_state *shared); 189bf215546Sopenharmony_ci 190bf215546Sopenharmony_cisize_t 191bf215546Sopenharmony_ci_mesa_get_shader_include_cursor(struct gl_shared_state *shared); 192bf215546Sopenharmony_ci 193bf215546Sopenharmony_civoid 194bf215546Sopenharmony_ci_mesa_set_shader_include_cursor(struct gl_shared_state *shared, size_t cusor); 195bf215546Sopenharmony_ci 196bf215546Sopenharmony_civoid 197bf215546Sopenharmony_ci_mesa_destroy_shader_includes(struct gl_shared_state *shared); 198bf215546Sopenharmony_ci 199bf215546Sopenharmony_ciconst char * 200bf215546Sopenharmony_ci_mesa_lookup_shader_include(struct gl_context *ctx, char *path, 201bf215546Sopenharmony_ci bool error_check); 202bf215546Sopenharmony_ci 203bf215546Sopenharmony_ci#ifdef __cplusplus 204bf215546Sopenharmony_ci} 205bf215546Sopenharmony_ci#endif 206bf215546Sopenharmony_ci 207bf215546Sopenharmony_ci#endif /* SHADERAPI_H */ 208