mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 09:48:07 +02:00
vulkan/util: add vk_topology_to_mesa helper function
Something like this already exists in a few drivers, move it to common code. This specific version was pulled from honeykrisp, which is the only one that handles META_RECT_LIST_MESA. Signed-off-by: Olivia Lee <olivia.lee@collabora.com> Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37038>
This commit is contained in:
parent
ed80e33f51
commit
5faa62f91e
3 changed files with 39 additions and 0 deletions
|
|
@ -26,6 +26,7 @@
|
|||
#include "vk_internal_exts.h"
|
||||
#include "vk_limits.h"
|
||||
#include "vk_object.h"
|
||||
#include "vk_util.h"
|
||||
|
||||
#include "util/simple_mtx.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include "vk_internal_exts.h"
|
||||
#include "vk_util.h"
|
||||
#include "util/u_debug.h"
|
||||
|
||||
|
|
@ -141,3 +142,38 @@ vk_spec_info_to_nir_spirv(const VkSpecializationInfo *spec_info,
|
|||
*out_num_spec_entries = num_spec_entries;
|
||||
return spec_entries;
|
||||
}
|
||||
|
||||
enum mesa_prim
|
||||
vk_topology_to_mesa(VkPrimitiveTopology topology)
|
||||
{
|
||||
switch (topology) {
|
||||
case VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
|
||||
return MESA_PRIM_POINTS;
|
||||
case VK_PRIMITIVE_TOPOLOGY_LINE_LIST:
|
||||
return MESA_PRIM_LINES;
|
||||
case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP:
|
||||
return MESA_PRIM_LINE_STRIP;
|
||||
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST:
|
||||
PRAGMA_DIAGNOSTIC_PUSH
|
||||
PRAGMA_DIAGNOSTIC_IGNORED(-Wswitch)
|
||||
case VK_PRIMITIVE_TOPOLOGY_META_RECT_LIST_MESA:
|
||||
PRAGMA_DIAGNOSTIC_POP
|
||||
return MESA_PRIM_TRIANGLES;
|
||||
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP:
|
||||
return MESA_PRIM_TRIANGLE_STRIP;
|
||||
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN:
|
||||
return MESA_PRIM_TRIANGLE_FAN;
|
||||
case VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY:
|
||||
return MESA_PRIM_LINES_ADJACENCY;
|
||||
case VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY:
|
||||
return MESA_PRIM_LINE_STRIP_ADJACENCY;
|
||||
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY:
|
||||
return MESA_PRIM_TRIANGLES_ADJACENCY;
|
||||
case VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY:
|
||||
return MESA_PRIM_TRIANGLE_STRIP_ADJACENCY;
|
||||
case VK_PRIMITIVE_TOPOLOGY_PATCH_LIST:
|
||||
return MESA_PRIM_PATCHES;
|
||||
default:
|
||||
UNREACHABLE("invalid");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -401,6 +401,8 @@ vk_descriptor_type_is_dynamic(VkDescriptorType type)
|
|||
}
|
||||
}
|
||||
|
||||
enum mesa_prim vk_topology_to_mesa(VkPrimitiveTopology topology);
|
||||
|
||||
#define VK_PRINT_STR(field, ...) do { \
|
||||
memset(field, 0, sizeof(field)); \
|
||||
UNUSED int i = snprintf(field, sizeof(field), __VA_ARGS__); \
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue