3 * Copyright © 2010 Intel Corporation
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
29 ir_function_signature
*
30 link_get_main_function_signature(gl_shader
*sh
);
33 link_function_calls(gl_shader_program
*prog
, gl_shader
*main
,
34 gl_shader
**shader_list
, unsigned num_shaders
);
37 link_invalidate_variable_locations(exec_list
*ir
);
40 link_assign_uniform_locations(struct gl_shader_program
*prog
,
41 unsigned int boolean_true
);
44 link_set_uniform_initializers(struct gl_shader_program
*prog
,
45 unsigned int boolean_true
);
48 link_cross_validate_uniform_block(void *mem_ctx
,
49 struct gl_uniform_block
**linked_blocks
,
50 unsigned int *num_linked_blocks
,
51 struct gl_uniform_block
*new_block
);
54 link_uniform_blocks_are_compatible(const gl_uniform_block
*a
,
55 const gl_uniform_block
*b
);
58 link_uniform_blocks(void *mem_ctx
,
59 struct gl_shader_program
*prog
,
60 struct gl_shader
**shader_list
,
62 struct gl_uniform_block
**blocks_ret
);
65 validate_intrastage_interface_blocks(struct gl_shader_program
*prog
,
66 const gl_shader
**shader_list
,
67 unsigned num_shaders
);
70 validate_interstage_inout_blocks(struct gl_shader_program
*prog
,
71 const gl_shader
*producer
,
72 const gl_shader
*consumer
);
75 validate_interstage_uniform_blocks(struct gl_shader_program
*prog
,
76 gl_shader
**stages
, int num_stages
);
79 link_assign_atomic_counter_resources(struct gl_context
*ctx
,
80 struct gl_shader_program
*prog
);
83 link_check_atomic_counter_resources(struct gl_context
*ctx
,
84 struct gl_shader_program
*prog
);
87 * Class for processing all of the leaf fields of a variable that corresponds
88 * to a program resource.
90 * The leaf fields are all the parts of the variable that the application
91 * could query using \c glGetProgramResourceIndex (or that could be returned
92 * by \c glGetProgramResourceName).
94 * Classes my derive from this class to implement specific functionality.
95 * This class only provides the mechanism to iterate over the leaves. Derived
96 * classes must implement \c ::visit_field and may override \c ::process.
98 class program_resource_visitor
{
101 * Begin processing a variable
103 * Classes that overload this function should call \c ::process from the
104 * base class to start the recursive processing of the variable.
106 * \param var The variable that is to be processed
108 * Calls \c ::visit_field for each leaf of the variable.
111 * When processing a uniform block, this entry should only be used in cases
112 * where the row / column ordering of matrices in the block does not
113 * matter. For example, enumerating the names of members of the block, but
114 * not for determining the offsets of members.
116 void process(ir_variable
*var
);
119 * Begin processing a variable of a structured type.
121 * This flavor of \c process should be used to handle structured types
122 * (i.e., structures, interfaces, or arrays there of) that need special
123 * name handling. A common usage is to handle cases where the block name
124 * (instead of the instance name) is used for an interface block.
126 * \param type Type that is to be processed, associated with \c name
127 * \param name Base name of the structured variable being processed
130 * \c type must be \c GLSL_TYPE_RECORD, \c GLSL_TYPE_INTERFACE, or an array
133 void process(const glsl_type
*type
, const char *name
);
137 * Method invoked for each leaf of the variable
139 * \param type Type of the field.
140 * \param name Fully qualified name of the field.
141 * \param row_major For a matrix type, is it stored row-major.
142 * \param record_type Type of the record containing the field.
143 * \param last_field Set if \c name is the last field of the structure
144 * containing it. This will always be false for items
145 * not contained in a structure or interface block.
147 * The default implementation just calls the other \c visit_field method.
149 virtual void visit_field(const glsl_type
*type
, const char *name
,
150 bool row_major
, const glsl_type
*record_type
,
154 * Method invoked for each leaf of the variable
156 * \param type Type of the field.
157 * \param name Fully qualified name of the field.
158 * \param row_major For a matrix type, is it stored row-major.
160 virtual void visit_field(const glsl_type
*type
, const char *name
,
164 * Visit a record before visiting its fields
166 * For structures-of-structures or interfaces-of-structures, this visits
167 * the inner structure before visiting its fields.
169 * The default implementation does nothing.
171 virtual void visit_field(const glsl_struct_field
*field
);
175 * \param name_length Length of the current name \b not including the
176 * terminating \c NUL character.
177 * \param last_field Set if \c name is the last field of the structure
178 * containing it. This will always be false for items
179 * not contained in a structure or interface block.
181 void recursion(const glsl_type
*t
, char **name
, size_t name_length
,
182 bool row_major
, const glsl_type
*record_type
,
187 linker_error(gl_shader_program
*prog
, const char *fmt
, ...);
190 linker_warning(gl_shader_program
*prog
, const char *fmt
, ...);
192 #endif /* GLSL_LINKER_H */