From: Jason Ekstrand Date: Fri, 12 May 2017 23:22:58 +0000 (-0700) Subject: intel/blorp: Use designated initializers to set up VERTEX_ELEMENTS X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=110061afa214fbefb97ed5efb3bbe277d0354f67;p=mesa.git intel/blorp: Use designated initializers to set up VERTEX_ELEMENTS We also add a slot variable and use it as an iterator. This will make it much easier to conditionally put something between the header and the vertex position. Reviewed-by: Topi Pohjolainen --- diff --git a/src/intel/blorp/blorp_genX_exec.h b/src/intel/blorp/blorp_genX_exec.h index 31cb0491e8c..c6c14f5e92e 100644 --- a/src/intel/blorp/blorp_genX_exec.h +++ b/src/intel/blorp/blorp_genX_exec.h @@ -356,44 +356,55 @@ blorp_emit_vertex_elements(struct blorp_batch *batch, * * See the vertex element setup below. */ - ve[0].VertexBufferIndex = 1; - ve[0].Valid = true; - ve[0].SourceElementFormat = ISL_FORMAT_R32G32B32A32_FLOAT; - ve[0].SourceElementOffset = 0; - ve[0].Component0Control = VFCOMP_STORE_SRC; - - /* From Gen8 onwards hardware is no more instructed to overwrite components - * using an element specifier. Instead one has separate 3DSTATE_VF_SGVS - * (System Generated Value Setup) state packet for it. - */ + unsigned slot = 0; + + ve[slot] = (struct GENX(VERTEX_ELEMENT_STATE)) { + .VertexBufferIndex = 1, + .Valid = true, + .SourceElementFormat = ISL_FORMAT_R32G32B32A32_FLOAT, + .SourceElementOffset = 0, + .Component0Control = VFCOMP_STORE_SRC, + + /* From Gen8 onwards hardware is no more instructed to overwrite + * components using an element specifier. Instead one has separate + * 3DSTATE_VF_SGVS (System Generated Value Setup) state packet for it. + */ #if GEN_GEN >= 8 - ve[0].Component1Control = VFCOMP_STORE_0; + .Component1Control = VFCOMP_STORE_0, #elif GEN_GEN >= 5 - ve[0].Component1Control = VFCOMP_STORE_IID; + .Component1Control = VFCOMP_STORE_IID, #else - ve[0].Component1Control = VFCOMP_STORE_0; + .Component1Control = VFCOMP_STORE_0, #endif - ve[0].Component2Control = VFCOMP_STORE_SRC; - ve[0].Component3Control = VFCOMP_STORE_SRC; - - ve[1].VertexBufferIndex = 0; - ve[1].Valid = true; - ve[1].SourceElementFormat = ISL_FORMAT_R32G32B32_FLOAT; - ve[1].SourceElementOffset = 0; - ve[1].Component0Control = VFCOMP_STORE_SRC; - ve[1].Component1Control = VFCOMP_STORE_SRC; - ve[1].Component2Control = VFCOMP_STORE_SRC; - ve[1].Component3Control = VFCOMP_STORE_1_FP; + .Component2Control = VFCOMP_STORE_SRC, + .Component3Control = VFCOMP_STORE_SRC, + }; + slot++; + + ve[slot] = (struct GENX(VERTEX_ELEMENT_STATE)) { + .VertexBufferIndex = 0, + .Valid = true, + .SourceElementFormat = ISL_FORMAT_R32G32B32_FLOAT, + .SourceElementOffset = 0, + .Component0Control = VFCOMP_STORE_SRC, + .Component1Control = VFCOMP_STORE_SRC, + .Component2Control = VFCOMP_STORE_SRC, + .Component3Control = VFCOMP_STORE_1_FP, + }; + slot++; for (unsigned i = 0; i < num_varyings; ++i) { - ve[i + 2].VertexBufferIndex = 1; - ve[i + 2].Valid = true; - ve[i + 2].SourceElementFormat = ISL_FORMAT_R32G32B32A32_FLOAT; - ve[i + 2].SourceElementOffset = 16 + i * 4 * sizeof(float); - ve[i + 2].Component0Control = VFCOMP_STORE_SRC; - ve[i + 2].Component1Control = VFCOMP_STORE_SRC; - ve[i + 2].Component2Control = VFCOMP_STORE_SRC; - ve[i + 2].Component3Control = VFCOMP_STORE_SRC; + ve[slot] = (struct GENX(VERTEX_ELEMENT_STATE)) { + .VertexBufferIndex = 1, + .Valid = true, + .SourceElementFormat = ISL_FORMAT_R32G32B32A32_FLOAT, + .SourceElementOffset = 16 + i * 4 * sizeof(float), + .Component0Control = VFCOMP_STORE_SRC, + .Component1Control = VFCOMP_STORE_SRC, + .Component2Control = VFCOMP_STORE_SRC, + .Component3Control = VFCOMP_STORE_SRC, + }; + slot++; } const unsigned num_dwords =