mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 11:28:05 +02:00
kk: Fix VK_CULL_MODE_FRONT_AND_BACK with points and lines.
Only triangles are culled, so we can't always disable rasterization here. Fixes: dEQP-VK.glsl.builtin_var.frontfacing.add_ubo_load.point_list.front_and_back dEQP-VK.glsl.builtin_var.frontfacing.add_ubo_load.line_list.front_and_back Reviewed-by: Aitor Camacho <aitor@lunarg.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41176>
This commit is contained in:
parent
cc23376ff5
commit
642bed9eba
2 changed files with 20 additions and 2 deletions
|
|
@ -227,6 +227,7 @@ vk_front_face_to_mtl_cull_mode(enum VkCullModeFlagBits mode)
|
|||
{
|
||||
switch (mode) {
|
||||
case VK_CULL_MODE_NONE:
|
||||
case VK_CULL_MODE_FRONT_AND_BACK: // Emulated with scissor
|
||||
return MTL_CULL_MODE_NONE;
|
||||
case VK_CULL_MODE_FRONT_BIT:
|
||||
return MTL_CULL_MODE_FRONT;
|
||||
|
|
|
|||
|
|
@ -639,6 +639,21 @@ kk_calculate_vbo_clamp(uint64_t vbuf, uint64_t sink, enum pipe_format format,
|
|||
}
|
||||
}
|
||||
|
||||
static bool
|
||||
is_primitive_culled(VkPrimitiveTopology topology)
|
||||
{
|
||||
switch (topology) {
|
||||
case VK_PRIMITIVE_TOPOLOGY_POINT_LIST:
|
||||
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:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
set_empty_scissor(mtl_render_encoder *enc)
|
||||
{
|
||||
|
|
@ -706,9 +721,11 @@ kk_flush_dynamic_state(struct kk_cmd_buffer *cmd)
|
|||
}
|
||||
}
|
||||
|
||||
if (IS_DIRTY(RS_CULL_MODE)) {
|
||||
if (IS_DIRTY(RS_CULL_MODE) || IS_DIRTY(IA_PRIMITIVE_TOPOLOGY)) {
|
||||
/* Only disable rendering if primitive type is culled. */
|
||||
gfx->is_cull_front_and_back =
|
||||
dyn->rs.cull_mode == VK_CULL_MODE_FRONT_AND_BACK;
|
||||
dyn->rs.cull_mode == VK_CULL_MODE_FRONT_AND_BACK &&
|
||||
is_primitive_culled(dyn->ia.primitive_topology);
|
||||
if (gfx->is_cull_front_and_back) {
|
||||
set_empty_scissor(enc);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue