Commit 123590b8 authored by Ella-0's avatar Ella-0 Committed by Marge Bot
Browse files

v3dv: Implement VK_EXT_provoking_vertex


Reviewed-by: Alejandro Piñeiro's avatarAlejandro Piñeiro <apinheiro@igalia.com>
Part-of: <!12382>
parent 80e5e059
Pipeline #382786 waiting for manual action with stages
in 2 minutes and 54 seconds
......@@ -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)
......
......@@ -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;
......
......@@ -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);
......
......@@ -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);
}
......
......@@ -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,
......
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