1*61046927SAndroid Build Coastguard Worker /* 2*61046927SAndroid Build Coastguard Worker * Mesa 3-D graphics library 3*61046927SAndroid Build Coastguard Worker * 4*61046927SAndroid Build Coastguard Worker * Copyright (C) 2010 VMware, Inc. All Rights Reserved. 5*61046927SAndroid Build Coastguard Worker * 6*61046927SAndroid Build Coastguard Worker * Permission is hereby granted, free of charge, to any person obtaining a 7*61046927SAndroid Build Coastguard Worker * copy of this software and associated documentation files (the "Software"), 8*61046927SAndroid Build Coastguard Worker * to deal in the Software without restriction, including without limitation 9*61046927SAndroid Build Coastguard Worker * the rights to use, copy, modify, merge, publish, distribute, sublicense, 10*61046927SAndroid Build Coastguard Worker * and/or sell copies of the Software, and to permit persons to whom the 11*61046927SAndroid Build Coastguard Worker * Software is furnished to do so, subject to the following conditions: 12*61046927SAndroid Build Coastguard Worker * 13*61046927SAndroid Build Coastguard Worker * The above copyright notice and this permission notice shall be included 14*61046927SAndroid Build Coastguard Worker * in all copies or substantial portions of the Software. 15*61046927SAndroid Build Coastguard Worker * 16*61046927SAndroid Build Coastguard Worker * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 17*61046927SAndroid Build Coastguard Worker * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18*61046927SAndroid Build Coastguard Worker * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19*61046927SAndroid Build Coastguard Worker * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20*61046927SAndroid Build Coastguard Worker * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21*61046927SAndroid Build Coastguard Worker * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22*61046927SAndroid Build Coastguard Worker * OTHER DEALINGS IN THE SOFTWARE. 23*61046927SAndroid Build Coastguard Worker */ 24*61046927SAndroid Build Coastguard Worker 25*61046927SAndroid Build Coastguard Worker 26*61046927SAndroid Build Coastguard Worker #ifndef UNIFORMS_H 27*61046927SAndroid Build Coastguard Worker #define UNIFORMS_H 28*61046927SAndroid Build Coastguard Worker 29*61046927SAndroid Build Coastguard Worker #include "util/glheader.h" 30*61046927SAndroid Build Coastguard Worker #include "compiler/glsl_types.h" 31*61046927SAndroid Build Coastguard Worker #include "compiler/glsl/ir_uniform.h" 32*61046927SAndroid Build Coastguard Worker #include "program/prog_parameter.h" 33*61046927SAndroid Build Coastguard Worker 34*61046927SAndroid Build Coastguard Worker #ifdef __cplusplus 35*61046927SAndroid Build Coastguard Worker extern "C" { 36*61046927SAndroid Build Coastguard Worker #endif 37*61046927SAndroid Build Coastguard Worker 38*61046927SAndroid Build Coastguard Worker 39*61046927SAndroid Build Coastguard Worker struct gl_program; 40*61046927SAndroid Build Coastguard Worker struct _glapi_table; 41*61046927SAndroid Build Coastguard Worker 42*61046927SAndroid Build Coastguard Worker void 43*61046927SAndroid Build Coastguard Worker _mesa_uniform(GLint location, GLsizei count, const GLvoid *values, 44*61046927SAndroid Build Coastguard Worker struct gl_context *, struct gl_shader_program *, 45*61046927SAndroid Build Coastguard Worker enum glsl_base_type basicType, unsigned src_components); 46*61046927SAndroid Build Coastguard Worker 47*61046927SAndroid Build Coastguard Worker void 48*61046927SAndroid Build Coastguard Worker _mesa_uniform_matrix(GLint location, GLsizei count, 49*61046927SAndroid Build Coastguard Worker GLboolean transpose, const void *values, 50*61046927SAndroid Build Coastguard Worker struct gl_context *, struct gl_shader_program *, 51*61046927SAndroid Build Coastguard Worker GLuint cols, GLuint rows, enum glsl_base_type basicType); 52*61046927SAndroid Build Coastguard Worker 53*61046927SAndroid Build Coastguard Worker void 54*61046927SAndroid Build Coastguard Worker _mesa_uniform_handle(GLint location, GLsizei count, const GLvoid *values, 55*61046927SAndroid Build Coastguard Worker struct gl_context *, struct gl_shader_program *); 56*61046927SAndroid Build Coastguard Worker 57*61046927SAndroid Build Coastguard Worker void 58*61046927SAndroid Build Coastguard Worker _mesa_get_uniform(struct gl_context *ctx, GLuint program, GLint location, 59*61046927SAndroid Build Coastguard Worker GLsizei bufSize, enum glsl_base_type returnType, 60*61046927SAndroid Build Coastguard Worker GLvoid *paramsOut); 61*61046927SAndroid Build Coastguard Worker 62*61046927SAndroid Build Coastguard Worker extern void 63*61046927SAndroid Build Coastguard Worker _mesa_uniform_attach_driver_storage(struct gl_uniform_storage *, 64*61046927SAndroid Build Coastguard Worker unsigned element_stride, 65*61046927SAndroid Build Coastguard Worker unsigned vector_stride, 66*61046927SAndroid Build Coastguard Worker enum gl_uniform_driver_format format, 67*61046927SAndroid Build Coastguard Worker void *data); 68*61046927SAndroid Build Coastguard Worker 69*61046927SAndroid Build Coastguard Worker extern void 70*61046927SAndroid Build Coastguard Worker _mesa_uniform_detach_all_driver_storage(struct gl_uniform_storage *uni); 71*61046927SAndroid Build Coastguard Worker 72*61046927SAndroid Build Coastguard Worker extern void 73*61046927SAndroid Build Coastguard Worker _mesa_propagate_uniforms_to_driver_storage(struct gl_uniform_storage *uni, 74*61046927SAndroid Build Coastguard Worker unsigned array_index, 75*61046927SAndroid Build Coastguard Worker unsigned count); 76*61046927SAndroid Build Coastguard Worker 77*61046927SAndroid Build Coastguard Worker void 78*61046927SAndroid Build Coastguard Worker _mesa_ensure_and_associate_uniform_storage(struct gl_context *ctx, 79*61046927SAndroid Build Coastguard Worker struct gl_shader_program *shader_program, 80*61046927SAndroid Build Coastguard Worker struct gl_program *prog, unsigned required_space); 81*61046927SAndroid Build Coastguard Worker 82*61046927SAndroid Build Coastguard Worker extern void 83*61046927SAndroid Build Coastguard Worker _mesa_update_shader_textures_used(struct gl_shader_program *shProg, 84*61046927SAndroid Build Coastguard Worker struct gl_program *prog); 85*61046927SAndroid Build Coastguard Worker 86*61046927SAndroid Build Coastguard Worker extern bool 87*61046927SAndroid Build Coastguard Worker _mesa_sampler_uniforms_are_valid(const struct gl_shader_program *shProg, 88*61046927SAndroid Build Coastguard Worker char *errMsg, size_t errMsgLength); 89*61046927SAndroid Build Coastguard Worker extern bool 90*61046927SAndroid Build Coastguard Worker _mesa_sampler_uniforms_pipeline_are_valid(struct gl_pipeline_object *); 91*61046927SAndroid Build Coastguard Worker 92*61046927SAndroid Build Coastguard Worker extern void 93*61046927SAndroid Build Coastguard Worker _mesa_flush_vertices_for_uniforms(struct gl_context *ctx, 94*61046927SAndroid Build Coastguard Worker const struct gl_uniform_storage *uni); 95*61046927SAndroid Build Coastguard Worker 96*61046927SAndroid Build Coastguard Worker extern GLint 97*61046927SAndroid Build Coastguard Worker _mesa_GetUniformLocation_impl(GLuint programObj, const GLcharARB *name, 98*61046927SAndroid Build Coastguard Worker bool glthread); 99*61046927SAndroid Build Coastguard Worker 100*61046927SAndroid Build Coastguard Worker extern void 101*61046927SAndroid Build Coastguard Worker _mesa_GetActiveUniform_impl(GLuint program, GLuint index, 102*61046927SAndroid Build Coastguard Worker GLsizei maxLength, GLsizei *length, GLint *size, 103*61046927SAndroid Build Coastguard Worker GLenum *type, GLcharARB *nameOut, bool glthread); 104*61046927SAndroid Build Coastguard Worker 105*61046927SAndroid Build Coastguard Worker struct gl_builtin_uniform_element { 106*61046927SAndroid Build Coastguard Worker const char *field; 107*61046927SAndroid Build Coastguard Worker gl_state_index16 tokens[STATE_LENGTH]; 108*61046927SAndroid Build Coastguard Worker int swizzle; 109*61046927SAndroid Build Coastguard Worker }; 110*61046927SAndroid Build Coastguard Worker 111*61046927SAndroid Build Coastguard Worker struct gl_builtin_uniform_desc { 112*61046927SAndroid Build Coastguard Worker const char *name; 113*61046927SAndroid Build Coastguard Worker const struct gl_builtin_uniform_element *elements; 114*61046927SAndroid Build Coastguard Worker unsigned int num_elements; 115*61046927SAndroid Build Coastguard Worker }; 116*61046927SAndroid Build Coastguard Worker 117*61046927SAndroid Build Coastguard Worker #ifdef __cplusplus 118*61046927SAndroid Build Coastguard Worker } 119*61046927SAndroid Build Coastguard Worker #endif 120*61046927SAndroid Build Coastguard Worker 121*61046927SAndroid Build Coastguard Worker 122*61046927SAndroid Build Coastguard Worker #endif /* UNIFORMS_H */ 123