Commit bd0f9283 authored by Ella-0's avatar Ella-0
Browse files

v3dv: Implement VK_EXT_vertex_attribute_divisor


Reviewed-by: Alejandro Piñeiro's avatarAlejandro Piñeiro <apinheiro@igalia.com>
Part-of: <!12524>
parent 43790a4d
......@@ -553,7 +553,7 @@ Khronos extensions that are not part of any Vulkan version:
VK_EXT_subgroup_size_control DONE (anv, radv)
VK_EXT_texel_buffer_alignment DONE (anv, radv)
VK_EXT_transform_feedback DONE (anv, lvp, radv, tu, vn)
VK_EXT_vertex_attribute_divisor DONE (anv, radv, lvp, tu)
VK_EXT_vertex_attribute_divisor DONE (anv, radv, lvp, tu, v3dv)
VK_EXT_vertex_input_dynamic_state DONE (lvp)
VK_EXT_ycbcr_image_arrays DONE (anv, radv)
VK_ANDROID_external_memory_android_hardware_buffer DONE (anv, radv)
......
......@@ -148,6 +148,7 @@ get_device_extensions(const struct v3dv_physical_device *device,
.EXT_pipeline_creation_feedback = true,
.EXT_private_data = true,
.EXT_provoking_vertex = true,
.EXT_vertex_attribute_divisor = true,
};
}
......@@ -1125,6 +1126,14 @@ v3dv_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT: {
VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT *features =
(void *) ext;
features->vertexAttributeInstanceRateDivisor = true;
features->vertexAttributeInstanceRateZeroDivisor = false;
break;
}
/* Vulkan 1.1 */
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES: {
VkPhysicalDeviceVulkan11Features *features =
......@@ -1433,6 +1442,12 @@ v3dv_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
props->transformFeedbackPreservesTriangleFanProvokingVertex = false;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT: {
VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT *props =
(VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT *)ext;
props->maxVertexAttribDivisor = 0xffff;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES: {
VkPhysicalDeviceIDProperties *id_props =
(VkPhysicalDeviceIDProperties *)ext;
......
......@@ -3002,8 +3002,14 @@ pipeline_init(struct v3dv_pipeline *pipeline,
return result;
}
v3dv_X(device, pipeline_pack_compile_state)(pipeline,
pCreateInfo->pVertexInputState);
const VkPipelineVertexInputStateCreateInfo *vi_info =
pCreateInfo->pVertexInputState;
const VkPipelineVertexInputDivisorStateCreateInfoEXT *vd_info =
vk_find_struct_const(vi_info->pNext,
PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT);
v3dv_X(device, pipeline_pack_compile_state)(pipeline, vi_info, vd_info);
if (pipeline_has_integer_vertex_attrib(pipeline)) {
pipeline->default_attribute_values =
......
......@@ -599,7 +599,8 @@ pack_shader_state_attribute_record(struct v3dv_pipeline *pipeline,
void
v3dX(pipeline_pack_compile_state)(struct v3dv_pipeline *pipeline,
const VkPipelineVertexInputStateCreateInfo *vi_info)
const VkPipelineVertexInputStateCreateInfo *vi_info,
const VkPipelineVertexInputDivisorStateCreateInfoEXT *vd_info)
{
pack_shader_state_record(pipeline);
pack_vcm_cache_size(pipeline);
......@@ -613,6 +614,15 @@ v3dX(pipeline_pack_compile_state)(struct v3dv_pipeline *pipeline,
pipeline->vb[desc->binding].instance_divisor = desc->inputRate;
}
if (vd_info) {
for (uint32_t i = 0; i < vd_info->vertexBindingDivisorCount; i++) {
const VkVertexInputBindingDivisorDescriptionEXT *desc =
&vd_info->pVertexBindingDivisors[i];
pipeline->vb[desc->binding].instance_divisor = desc->divisor;
}
}
pipeline->va_count = 0;
struct v3d_vs_prog_data *prog_data_vs =
pipeline->shared_data->variants[BROADCOM_SHADER_VERTEX]->prog_data.vs;
......
......@@ -298,8 +298,8 @@ v3dX(pipeline_pack_state)(struct v3dv_pipeline *pipeline,
const VkPipelineMultisampleStateCreateInfo *ms_info);
void
v3dX(pipeline_pack_compile_state)(struct v3dv_pipeline *pipeline,
const VkPipelineVertexInputStateCreateInfo *vi_info);
const VkPipelineVertexInputStateCreateInfo *vi_info,
const VkPipelineVertexInputDivisorStateCreateInfoEXT *vd_info);
/* Used at v3dv_queue */
void
v3dX(job_emit_noop)(struct v3dv_job *job);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment