wined3d: Implement WINED3D_MAP_DISCARD support in adapter_vk_map_bo_address().

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2020-04-29 02:47:00 +04:30 committed by Alexandre Julliard
parent 359d53d4d1
commit f2d733102d
1 changed files with 14 additions and 1 deletions

View File

@ -813,8 +813,8 @@ static void *adapter_vk_map_bo_address(struct wined3d_context *context,
struct wined3d_device_vk *device_vk;
VkCommandBuffer vk_command_buffer;
VkBufferMemoryBarrier vk_barrier;
struct wined3d_bo_vk *bo, tmp;
VkMappedMemoryRange range;
struct wined3d_bo_vk *bo;
void *map_ptr;
if (!(bo = (struct wined3d_bo_vk *)data->buffer_object))
@ -826,6 +826,19 @@ static void *adapter_vk_map_bo_address(struct wined3d_context *context,
if (map_flags & WINED3D_MAP_NOOVERWRITE)
goto map;
if ((map_flags & WINED3D_MAP_DISCARD) && bo->command_buffer_id > context_vk->completed_command_buffer_id)
{
if (wined3d_context_vk_create_bo(context_vk, bo->size, bo->usage, bo->memory_type, &tmp))
{
wined3d_context_vk_destroy_bo(context_vk, bo);
*bo = tmp;
goto map;
}
ERR("Failed to create new buffer object.\n");
}
if (map_flags & WINED3D_MAP_READ)
{
if (!(vk_command_buffer = wined3d_context_vk_get_command_buffer(context_vk)))