Module: Mesa
Branch: master
Commit: 775191cd99a772acda37f41790ff09b93c7a00ba
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=775191cd99a772acda37f41790ff09b93c7a00ba

Author: Samuel Pitoiset <[email protected]>
Date:   Mon Apr  8 14:11:51 2019 +0200

radv: fix getting the vertex strides if the bindings aren't contiguous

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=110349
Fixes: a66b186bebf ("radv: use typed buffer loads for vertex input fetches")
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>

---

 src/amd/vulkan/radv_pipeline.c | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index 83a06226ada..d96ae9a4223 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -1827,6 +1827,20 @@ radv_link_shaders(struct radv_pipeline *pipeline, 
nir_shader **shaders)
        }
 }
 
+static uint32_t
+radv_get_attrib_stride(const VkPipelineVertexInputStateCreateInfo *input_state,
+                      uint32_t attrib_binding)
+{
+       for (uint32_t i = 0; i < input_state->vertexBindingDescriptionCount; 
i++) {
+               const VkVertexInputBindingDescription *input_binding =
+                       &input_state->pVertexBindingDescriptions[i];
+
+               if (input_binding->binding == attrib_binding)
+                       return input_binding->stride;
+       }
+
+       return 0;
+}
 
 static struct radv_pipeline_key
 radv_generate_graphics_pipeline_key(struct radv_pipeline *pipeline,
@@ -1886,7 +1900,7 @@ radv_generate_graphics_pipeline_key(struct radv_pipeline 
*pipeline,
                key.vertex_attribute_formats[location] = data_format | 
(num_format << 4);
                key.vertex_attribute_bindings[location] = desc->binding;
                key.vertex_attribute_offsets[location] = desc->offset;
-               key.vertex_attribute_strides[location] = 
input_state->pVertexBindingDescriptions[desc->binding].stride;
+               key.vertex_attribute_strides[location] = 
radv_get_attrib_stride(input_state, desc->binding);
 
                if (pipeline->device->physical_device->rad_info.chip_class <= 
VI &&
                    pipeline->device->physical_device->rad_info.family != 
CHIP_STONEY) {

_______________________________________________
mesa-commit mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-commit

Reply via email to