From: Jason Ekstrand Date: Fri, 23 Oct 2015 00:54:24 +0000 (-0700) Subject: nir/spirv: Make the builtins array distinguish between in and out X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=9fe907ec7999323035827483e8a8ea1db19863c7;p=mesa.git nir/spirv: Make the builtins array distinguish between in and out --- diff --git a/src/glsl/nir/spirv_to_nir.c b/src/glsl/nir/spirv_to_nir.c index 973ff7c6777..245ee7424ad 100644 --- a/src/glsl/nir/spirv_to_nir.c +++ b/src/glsl/nir/spirv_to_nir.c @@ -830,7 +830,10 @@ var_decoration_cb(struct vtn_builder *b, struct vtn_value *val, int member, if (builtin == SpvBuiltInFragCoord || builtin == SpvBuiltInSamplePosition) var->data.origin_upper_left = b->origin_upper_left; - b->builtins[dec->literals[0]] = var; + if (mode == nir_var_shader_out) + b->builtins[dec->literals[0]].out = var; + else + b->builtins[dec->literals[0]].in = var; break; } case SpvDecorationRowMajor: @@ -866,7 +869,11 @@ get_builtin_variable(struct vtn_builder *b, const struct glsl_type *type, SpvBuiltIn builtin) { - nir_variable *var = b->builtins[builtin]; + nir_variable *var; + if (mode == nir_var_shader_out) + var = b->builtins[builtin].out; + else + var = b->builtins[builtin].in; if (!var) { int location; @@ -880,7 +887,10 @@ get_builtin_variable(struct vtn_builder *b, if (builtin == SpvBuiltInFragCoord || builtin == SpvBuiltInSamplePosition) var->data.origin_upper_left = b->origin_upper_left; - b->builtins[builtin] = var; + if (mode == nir_var_shader_out) + b->builtins[builtin].out = var; + else + b->builtins[builtin].in = var; } return var; diff --git a/src/glsl/nir/spirv_to_nir_private.h b/src/glsl/nir/spirv_to_nir_private.h index 96044b05aac..45111f816bc 100644 --- a/src/glsl/nir/spirv_to_nir_private.h +++ b/src/glsl/nir/spirv_to_nir_private.h @@ -172,7 +172,10 @@ struct vtn_builder { /* * NIR variable for each SPIR-V builtin. */ - nir_variable *builtins[42]; /* XXX need symbolic constant from SPIR-V header */ + struct { + nir_variable *in; + nir_variable *out; + } builtins[42]; /* XXX need symbolic constant from SPIR-V header */ unsigned value_id_bound; struct vtn_value *values;