Module: Mesa Branch: staging/22.3 Commit: 7eafa1c7d686351f960aa6b99b0d4333fcd6640f URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7eafa1c7d686351f960aa6b99b0d4333fcd6640f
Author: Lionel Landwerlin <[email protected]> Date: Fri Jan 27 11:21:54 2023 +0200 anv: fix null descriptors When writing descriptor with a null buffer/image we expect that writing 0 will point to the null surface. For that to work the null surface has to be in the bindless surface heap. This fixes some new failures in dEQP-VK.robustness.* tests once rewritten from the NV_ray_tracing to KHR_ray_tracing extension. Signed-off-by: Lionel Landwerlin <[email protected]> Fixes: 4ceaed7839 ("anv: split internal surface states from descriptors") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7762 Reviewed-by: Jason Ekstrand <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20953> (cherry picked from commit 0d7f8aa2499104b1d16deba32e4c25c342d1ce7d) --- .pick_status.json | 2 +- src/intel/vulkan/anv_device.c | 4 +--- src/intel/vulkan/genX_cmd_buffer.c | 23 ++++++++++++++++------- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index aeba5190999..6817741ef3a 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -40,7 +40,7 @@ "description": "anv: fix null descriptors", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "4ceaed7839afd724b2a2f10f6879f54199c041ad" }, diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 65d1201cbc7..48693614681 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -3575,9 +3575,7 @@ VkResult anv_CreateDevice( * to zero and they have a valid descriptor. */ device->null_surface_state = - anv_state_pool_alloc(device->info->verx10 >= 125 ? - &device->scratch_surface_state_pool : - &device->internal_surface_state_pool, + anv_state_pool_alloc(&device->bindless_surface_state_pool, device->isl_dev.ss.size, device->isl_dev.ss.align); isl_null_fill_state(&device->isl_dev, device->null_surface_state.map, diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 6e4ecbe5939..594b2e59513 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -2501,7 +2501,8 @@ emit_binding_table(struct anv_cmd_buffer *cmd_buffer, assert(desc_idx < MAX_PUSH_DESCRIPTORS); if (shader->push_desc_info.fully_promoted_ubo_descriptors & BITFIELD_BIT(desc_idx)) { - surface_state = cmd_buffer->device->null_surface_state; + surface_state = anv_bindless_state_for_binding_table( + cmd_buffer->device->null_surface_state); break; } } @@ -2531,7 +2532,9 @@ emit_binding_table(struct anv_cmd_buffer *cmd_buffer, anv_bindless_state_for_binding_table(sstate.state); assert(surface_state.alloc_size); } else { - surface_state = cmd_buffer->device->null_surface_state; + surface_state = + anv_bindless_state_for_binding_table( + cmd_buffer->device->null_surface_state); } break; } @@ -2561,7 +2564,8 @@ emit_binding_table(struct anv_cmd_buffer *cmd_buffer, "corresponding SPIR-V format enum."); } } else { - surface_state = cmd_buffer->device->null_surface_state; + surface_state = anv_bindless_state_for_binding_table( + cmd_buffer->device->null_surface_state); } break; } @@ -2572,7 +2576,8 @@ emit_binding_table(struct anv_cmd_buffer *cmd_buffer, surface_state = desc->set_buffer_view->surface_state; assert(surface_state.alloc_size); } else { - surface_state = cmd_buffer->device->null_surface_state; + surface_state = anv_bindless_state_for_binding_table( + cmd_buffer->device->null_surface_state); } break; @@ -2582,7 +2587,8 @@ emit_binding_table(struct anv_cmd_buffer *cmd_buffer, desc->buffer_view->surface_state); assert(surface_state.alloc_size); } else { - surface_state = cmd_buffer->device->null_surface_state; + surface_state = anv_bindless_state_for_binding_table( + cmd_buffer->device->null_surface_state); } break; @@ -2619,7 +2625,9 @@ emit_binding_table(struct anv_cmd_buffer *cmd_buffer, format, ISL_SWIZZLE_IDENTITY, usage, address, range, 1); } else { - surface_state = cmd_buffer->device->null_surface_state; + surface_state = + anv_bindless_state_for_binding_table( + cmd_buffer->device->null_surface_state); } break; } @@ -2632,7 +2640,8 @@ emit_binding_table(struct anv_cmd_buffer *cmd_buffer, : desc->buffer_view->storage_surface_state); assert(surface_state.alloc_size); } else { - surface_state = cmd_buffer->device->null_surface_state; + surface_state = anv_bindless_state_for_binding_table( + cmd_buffer->device->null_surface_state); } break;
