Mesa (main): v3dv: Implement VK_EXT_provoking_vertex
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Aug 17 08:04:55 UTC 2021
Module: Mesa
Branch: main
Commit: 123590b88c007cd753c5c22515057f72e295c344
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=123590b88c007cd753c5c22515057f72e295c344
Author: Ella-0 <estanforth at igalia.com>
Date: Sun Aug 15 14:50:39 2021 +0000
v3dv: Implement VK_EXT_provoking_vertex
Reviewed-by: Alejandro Piñeiro <apinheiro at igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12382>
---
docs/features.txt | 2 +-
src/broadcom/vulkan/v3dv_device.c | 17 +++++++++++++++++
src/broadcom/vulkan/v3dv_pipeline.c | 8 +++++++-
src/broadcom/vulkan/v3dvx_pipeline.c | 12 ++++++++++--
src/broadcom/vulkan/v3dvx_private.h | 1 +
5 files changed, 36 insertions(+), 4 deletions(-)
diff --git a/docs/features.txt b/docs/features.txt
index a90c99e3879..dc4c330c6be 100644
--- a/docs/features.txt
+++ b/docs/features.txt
@@ -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)
diff --git a/src/broadcom/vulkan/v3dv_device.c b/src/broadcom/vulkan/v3dv_device.c
index 049b321f283..bcd5d23920d 100644
--- a/src/broadcom/vulkan/v3dv_device.c
+++ b/src/broadcom/vulkan/v3dv_device.c
@@ -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;
diff --git a/src/broadcom/vulkan/v3dv_pipeline.c b/src/broadcom/vulkan/v3dv_pipeline.c
index 2de574bb1d6..bd2854636f7 100644
--- a/src/broadcom/vulkan/v3dv_pipeline.c
+++ b/src/broadcom/vulkan/v3dv_pipeline.c
@@ -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);
diff --git a/src/broadcom/vulkan/v3dvx_pipeline.c b/src/broadcom/vulkan/v3dvx_pipeline.c
index 8fb224df845..04002311775 100644
--- a/src/broadcom/vulkan/v3dvx_pipeline.c
+++ b/src/broadcom/vulkan/v3dvx_pipeline.c
@@ -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);
}
diff --git a/src/broadcom/vulkan/v3dvx_private.h b/src/broadcom/vulkan/v3dvx_private.h
index 47ac2947c08..18e7a1af869 100644
--- a/src/broadcom/vulkan/v3dvx_private.h
+++ b/src/broadcom/vulkan/v3dvx_private.h
@@ -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,
More information about the mesa-commit
mailing list