radv: Use correct bindings for inputRate in key generation.
authorBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Thu, 18 Jan 2018 14:35:11 +0000 (15:35 +0100)
committerBas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Fri, 19 Jan 2018 00:54:59 +0000 (01:54 +0100)
The bindings also have an index field.

Fixes: 49d035122e "radv: Add single pipeline cache key."
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104677
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
src/amd/vulkan/radv_pipeline.c

index c3c17af8500d60ab1c7ef033cd44a7582c1aba95..5f824796fe5413aa4c55dc70f618d72e4fcfb21a 100644 (file)
@@ -1726,10 +1726,16 @@ radv_generate_graphics_pipeline_key(struct radv_pipeline *pipeline,
 
        key.has_multiview_view_index = has_view_index;
 
+       uint32_t binding_input_rate = 0;
+       for (unsigned i = 0; i < input_state->vertexBindingDescriptionCount; ++i) {
+               if (input_state->pVertexBindingDescriptions[i].inputRate)
+                       binding_input_rate |= 1u << input_state->pVertexBindingDescriptions[i].binding;
+       }
+
        for (unsigned i = 0; i < input_state->vertexAttributeDescriptionCount; ++i) {
                unsigned binding;
                binding = input_state->pVertexAttributeDescriptions[i].binding;
-               if (input_state->pVertexBindingDescriptions[binding].inputRate)
+               if (binding_input_rate & (1u << binding))
                        key.instance_rate_inputs |= 1u << input_state->pVertexAttributeDescriptions[i].location;
        }