zink: have_triangle_fans support.

MoltenVK, at least upto 1.2.141, does not render triangle fans. This is reflected in the portability EXTX extension.
This code get the extensions properties and features and then sets the have_triangle_fans.
This extension is not avaiable on all systems, so an amout of the code has to be protected by the define VK_EXTX_PORTABILITY_SUBSET_EXTENSION_NAME.

Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7457>
This commit is contained in:
Duncan Hopkins
2020-11-05 11:17:40 +00:00
committed by Duncan Hopkins
parent 2aca3749c5
commit f0bbd8fdd0
5 changed files with 19 additions and 2 deletions
+3 -2
View File
@@ -1251,8 +1251,9 @@ zink_context_create(struct pipe_screen *pscreen, void *priv, unsigned flags)
1 << PIPE_PRIM_LINES |
1 << PIPE_PRIM_LINE_STRIP |
1 << PIPE_PRIM_TRIANGLES |
1 << PIPE_PRIM_TRIANGLE_STRIP |
1 << PIPE_PRIM_TRIANGLE_FAN;
1 << PIPE_PRIM_TRIANGLE_STRIP;
if (screen->have_triangle_fans)
prim_hwsupport |= 1 << PIPE_PRIM_TRIANGLE_FAN;
ctx->primconvert = util_primconvert_create(&ctx->base, prim_hwsupport);
if (!ctx->primconvert)
@@ -72,6 +72,7 @@ def EXTENSIONS():
Extension("VK_EXT_extended_dynamic_state", alias="dynamic_state", have_feature="extendedDynamicState"),
Extension("VK_EXT_pipeline_creation_cache_control", alias="pipeline_cache_control", have_feature="pipelineCreationCacheControl"),
Extension("VK_EXT_shader_stencil_export", alias="stencil_export"),
Extension("VK_EXTX_portability_subset", alias="portability_subset_extx", properties=True, features=True, guard=True),
]
# There exists some inconsistencies regarding the enum constants, fix them.
@@ -90,6 +91,12 @@ header_code = """
#include <vulkan/vulkan.h>
#if defined(__APPLE__)
// Source of MVK_VERSION
// Source of VK_EXTX_PORTABILITY_SUBSET_EXTENSION_NAME
#include "MoltenVK/vk_mvk_moltenvk.h"
#endif
struct zink_screen;
struct zink_device_info {
+1
View File
@@ -225,6 +225,7 @@ zink_draw_vbo(struct pipe_context *pctx,
if (dinfo->mode == PIPE_PRIM_QUADS ||
dinfo->mode == PIPE_PRIM_QUAD_STRIP ||
dinfo->mode == PIPE_PRIM_POLYGON ||
(dinfo->mode == PIPE_PRIM_TRIANGLE_FAN && !screen->have_triangle_fans) ||
dinfo->mode == PIPE_PRIM_LINE_LOOP) {
if (!u_trim_pipe_prim(dinfo->mode, (unsigned *)&dinfo->count))
return;
+7
View File
@@ -918,6 +918,13 @@ load_device_extensions(struct zink_screen *screen)
GET_PROC_ADDR(CmdSetScissorWithCountEXT);
}
screen->have_triangle_fans = true;
#if defined(VK_EXTX_PORTABILITY_SUBSET_EXTENSION_NAME)
if (screen->info.have_EXTX_portability_subset) {
screen->have_triangle_fans = (VK_TRUE == screen->info.portability_subset_extx_feats.triangleFans);
}
#endif // VK_EXTX_PORTABILITY_SUBSET_EXTENSION_NAME
return true;
}
+1
View File
@@ -57,6 +57,7 @@ struct zink_screen {
bool have_X8_D24_UNORM_PACK32;
bool have_D24_UNORM_S8_UINT;
bool have_triangle_fans;
uint32_t gfx_queue;
uint32_t timestamp_valid_bits;