static gl_shader_variable *
create_shader_variable(struct gl_shader_program *shProg,
const ir_variable *in, bool use_implicit_location,
- int location_bias)
+ int location)
{
gl_shader_variable *out = ralloc(shProg, struct gl_shader_variable);
if (!out)
!(in->data.explicit_location || use_implicit_location)) {
out->location = -1;
} else {
- out->location = in->data.location - location_bias;
+ out->location = location;
}
out->type = in->type;
static bool
add_shader_variable(struct gl_shader_program *shProg, unsigned stage_mask,
GLenum programInterface, ir_variable *var,
- bool use_implicit_location, int location_bias)
+ bool use_implicit_location, int location)
{
gl_shader_variable *sha_v =
- create_shader_variable(shProg, var, use_implicit_location, location_bias);
+ create_shader_variable(shProg, var, use_implicit_location, location);
if (!sha_v)
return false;
(stage == MESA_SHADER_FRAGMENT && var->data.mode == ir_var_shader_out);
if (!add_shader_variable(shProg, 1 << stage, programInterface,
- var, vs_input_or_fs_output, loc_bias))
+ var, vs_input_or_fs_output,
+ var->data.location - loc_bias))
return false;
}
return true;
const int stage_mask =
build_stageref(shProg, var->name, var->data.mode);
if (!add_shader_variable(shProg, stage_mask,
- iface, var, false, VARYING_SLOT_VAR0))
+ iface, var, false,
+ var->data.location - VARYING_SLOT_VAR0))
return false;
}
}
if (!add_shader_variable(shProg,
1 << MESA_SHADER_FRAGMENT,
- GL_PROGRAM_OUTPUT, var, true, FRAG_RESULT_DATA0))
+ GL_PROGRAM_OUTPUT, var, true,
+ var->data.location - FRAG_RESULT_DATA0))
return false;
}
}