summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-07-02 12:44:49 -0700
committerJason Ekstrand <[email protected]>2018-07-09 15:37:51 -0700
commit32f4feb5a0d515c7ec1aaa774cefd8496414d53f (patch)
treee7889aa74e6af2f724d0b901ba4e72df60de36df
parent6db20229ab6f1324a191d0a1b13437e31a9ec9cd (diff)
anv/pipeline: Use a per-VB struct instead of separate arrays
Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]>
-rw-r--r--src/intel/vulkan/anv_pipeline.c6
-rw-r--r--src/intel/vulkan/anv_private.h7
-rw-r--r--src/intel/vulkan/genX_cmd_buffer.c4
-rw-r--r--src/intel/vulkan/genX_pipeline.c2
4 files changed, 11 insertions, 8 deletions
diff --git a/src/intel/vulkan/anv_pipeline.c b/src/intel/vulkan/anv_pipeline.c
index 1565fe7a7a3..f0bf80a1cf0 100644
--- a/src/intel/vulkan/anv_pipeline.c
+++ b/src/intel/vulkan/anv_pipeline.c
@@ -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;
}
}
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 1763b81fbc2..ae763e4e2eb 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -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;
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index 8bb08a45d03..7033e978144 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -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
diff --git a/src/intel/vulkan/genX_pipeline.c b/src/intel/vulkan/genX_pipeline.c
index 70097e46285..f4a455cce67 100644
--- a/src/intel/vulkan/genX_pipeline.c
+++ b/src/intel/vulkan/genX_pipeline.c
@@ -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