panvk: add support for adjacency primitive topologies

These are not usable by applications until we advertise GS, but the
implementation is effectively independent of the rest of the GS
implementation.

Signed-off-by: Olivia Lee <olivia.lee@collabora.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Reviewed-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41478>
This commit is contained in:
Olivia Lee 2026-05-03 23:18:40 -07:00 committed by Marge Bot
parent 04576a5b4f
commit a17276037a
2 changed files with 18 additions and 8 deletions

View file

@ -579,9 +579,13 @@ translate_prim_topology(VkPrimitiveTopology in)
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN:
return MALI_DRAW_MODE_TRIANGLE_FAN;
case VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY:
return MALI_DRAW_MODE_LINES_ADJACENCY;
case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY:
return MALI_DRAW_MODE_LINE_STRIP_ADJACENCY;
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY:
return MALI_DRAW_MODE_TRIANGLES_ADJACENCY;
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY:
return MALI_DRAW_MODE_TRIANGLE_STRIP_ADJACENCY;
case VK_PRIMITIVE_TOPOLOGY_PATCH_LIST:
default:
UNREACHABLE("Invalid primitive type");
@ -875,7 +879,8 @@ prepare_tiler_primitive_size(struct panvk_cmd_buffer *cmdbuf)
!gfx_state_dirty(cmdbuf, VS))
return;
switch (ia->primitive_topology) {
enum mesa_prim prim = vk_topology_to_mesa(ia->primitive_topology);
switch (u_reduced_prim(prim)) {
/* From the Vulkan spec 1.3.293:
*
* "If maintenance5 is enabled and a value is not written to a variable
@ -886,7 +891,7 @@ prepare_tiler_primitive_size(struct panvk_cmd_buffer *cmdbuf)
* On v13+, the point size default to 1.0f.
*/
#if PAN_ARCH < 13
case VK_PRIMITIVE_TOPOLOGY_POINT_LIST: {
case MESA_PRIM_POINTS: {
const struct panvk_shader_variant *vs =
panvk_shader_hw_variant(cmdbuf->state.gfx.vs.shader);
@ -897,8 +902,7 @@ prepare_tiler_primitive_size(struct panvk_cmd_buffer *cmdbuf)
break;
}
#endif
case VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
case MESA_PRIM_LINES:
primitive_size = cmdbuf->vk.dynamic_graphics_state.rs.line.width;
break;
default:
@ -2085,8 +2089,8 @@ prepare_dcd(struct panvk_cmd_buffer *cmdbuf,
}
bool msaa = dyns->ms.rasterization_samples > 1;
if ((ia->primitive_topology == VK_PRIMITIVE_TOPOLOGY_LINE_LIST ||
ia->primitive_topology == VK_PRIMITIVE_TOPOLOGY_LINE_STRIP) &&
enum mesa_prim prim = vk_topology_to_mesa(ia->primitive_topology);
if (u_reduced_prim(prim) == MESA_PRIM_LINES &&
rs->line.mode == VK_LINE_RASTERIZATION_MODE_BRESENHAM) {
/* we need to disable MSAA when rendering bresenham lines.
*

View file

@ -877,10 +877,16 @@ translate_prim_topology(VkPrimitiveTopology in)
return MALI_DRAW_MODE_TRIANGLE_STRIP;
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN:
return MALI_DRAW_MODE_TRIANGLE_FAN;
#if PAN_ARCH >= 9
case VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY:
return MALI_DRAW_MODE_LINES_ADJACENCY;
case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY:
return MALI_DRAW_MODE_LINE_STRIP_ADJACENCY;
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY:
return MALI_DRAW_MODE_TRIANGLES_ADJACENCY;
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY:
return MALI_DRAW_MODE_TRIANGLE_STRIP_ADJACENCY;
#endif
case VK_PRIMITIVE_TOPOLOGY_PATCH_LIST:
default:
UNREACHABLE("Invalid primitive type");
@ -1016,8 +1022,8 @@ panvk_emit_tiler_dcd(struct panvk_cmd_buffer *cmdbuf,
* be set to 0 and the provoking vertex is selected with the
* PRIMITIVE.first_provoking_vertex field.
*/
if (ia->primitive_topology == VK_PRIMITIVE_TOPOLOGY_LINE_LIST ||
ia->primitive_topology == VK_PRIMITIVE_TOPOLOGY_LINE_STRIP)
enum mesa_prim prim = vk_topology_to_mesa(ia->primitive_topology);
if (u_reduced_prim(prim) == MESA_PRIM_LINES)
cfg.flat_shading_vertex = true;
/* In case of indirect draw, the descriptor will be patched at runtime */