pipeline->vb[desc->binding].instanced = true;
break;
}
+
+ pipeline->vb[desc->binding].instance_divisor = 1;
+ }
+
+
+ /* Our implementation of VK_KHR_multiview uses instancing to draw the
+ * different views. If the client asks for instancing, we need to multiply
+ * the instance divisor by the number of views ensure that we repeat the
+ * client's per-instance data once for each view.
+ */
+ if (pipeline->subpass->view_mask) {
+ const uint32_t view_count = anv_subpass_view_count(pipeline->subpass);
+ for (uint32_t vb = 0; vb < MAX_VBS; vb++) {
+ if (pipeline->vb[vb].instanced)
+ pipeline->vb[vb].instance_divisor *= view_count;
+ }
}
const VkPipelineInputAssemblyStateCreateInfo *ia_info =
struct anv_pipeline_vertex_binding {
uint32_t stride;
bool instanced;
+ uint32_t instance_divisor;
} vb[MAX_VBS];
bool primitive_restart;
.MemoryObjectControlState = GENX(MOCS),
#else
.BufferAccessType = pipeline->vb[vb].instanced ? INSTANCEDATA : VERTEXDATA,
- /* Our implementation of VK_KHR_multiview uses instancing to draw
- * the different views. If the client asks for instancing, we
- * need to use the Instance Data Step Rate to ensure that we
- * repeat the client's per-instance data once for each view.
- */
- .InstanceDataStepRate = anv_subpass_view_count(pipeline->subpass),
+ .InstanceDataStepRate = pipeline->vb[vb].instance_divisor,
.VertexBufferMemoryObjectControlState = GENX(MOCS),
#endif
anv_batch_emit(&pipeline->batch, GENX(3DSTATE_VF_INSTANCING), vfi) {
vfi.InstancingEnable = pipeline->vb[desc->binding].instanced;
vfi.VertexElementIndex = slot;
- /* Our implementation of VK_KHR_multiview uses instancing to draw
- * the different views. If the client asks for instancing, we
- * need to use the Instance Data Step Rate to ensure that we
- * repeat the client's per-instance data once for each view.
- */
- vfi.InstanceDataStepRate = anv_subpass_view_count(pipeline->subpass);
+ vfi.InstanceDataStepRate =
+ pipeline->vb[desc->binding].instance_divisor;
}
#endif
}