diff --git a/src/microsoft/vulkan/dzn_cmd_buffer.c b/src/microsoft/vulkan/dzn_cmd_buffer.c index ed471a17bf5..01b24dd7b66 100644 --- a/src/microsoft/vulkan/dzn_cmd_buffer.c +++ b/src/microsoft/vulkan/dzn_cmd_buffer.c @@ -3216,8 +3216,10 @@ dzn_cmd_buffer_update_heaps(struct dzn_cmd_buffer *cmdbuf, uint32_t bindpoint) const struct dzn_buffer_desc *bdesc = &set->dynamic_buffers[o]; struct dxil_spirv_bindless_entry *map_entry = &map[pipeline->sets[s].dynamic_buffer_heap_offsets[o].primary]; if (*bdesc->bindless_descriptor_slot >= 0) { + uint32_t embedded_offset = (bdesc->offset / D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT) * D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT; + uint32_t additional_offset = bdesc->offset - embedded_offset; map_entry->buffer_idx = *bdesc->bindless_descriptor_slot; - map_entry->buffer_offset = desc_state->sets[s].dynamic_offsets[o]; + map_entry->buffer_offset = additional_offset + desc_state->sets[s].dynamic_offsets[o]; } else { map_entry->buffer_idx = bdesc->type == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC ? bdesc->buffer->uav_bindless_slot : bdesc->buffer->cbv_bindless_slot; diff --git a/src/microsoft/vulkan/dzn_descriptor_set.c b/src/microsoft/vulkan/dzn_descriptor_set.c index 7a83d77146e..7995ccfb01f 100644 --- a/src/microsoft/vulkan/dzn_descriptor_set.c +++ b/src/microsoft/vulkan/dzn_descriptor_set.c @@ -1182,10 +1182,16 @@ dzn_bindless_descriptor_set_write_buffer_desc(struct dzn_device *device, if (*info->bindless_descriptor_slot < 0) *info->bindless_descriptor_slot = dzn_device_descriptor_heap_alloc_slot(device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); + uint32_t offset = (info->offset / D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT) * D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT; + + struct dzn_buffer_desc local_info = *info; + local_info.offset = offset; + info = &local_info; + dzn_descriptor_heap_write_buffer_desc(device, &device->device_heaps[D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV].heap, *info->bindless_descriptor_slot, info->type == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, info); map[desc_offset].buffer_idx = *info->bindless_descriptor_slot; - map[desc_offset].buffer_offset = 0; + map[desc_offset].buffer_offset = info->offset - offset; } } @@ -1372,8 +1378,12 @@ dzn_descriptor_set_write_dynamic_buffer_desc(struct dzn_device *device, if (*info->bindless_descriptor_slot < 0) *info->bindless_descriptor_slot = dzn_device_descriptor_heap_alloc_slot(device, D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV); + uint32_t offset = (info->offset / D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT) * D3D12_RAW_UAV_SRV_BYTE_ALIGNMENT; + + struct dzn_buffer_desc local_info = *info; + local_info.offset = offset; dzn_descriptor_heap_write_buffer_desc(device, &device->device_heaps[D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV].heap, - *info->bindless_descriptor_slot, info->type == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, info); + *info->bindless_descriptor_slot, info->type == VK_DESCRIPTOR_TYPE_STORAGE_BUFFER, &local_info); } }