<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Jan 10, 2017 at 8:59 AM, Ilia Mirkin <span dir="ltr"><<a href="mailto:imirkin@alum.mit.edu" target="_blank">imirkin@alum.mit.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class="gmail-HOEnZb"><div class="gmail-h5">On Tue, Jan 10, 2017 at 11:50 AM, Lionel Landwerlin<br>
<<a href="mailto:lionel.g.landwerlin@intel.com">lionel.g.landwerlin@intel.com</a><wbr>> wrote:<br>
> With shaders using a lot of inputs/outputs, like this (from Gtk+) :<br>
><br>
> layout(location = 0) in vec2 inPos;<br>
> layout(location = 1) in float inGradientPos;<br>
> layout(location = 2) in flat int inRepeating;<br>
> layout(location = 3) in flat int inStopCount;<br>
> layout(location = 4) in flat vec4 inClipBounds;<br>
> layout(location = 5) in flat vec4 inClipWidths;<br>
> layout(location = 6) in flat ColorStop inStops[8];<br>
><br>
> layout(location = 0) out vec4 outColor;<br>
><br>
> we're missing the programming of the input_slots_valid field leading<br>
> to an assert further down the backend code.<br>
><br>
> Note that we need the shader to be translated from spirv before we can<br>
> get the number of inputs/outputs so we set this in a post function and<br>
> leave the field at 0 for hashing.<br>
><br>
> v2: Use valid slots of the geometry or vertex stage (Jason)<br>
><br>
> Signed-off-by: Lionel Landwerlin <<a href="mailto:lionel.g.landwerlin@intel.com">lionel.g.landwerlin@intel.com</a><wbr>><br>
> Cc: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>><br>
> Cc: Kenneth Graunke <<a href="mailto:kenneth@whitecape.org">kenneth@whitecape.org</a>><br>
> ---<br>
> src/intel/vulkan/anv_pipeline.<wbr>c | 21 +++++++++++++++++++--<br>
> 1 file changed, 19 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/src/intel/vulkan/anv_<wbr>pipeline.c b/src/intel/vulkan/anv_<wbr>pipeline.c<br>
> index 2c46ef5bf9..e51149cf37 100644<br>
> --- a/src/intel/vulkan/anv_<wbr>pipeline.c<br>
> +++ b/src/intel/vulkan/anv_<wbr>pipeline.c<br>
> @@ -266,8 +266,6 @@ populate_wm_prog_key(const struct gen_device_info *devinfo,<br>
><br>
> populate_sampler_prog_key(<wbr>devinfo, &key->tex);<br>
><br>
> - /* TODO: Fill out key->input_slots_valid */<br>
> -<br>
> /* Vulkan doesn't specify a default */<br>
> key->high_quality_derivatives = false;<br>
><br>
> @@ -293,6 +291,23 @@ populate_wm_prog_key(const struct gen_device_info *devinfo,<br>
> }<br>
><br>
> static void<br>
> +post_populate_wm_prog_key(<wbr>const struct anv_pipeline *pipeline,<br>
> + const nir_shader *nir,<br>
> + struct brw_wm_prog_key *key)<br>
> +{<br>
> + if (_mesa_bitcount_64(nir->info-><wbr>inputs_read &<br>
> + BRW_FS_VARYING_INPUT_MASK) > 16) {<br>
> + struct anv_shader_bin * const *shaders = pipeline->shaders;<br>
> + const struct brw_vue_prog_data *vue_prog_data =<br>
> + shaders[MESA_SHADER_GEOMETRY] ?<br>
> + (struct brw_vue_prog_data *) shaders[MESA_SHADER_GEOMETRY]-<wbr>>prog_data :<br>
<br>
</div></div>As you're about to get tess support, maybe just take that into account<br>
here? It should fall back as GP -> TEP -> VP. (Presumably the logic<br>
you're copying from has this as well.)<span class="gmail-"><br></span></blockquote><div><br></div><div>Agreed. I think what we actually want is to add a anv_pipeline_get_fs_input_map() helper that returns the VUE map and takes these things into account. We have to do the same thing in emit_3dstate_sbe in genX_pipeline.h so it may be worth the deduplication. Could be<br><br></div><div>if (pipeline_has_stage(pipeline, MESA_SHADER_GEOMETRY))<br></div><div> return &anv_get_gs_prog_data(pipeline)->base.vue_map;<br></div><div>else<br><div> return &anv_get_vs_prog_data(pipeline)->base.vue_map;<br><br></div><div>with the tessellation one in there too.<br></div></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">
> + (struct brw_vue_prog_data *) shaders[MESA_SHADER_VERTEX]-><wbr>prog_data;<br>
> +<br>
> + key->input_slots_valid = vue_prog_data->vue_map.slots_<wbr>valid;<br>
> + }<br>
> +}<br>
> +<br>
> +static void<br>
> populate_cs_prog_key(const struct gen_device_info *devinfo,<br>
> struct brw_cs_prog_key *key)<br>
> {<br>
> @@ -616,6 +631,8 @@ anv_pipeline_compile_fs(struct anv_pipeline *pipeline,<br>
> if (nir == NULL)<br>
> return vk_error(VK_ERROR_OUT_OF_HOST_<wbr>MEMORY);<br>
><br>
> + post_populate_wm_prog_key(<wbr>pipeline, nir, &key);<br>
> +<br>
> unsigned num_rts = 0;<br>
> struct anv_pipeline_binding rt_bindings[8];<br>
> nir_function_impl *impl = nir_shader_get_entrypoint(nir)<wbr>;<br>
> --<br>
> 2.11.0<br>
</span>> ______________________________<wbr>_________________<br>
> mesa-dev mailing list<br>
> <a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
> <a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</blockquote></div><br></div></div>