Commit c53736d1 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

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

parent 59f16dd5
...@@ -988,7 +988,7 @@ static void *adapter_vk_map_bo_address(struct wined3d_context *context, ...@@ -988,7 +988,7 @@ static void *adapter_vk_map_bo_address(struct wined3d_context *context,
range.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE; range.sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE;
range.pNext = NULL; range.pNext = NULL;
range.memory = bo->vk_memory; 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; range.size = size;
VK_CALL(vkInvalidateMappedMemoryRanges(device_vk->vk_device, 1, &range)); VK_CALL(vkInvalidateMappedMemoryRanges(device_vk->vk_device, 1, &range));
} }
...@@ -1005,7 +1005,7 @@ map: ...@@ -1005,7 +1005,7 @@ map:
return NULL; 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, 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, ...@@ -1032,7 +1032,7 @@ static void adapter_vk_unmap_bo_address(struct wined3d_context *context,
for (i = 0; i < range_count; ++i) 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; range.size = ranges[i].size;
VK_CALL(vkFlushMappedMemoryRanges(device_vk->vk_device, 1, &range)); VK_CALL(vkFlushMappedMemoryRanges(device_vk->vk_device, 1, &range));
} }
......
...@@ -2889,6 +2889,7 @@ bool wined3d_context_gl_create_bo(struct wined3d_context_gl *context_gl, GLsizei ...@@ -2889,6 +2889,7 @@ bool wined3d_context_gl_create_bo(struct wined3d_context_gl *context_gl, GLsizei
bo->coherent = coherent; bo->coherent = coherent;
list_init(&bo->b.users); list_init(&bo->b.users);
bo->command_fence_id = 0; bo->command_fence_id = 0;
bo->b.memory_offset = 0;
return true; return true;
} }
......
...@@ -411,7 +411,7 @@ static bool wined3d_context_vk_create_slab_bo(struct wined3d_context_vk *context ...@@ -411,7 +411,7 @@ static bool wined3d_context_vk_create_slab_bo(struct wined3d_context_vk *context
bo->memory = NULL; bo->memory = NULL;
bo->slab = slab; bo->slab = slab;
bo->buffer_offset = idx * object_size; 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; bo->size = size;
list_init(&bo->b.users); list_init(&bo->b.users);
bo->command_buffer_id = 0; bo->command_buffer_id = 0;
...@@ -473,10 +473,10 @@ BOOL wined3d_context_vk_create_bo(struct wined3d_context_vk *context_vk, VkDevic ...@@ -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)); VK_CALL(vkDestroyBuffer(device_vk->vk_device, bo->vk_buffer, NULL));
return FALSE; 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, 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)); ERR("Failed to bind buffer memory, vr %s.\n", wined3d_debug_vkresult(vr));
if (bo->memory) if (bo->memory)
......
...@@ -1591,6 +1591,7 @@ do { \ ...@@ -1591,6 +1591,7 @@ do { \
struct wined3d_bo struct wined3d_bo
{ {
struct list users; struct list users;
size_t memory_offset;
}; };
struct wined3d_bo_gl struct wined3d_bo_gl
...@@ -1630,7 +1631,6 @@ struct wined3d_bo_vk ...@@ -1630,7 +1631,6 @@ struct wined3d_bo_vk
void *map_ptr; void *map_ptr;
VkDeviceSize buffer_offset; VkDeviceSize buffer_offset;
VkDeviceSize memory_offset;
VkDeviceSize size; VkDeviceSize size;
VkBufferUsageFlags usage; VkBufferUsageFlags usage;
VkMemoryPropertyFlags memory_type; VkMemoryPropertyFlags memory_type;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment