diff options
author | Kenneth Graunke <[email protected]> | 2016-10-25 03:46:51 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2016-10-27 00:56:34 -0700 |
commit | 34fd2ffed8c7acfe1b19247eb3b98c3e754680b2 (patch) | |
tree | a15543974e26fffeab42b552834e9d6e04673c80 /src/compiler/glsl | |
parent | 2035930966b05a7c4dd1f6559d66b5a3b41e01a5 (diff) |
glsl: Pass ctx to program interface query helper functions.
The next commit will use this in add_shader_variable - this just
separates out some of the mechanical changes for easier review.
Cc: [email protected]
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Reviewed-by: Tapani Pälli <[email protected]>
Diffstat (limited to 'src/compiler/glsl')
-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; |