diff options
author | Ian Romanick <[email protected]> | 2016-05-19 10:25:47 -0700 |
---|---|---|
committer | Ian Romanick <[email protected]> | 2016-05-26 16:19:16 -0700 |
commit | cfff74629765d1d06313705f5ca80138c2182ef0 (patch) | |
tree | 963623ec982596422d5c2065aa99f6c66c6548fb /src/compiler/glsl/linker.cpp | |
parent | 15e553daf0cd5fe70994b6ac5377ff11002357a3 (diff) |
mesa: Track the additional data in gl_shader_variable
The interface type, interpolation mode, precision, the type of the
outermost structure, and whether or not the variable has an explicit
location will be used for SSO validation on OpenGL ES.
Signed-off-by: Ian Romanick <[email protected]>
Reviewed-by: Timothy Arceri <[email protected]>
Reviewed-by: Alejandro PiƱeiro <[email protected]>
Diffstat (limited to 'src/compiler/glsl/linker.cpp')
-rw-r--r-- | src/compiler/glsl/linker.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 8e6455310bb..1d5552915ca 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -3660,7 +3660,8 @@ static gl_shader_variable * create_shader_variable(struct gl_shader_program *shProg, const ir_variable *in, const char *name, const glsl_type *type, - bool use_implicit_location, int location) + bool use_implicit_location, int location, + const glsl_type *outermost_struct_type) { gl_shader_variable *out = ralloc(shProg, struct gl_shader_variable); if (!out) @@ -3703,10 +3704,15 @@ create_shader_variable(struct gl_shader_program *shProg, } out->type = type; + out->outermost_struct_type = outermost_struct_type; + out->interface_type = in->get_interface_type(); out->component = in->data.location_frac; out->index = in->data.index; out->patch = in->data.patch; out->mode = in->data.mode; + out->interpolation = in->data.interpolation; + out->explicit_location = in->data.explicit_location; + out->precision = in->data.precision; return out; } @@ -3715,7 +3721,8 @@ static bool add_shader_variable(struct gl_shader_program *shProg, unsigned stage_mask, GLenum programInterface, ir_variable *var, const char *name, const glsl_type *type, - bool use_implicit_location, int location) + bool use_implicit_location, int location, + const glsl_type *outermost_struct_type = NULL) { const bool is_vertex_input = programInterface == GL_PROGRAM_INPUT && @@ -3732,13 +3739,17 @@ add_shader_variable(struct gl_shader_program *shProg, unsigned stage_mask, * structure member to enumerate is itself a structure or array, * these enumeration rules are applied recursively." */ + if (outermost_struct_type == NULL) + outermost_struct_type = type; + unsigned field_location = location; 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, stage_mask, programInterface, var, field_name, field->type, - use_implicit_location, field_location)) + use_implicit_location, field_location, + outermost_struct_type)) return false; field_location += @@ -3772,7 +3783,8 @@ add_shader_variable(struct gl_shader_program *shProg, unsigned stage_mask, */ gl_shader_variable *sha_v = create_shader_variable(shProg, var, prefixed_name, type, - use_implicit_location, location); + use_implicit_location, location, + outermost_struct_type); if (!sha_v) return false; |