v3dv: Implement VK_EXT_provoking_vertex

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12382>
This commit is contained in:
Ella-0 2021-08-15 14:50:39 +00:00 committed by Marge Bot
parent 80e5e059fa
commit 123590b88c
5 changed files with 36 additions and 4 deletions

View File

@ -538,7 +538,7 @@ Khronos extensions that are not part of any Vulkan version:
VK_EXT_pipeline_creation_feedback DONE (anv, radv)
VK_EXT_post_depth_coverage DONE (anv/gfx10+, lvp, radv)
VK_EXT_private_data DONE (anv, lvp, radv, tu, v3dv)
VK_EXT_provoking_vertex DONE (anv, lvp, radv, tu)
VK_EXT_provoking_vertex DONE (anv, lvp, radv, tu, v3dv)
VK_EXT_queue_family_foreign DONE (anv, radv)
VK_EXT_robustness2 DONE (anv, radv, tu)
VK_EXT_sample_locations DONE (anv, radv/gfx9-, tu/a650)

View File

@ -146,6 +146,7 @@ get_device_extensions(const struct v3dv_physical_device *device,
.EXT_physical_device_drm = true,
.EXT_pipeline_creation_cache_control = true,
.EXT_private_data = true,
.EXT_provoking_vertex = true,
};
}
@ -1113,6 +1114,14 @@ v3dv_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice,
VkPhysicalDevicePipelineCreationCacheControlFeaturesEXT *features = (void *) ext;
features->pipelineCreationCacheControl = true;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT: {
VkPhysicalDeviceProvokingVertexFeaturesEXT *features = (void *) ext;
features->provokingVertexLast = true;
/* FIXME: update when supporting EXT_transform_feedback */
features->transformFeedbackPreservesProvokingVertex = false;
break;
}
/* Vulkan 1.1 */
@ -1415,6 +1424,14 @@ v3dv_GetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice,
props->maxCustomBorderColorSamplers = V3D_MAX_TEXTURE_SAMPLERS;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_PROPERTIES_EXT: {
VkPhysicalDeviceProvokingVertexPropertiesEXT *props =
(VkPhysicalDeviceProvokingVertexPropertiesEXT *)ext;
props->provokingVertexModePerPipeline = true;
/* FIXME: update when supporting EXT_transform_feedback */
props->transformFeedbackPreservesTriangleFanProvokingVertex = false;
break;
}
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES: {
VkPhysicalDeviceIDProperties *id_props =
(VkPhysicalDeviceIDProperties *)ext;

View File

@ -2849,6 +2849,12 @@ pipeline_init(struct v3dv_pipeline *pipeline,
const VkPipelineRasterizationStateCreateInfo *rs_info =
raster_enabled ? pCreateInfo->pRasterizationState : NULL;
const VkPipelineRasterizationProvokingVertexStateCreateInfoEXT *pv_info =
rs_info ? vk_find_struct_const(
rs_info->pNext,
PIPELINE_RASTERIZATION_PROVOKING_VERTEX_STATE_CREATE_INFO_EXT) :
NULL;
const VkPipelineColorBlendStateCreateInfo *cb_info =
raster_enabled ? pCreateInfo->pColorBlendState : NULL;
@ -2870,7 +2876,7 @@ pipeline_init(struct v3dv_pipeline *pipeline,
assert(!ds_info || !ds_info->depthBoundsTestEnable);
v3dv_X(device, pipeline_pack_state)(pipeline, cb_info, ds_info,
rs_info, ms_info);
rs_info, pv_info, ms_info);
pipeline_set_ez_state(pipeline, ds_info);
enable_depth_bias(pipeline, rs_info);

View File

@ -147,6 +147,7 @@ static void
pack_cfg_bits(struct v3dv_pipeline *pipeline,
const VkPipelineDepthStencilStateCreateInfo *ds_info,
const VkPipelineRasterizationStateCreateInfo *rs_info,
const VkPipelineRasterizationProvokingVertexStateCreateInfoEXT *pv_info,
const VkPipelineMultisampleStateCreateInfo *ms_info)
{
assert(sizeof(pipeline->cfg_bits) == cl_packet_length(CFG_BITS));
@ -192,7 +193,13 @@ pack_cfg_bits(struct v3dv_pipeline *pipeline,
* First vertex is the Direct3D style for provoking vertex. OpenGL uses
* the last vertex by default.
*/
config.direct3d_provoking_vertex = true;
if (pv_info) {
config.direct3d_provoking_vertex =
pv_info->provokingVertexMode ==
VK_PROVOKING_VERTEX_MODE_FIRST_VERTEX_EXT;
} else {
config.direct3d_provoking_vertex = true;
}
config.blend_enable = pipeline->blend.enables != 0;
@ -336,10 +343,11 @@ v3dX(pipeline_pack_state)(struct v3dv_pipeline *pipeline,
const VkPipelineColorBlendStateCreateInfo *cb_info,
const VkPipelineDepthStencilStateCreateInfo *ds_info,
const VkPipelineRasterizationStateCreateInfo *rs_info,
const VkPipelineRasterizationProvokingVertexStateCreateInfoEXT *pv_info,
const VkPipelineMultisampleStateCreateInfo *ms_info)
{
pack_blend(pipeline, cb_info);
pack_cfg_bits(pipeline, ds_info, rs_info, ms_info);
pack_cfg_bits(pipeline, ds_info, rs_info, pv_info, ms_info);
pack_stencil_cfg(pipeline, ds_info);
}

View File

@ -294,6 +294,7 @@ v3dX(pipeline_pack_state)(struct v3dv_pipeline *pipeline,
const VkPipelineColorBlendStateCreateInfo *cb_info,
const VkPipelineDepthStencilStateCreateInfo *ds_info,
const VkPipelineRasterizationStateCreateInfo *rs_info,
const VkPipelineRasterizationProvokingVertexStateCreateInfoEXT *pv_info,
const VkPipelineMultisampleStateCreateInfo *ms_info);
void
v3dX(pipeline_pack_compile_state)(struct v3dv_pipeline *pipeline,