From 17468aee4b770638878f21f22f5332d21feafb2e Mon Sep 17 00:00:00 2001 From: James Fitzpatrick Date: Tue, 30 Apr 2024 08:40:05 +0100 Subject: [PATCH] pvr: add support for (EXT|KHR)_line_rasterization Signed-off-by: James Fitzpatrick Acked-by: Erik Faye-Lund Part-of: --- docs/features.txt | 4 ++-- src/imagination/vulkan/pvr_cmd_buffer.c | 15 +++++++++++++++ src/imagination/vulkan/pvr_device.c | 11 +++++++++++ 3 files changed, 28 insertions(+), 2 deletions(-) diff --git a/docs/features.txt b/docs/features.txt index 05584a4982b..a424eb0b7c4 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -517,7 +517,7 @@ Vulkan 1.4 -- all DONE: anv, hk, lvp, nvk, panvk/v10+, radv/gfx8+, tu/a7xx+, vn VK_KHR_dynamic_rendering_local_read DONE (anv, lvp, nvk, panvk, radv, tu, vn) VK_KHR_global_priority DONE (anv, lvp, nvk, panvk, radv, tu, vn) VK_KHR_index_type_uint8 DONE (anv, lvp, nvk, panvk, pvr, radv, tu, v3dv, vn) - VK_KHR_line_rasterization DONE (anv, lvp, nvk, panvk, radv, tu, v3dv, vn) + VK_KHR_line_rasterization DONE (anv, lvp, nvk, panvk, pvr, radv, tu, v3dv, vn) VK_KHR_load_store_op_none DONE (anv, lvp, nvk, panvk, radv, tu, v3dv, vn) VK_KHR_maintenance5 DONE (anv, lvp, nvk, panvk/v10+, radv, tu, v3dv, vn) VK_KHR_maintenance6 DONE (anv, lvp, nvk, panvk/v10+, radv, tu, vn) @@ -635,7 +635,7 @@ Khronos extensions that are not part of any Vulkan version: VK_EXT_image_view_min_lod DONE (anv, hasvk, hk, nvk, radv, tu, vn) VK_EXT_index_type_uint8 DONE (anv, hasvk, hk, nvk, lvp, panvk, pvr, radv/gfx8+, tu, v3dv, vn) VK_EXT_legacy_vertex_attributes DONE (anv, lvp, nvk, radv, tu, vn) - VK_EXT_line_rasterization DONE (anv, hasvk, hk, nvk, panvk, lvp, radv, tu, v3dv, vn) + VK_EXT_line_rasterization DONE (anv, hasvk, hk, nvk, panvk, pvr, lvp, radv, tu, v3dv, vn) VK_EXT_load_store_op_none DONE (anv, hk, lvp, nvk, panvk, radv, tu, v3dv, vn) VK_EXT_memory_budget DONE (anv, hasvk, lvp, nvk, radv, tu, v3dv, vn) VK_EXT_memory_priority DONE (lvp, radv) diff --git a/src/imagination/vulkan/pvr_cmd_buffer.c b/src/imagination/vulkan/pvr_cmd_buffer.c index 958238ea55a..a6ac5025dfb 100644 --- a/src/imagination/vulkan/pvr_cmd_buffer.c +++ b/src/imagination/vulkan/pvr_cmd_buffer.c @@ -5900,6 +5900,21 @@ static void pvr_setup_ppp_control(struct pvr_cmd_buffer *const cmd_buffer) default: UNREACHABLE("Unsupported cull mode!"); } + + if (dynamic_state->rs.line.mode == + VK_LINE_RASTERIZATION_MODE_BRESENHAM_KHR) { + switch (topology) { + case VK_PRIMITIVE_TOPOLOGY_LINE_LIST: + case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP: + case VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY: + case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY: + control.prim_msaa = true; + break; + + default: + break; + } + } } if (ppp_control != ppp_state->ppp_control) { diff --git a/src/imagination/vulkan/pvr_device.c b/src/imagination/vulkan/pvr_device.c index 72479b0494c..28d04912d5d 100644 --- a/src/imagination/vulkan/pvr_device.c +++ b/src/imagination/vulkan/pvr_device.c @@ -188,6 +188,7 @@ static void pvr_physical_device_get_supported_extensions( .KHR_image_format_list = true, .KHR_imageless_framebuffer = true, .KHR_index_type_uint8 = false, + .KHR_line_rasterization = true, .KHR_maintenance1 = true, .KHR_maintenance2 = true, .KHR_maintenance3 = true, @@ -216,6 +217,7 @@ static void pvr_physical_device_get_supported_extensions( .EXT_host_query_reset = true, .EXT_image_2d_view_of_3d = true, .EXT_index_type_uint8 = false, + .EXT_line_rasterization = true, .EXT_physical_device_drm = true, .EXT_private_data = true, .EXT_provoking_vertex = true, @@ -422,6 +424,9 @@ static void pvr_physical_device_get_supported_features( /* VK_EXT_depth_clip_enable */ .depthClipEnable = true, + + /* VK_KHR_line_rasterization */ + .bresenhamLines = true, }; } @@ -487,6 +492,9 @@ static bool pvr_physical_device_get_properties( const VkDeviceSize max_memory_alloc_size = pdevice->memory.memoryHeaps[0].size; + const uint32_t line_sub_pixel_precision_bits = + PVR_HAS_FEATURE(dev_info, simple_internal_parameter_format) ? 4U : 8U; + *properties = (struct vk_properties){ /* Vulkan 1.0 */ .apiVersion = get_api_version(), @@ -759,6 +767,9 @@ static bool pvr_physical_device_get_properties( VK_RESOLVE_MODE_SAMPLE_ZERO_BIT, .independentResolveNone = true, .independentResolve = true, + + /* VK_KHR_line_rasterization */ + .lineSubPixelPrecisionBits = line_sub_pixel_precision_bits, }; if (PVR_HAS_FEATURE(dev_info, gpu_multicore_support)) {