panvk: Implement VK_EXT_vertex_attribute_divisor

Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15295>
This commit is contained in:
Jason Ekstrand 2022-03-10 16:21:34 -06:00
parent 58587c32cb
commit acbb0d86f7
3 changed files with 21 additions and 0 deletions

View File

@ -7,6 +7,7 @@ include = [
"dEQP-VK.api.buffer_view.*",
"dEQP-VK.api.copy_and_blit.core.*",
"dEQP-VK.compute.builtin_var.*",
"dEQP-VK.draw.renderpass.instanced.draw_indexed_vk_*",
"dEQP-VK.glsl.builtin.function.integer.usubborrow.*",
"dEQP-VK.glsl.builtin.precision.frexp.*",
"dEQP-VK.glsl.builtin.precision.ldexp.*",

View File

@ -152,6 +152,7 @@ panvk_get_device_extensions(const struct panvk_physical_device *device,
#endif
.EXT_custom_border_color = true,
.EXT_index_type_uint8 = true,
.EXT_vertex_attribute_divisor = true,
};
}
@ -702,6 +703,13 @@ panvk_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
properties->maxMemoryAllocationSize = 0xFFFFFFFFull;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT: {
VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT *properties =
(VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT *)ext;
/* We have to restrict this a bit for multiview */
properties->maxVertexAttribDivisor = UINT32_MAX / (16 * 2048);
break;
}
default:
break;
}

View File

@ -875,6 +875,10 @@ panvk_pipeline_builder_parse_vertex_input(struct panvk_pipeline_builder *builder
const VkPipelineVertexInputStateCreateInfo *info =
builder->create_info.gfx->pVertexInputState;
const VkPipelineVertexInputDivisorStateCreateInfoEXT *div_info =
vk_find_struct_const(info->pNext,
PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT);
for (unsigned i = 0; i < info->vertexBindingDescriptionCount; i++) {
const VkVertexInputBindingDescription *desc =
&info->pVertexBindingDescriptions[i];
@ -895,6 +899,14 @@ panvk_pipeline_builder_parse_vertex_input(struct panvk_pipeline_builder *builder
attribs->attrib[desc->location].offset = desc->offset;
}
if (div_info) {
for (unsigned i = 0; i < div_info->vertexBindingDivisorCount; i++) {
const VkVertexInputBindingDivisorDescriptionEXT *div =
&div_info->pVertexBindingDivisors[i];
attribs->buf[div->binding].instance_divisor = div->divisor;
}
}
const struct pan_shader_info *vs =
&builder->shaders[MESA_SHADER_VERTEX]->info;