anv: Support fetching descriptor addresses from push constants

Bindless shaders don't have binding tables so they have to get at the
descriptor sets via a different mechanism.

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8637>
This commit is contained in:
Jason Ekstrand
2021-01-21 14:13:47 -06:00
committed by Marge Bot
parent 937ffb1af0
commit 379b9bb7b0
3 changed files with 45 additions and 0 deletions

View File

@@ -928,6 +928,25 @@ anv_cmd_buffer_bind_descriptor_set(struct anv_cmd_buffer *cmd_buffer,
VkShaderStageFlags dirty_stages = 0;
if (pipe_state->descriptors[set_index] != set) {
pipe_state->descriptors[set_index] = set;
/* Ray-tracing shaders are entirely bindless and so they don't have
* access to HW binding tables. This means that we have to upload the
* descriptor set as an 64-bit address in the push constants.
*/
if (bind_point == VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR) {
struct anv_push_constants *push = &pipe_state->push_constants;
struct anv_address set_addr = {
.bo = set->pool->bo,
.offset = set->desc_mem.offset,
};
push->desc_sets[set_index] = anv_address_physical(set_addr);
anv_reloc_list_add_bo(cmd_buffer->batch.relocs,
cmd_buffer->batch.alloc,
set->pool->bo);
}
dirty_stages |= stages;
}