diff options
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/glsl/linker.cpp | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index af0e29d44f4..116e17b5004 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -3654,7 +3654,9 @@ create_shader_variable(struct gl_shader_program *shProg, } 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, @@ -3683,7 +3685,7 @@ add_shader_variable(struct gl_shader_program *shProg, struct set *resource_set, 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, @@ -3733,7 +3735,8 @@ add_shader_variable(struct gl_shader_program *shProg, struct set *resource_set, } 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) { @@ -3784,7 +3787,7 @@ add_interface_variables(struct gl_shader_program *shProg, (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)) @@ -3794,7 +3797,9 @@ add_interface_variables(struct gl_shader_program *shProg, } 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]; @@ -3820,7 +3825,7 @@ add_packed_varyings(struct gl_shader_program *shProg, struct set *resource_set, 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)) @@ -3832,7 +3837,9 @@ add_packed_varyings(struct gl_shader_program *shProg, struct set *resource_set, } 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]; @@ -3844,7 +3851,7 @@ add_fragdata_arrays(struct gl_shader_program *shProg, struct set *resource_set) 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)) @@ -4103,24 +4110,24 @@ build_program_resource_list(struct gl_context *ctx, /* 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; |