}
static bool
-add_shader_variable(struct gl_shader_program *shProg, struct set *resource_set,
+add_shader_variable(const struct gl_context *ctx,
+ struct gl_shader_program *shProg,
+ struct set *resource_set,
unsigned stage_mask,
GLenum programInterface, ir_variable *var,
const char *name, const glsl_type *type,
for (unsigned i = 0; i < type->length; i++) {
const struct glsl_struct_field *field = &type->fields.structure[i];
char *field_name = ralloc_asprintf(shProg, "%s.%s", name, field->name);
- if (!add_shader_variable(shProg, resource_set,
+ if (!add_shader_variable(ctx, shProg, resource_set,
stage_mask, programInterface,
var, field_name, field->type,
use_implicit_location, field_location,
}
static bool
-add_interface_variables(struct gl_shader_program *shProg,
+add_interface_variables(const struct gl_context *ctx,
+ struct gl_shader_program *shProg,
struct set *resource_set,
unsigned stage, GLenum programInterface)
{
(stage == MESA_SHADER_VERTEX && var->data.mode == ir_var_shader_in) ||
(stage == MESA_SHADER_FRAGMENT && var->data.mode == ir_var_shader_out);
- if (!add_shader_variable(shProg, resource_set,
+ if (!add_shader_variable(ctx, shProg, resource_set,
1 << stage, programInterface,
var, var->name, var->type, vs_input_or_fs_output,
var->data.location - loc_bias))
}
static bool
-add_packed_varyings(struct gl_shader_program *shProg, struct set *resource_set,
+add_packed_varyings(const struct gl_context *ctx,
+ struct gl_shader_program *shProg,
+ struct set *resource_set,
int stage, GLenum type)
{
struct gl_linked_shader *sh = shProg->_LinkedShaders[stage];
if (type == iface) {
const int stage_mask =
build_stageref(shProg, var->name, var->data.mode);
- if (!add_shader_variable(shProg, resource_set,
+ if (!add_shader_variable(ctx, shProg, resource_set,
stage_mask,
iface, var, var->name, var->type, false,
var->data.location - VARYING_SLOT_VAR0))
}
static bool
-add_fragdata_arrays(struct gl_shader_program *shProg, struct set *resource_set)
+add_fragdata_arrays(const struct gl_context *ctx,
+ struct gl_shader_program *shProg,
+ struct set *resource_set)
{
struct gl_linked_shader *sh = shProg->_LinkedShaders[MESA_SHADER_FRAGMENT];
if (var) {
assert(var->data.mode == ir_var_shader_out);
- if (!add_shader_variable(shProg, resource_set,
+ if (!add_shader_variable(ctx, shProg, resource_set,
1 << MESA_SHADER_FRAGMENT,
GL_PROGRAM_OUTPUT, var, var->name, var->type,
true, var->data.location - FRAG_RESULT_DATA0))
/* Program interface needs to expose varyings in case of SSO. */
if (shProg->SeparateShader) {
- if (!add_packed_varyings(shProg, resource_set,
+ if (!add_packed_varyings(ctx, shProg, resource_set,
input_stage, GL_PROGRAM_INPUT))
return;
- if (!add_packed_varyings(shProg, resource_set,
+ if (!add_packed_varyings(ctx, shProg, resource_set,
output_stage, GL_PROGRAM_OUTPUT))
return;
}
- if (!add_fragdata_arrays(shProg, resource_set))
+ if (!add_fragdata_arrays(ctx, shProg, resource_set))
return;
/* Add inputs and outputs to the resource list. */
- if (!add_interface_variables(shProg, resource_set,
+ if (!add_interface_variables(ctx, shProg, resource_set,
input_stage, GL_PROGRAM_INPUT))
return;
- if (!add_interface_variables(shProg, resource_set,
+ if (!add_interface_variables(ctx, shProg, resource_set,
output_stage, GL_PROGRAM_OUTPUT))
return;