From 0d7f8aa2499104b1d16deba32e4c25c342d1ce7d Mon Sep 17 00:00:00 2001 From: Lionel Landwerlin Date: Fri, 27 Jan 2023 11:21:54 +0200 Subject: [PATCH] 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 Fixes: 4ceaed7839 ("anv: split internal surface states from descriptors") Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7762 Reviewed-by: Jason Ekstrand Part-of: --- src/intel/vulkan/anv_device.c | 4 +--- src/intel/vulkan/genX_cmd_buffer.c | 23 ++++++++++++++++------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index fad34e0f81e..8ee359a9542 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -3485,9 +3485,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 eda096b09ba..c16eff9236f 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -2101,7 +2101,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; } } @@ -2131,7 +2132,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; } @@ -2161,7 +2164,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; } @@ -2172,7 +2176,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; @@ -2182,7 +2187,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; @@ -2219,7 +2225,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; } @@ -2232,7 +2240,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;