lavapipe: implement VK_EXT_vertex_attribute_divisor (v2)

This is more or less just compile-tested, but this seems about right to
me. I see the extension being supported when running on top of Zink,
which makes me happy enough for now ;)

v2: fixed up to copy the structs on pipeline create [airlied]
gallium doesn't support the 0 divisor case yet.

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7930>
This commit is contained in:
Erik Faye-Lund
2020-12-04 20:21:51 +01:00
committed by Dave Airlie
parent 5b0b03733a
commit 3f0da800eb
4 changed files with 65 additions and 3 deletions

View File

@@ -22,7 +22,7 @@
*/
#include "lvp_private.h"
#include "vk_util.h"
#include "glsl_types.h"
#include "spirv/nir_spirv.h"
#include "nir/nir_builder.h"
@@ -165,6 +165,29 @@ deep_copy_vertex_input_state(void *mem_ctx,
VkVertexInputAttributeDescription,
src->vertexAttributeDescriptionCount);
if (src->pNext) {
vk_foreach_struct(ext, src->pNext) {
switch (ext->sType) {
case VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT: {
VkPipelineVertexInputDivisorStateCreateInfoEXT *ext_src = (VkPipelineVertexInputDivisorStateCreateInfoEXT *)ext;;
VkPipelineVertexInputDivisorStateCreateInfoEXT *ext_dst = ralloc(mem_ctx, VkPipelineVertexInputDivisorStateCreateInfoEXT);
ext_dst->sType = ext_src->sType;
ext_dst->vertexBindingDivisorCount = ext_src->vertexBindingDivisorCount;
LVP_PIPELINE_DUP(ext_dst->pVertexBindingDivisors,
ext_src->pVertexBindingDivisors,
VkVertexInputBindingDivisorDescriptionEXT,
ext_src->vertexBindingDivisorCount);
dst->pNext = ext_dst;
break;
}
default:
break;
}
}
}
return VK_SUCCESS;
}