From bd3e8360467a2bd82f5a895efa23234abcb5dd75 Mon Sep 17 00:00:00 2001 From: Daivik Bhatia Date: Sun, 25 Jan 2026 06:53:08 +0530 Subject: [PATCH] v3dv: Implement robust_image_access_2 flag This flag is used to implement robustImageAccess2. Reviewed-by: Iago Toral Quiroga Part-of: --- src/broadcom/compiler/v3d_compiler.h | 1 + src/broadcom/compiler/vir.c | 4 ++-- src/broadcom/vulkan/v3dv_pipeline.c | 5 +++++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/broadcom/compiler/v3d_compiler.h b/src/broadcom/compiler/v3d_compiler.h index 33677221b34..c0123af7ea0 100644 --- a/src/broadcom/compiler/v3d_compiler.h +++ b/src/broadcom/compiler/v3d_compiler.h @@ -416,6 +416,7 @@ struct v3d_key { bool robust_uniform_access; bool robust_storage_access; bool robust_image_access; + bool robust_image_access_2; }; struct v3d_fs_key { diff --git a/src/broadcom/compiler/vir.c b/src/broadcom/compiler/vir.c index a97205375d8..cbd0997fb69 100644 --- a/src/broadcom/compiler/vir.c +++ b/src/broadcom/compiler/vir.c @@ -1791,7 +1791,7 @@ should_lower_robustness(const nir_intrinsic_instr *intr, const void *data) case nir_intrinsic_image_store: case nir_intrinsic_image_atomic: case nir_intrinsic_image_atomic_swap: - return key->robust_image_access; + return key->robust_image_access || key->robust_image_access_2; default: return false; @@ -1877,7 +1877,7 @@ v3d_attempt_compile(struct v3d_compile *c) NIR_PASS(_, c->s, nir_lower_alu); if (c->key->robust_uniform_access || c->key->robust_storage_access || - c->key->robust_image_access) { + c->key->robust_image_access || c->key->robust_image_access_2) { /* nir_lower_robust_access assumes constant buffer * indices on ubo/ssbo intrinsics so run copy propagation and * constant folding passes before we run the lowering to warrant diff --git a/src/broadcom/vulkan/v3dv_pipeline.c b/src/broadcom/vulkan/v3dv_pipeline.c index a87fe3e5950..f75c74701ed 100644 --- a/src/broadcom/vulkan/v3dv_pipeline.c +++ b/src/broadcom/vulkan/v3dv_pipeline.c @@ -1027,6 +1027,9 @@ pipeline_populate_v3d_key(struct v3d_key *key, const VkPipelineRobustnessBufferBehaviorEXT robust_buffer_enabled = VK_PIPELINE_ROBUSTNESS_BUFFER_BEHAVIOR_ROBUST_BUFFER_ACCESS_EXT; + const VkPipelineRobustnessImageBehaviorEXT robust_image2_enabled = + VK_PIPELINE_ROBUSTNESS_IMAGE_BEHAVIOR_ROBUST_IMAGE_ACCESS_2_EXT; + const VkPipelineRobustnessImageBehaviorEXT robust_image_enabled = VK_PIPELINE_ROBUSTNESS_IMAGE_BEHAVIOR_ROBUST_IMAGE_ACCESS_EXT; @@ -1036,6 +1039,8 @@ pipeline_populate_v3d_key(struct v3d_key *key, p_stage->robustness.storage_buffers == robust_buffer_enabled; key->robust_image_access = p_stage->robustness.images == robust_image_enabled; + key->robust_image_access_2 = + p_stage->robustness.images == robust_image2_enabled; } uint32_t