bool
-assign_attribute_locations(glsl_shader *sh,
- struct gl_program_parameter_list *attrib,
- unsigned max_attribute_index)
+assign_attribute_locations(glsl_program *prog, unsigned max_attribute_index)
{
/* Mark invalid attribute locations as being used.
*/
unsigned used_locations = (max_attribute_index >= 32)
? ~0 : ~((1 << max_attribute_index) - 1);
+ glsl_shader *const sh = prog->_LinkedShaders[0];
assert(sh->Type == GL_VERTEX_SHADER);
/* Operate in a total of four passes.
invalidate_variable_locations(sh, ir_var_in, VERT_ATTRIB_GENERIC0);
- if (attrib != NULL) {
- for (unsigned i = 0; i < attrib->NumParameters; i++) {
+ if (prog->Attributes != NULL) {
+ for (unsigned i = 0; i < prog->Attributes->NumParameters; i++) {
ir_variable *const var =
- sh->symbols->get_variable(attrib->Parameters[i].Name);
+ sh->symbols->get_variable(prog->Attributes->Parameters[i].Name);
/* Note: attributes that occupy multiple slots, such as arrays or
* matrices, may appear in the attrib array multiple times.
/* FINISHME: The code as currently written does not support attribute
* FINISHME: location aliasing (see comment above).
*/
- const int attr = attrib->Parameters[i].StateIndexes[0];
+ const int attr = prog->Attributes->Parameters[i].StateIndexes[0];
const unsigned slots = count_attribute_slots(var->type);
/* Mask representing the contiguous slots that will be used by this
* attribute overlaps any previously allocated bits.
*/
if ((~(use_mask << attr) & used_locations) != used_locations) {
- printf("error: insufficient contiguous attribute locations "
- "available for vertex shader input `%s'",
- var->name);
+ linker_error_printf(prog,
+ "insufficient contiguous attribute locations "
+ "available for vertex shader input `%s'",
+ var->name);
return false;
}
int location = find_available_slots(used_locations, to_assign[i].slots);
if (location < 0) {
- printf("error: insufficient contiguous attribute locations "
- "available for vertex shader input `%s'",
- to_assign[i].var->name);
+ linker_error_printf(prog,
+ "insufficient contiguous attribute locations "
+ "available for vertex shader input `%s'",
+ to_assign[i].var->name);
return false;
}
* FINISHME: GL_MAX_VERTEX_ATTRIBS. GL_MAX_VERTEX_ATTRIBS must be
* FINISHME: at least 16, so hardcode 16 for now.
*/
- if (!assign_attribute_locations(prog->_LinkedShaders[0],
- prog->Attributes,
- 16))
+ if (!assign_attribute_locations(prog, 16))
goto done;
for (unsigned i = 1; i < prog->_NumLinkedShaders; i++)