diff --git a/docs/features.txt b/docs/features.txt index c4470a2318d..f94dbcf9feb 100644 --- a/docs/features.txt +++ b/docs/features.txt @@ -489,7 +489,7 @@ Vulkan 1.3 -- all DONE: anv, radv, tu, lvp VK_EXT_pipeline_creation_cache_control DONE (anv, lvp, radv, tu, v3dv, vn) VK_EXT_pipeline_creation_feedback DONE (anv, lvp, radv, tu, v3dv, vn) VK_EXT_private_data DONE (anv, lvp, pvr, radv, tu, v3dv, vn) - VK_EXT_image_robustness DONE (anv, lvp, radv, tu, vn) + VK_EXT_image_robustness DONE (anv, lvp, radv, tu, v3dv, vn) VK_EXT_shader_demote_to_helper_invocation DONE (anv, lvp, radv, tu, vn) VK_EXT_subgroup_size_control DONE (anv, lvp, radv, tu, vn) VK_EXT_texel_buffer_alignment DONE (anv, lvp, radv, tu, v3dv, vn) diff --git a/docs/relnotes/new_features.txt b/docs/relnotes/new_features.txt index f5183328e0c..ea0b00bfec8 100644 --- a/docs/relnotes/new_features.txt +++ b/docs/relnotes/new_features.txt @@ -9,3 +9,4 @@ VK_EXT_mutable_descriptor_type on RADV VK_EXT_shader_atomic_float on lvp VK_EXT_shader_atomic_float2 on lvp GL_NV_shader_atomic_float on llvmpipe +VK_EXT_image_robustness on v3dv diff --git a/src/broadcom/compiler/v3d_compiler.h b/src/broadcom/compiler/v3d_compiler.h index 3f33c09fb7f..cbd61779ab8 100644 --- a/src/broadcom/compiler/v3d_compiler.h +++ b/src/broadcom/compiler/v3d_compiler.h @@ -405,6 +405,7 @@ struct v3d_key { uint8_t ucp_enables; bool is_last_geometry_stage; bool robust_buffer_access; + bool robust_image_access; enum v3d_execution_environment environment; }; diff --git a/src/broadcom/compiler/vir.c b/src/broadcom/compiler/vir.c index 1bff8e6a195..251d191de10 100644 --- a/src/broadcom/compiler/vir.c +++ b/src/broadcom/compiler/vir.c @@ -1598,6 +1598,9 @@ v3d_attempt_compile(struct v3d_compile *c) NIR_PASS(_, c->s, v3d_nir_lower_robust_buffer_access, c); } + if (c->key->robust_image_access) + v3d_nir_lower_robust_image_access(c->s, c); + NIR_PASS(_, c->s, nir_lower_wrmasks, should_split_wrmask, c->s); NIR_PASS(_, c->s, v3d_nir_lower_load_store_bitsize, c); diff --git a/src/broadcom/vulkan/v3dv_device.c b/src/broadcom/vulkan/v3dv_device.c index c0010462851..cbe41367bd0 100644 --- a/src/broadcom/vulkan/v3dv_device.c +++ b/src/broadcom/vulkan/v3dv_device.c @@ -176,6 +176,7 @@ get_device_extensions(const struct v3dv_physical_device *device, .EXT_external_memory_dma_buf = true, .EXT_host_query_reset = true, .EXT_image_drm_format_modifier = true, + .EXT_image_robustness = true, .EXT_index_type_uint8 = true, .EXT_line_rasterization = true, .EXT_memory_budget = true, @@ -1165,6 +1166,7 @@ v3dv_GetPhysicalDeviceFeatures2(VkPhysicalDevice physicalDevice, .maintenance4 = true, .shaderZeroInitializeWorkgroupMemory = true, .synchronization2 = true, + .robustImageAccess = true, }; VkPhysicalDeviceVulkan12Features vk12 = { @@ -2068,6 +2070,11 @@ v3dv_CreateDevice(VkPhysicalDevice physicalDevice, if (features2) { memcpy(&device->features, &features2->features, sizeof(device->features)); + + const VkPhysicalDeviceImageRobustnessFeatures *irf = + vk_find_struct_const(pCreateInfo->pNext, + PHYSICAL_DEVICE_IMAGE_ROBUSTNESS_FEATURES); + device->ext_features.robustImageAccess = irf && irf->robustImageAccess; } else if (pCreateInfo->pEnabledFeatures) { memcpy(&device->features, pCreateInfo->pEnabledFeatures, sizeof(device->features)); @@ -2076,6 +2083,10 @@ v3dv_CreateDevice(VkPhysicalDevice physicalDevice, if (device->features.robustBufferAccess) perf_debug("Device created with Robust Buffer Access enabled.\n"); + if (device->ext_features.robustImageAccess) + perf_debug("Device created with Robust Image Access enabled.\n"); + + #ifdef DEBUG v3dv_X(device, device_check_prepacked_sizes)(); #endif diff --git a/src/broadcom/vulkan/v3dv_pipeline.c b/src/broadcom/vulkan/v3dv_pipeline.c index 5e2b7de2016..1ce2dd0ddb1 100644 --- a/src/broadcom/vulkan/v3dv_pipeline.c +++ b/src/broadcom/vulkan/v3dv_pipeline.c @@ -1036,7 +1036,8 @@ static void pipeline_populate_v3d_key(struct v3d_key *key, const struct v3dv_pipeline_stage *p_stage, uint32_t ucp_enables, - bool robust_buffer_access) + bool robust_buffer_access, + bool robust_image_access) { assert(p_stage->pipeline->shared_data && p_stage->pipeline->shared_data->maps[p_stage->stage]); @@ -1100,6 +1101,7 @@ pipeline_populate_v3d_key(struct v3d_key *key, key->ucp_enables = ucp_enables; key->robust_buffer_access = robust_buffer_access; + key->robust_image_access = robust_image_access; key->environment = V3D_ENVIRONMENT_VULKAN; } @@ -1151,7 +1153,8 @@ pipeline_populate_v3d_fs_key(struct v3d_fs_key *key, memset(key, 0, sizeof(*key)); const bool rba = p_stage->pipeline->device->features.robustBufferAccess; - pipeline_populate_v3d_key(&key->base, p_stage, ucp_enables, rba); + const bool ria = p_stage->pipeline->device->ext_features.robustImageAccess; + pipeline_populate_v3d_key(&key->base, p_stage, ucp_enables, rba, ria); const VkPipelineInputAssemblyStateCreateInfo *ia_info = pCreateInfo->pInputAssemblyState; @@ -1269,7 +1272,8 @@ pipeline_populate_v3d_gs_key(struct v3d_gs_key *key, memset(key, 0, sizeof(*key)); const bool rba = p_stage->pipeline->device->features.robustBufferAccess; - pipeline_populate_v3d_key(&key->base, p_stage, 0, rba); + const bool ria = p_stage->pipeline->device->ext_features.robustImageAccess; + pipeline_populate_v3d_key(&key->base, p_stage, 0, rba, ria); struct v3dv_pipeline *pipeline = p_stage->pipeline; @@ -1311,7 +1315,8 @@ pipeline_populate_v3d_vs_key(struct v3d_vs_key *key, memset(key, 0, sizeof(*key)); const bool rba = p_stage->pipeline->device->features.robustBufferAccess; - pipeline_populate_v3d_key(&key->base, p_stage, 0, rba); + const bool ria = p_stage->pipeline->device->ext_features.robustImageAccess; + pipeline_populate_v3d_key(&key->base, p_stage, 0, rba, ria); struct v3dv_pipeline *pipeline = p_stage->pipeline; @@ -1944,6 +1949,9 @@ pipeline_populate_graphics_key(struct v3dv_pipeline *pipeline, key->robust_buffer_access = pipeline->device->features.robustBufferAccess; + key->robust_image_access = + pipeline->device->ext_features.robustImageAccess; + const bool raster_enabled = !pCreateInfo->pRasterizationState->rasterizerDiscardEnable; @@ -2035,6 +2043,8 @@ pipeline_populate_compute_key(struct v3dv_pipeline *pipeline, memset(key, 0, sizeof(*key)); key->robust_buffer_access = pipeline->device->features.robustBufferAccess; + key->robust_image_access = + pipeline->device->ext_features.robustImageAccess; } static struct v3dv_pipeline_shared_data * @@ -3222,8 +3232,9 @@ pipeline_compile_compute(struct v3dv_pipeline *pipeline, struct v3d_key key; memset(&key, 0, sizeof(key)); - pipeline_populate_v3d_key(&key, p_stage, 0, - pipeline->device->features.robustBufferAccess); + const bool rba = pipeline->device->features.robustBufferAccess; + const bool ria = pipeline->device->ext_features.robustImageAccess; + pipeline_populate_v3d_key(&key, p_stage, 0, rba, ria); pipeline->shared_data->variants[BROADCOM_SHADER_COMPUTE] = pipeline_compile_shader_variant(p_stage, &key, sizeof(key), alloc, &result); diff --git a/src/broadcom/vulkan/v3dv_private.h b/src/broadcom/vulkan/v3dv_private.h index d962dfddeb9..aa0e8d11486 100644 --- a/src/broadcom/vulkan/v3dv_private.h +++ b/src/broadcom/vulkan/v3dv_private.h @@ -313,6 +313,7 @@ struct v3dv_meta_texel_buffer_copy_pipeline { struct v3dv_pipeline_key { bool robust_buffer_access; + bool robust_image_access; uint8_t topology; uint8_t logicop_func; bool msaa; @@ -518,7 +519,11 @@ struct v3dv_device { * attributes will create their own BO. */ struct v3dv_bo *default_attribute_float; + VkPhysicalDeviceFeatures features; + struct { + bool robustImageAccess; + } ext_features; void *device_address_mem_ctx; struct util_dynarray device_address_bo_list; /* Array of struct v3dv_bo * */