From 3d1072ec266c8defac600ec60171bf524332e591 Mon Sep 17 00:00:00 2001 From: Konstantin Seurer Date: Sat, 22 Feb 2025 11:29:38 +0100 Subject: [PATCH] lavapipe: Implement VK_EXT_fragment_shader_interlock This is a noop implementation because it is not possible for multiple threads to access the same pixel during rasterization since it is tiled. Reviewed-by: Mike Blumenkrantz Part-of: --- src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c | 6 ++++++ src/gallium/frontends/lavapipe/lvp_device.c | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c index 31ef9a25a50..84347124daa 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c +++ b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c @@ -5172,6 +5172,12 @@ visit_intrinsic(struct lp_build_nir_soa_context *bld, result[0] = load_ubo_base_addr(bld, get_src(bld, &instr->src[0], 0)); break; } + case nir_intrinsic_begin_invocation_interlock: + case nir_intrinsic_end_invocation_interlock: + /* There is no need to do any synchronization here since llvmpipe rasterizes + * geometry using tiles and each tile is handled by only one thread at once. + */ + break; default: fprintf(stderr, "Unsupported intrinsic: "); nir_print_instr(&instr->instr, stderr); diff --git a/src/gallium/frontends/lavapipe/lvp_device.c b/src/gallium/frontends/lavapipe/lvp_device.c index f63d9b9b233..dd1bd538164 100644 --- a/src/gallium/frontends/lavapipe/lvp_device.c +++ b/src/gallium/frontends/lavapipe/lvp_device.c @@ -213,6 +213,7 @@ static const struct vk_device_extension_table lvp_device_extensions_supported = .EXT_extended_dynamic_state2 = true, .EXT_extended_dynamic_state3 = true, .EXT_external_memory_host = true, + .EXT_fragment_shader_interlock = true, .EXT_graphics_pipeline_library = true, .EXT_hdr_metadata = true, .EXT_host_image_copy = true, @@ -763,6 +764,11 @@ lvp_get_features(const struct lvp_physical_device *pdevice, /* VK_KHR_shader_quad_control */ .shaderQuadControl = true, + + /* VK_EXT_fragment_shader_interlock */ + .fragmentShaderSampleInterlock = true, + .fragmentShaderPixelInterlock = true, + .fragmentShaderShadingRateInterlock = false, }; }