<div dir="auto">Thanks!<div dir="auto"><br></div><div dir="auto">Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Jan 5, 2017 05:10, "Iago Toral Quiroga" <<a href="mailto:itoral@igalia.com">itoral@igalia.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This is the same we do in the GL driver: the hardware provides gl_Layer<br>
in the VUE header, so when the fragment shader reads it we can't skip it.<br>
---<br>
<br>
With this patch we now successfully read gl_Layer in fragment shaders. Layered<br>
rendering still does not work though, probably because we still need to hook up<br>
the layer_id stuff that Jason added some time ago. I'll look into that next.<br>
<br>
src/intel/vulkan/genX_<wbr>pipeline.c | 20 ++++++++++++++++----<br>
1 file changed, 16 insertions(+), 4 deletions(-)<br>
<br>
diff --git a/src/intel/vulkan/genX_<wbr>pipeline.c b/src/intel/vulkan/genX_<wbr>pipeline.c<br>
index 845d020..c1d8ae6 100644<br>
--- a/src/intel/vulkan/genX_<wbr>pipeline.c<br>
+++ b/src/intel/vulkan/genX_<wbr>pipeline.c<br>
@@ -291,6 +291,8 @@ emit_3dstate_sbe(struct anv_pipeline *pipeline)<br>
# define swiz sbe<br>
#endif<br>
<br>
+ /* Skip the VUE header and position slots by default */<br>
+ unsigned urb_entry_read_offset = 1;<br>
int max_source_attr = 0;<br>
for (int attr = 0; attr < VARYING_SLOT_MAX; attr++) {<br>
int input_index = wm_prog_data->urb_setup[attr];<br>
@@ -298,6 +300,12 @@ emit_3dstate_sbe(struct anv_pipeline *pipeline)<br>
if (input_index < 0)<br>
continue;<br>
<br>
+ /* gl_Layer is stored in the VUE header */<br>
+ if (attr == VARYING_SLOT_LAYER) {<br>
+ urb_entry_read_offset = 0;<br>
+ continue;<br>
+ }<br>
+<br>
if (attr == VARYING_SLOT_PNTC) {<br>
sbe.<wbr>PointSpriteTextureCoordinateEn<wbr>able = 1 << input_index;<br>
continue;<br>
@@ -322,18 +330,22 @@ emit_3dstate_sbe(struct anv_pipeline *pipeline)<br>
swiz.Attribute[input_index].<wbr>ComponentOverrideZ = true;<br>
swiz.Attribute[input_index].<wbr>ComponentOverrideW = true;<br>
} else {<br>
- assert(slot >= 2);<br>
- const int source_attr = slot - 2;<br>
- max_source_attr = MAX2(max_source_attr, source_attr);<br>
/* We have to subtract two slots to accout for the URB entry output<br>
* read offset in the VS and GS stages.<br>
*/<br>
+ assert(slot >= 2);<br>
+ const int source_attr = slot - 2 * urb_entry_read_offset;<br>
+ max_source_attr = MAX2(max_source_attr, source_attr);<br>
swiz.Attribute[input_index].<wbr>SourceAttribute = source_attr;<br>
}<br>
}<br>
<br>
- sbe.VertexURBEntryReadOffset = 1; /* Skip the VUE header and position slots */<br>
+ sbe.VertexURBEntryReadOffset = urb_entry_read_offset;<br>
sbe.VertexURBEntryReadLength = DIV_ROUND_UP(max_source_attr + 1, 2);<br>
+#if GEN_GEN >= 8<br>
+ sbe.<wbr>ForceVertexURBEntryReadOffset = true;<br>
+ sbe.<wbr>ForceVertexURBEntryReadLength = true;<br>
+#endif<br>
<br>
uint32_t *dw = anv_batch_emit_dwords(&<wbr>pipeline->batch,<br>
GENX(3DSTATE_SBE_length));<br>
--<br>
2.7.4<br>
<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></div>