aboutsummaryrefslogtreecommitdiffstats
path: root/src/intel
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-05-12 16:22:58 -0700
committerJason Ekstrand <[email protected]>2017-05-26 07:58:01 -0700
commit110061afa214fbefb97ed5efb3bbe277d0354f67 (patch)
tree477834f9fa65fdcebb27fbb503c861fabfce1c31 /src/intel
parentac79806766c4b5874c9393c4f9ec45816fe6e8e2 (diff)
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 <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r--src/intel/blorp/blorp_genX_exec.h75
1 files changed, 43 insertions, 32 deletions
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 =