summaryrefslogtreecommitdiffstats
path: root/src/compiler/glsl
diff options
context:
space:
mode:
authorKristian Høgsberg Kristensen <[email protected]>2016-04-11 13:06:07 -0700
committerKristian Høgsberg Kristensen <[email protected]>2016-04-12 14:38:26 -0700
commit778fd46aa4df08f2dd5d5a9162e6dce062cc1cb6 (patch)
treeebafd71b86f9ba711006cd67f6fee568b5ef9d56 /src/compiler/glsl
parent09f01215933f8f7f8d3d4cda9ff94605164df9a9 (diff)
glsl/linker: Pass name and type through to create_shader_variable()
No functional change here, but this now lets us recurse throught structs in add_shader_variable(). Signed-off-by: Kristian Høgsberg Kristensen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/compiler/glsl')
-rw-r--r--src/compiler/glsl/linker.cpp21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp
index 1ea5c1f0807..c1bc6994f48 100644
--- a/src/compiler/glsl/linker.cpp
+++ b/src/compiler/glsl/linker.cpp
@@ -3518,8 +3518,9 @@ build_stageref(struct gl_shader_program *shProg, const char *name,
*/
static gl_shader_variable *
create_shader_variable(struct gl_shader_program *shProg,
- const ir_variable *in, bool use_implicit_location,
- int location)
+ const ir_variable *in,
+ const char *name, const glsl_type *type,
+ bool use_implicit_location, int location)
{
gl_shader_variable *out = ralloc(shProg, struct gl_shader_variable);
if (!out)
@@ -3532,7 +3533,7 @@ create_shader_variable(struct gl_shader_program *shProg,
in->data.location == SYSTEM_VALUE_VERTEX_ID_ZERO_BASE) {
out->name = ralloc_strdup(shProg, "gl_VertexID");
} else {
- out->name = ralloc_strdup(shProg, in->name);
+ out->name = ralloc_strdup(shProg, name);
}
if (!out->name)
@@ -3560,7 +3561,7 @@ create_shader_variable(struct gl_shader_program *shProg,
out->location = location;
}
- out->type = in->type;
+ out->type = type;
out->index = in->data.index;
out->patch = in->data.patch;
out->mode = in->data.mode;
@@ -3571,10 +3572,12 @@ create_shader_variable(struct gl_shader_program *shProg,
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)
{
gl_shader_variable *sha_v =
- create_shader_variable(shProg, var, use_implicit_location, location);
+ create_shader_variable(shProg, var, name, type,
+ use_implicit_location, location);
if (!sha_v)
return false;
@@ -3630,7 +3633,7 @@ add_interface_variables(struct gl_shader_program *shProg,
(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,
+ var, var->name, var->type, vs_input_or_fs_output,
var->data.location - loc_bias))
return false;
}
@@ -3664,7 +3667,7 @@ add_packed_varyings(struct gl_shader_program *shProg, int stage, GLenum type)
const int stage_mask =
build_stageref(shProg, var->name, var->data.mode);
if (!add_shader_variable(shProg, stage_mask,
- iface, var, false,
+ iface, var, var->name, var->type, false,
var->data.location - VARYING_SLOT_VAR0))
return false;
}
@@ -3688,8 +3691,8 @@ add_fragdata_arrays(struct gl_shader_program *shProg)
if (!add_shader_variable(shProg,
1 << MESA_SHADER_FRAGMENT,
- GL_PROGRAM_OUTPUT, var, true,
- var->data.location - FRAG_RESULT_DATA0))
+ GL_PROGRAM_OUTPUT, var, var->name, var->type,
+ true, var->data.location - FRAG_RESULT_DATA0))
return false;
}
}