<p dir="ltr"></p>
<p dir="ltr">On Aug 31, 2016 9:06 AM, "Topi Pohjolainen" <<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a>> wrote:<br>
><br>
> This will indicate target layer (Render Target Array Index) needed<br>
> for layered clears.<br>
><br>
> v2: Use 3DSTATE_VF_SGVS for gen8+<br>
><br>
> Signed-off-by: Topi Pohjolainen <<a href="mailto:topi.pohjolainen@intel.com">topi.pohjolainen@intel.com</a>><br>
> ---<br>
> src/intel/blorp/blorp_genX_exec.h | 26 ++++++++++++++++++++++----<br>
> 1 file changed, 22 insertions(+), 4 deletions(-)<br>
><br>
> diff --git a/src/intel/blorp/blorp_genX_exec.h b/src/intel/blorp/blorp_genX_exec.h<br>
> index f44076e..7312847 100644<br>
> --- a/src/intel/blorp/blorp_genX_exec.h<br>
> +++ b/src/intel/blorp/blorp_genX_exec.h<br>
> @@ -298,8 +298,10 @@ blorp_emit_vertex_elements(struct blorp_batch *batch,<br>
> * the URB. This is controlled by the 3DSTATE_VERTEX_BUFFERS and<br>
> * 3DSTATE_VERTEX_ELEMENTS packets below. The VUE contents are as follows:<br>
> * dw0: Reserved, MBZ.<br>
> - * dw1: Render Target Array Index. The HiZ op does not use indexed<br>
> - * vertices, so set the dword to 0.<br>
> + * dw1: Render Target Array Index. Below vertex fetcher gets programmed<br>
> + * to assign this with primitive instance identifier which will be<br>
> + * used for layered clears. All other renders have only one instance<br>
> + * and therefore the value will be effectively zero.<br>
> * dw2: Viewport Index. The HiZ op disables viewport mapping and<br>
> * scissoring, so set the dword to 0.<br>
> * dw3: Point Width: The HiZ op does not emit the POINTLIST primitive,<br>
> @@ -318,7 +320,7 @@ blorp_emit_vertex_elements(struct blorp_batch *batch,<br>
> * "Vertex URB Entry (VUE) Formats".<br>
> *<br>
> * Only vertex position X and Y are going to be variable, Z is fixed to<br>
> - * zero and W to one. Header words dw0-3 are all zero. There is no need to<br>
> + * zero and W to one. Header words dw0,2,3 are zero. There is no need to<br>
> * include the fixed values in the vertex buffer. Vertex fetcher can be<br>
> * instructed to fill vertex elements with constant values of one and zero<br>
> * instead of reading them from the buffer.<br>
> @@ -332,7 +334,16 @@ blorp_emit_vertex_elements(struct blorp_batch *batch,<br>
> ve[0].SourceElementFormat = ISL_FORMAT_R32G32B32A32_FLOAT;<br>
> ve[0].SourceElementOffset = 0;<br>
> ve[0].Component0Control = VFCOMP_STORE_0;<br>
> +<br>
> + /* From Gen8 onwards hardware is no more instructed to overwrite components<br>
> + * using an element specifier. Instead one has separate 3DSTATE_VF_SGVS<br>
> + * (System Generated Value Setup) state packet for it.<br>
> + */<br>
> +#if GEN_GEN >= 8<br>
> ve[0].Component1Control = VFCOMP_STORE_0;<br>
> +#else<br>
> + ve[0].Component1Control = VFCOMP_STORE_IID;<br>
> +#endif<br>
> ve[0].Component2Control = VFCOMP_STORE_0;<br>
> ve[0].Component3Control = VFCOMP_STORE_0;<br>
><br>
> @@ -366,7 +377,14 @@ blorp_emit_vertex_elements(struct blorp_batch *batch,<br>
> }<br>
><br>
> #if GEN_GEN >= 8<br>
> - blorp_emit(batch, GENX(3DSTATE_VF_SGVS), sgvs);<br>
> + /* Overwrite Render Target Array Index (2nd dword) in the VUE header with<br>
> + * primitive instance identifier. This is used for layered clears.<br>
> + */<br>
> + blorp_emit(batch, GENX(3DSTATE_VF_SGVS), sgvs) {<br>
> + sgvs.InstanceIDEnable = true;<br>
> + sgvs.InstanceIDComponentNumber = COMP_1;<br>
> + sgvs.InstanceIDElementOffset = 0;<br>
> + }</p>
<p dir="ltr">I love the fact that we can use SVGS this way. I cc'd Kristian so he can enjoy it too!</p>
<p dir="ltr">Reviewed-by: Jason Ekstrand <<a href="mailto:jason@jlekstrand.net">jason@jlekstrand.net</a>></p>
<p dir="ltr">> for (unsigned i = 0; i < num_elements; i++) {<br>
> blorp_emit(batch, GENX(3DSTATE_VF_INSTANCING), vf) {<br>
> --<br>
> 2.5.5<br>
><br>
> _______________________________________________<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">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br></p>