zink: set zink_resource_object::host_visible based on actual bo placement

the properties determined before allocation may not be the same as what gets
allocated

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13849>
This commit is contained in:
Mike Blumenkrantz 2021-11-17 16:47:16 -05:00 committed by Marge Bot
parent 74d2e89201
commit 8f97af050e

View File

@ -647,11 +647,6 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t
assert(reqs.memoryTypeBits & BITFIELD_BIT(mai.memoryTypeIndex));
}
VkMemoryType mem_type = screen->info.mem_props.memoryTypes[mai.memoryTypeIndex];
obj->coherent = mem_type.propertyFlags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
if (!(templ->flags & PIPE_RESOURCE_FLAG_SPARSE))
obj->host_visible = mem_type.propertyFlags & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
VkMemoryDedicatedAllocateInfo ded_alloc_info = {
.sType = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO,
.pNext = mai.pNext,
@ -717,6 +712,11 @@ resource_object_create(struct zink_screen *screen, const struct pipe_resource *t
obj->size = zink_bo_get_size(obj->bo);
}
obj->coherent = obj->bo->base.placement & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT;
if (!(templ->flags & PIPE_RESOURCE_FLAG_SPARSE)) {
obj->host_visible = obj->bo->base.placement & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT;
}
if (templ->target == PIPE_BUFFER) {
if (!(templ->flags & PIPE_RESOURCE_FLAG_SPARSE))
if (VKSCR(BindBufferMemory)(screen->dev, obj->buffer, zink_bo_get_mem(obj->bo), obj->offset) != VK_SUCCESS)