summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>2021-04-20 17:19:05 -0400
committerMarge Bot <eric+marge@anholt.net>2021-04-26 20:19:48 +0000
commit0e439541a5b8a785914ffa8a6a523ceef41ef813 (patch)
tree16c94f82d1434165698c1c830fa8940e7613472c
parenta60767ec266a06fe04362c4df715d467e155a8dc (diff)
lavapipe: implement VK_EXT_provoking_vertex
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10458>
-rw-r--r--src/gallium/frontends/lavapipe/lvp_device.c16
-rw-r--r--src/gallium/frontends/lavapipe/lvp_execute.c2
-rw-r--r--src/gallium/frontends/lavapipe/lvp_pipeline.c6
-rw-r--r--src/gallium/frontends/lavapipe/lvp_private.h1
4 files changed, 23 insertions, 2 deletions
diff --git a/src/gallium/frontends/lavapipe/lvp_device.c b/src/gallium/frontends/lavapipe/lvp_device.c
index e6759f60907..45ad59e4d90 100644
--- a/src/gallium/frontends/lavapipe/lvp_device.c
+++ b/src/gallium/frontends/lavapipe/lvp_device.c
@@ -137,6 +137,7 @@ static const struct vk_device_extension_table lvp_device_extensions_supported =
.EXT_transform_feedback = true,
.EXT_vertex_attribute_divisor = true,
.EXT_custom_border_color = true,
+ .EXT_provoking_vertex = true,
.GOOGLE_decorate_string = true,
.GOOGLE_hlsl_functionality1 = true,
};
@@ -636,7 +637,13 @@ VKAPI_ATTR void VKAPI_CALL lvp_GetPhysicalDeviceFeatures2(
features->customBorderColorWithoutFormat = true;
break;
}
-
+ case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_FEATURES_EXT: {
+ VkPhysicalDeviceProvokingVertexFeaturesEXT *features =
+ (VkPhysicalDeviceProvokingVertexFeaturesEXT*)ext;
+ features->provokingVertexLast = true;
+ features->transformFeedbackPreservesProvokingVertex = true;
+ break;
+ }
default:
break;
}
@@ -954,6 +961,13 @@ VKAPI_ATTR void VKAPI_CALL lvp_GetPhysicalDeviceProperties2(
properties->maxCustomBorderColorSamplers = 32 * 1024;
break;
}
+ case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROVOKING_VERTEX_PROPERTIES_EXT: {
+ VkPhysicalDeviceProvokingVertexPropertiesEXT *properties =
+ (VkPhysicalDeviceProvokingVertexPropertiesEXT*)ext;
+ properties->provokingVertexModePerPipeline = true;
+ properties->transformFeedbackPreservesTriangleFanProvokingVertex = true;
+ break;
+ }
default:
break;
}
diff --git a/src/gallium/frontends/lavapipe/lvp_execute.c b/src/gallium/frontends/lavapipe/lvp_execute.c
index fcb1375e414..b335f66efcb 100644
--- a/src/gallium/frontends/lavapipe/lvp_execute.c
+++ b/src/gallium/frontends/lavapipe/lvp_execute.c
@@ -463,7 +463,7 @@ static void handle_graphics_pipeline(struct lvp_cmd_buffer_entry *cmd,
state->rs_state.fill_front = vk_polygon_mode_to_pipe(rsc->polygonMode);
state->rs_state.fill_back = vk_polygon_mode_to_pipe(rsc->polygonMode);
state->rs_state.point_size_per_vertex = true;
- state->rs_state.flatshade_first = true;
+ state->rs_state.flatshade_first = !pipeline->provoking_vertex_last;
state->rs_state.point_quad_rasterization = true;
state->rs_state.clip_halfz = true;
state->rs_state.half_pixel_center = true;
diff --git a/src/gallium/frontends/lavapipe/lvp_pipeline.c b/src/gallium/frontends/lavapipe/lvp_pipeline.c
index 0bc7b6f1c82..40fd8671205 100644
--- a/src/gallium/frontends/lavapipe/lvp_pipeline.c
+++ b/src/gallium/frontends/lavapipe/lvp_pipeline.c
@@ -755,6 +755,12 @@ lvp_graphics_pipeline_init(struct lvp_pipeline *pipeline,
deep_copy_graphics_create_info(pipeline->mem_ctx, &pipeline->graphics_create_info, pCreateInfo);
pipeline->is_compute_pipeline = false;
+ const VkPipelineRasterizationProvokingVertexStateCreateInfoEXT *pv_state =
+ vk_find_struct_const(pCreateInfo->pRasterizationState,
+ PIPELINE_RASTERIZATION_PROVOKING_VERTEX_STATE_CREATE_INFO_EXT);
+ pipeline->provoking_vertex_last = pv_state && pv_state->provokingVertexMode == VK_PROVOKING_VERTEX_MODE_LAST_VERTEX_EXT;
+
+
for (uint32_t i = 0; i < pCreateInfo->stageCount; i++) {
VK_FROM_HANDLE(vk_shader_module, module,
pCreateInfo->pStages[i].module);
diff --git a/src/gallium/frontends/lavapipe/lvp_private.h b/src/gallium/frontends/lavapipe/lvp_private.h
index 86b2bf0264f..debca5e889c 100644
--- a/src/gallium/frontends/lavapipe/lvp_private.h
+++ b/src/gallium/frontends/lavapipe/lvp_private.h
@@ -475,6 +475,7 @@ struct lvp_pipeline {
void *shader_cso[PIPE_SHADER_TYPES];
VkGraphicsPipelineCreateInfo graphics_create_info;
VkComputePipelineCreateInfo compute_create_info;
+ bool provoking_vertex_last;
};
struct lvp_event {