Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/wined3d/context_vk.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/dlls/wined3d/context_vk.c b/dlls/wined3d/context_vk.c index 97c60719489..f3ec5c03c85 100644 --- a/dlls/wined3d/context_vk.c +++ b/dlls/wined3d/context_vk.c @@ -456,6 +456,7 @@ static bool wined3d_context_vk_create_slab_bo(struct wined3d_context_vk *context *bo = slab->bo; bo->memory = NULL; bo->slab = slab; + bo->b.map_ptr = NULL; bo->b.buffer_offset = idx * object_size; bo->b.memory_offset = slab->bo.b.memory_offset + bo->b.buffer_offset; bo->size = size;
Be consistent with wined3d_cs_map_upload_bo(). This may change in the future, but for now we depend on this logic in the Vulkan backend.
This fixes test_dynamic_map_synchronization() on 32-bit architectures with the Vulkan backend, which is currently broken because we try to perform accelerated NOOVERWRITE maps while unmapping the same BOs.
Fixes: d8e8ab21c0f9f00d295c035534637115a5d70f9f Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/wined3d/buffer.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 2f3b5fd316e..a06bfb984ad 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -1002,7 +1002,8 @@ static HRESULT buffer_resource_sub_resource_map(struct wined3d_resource *resourc * but it's safe because the client thread will wait for the * map to return, thus completely serializing this call with * other client code. */ - buffer->resource.client.addr = addr; + if (wined3d_map_persistent()) + buffer->resource.client.addr = addr;
if (((DWORD_PTR)buffer->map_ptr) & (RESOURCE_ALIGNMENT - 1)) {
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
That is, don't just flush it, but unmap it as well.
As of d8e8ab21c0f9f00d295c035534637115a5d70f9f, we can get here even when !wined3d_map_persistent(). Thus we currently end up leaving BOs mapped when performing an accelerated DISCARD map. Try to avoid that.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/wined3d/buffer.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index a06bfb984ad..50e3e9fe2b4 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -1156,9 +1156,27 @@ void wined3d_buffer_update_sub_resource(struct wined3d_buffer *buffer, struct wi }
if (upload_bo->addr.buffer_object && upload_bo->addr.buffer_object == buffer->buffer_object) - wined3d_context_flush_bo_address(context, &upload_bo->addr, size); + { + struct wined3d_range range; + + /* We need to flush changes, which is implicitly done by + * wined3d_context_unmap_bo_address() even if we aren't actually going + * to unmap. + * + * We would also like to free up virtual address space used by this BO + * if it's at a premium—note that this BO was allocated for an + * accelerated map. Hence we unmap the BO instead of merely flushing it; + * if we don't care about unmapping BOs then + * wined3d_context_unmap_bo_address() will flush and return. + */ + range.offset = offset; + range.size = size; + wined3d_context_unmap_bo_address(context, (const struct wined3d_bo_address *)&upload_bo->addr, 1, &range); + } else + { wined3d_buffer_copy_bo_address(buffer, context, offset, &upload_bo->addr, size); + } }
static void wined3d_buffer_init_data(struct wined3d_buffer *buffer,
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com