From: Iago Toral Quiroga Date: Fri, 2 Dec 2016 13:16:07 +0000 (+0100) Subject: spirv: Builtin Layer is an input for fragment shaders X-Git-Tag: upstream/17.1.0~4141 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=66e7effc8542aa725eb9c08d826ece009526cd50;p=platform%2Fupstream%2Fmesa.git spirv: Builtin Layer is an input for fragment shaders This change makes it so we emit a load_input intrinsic when Layer is read in a fragment shader. Reviewed-by: Jason Ekstrand --- diff --git a/src/compiler/spirv/vtn_variables.c b/src/compiler/spirv/vtn_variables.c index 917aa9d..a38d359 100644 --- a/src/compiler/spirv/vtn_variables.c +++ b/src/compiler/spirv/vtn_variables.c @@ -819,7 +819,12 @@ vtn_get_builtin_location(struct vtn_builder *b, break; case SpvBuiltInLayer: *location = VARYING_SLOT_LAYER; - *mode = nir_var_shader_out; + if (b->shader->stage == MESA_SHADER_FRAGMENT) + *mode = nir_var_shader_in; + else if (b->shader->stage == MESA_SHADER_GEOMETRY) + *mode = nir_var_shader_out; + else + unreachable("invalid stage for SpvBuiltInLayer"); break; case SpvBuiltInViewportIndex: *location = VARYING_SLOT_VIEWPORT;