anv/pipeline: Use a per-VB struct instead of separate arrays
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
This commit is contained in:
@@ -1407,7 +1407,7 @@ anv_pipeline_init(struct anv_pipeline *pipeline,
|
||||
const VkVertexInputBindingDescription *desc =
|
||||
&vi_info->pVertexBindingDescriptions[i];
|
||||
|
||||
pipeline->binding_stride[desc->binding] = desc->stride;
|
||||
pipeline->vb[desc->binding].stride = desc->stride;
|
||||
|
||||
/* Step rate is programmed per vertex element (attribute), not
|
||||
* binding. Set up a map of which bindings step per instance, for
|
||||
@@ -1415,10 +1415,10 @@ anv_pipeline_init(struct anv_pipeline *pipeline,
|
||||
switch (desc->inputRate) {
|
||||
default:
|
||||
case VK_VERTEX_INPUT_RATE_VERTEX:
|
||||
pipeline->instancing_enable[desc->binding] = false;
|
||||
pipeline->vb[desc->binding].instanced = false;
|
||||
break;
|
||||
case VK_VERTEX_INPUT_RATE_INSTANCE:
|
||||
pipeline->instancing_enable[desc->binding] = true;
|
||||
pipeline->vb[desc->binding].instanced = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -2383,8 +2383,11 @@ struct anv_pipeline {
|
||||
struct anv_state blend_state;
|
||||
|
||||
uint32_t vb_used;
|
||||
uint32_t binding_stride[MAX_VBS];
|
||||
bool instancing_enable[MAX_VBS];
|
||||
struct anv_pipeline_vertex_binding {
|
||||
uint32_t stride;
|
||||
bool instanced;
|
||||
} vb[MAX_VBS];
|
||||
|
||||
bool primitive_restart;
|
||||
uint32_t topology;
|
||||
|
||||
|
@@ -2517,7 +2517,7 @@ genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer)
|
||||
#if GEN_GEN >= 8
|
||||
.MemoryObjectControlState = GENX(MOCS),
|
||||
#else
|
||||
.BufferAccessType = pipeline->instancing_enable[vb] ? INSTANCEDATA : VERTEXDATA,
|
||||
.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
|
||||
@@ -2528,7 +2528,7 @@ genX(cmd_buffer_flush_state)(struct anv_cmd_buffer *cmd_buffer)
|
||||
#endif
|
||||
|
||||
.AddressModifyEnable = true,
|
||||
.BufferPitch = pipeline->binding_stride[vb],
|
||||
.BufferPitch = pipeline->vb[vb].stride,
|
||||
.BufferStartingAddress = anv_address_add(buffer->address, offset),
|
||||
|
||||
#if GEN_GEN >= 8
|
||||
|
@@ -154,7 +154,7 @@ emit_vertex_input(struct anv_pipeline *pipeline,
|
||||
* VERTEX_BUFFER_STATE which we emit later.
|
||||
*/
|
||||
anv_batch_emit(&pipeline->batch, GENX(3DSTATE_VF_INSTANCING), vfi) {
|
||||
vfi.InstancingEnable = pipeline->instancing_enable[desc->binding];
|
||||
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
|
||||
|
Reference in New Issue
Block a user