mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-04 20:38:06 +02:00
zink: add some bda handling
will be useful in the near future Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19044>
This commit is contained in:
parent
5cf959393c
commit
19a74229c9
5 changed files with 30 additions and 1 deletions
|
|
@ -259,9 +259,18 @@ bo_create_internal(struct zink_screen *screen,
|
|||
|
||||
alignment = get_optimal_alignment(screen, size, alignment);
|
||||
|
||||
VkMemoryAllocateFlagsInfo ai;
|
||||
ai.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO;
|
||||
ai.pNext = pNext;
|
||||
ai.flags = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR;
|
||||
ai.deviceMask = 0;
|
||||
|
||||
VkMemoryAllocateInfo mai;
|
||||
mai.sType = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO;
|
||||
mai.pNext = pNext;
|
||||
if (screen->info.have_KHR_buffer_device_address)
|
||||
mai.pNext = &ai;
|
||||
else
|
||||
mai.pNext = pNext;
|
||||
mai.allocationSize = size;
|
||||
mai.memoryTypeIndex = screen->heap_map[heap];
|
||||
if (screen->info.mem_props.memoryTypes[mai.memoryTypeIndex].propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT) {
|
||||
|
|
|
|||
|
|
@ -76,6 +76,7 @@ EXTENSIONS = [
|
|||
Extension("VK_KHR_external_memory_win32"),
|
||||
Extension("VK_KHR_external_semaphore_win32"),
|
||||
Extension("VK_EXT_external_memory_dma_buf"),
|
||||
Extension("VK_KHR_buffer_device_address", alias="bda", features=True),
|
||||
Extension("VK_EXT_queue_family_foreign"),
|
||||
Extension("VK_KHR_swapchain_mutable_format"),
|
||||
Extension("VK_EXT_provoking_vertex",
|
||||
|
|
|
|||
|
|
@ -2209,6 +2209,21 @@ zink_resource_object_init_mutable(struct zink_context *ctx, struct zink_resource
|
|||
return resource_object_add_bind(ctx, res, ZINK_BIND_MUTABLE);
|
||||
}
|
||||
|
||||
VkDeviceAddress
|
||||
zink_resource_get_address(struct zink_screen *screen, struct zink_resource *res)
|
||||
{
|
||||
assert(res->obj->is_buffer);
|
||||
if (!res->obj->bda) {
|
||||
VkBufferDeviceAddressInfo info = {
|
||||
VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO,
|
||||
NULL,
|
||||
res->obj->buffer
|
||||
};
|
||||
res->obj->bda = VKSCR(GetBufferDeviceAddress)(screen->dev, &info);
|
||||
}
|
||||
return res->obj->bda;
|
||||
}
|
||||
|
||||
void
|
||||
zink_resource_setup_transfer_layouts(struct zink_context *ctx, struct zink_resource *src, struct zink_resource *dst)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -75,6 +75,9 @@ zink_resource_object_init_storage(struct zink_context *ctx, struct zink_resource
|
|||
bool
|
||||
zink_resource_object_init_mutable(struct zink_context *ctx, struct zink_resource *res);
|
||||
|
||||
VkDeviceAddress
|
||||
zink_resource_get_address(struct zink_screen *screen, struct zink_resource *res);
|
||||
|
||||
static inline bool
|
||||
zink_resource_has_binds(const struct zink_resource *res)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -965,6 +965,7 @@ struct zink_resource_object {
|
|||
VkBuffer buffer;
|
||||
VkImage image;
|
||||
};
|
||||
VkDeviceAddress bda;
|
||||
|
||||
VkSampleLocationsInfoEXT zs_evaluate;
|
||||
bool needs_zs_evaluate;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue