wined3d: Move the "memory_offset" field from struct wined3d_bo_vk to struct wined3d_bo.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2021-10-12 16:15:45 -05:00 committed by Alexandre Julliard
parent 59f16dd564
commit c53736d12f
4 changed files with 8 additions and 7 deletions

View File

@ -988,7 +988,7 @@ static void *adapter_vk_map_bo_address(struct wined3d_context *context,
range.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE;
range.pNext = NULL;
range.memory = bo->vk_memory;
range.offset = bo->memory_offset + (uintptr_t)data->addr;
range.offset = bo->b.memory_offset + (uintptr_t)data->addr;
range.size = size;
VK_CALL(vkInvalidateMappedMemoryRanges(device_vk->vk_device, 1, &range));
}
@ -1005,7 +1005,7 @@ map:
return NULL;
}
return (uint8_t *)map_ptr + bo->memory_offset + (uintptr_t)data->addr;
return (uint8_t *)map_ptr + bo->b.memory_offset + (uintptr_t)data->addr;
}
static void adapter_vk_unmap_bo_address(struct wined3d_context *context,
@ -1032,7 +1032,7 @@ static void adapter_vk_unmap_bo_address(struct wined3d_context *context,
for (i = 0; i < range_count; ++i)
{
range.offset = bo->memory_offset + ranges[i].offset;
range.offset = bo->b.memory_offset + ranges[i].offset;
range.size = ranges[i].size;
VK_CALL(vkFlushMappedMemoryRanges(device_vk->vk_device, 1, &range));
}

View File

@ -2889,6 +2889,7 @@ bool wined3d_context_gl_create_bo(struct wined3d_context_gl *context_gl, GLsizei
bo->coherent = coherent;
list_init(&bo->b.users);
bo->command_fence_id = 0;
bo->b.memory_offset = 0;
return true;
}

View File

@ -411,7 +411,7 @@ static bool wined3d_context_vk_create_slab_bo(struct wined3d_context_vk *context
bo->memory = NULL;
bo->slab = slab;
bo->buffer_offset = idx * object_size;
bo->memory_offset = slab->bo.memory_offset + bo->buffer_offset;
bo->b.memory_offset = slab->bo.b.memory_offset + bo->buffer_offset;
bo->size = size;
list_init(&bo->b.users);
bo->command_buffer_id = 0;
@ -473,10 +473,10 @@ BOOL wined3d_context_vk_create_bo(struct wined3d_context_vk *context_vk, VkDevic
VK_CALL(vkDestroyBuffer(device_vk->vk_device, bo->vk_buffer, NULL));
return FALSE;
}
bo->memory_offset = bo->memory ? bo->memory->offset : 0;
bo->b.memory_offset = bo->memory ? bo->memory->offset : 0;
if ((vr = VK_CALL(vkBindBufferMemory(device_vk->vk_device, bo->vk_buffer,
bo->vk_memory, bo->memory_offset))) < 0)
bo->vk_memory, bo->b.memory_offset))) < 0)
{
ERR("Failed to bind buffer memory, vr %s.\n", wined3d_debug_vkresult(vr));
if (bo->memory)

View File

@ -1591,6 +1591,7 @@ do { \
struct wined3d_bo
{
struct list users;
size_t memory_offset;
};
struct wined3d_bo_gl
@ -1630,7 +1631,6 @@ struct wined3d_bo_vk
void *map_ptr;
VkDeviceSize buffer_offset;
VkDeviceSize memory_offset;
VkDeviceSize size;
VkBufferUsageFlags usage;
VkMemoryPropertyFlags memory_type;