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 <lionel.g.landwerlin@intel.com>
Fixes: 4ceaed7839 ("anv: split internal surface states from descriptors")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/7762
Reviewed-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20953>
(cherry picked from commit 0d7f8aa249)
This commit is contained in:
Lionel Landwerlin 2023-01-27 11:21:54 +02:00 committed by Dylan Baker
parent f9cf3599b4
commit e2153c29fe
3 changed files with 18 additions and 11 deletions

View file

@ -427,7 +427,7 @@
"description": "anv: fix null descriptors",
"nominated": true,
"nomination_type": 1,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "4ceaed7839afd724b2a2f10f6879f54199c041ad"
},

View file

@ -3608,9 +3608,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,

View file

@ -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;