This patchset implements dynamic resource handling, and in particular NOOVERWRITE buffer maps, in situations where we don't have GL_ARB_buffer_storage. This is relevant e.g. on MacOS but probably also on some ARM CPUs where write combined memory has different performance characteristics than windows games expect [0].
Some benchmark results from hl2 (chosen because it is very CPU heavy on modern systems and heavy use of dynamic resources), tested on a MacBookPro14,3 on Linux with GL_ARB_buffer_storage disabled.
"csmt usr" means with patch "wined3d: Avoid heap_alloc in update_sub_resource.", "heap usr" without this patch.
"no dyn" means the current upstream code with buffer storage disabled. "sysmem dyn" means the entire patchset of this MR with buffer storage disabled. "BO dyn" is current wine code with GL_ARB_buffer_storage available. I also double checked that this patchset has no impact on this default case. "heapalloc dyn" means the current code in cs_map_upload_bo that returns HeapAlloc'ed memory, just enabled for dynamic buffer maps. This code is faster than sysmem dyn because it doesn't re-upload the entire BO after a DISCARD map. It also happens to be incorrect for non-DISCARD maps because we aren't allowed to throw away existing data, but I think it isn't ever used for maps in practise due to mutually exclusive flag checks in the callers and callee.
Summary: This patchset improves performance measurably (240 fps to 327 fps). The patch that avoids HeapAlloc calls when setting shader constants has an impact, but it is relatively small - much smaller than I expected. Plus the ntdll heap code is pretty good by now.
csmt usr heap usr no dyn 246 240 sysmem dyn 327 318 BO dyn 382 369 heapalloc dyn 344 335
From: Stefan Dösinger stefan@codeweavers.com
---
Having msvcrt is nice :-) --- dlls/wined3d/resource.c | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-)
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c index 9d3fd0a426d..1b9bd43d6f8 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -331,22 +331,8 @@ void CDECL wined3d_resource_preload(struct wined3d_resource *resource)
static BOOL wined3d_resource_allocate_sysmem(struct wined3d_resource *resource) { - void **p; - SIZE_T align = RESOURCE_ALIGNMENT - 1 + sizeof(*p); - void *mem; - - if (!(mem = heap_alloc_zero(resource->size + align))) - { - ERR("Failed to allocate system memory.\n"); - return FALSE; - } - - p = (void **)(((ULONG_PTR)mem + align) & ~(RESOURCE_ALIGNMENT - 1)) - 1; - *p = mem; - - resource->heap_memory = ++p; - - return TRUE; + resource->heap_memory = _aligned_malloc(resource->size, RESOURCE_ALIGNMENT); + return !!resource->heap_memory; }
BOOL wined3d_resource_prepare_sysmem(struct wined3d_resource *resource) @@ -359,12 +345,7 @@ BOOL wined3d_resource_prepare_sysmem(struct wined3d_resource *resource)
void wined3d_resource_free_sysmem(struct wined3d_resource *resource) { - void **p = resource->heap_memory; - - if (!p) - return; - - heap_free(*(--p)); + _aligned_free(resource->heap_memory); resource->heap_memory = NULL; }
From: Stefan Dösinger stefan@codeweavers.com
---
In practise those don't get returned to the application because of conflicting NOOVERWRITE|DISCARD checks in the callers vs this function, but I ran into this when benchmarking the performance of this codepath for dynamic uploads. It doesn't hurt to get the alignment right. --- dlls/wined3d/cs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 50d89615dd3..fa2a968fef3 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -2711,7 +2711,7 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi if (op->bo.addr.buffer_object) FIXME("Free BO address %s.\n", debug_const_bo_address(&op->bo.addr)); else - heap_free((void *)op->bo.addr.addr); + _aligned_free((void *)op->bo.addr.addr); } }
@@ -3124,7 +3124,7 @@ static bool wined3d_cs_map_upload_bo(struct wined3d_device_context *context, str + ((box->bottom - box->top - 1) / format->block_height) * map_desc->row_pitch + ((box->right - box->left + format->block_width - 1) / format->block_width) * format->block_byte_count;
- if (!(map_desc->data = heap_alloc(size))) + if (!(map_desc->data = _aligned_malloc(size, RESOURCE_ALIGNMENT))) { WARN_(d3d_perf)("Failed to allocate a heap memory buffer.\n"); return false;
From: Stefan Dösinger stefan@codeweavers.com
---
This raises performance in HL2 from 170 to 190 fps. The USR call is due to d3d9 push constants. --- dlls/wined3d/cs.c | 51 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index fa2a968fef3..defe3405c3e 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -501,6 +501,7 @@ struct wined3d_cs_update_sub_resource struct wined3d_box box; struct upload_bo bo; unsigned int row_pitch, slice_pitch; + uint8_t data[1]; };
struct wined3d_cs_add_dirty_texture_region @@ -2719,16 +2720,60 @@ void wined3d_device_context_emit_update_sub_resource(struct wined3d_device_conte struct wined3d_resource *resource, unsigned int sub_resource_idx, const struct wined3d_box *box, const void *data, unsigned int row_pitch, unsigned int slice_pitch) { + const struct wined3d_format *format = resource->format; struct wined3d_cs_update_sub_resource *op; struct wined3d_map_desc map_desc; struct wined3d_box dummy_box; struct upload_bo bo; + size_t size;
/* If we are replacing the whole resource, the CS thread might discard and * rename the buffer object, in which case ours is no longer valid. */ if (resource->type == WINED3D_RTYPE_BUFFER && box->right - box->left == resource->size) invalidate_client_address(resource);
+ wined3d_format_calculate_pitch(format, 1, box->right - box->left, + box->bottom - box->top, &map_desc.row_pitch, &map_desc.slice_pitch); + + size = (box->back - box->front - 1) * map_desc.slice_pitch + + ((box->bottom - box->top - 1) / format->block_height) * map_desc.row_pitch + + ((box->right - box->left + format->block_width - 1) / format->block_width) * format->block_byte_count; + + if (size <= 4096) + { + /* For small data, make a copy, schedule an in-band update and go home. The copy is placed on the + * CS buffer itself to avoid malloc/free in this performance critical path. + * + * The 4k are based on the maximum d3d9 push constant size. + * + * The reason why this code is here and not in map_upload_bo is that map_upload_bo needs to + * preserve existing data in the cases where this special handling might be of interest. It can + * only throw away data in case of DISCARD maps, which are already handled. Otherwise, even in + * case of a synchronous write-only map, it needs to preserve existing data because there is no + * guarantee that the application will overwrite every single byte. + * + * TODO: It might be faster to use the WINED3D_CS_QUEUE_MAP codepath below if the resource is + * already idle. There is no guarantee of that though. It would eliminate one copy, but copying + * 4k is fast, whereas cs_finish(QUEUE_MAP) does a round-trip to the other thread. */ + op = wined3d_device_context_require_space(context, + offsetof(struct wined3d_cs_update_sub_resource, data[size]), WINED3D_CS_QUEUE_DEFAULT); + op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE; + op->resource = resource; + op->sub_resource_idx = sub_resource_idx; + op->box = *box; + op->bo.addr.buffer_object = 0; + op->bo.addr.addr = op->data; + op->bo.flags = 0; + op->row_pitch = row_pitch; + op->slice_pitch = slice_pitch; + + wined3d_format_copy_data(resource->format, data, row_pitch, slice_pitch, op->data, map_desc.row_pitch, + map_desc.slice_pitch, box->right - box->left, box->bottom - box->top, box->back - box->front); + + wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT); + return; + } + if (context->ops->map_upload_bo(context, resource, sub_resource_idx, &map_desc, box, WINED3D_MAP_WRITE)) { wined3d_format_copy_data(resource->format, data, row_pitch, slice_pitch, map_desc.data, map_desc.row_pitch, @@ -2741,7 +2786,8 @@ void wined3d_device_context_emit_update_sub_resource(struct wined3d_device_conte
wined3d_resource_wait_idle(resource);
- op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_MAP); + op = wined3d_device_context_require_space(context, + offsetof(struct wined3d_cs_update_sub_resource, data[0]), WINED3D_CS_QUEUE_MAP); op->opcode = WINED3D_CS_OP_UPDATE_SUB_RESOURCE; op->resource = resource; op->sub_resource_idx = sub_resource_idx; @@ -2753,8 +2799,7 @@ void wined3d_device_context_emit_update_sub_resource(struct wined3d_device_conte op->slice_pitch = slice_pitch;
wined3d_device_context_submit(context, WINED3D_CS_QUEUE_MAP); - /* The data pointer may go away, so we need to wait until it is read. - * Copying the data may be faster if it's small. */ + /* The data pointer may go away, so we need to wait until it is read. */ wined3d_device_context_finish(context, WINED3D_CS_QUEUE_MAP); }
From: Stefan Dösinger stefan@codeweavers.com
This should make the next patch easier to read. The heap_alloc path hopefully goes away at some point, it has a few flaws. --- dlls/wined3d/cs.c | 173 +++++++++++++++++++++++----------------------- 1 file changed, 88 insertions(+), 85 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index defe3405c3e..80edad7affe 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -3066,118 +3066,121 @@ static void wined3d_cs_st_finish(struct wined3d_device_context *context, enum wi static bool wined3d_cs_map_upload_bo(struct wined3d_device_context *context, struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_map_desc *map_desc, const struct wined3d_box *box, uint32_t flags) { + const struct wined3d_d3d_info *d3d_info = &context->device->adapter->d3d_info; struct wined3d_client_resource *client = &resource->client; - const struct wined3d_format *format = resource->format; + struct wined3d_device *device = context->device; + struct wined3d_bo_address addr; + struct wined3d_bo *bo; + uint8_t *map_ptr; size_t size;
- if (flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE)) + if (!(flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))) { - const struct wined3d_d3d_info *d3d_info = &context->device->adapter->d3d_info; - struct wined3d_device *device = context->device; - struct wined3d_bo_address addr; - struct wined3d_bo *bo; - uint8_t *map_ptr; + const struct wined3d_format *format = resource->format;
- /* We can't use persistent maps if we might need to do vertex attribute - * conversion; that will cause the CS thread to invalidate the BO. */ - if (!d3d_info->xyzrhw || !d3d_info->vertex_bgra || !d3d_info->ffp_generic_attributes) - { - TRACE("Not returning a persistent buffer because we might need to do vertex attribute conversion.\n"); - return false; - } + wined3d_format_calculate_pitch(format, 1, box->right - box->left, + box->bottom - box->top, &map_desc->row_pitch, &map_desc->slice_pitch); + + size = (box->back - box->front - 1) * map_desc->slice_pitch + + ((box->bottom - box->top - 1) / format->block_height) * map_desc->row_pitch + + ((box->right - box->left + format->block_width - 1) / format->block_width) * format->block_byte_count;
- if (resource->pin_sysmem) + if (!(map_desc->data = _aligned_malloc(size, RESOURCE_ALIGNMENT))) { - TRACE("Not allocating an upload buffer because system memory is pinned for this resource.\n"); + WARN_(d3d_perf)("Failed to allocate a heap memory buffer.\n"); return false; } + client->mapped_upload.addr.buffer_object = 0; + client->mapped_upload.addr.addr = map_desc->data; + client->mapped_upload.flags = UPLOAD_BO_UPLOAD_ON_UNMAP | UPLOAD_BO_FREE_ON_UNMAP; + client->mapped_box = *box;
- if ((flags & WINED3D_MAP_NOOVERWRITE) && client->addr.buffer_object == CLIENT_BO_DISCARDED) - flags = (flags & ~WINED3D_MAP_NOOVERWRITE) | WINED3D_MAP_DISCARD; + TRACE("Returning bo %s, flags %#x.\n", debug_const_bo_address(&client->mapped_upload.addr), + client->mapped_upload.flags); + return true; + }
- if (flags & WINED3D_MAP_DISCARD) - { - if (!device->adapter->adapter_ops->adapter_alloc_bo(device, resource, sub_resource_idx, &addr)) - return false; + /* We can't use persistent maps if we might need to do vertex attribute + * conversion; that will cause the CS thread to invalidate the BO. */ + if (!d3d_info->xyzrhw || !d3d_info->vertex_bgra || !d3d_info->ffp_generic_attributes) + { + TRACE("Not returning a persistent buffer because we might need to do vertex attribute conversion.\n"); + return false; + }
- /* Limit NOOVERWRITE maps to buffers for now; there are too many - * ways that a texture can be invalidated to even count. */ - if (resource->type == WINED3D_RTYPE_BUFFER) - client->addr = addr; - } - else - { - addr = client->addr; - } + if (resource->pin_sysmem) + { + TRACE("Not allocating an upload buffer because system memory is pinned for this resource.\n"); + return false; + }
- map_ptr = NULL; - if ((bo = addr.buffer_object)) - { - wined3d_device_bo_map_lock(device); - if ((map_ptr = bo->map_ptr)) - ++bo->client_map_count; - wined3d_device_bo_map_unlock(device); + if ((flags & WINED3D_MAP_NOOVERWRITE) && client->addr.buffer_object == CLIENT_BO_DISCARDED) + flags = (flags & ~WINED3D_MAP_NOOVERWRITE) | WINED3D_MAP_DISCARD;
- if (!map_ptr) - { - /* adapter_alloc_bo() should have given us a mapped BO if we are - * discarding. */ - assert(flags & WINED3D_MAP_NOOVERWRITE); - WARN_(d3d_perf)("Not accelerating a NOOVERWRITE map because the BO is not mapped.\n"); - return false; - } - } - map_ptr += (uintptr_t)addr.addr; + if (flags & WINED3D_MAP_DISCARD) + { + if (!device->adapter->adapter_ops->adapter_alloc_bo(device, resource, sub_resource_idx, &addr)) + return false; + + /* Limit NOOVERWRITE maps to buffers for now; there are too many + * ways that a texture can be invalidated to even count. */ + if (resource->type == WINED3D_RTYPE_BUFFER) + client->addr = addr; + } + else + { + addr = client->addr; + } + + map_ptr = NULL; + if ((bo = addr.buffer_object)) + { + wined3d_device_bo_map_lock(device); + if ((map_ptr = bo->map_ptr)) + ++bo->client_map_count; + wined3d_device_bo_map_unlock(device);
if (!map_ptr) { + /* adapter_alloc_bo() should have given us a mapped BO if we are + * discarding. */ assert(flags & WINED3D_MAP_NOOVERWRITE); - WARN_(d3d_perf)("Not accelerating a NOOVERWRITE map because the sub-resource has no valid address.\n"); + WARN_(d3d_perf)("Not accelerating a NOOVERWRITE map because the BO is not mapped.\n"); return false; } - - wined3d_resource_get_sub_resource_map_pitch(resource, sub_resource_idx, - &map_desc->row_pitch, &map_desc->slice_pitch); - - client->mapped_upload.addr = *wined3d_const_bo_address(&addr); - client->mapped_upload.flags = 0; - if (bo) - { - map_ptr += bo->memory_offset; - /* If we are not mapping all buffers persistently, use - * UPDATE_SUB_RESOURCE as a means of telling the CS thread to try - * to unmap the resource, so that we can free VA space. */ - if (!bo->coherent || !wined3d_map_persistent()) - client->mapped_upload.flags |= UPLOAD_BO_UPLOAD_ON_UNMAP; - } - map_desc->data = resource_offset_map_pointer(resource, sub_resource_idx, map_ptr, box); - - if (flags & WINED3D_MAP_DISCARD) - client->mapped_upload.flags |= UPLOAD_BO_UPLOAD_ON_UNMAP | UPLOAD_BO_RENAME_ON_UNMAP; - - client->mapped_box = *box; - - TRACE("Returning bo %s, flags %#x.\n", debug_const_bo_address(&client->mapped_upload.addr), - client->mapped_upload.flags); - return true; } + map_ptr += (uintptr_t)addr.addr;
- wined3d_format_calculate_pitch(format, 1, box->right - box->left, - box->bottom - box->top, &map_desc->row_pitch, &map_desc->slice_pitch); + if (!map_ptr) + { + assert(flags & WINED3D_MAP_NOOVERWRITE); + WARN_(d3d_perf)("Not accelerating a NOOVERWRITE map because the sub-resource has no valid address.\n"); + return false; + }
- size = (box->back - box->front - 1) * map_desc->slice_pitch - + ((box->bottom - box->top - 1) / format->block_height) * map_desc->row_pitch - + ((box->right - box->left + format->block_width - 1) / format->block_width) * format->block_byte_count; + wined3d_resource_get_sub_resource_map_pitch(resource, sub_resource_idx, + &map_desc->row_pitch, &map_desc->slice_pitch);
- if (!(map_desc->data = _aligned_malloc(size, RESOURCE_ALIGNMENT))) + client->mapped_upload.addr = *wined3d_const_bo_address(&addr); + client->mapped_upload.flags = 0; + if (bo) { - WARN_(d3d_perf)("Failed to allocate a heap memory buffer.\n"); - return false; + map_ptr += bo->memory_offset; + /* If we are not mapping all buffers persistently, use + * UPDATE_SUB_RESOURCE as a means of telling the CS thread to try + * to unmap the resource, so that we can free VA space. */ + if (!bo->coherent || !wined3d_map_persistent()) + client->mapped_upload.flags |= UPLOAD_BO_UPLOAD_ON_UNMAP; } - client->mapped_upload.addr.buffer_object = 0; - client->mapped_upload.addr.addr = map_desc->data; - client->mapped_upload.flags = UPLOAD_BO_UPLOAD_ON_UNMAP | UPLOAD_BO_FREE_ON_UNMAP; + map_desc->data = resource_offset_map_pointer(resource, sub_resource_idx, map_ptr, box); + + if (flags & WINED3D_MAP_DISCARD) + client->mapped_upload.flags |= UPLOAD_BO_UPLOAD_ON_UNMAP | UPLOAD_BO_RENAME_ON_UNMAP; + client->mapped_box = *box; + + TRACE("Returning bo %s, flags %#x.\n", debug_const_bo_address(&client->mapped_upload.addr), + client->mapped_upload.flags); return true; }
From: Stefan Dösinger stefan@codeweavers.com
This implementation works similarly to the current permanently mapped buffer one and shares most of the code.
By nature it will be slow for d3d10+ applications because we don't get any map range info from the API. --- dlls/wined3d/buffer.c | 30 ++++++++++++++------- dlls/wined3d/context_gl.c | 6 ++++- dlls/wined3d/cs.c | 48 ++++++++++++++++++++++++++++++---- dlls/wined3d/wined3d_private.h | 6 +++++ 4 files changed, 75 insertions(+), 15 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 082d502ff98..a107c7ecb1d 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -1245,15 +1245,27 @@ void wined3d_buffer_update_sub_resource(struct wined3d_buffer *buffer, struct wi
if (flags & UPLOAD_BO_RENAME_ON_UNMAP) { - /* Don't increment the refcount. UPLOAD_BO_RENAME_ON_UNMAP transfers an - * existing reference. - * - * FIXME: We could degenerate RENAME to a copy + free and rely on the - * COW logic to detect this case. - */ - wined3d_buffer_set_bo(buffer, context, upload_bo->addr.buffer_object); - wined3d_buffer_validate_location(buffer, WINED3D_LOCATION_BUFFER); - wined3d_buffer_invalidate_location(buffer, ~WINED3D_LOCATION_BUFFER); + if (upload_bo->addr.buffer_object) + { + /* Don't increment the refcount. UPLOAD_BO_RENAME_ON_UNMAP transfers an + * existing reference. + * + * FIXME: We could degenerate RENAME to a copy + free and rely on the + * COW logic to detect this case. + */ + wined3d_buffer_set_bo(buffer, context, upload_bo->addr.buffer_object); + wined3d_buffer_validate_location(buffer, WINED3D_LOCATION_BUFFER); + wined3d_buffer_invalidate_location(buffer, ~WINED3D_LOCATION_BUFFER); + } + else + { + _aligned_free(buffer->resource.heap_memory); + buffer->resource.heap_memory = (void *)upload_bo->addr.addr; + wined3d_buffer_validate_location(buffer, WINED3D_LOCATION_SYSMEM); + wined3d_buffer_invalidate_location(buffer, ~WINED3D_LOCATION_SYSMEM); + /* We are done here. Due to the invalidated LOCATION_BUFFER the data will be uplooaded on the next draw. */ + return; + } }
if (upload_bo->addr.buffer_object && upload_bo->addr.buffer_object == buffer->buffer_object) diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c index eb3c8b2438e..ece2573545d 100644 --- a/dlls/wined3d/context_gl.c +++ b/dlls/wined3d/context_gl.c @@ -3138,8 +3138,12 @@ void wined3d_context_gl_copy_bo_address(struct wined3d_context_gl *context_gl, wined3d_context_gl_reference_bo(context_gl, dst_bo); } } - else + else if (dst->addr != src->addr) { + /* Copies between the same address can happen if we NOOVERWRITE mapped into heap_memory + * and buffer_get_location picked the sysmem location to copy the new data to (e.g. because + * the buffer has been invalidated after DISCARD. This function will get called again on + * the next draw to copy the data into the BO. */ for (i = 0; i < range_count; ++i) memcpy(dst->addr + ranges[i].offset, src->addr + ranges[i].offset, ranges[i].size); } diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 80edad7affe..75bcc427523 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -3078,6 +3078,11 @@ static bool wined3d_cs_map_upload_bo(struct wined3d_device_context *context, str { const struct wined3d_format *format = resource->format;
+ /* FIXME: This codepath exists to retain update_sub_resource's ability to copy incoming data + * above 4k (or above what we want to place on the CS queue itself) at the cost of doing a + * heap_alloc + heap_free. It is incorrect for maps - even if we have a write-only map, there + * is no guarantee that the application will overwrite every single byte in the mapped range, + * so we would have to copy the current buffer data into the new buffer before returning it. */ wined3d_format_calculate_pitch(format, 1, box->right - box->left, box->bottom - box->top, &map_desc->row_pitch, &map_desc->slice_pitch);
@@ -3120,7 +3125,24 @@ static bool wined3d_cs_map_upload_bo(struct wined3d_device_context *context, str if (flags & WINED3D_MAP_DISCARD) { if (!device->adapter->adapter_ops->adapter_alloc_bo(device, resource, sub_resource_idx, &addr)) - return false; + { + if (resource->type == WINED3D_RTYPE_BUFFER) + { + size = resource->size; + } + else + { + struct wined3d_texture *texture = texture_from_resource(resource); + size = texture->sub_resources[sub_resource_idx].size; + } + + addr.buffer_object = 0; + if (!(addr.addr = _aligned_malloc(size, RESOURCE_ALIGNMENT))) + { + WARN_(d3d_perf)("Failed to allocate a heap memory buffer.\n"); + return false; + } + }
/* Limit NOOVERWRITE maps to buffers for now; there are too many * ways that a texture can be invalidated to even count. */ @@ -3161,7 +3183,6 @@ static bool wined3d_cs_map_upload_bo(struct wined3d_device_context *context, str wined3d_resource_get_sub_resource_map_pitch(resource, sub_resource_idx, &map_desc->row_pitch, &map_desc->slice_pitch);
- client->mapped_upload.addr = *wined3d_const_bo_address(&addr); client->mapped_upload.flags = 0; if (bo) { @@ -3171,11 +3192,28 @@ static bool wined3d_cs_map_upload_bo(struct wined3d_device_context *context, str * to unmap the resource, so that we can free VA space. */ if (!bo->coherent || !wined3d_map_persistent()) client->mapped_upload.flags |= UPLOAD_BO_UPLOAD_ON_UNMAP; + + if (flags & WINED3D_MAP_DISCARD) + client->mapped_upload.flags |= UPLOAD_BO_UPLOAD_ON_UNMAP | UPLOAD_BO_RENAME_ON_UNMAP; + + client->mapped_upload.addr = *wined3d_const_bo_address(&addr); } - map_desc->data = resource_offset_map_pointer(resource, sub_resource_idx, map_ptr, box); + else + { + client->mapped_upload.flags |= UPLOAD_BO_UPLOAD_ON_UNMAP;
- if (flags & WINED3D_MAP_DISCARD) - client->mapped_upload.flags |= UPLOAD_BO_UPLOAD_ON_UNMAP | UPLOAD_BO_RENAME_ON_UNMAP; + /* FIXME: This different handling vs the buffer case is ugly. Its because the above + * codepath abuses UPLOAD_ON_UNMAP to flush the BO, but it never reads mapped_upload.addr. + * For the sysmem codepath it is where glBufferSubData will eventually get the actual data + * from. */ + client->mapped_upload.addr.buffer_object = 0; + client->mapped_upload.addr.addr = resource_offset_map_pointer(resource, sub_resource_idx, map_ptr, box); + + if (flags & WINED3D_MAP_DISCARD) + client->mapped_upload.flags |= UPLOAD_BO_RENAME_ON_UNMAP; + } + + map_desc->data = resource_offset_map_pointer(resource, sub_resource_idx, map_ptr, box);
client->mapped_box = *box;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 0b92ae52e64..441e04fbbe3 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2518,6 +2518,12 @@ bool wined3d_driver_info_init(struct wined3d_driver_info *driver_info, const struct wined3d_gpu_description *gpu_description, enum wined3d_feature_level feature_level, UINT64 vram_bytes, UINT64 sysmem_bytes) DECLSPEC_HIDDEN;
+/* If RENAME_ON_UNMAP or FREE_ON_UNMAP are used, then the "const" qualifier in addr is wrong. In the + * first case the destination d3d buffer takes ownership of the BO (either GL/vulkan BO or sysmem + * allocation), in the second case the sysmem allocation is freed. + * + * But the code has to be able to deal with genuine const pointers in case of update_sub_resource. + * It must not modify the contents in this case. */ #define UPLOAD_BO_UPLOAD_ON_UNMAP 0x1 #define UPLOAD_BO_RENAME_ON_UNMAP 0x2 #define UPLOAD_BO_FREE_ON_UNMAP 0x4
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=138333
Your paranoid android.
=== debian11b (64 bit WoW report) ===
d2d1: d2d1.c:5419: Test failed: Surface does not match. d2d1.c:5419: Test failed: Surface does not match.
d3d10core: d3d10core.c:9864: Test failed: Got unexpected color 0x00000060 at (1, 2), expected 0xffff0000. d3d10core.c:9864: Test failed: Got unexpected color 0x00000000 at (2, 2), expected 0xffff00ff. d3d10core.c:7966: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {5.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d10core.c:7966: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {2.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d10core.c:7966: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {5.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d10core.c:7966: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {7.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d10core.c:7966: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {8.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d10core.c:7966: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {1.10000000e+001, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d10core.c:3279: Test failed: Got 0x00001050, expected 0x00000000 at (0, 8), sub-resource 1. d3d10core.c:7966: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {1.40000000e+001, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d10core.c:3287: Test failed: Got 0x00001050, expected 0x00000000 at (0, 8), sub-resource 1. d3d10core.c:7966: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {1.70000000e+001, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d10core.c:3279: Test failed: Got 0x00001050, expected 0x00000000 at (0, 8), sub-resource 1. d3d10core.c:3279: Test failed: Got 0x00001050, expected 0x00000000 at (0, 8), sub-resource 1. d3d10core.c:3287: Test failed: Got 0x00001050, expected 0x00000000 at (0, 8), sub-resource 1. d3d10core.c:7673: Test failed: Test 79: Got unexpected color 0xd05d1db0 at (0, 1). d3d10core.c:7673: Test failed: Test 79: Got unexpected color 0x00007f53 at (1, 1). d3d10core.c:7673: Test failed: Test 79: Got unexpected color 0x00007f53 at (2, 1). d3d10core.c:7673: Test failed: Test 79: Got unexpected color 0x00007f53 at (3, 1). d3d10core.c:7673: Test failed: Test 79: Got unexpected color 0xd05d1db0 at (0, 2). d3d10core.c:7673: Test failed: Test 79: Got unexpected color 0x00007f53 at (1, 2). d3d10core.c:7673: Test failed: Test 79: Got unexpected color 0x00007f53 at (2, 2). d3d10core.c:7673: Test failed: Test 79: Got unexpected color 0x00007f53 at (3, 2). d3d10core.c:7673: Test failed: Test 79: Got unexpected color 0xd05d1db0 at (0, 3). d3d10core.c:7673: Test failed: Test 79: Got unexpected color 0x00007f53 at (1, 3). d3d10core.c:7673: Test failed: Test 79: Got unexpected color 0x00007f53 at (2, 3). d3d10core.c:7673: Test failed: Test 79: Got unexpected color 0x00007f53 at (3, 3). d3d10core.c:7673: Test failed: Test 80: Got unexpected color 0xd05d1db0 at (0, 1). d3d10core.c:7673: Test failed: Test 80: Got unexpected color 0x00007f53 at (1, 1). d3d10core.c:7673: Test failed: Test 80: Got unexpected color 0x00007f53 at (2, 1). d3d10core.c:7673: Test failed: Test 80: Got unexpected color 0x00007f53 at (3, 1). d3d10core.c:7673: Test failed: Test 80: Got unexpected color 0xd05d1db0 at (0, 2). d3d10core.c:7673: Test failed: Test 80: Got unexpected color 0x00007f53 at (1, 2). d3d10core.c:7673: Test failed: Test 80: Got unexpected color 0x00007f53 at (2, 2). d3d10core.c:7673: Test failed: Test 80: Got unexpected color 0x00007f53 at (3, 2). d3d10core.c:7673: Test failed: Test 80: Got unexpected color 0xd05d1db0 at (0, 3). d3d10core.c:7673: Test failed: Test 80: Got unexpected color 0x00007f53 at (1, 3). d3d10core.c:7673: Test failed: Test 80: Got unexpected color 0x00007f53 at (2, 3). d3d10core.c:7673: Test failed: Test 80: Got unexpected color 0x00007f53 at (3, 3). d3d10core.c:7673: Test failed: Test 81: Got unexpected color 0xd05d1db0 at (0, 1). d3d10core.c:7673: Test failed: Test 81: Got unexpected color 0x00007f53 at (1, 1). d3d10core.c:7673: Test failed: Test 81: Got unexpected color 0x00007f53 at (2, 1). d3d10core.c:7673: Test failed: Test 81: Got unexpected color 0x00007f53 at (3, 1). d3d10core.c:7673: Test failed: Test 81: Got unexpected color 0xd05d1db0 at (0, 2). d3d10core.c:7673: Test failed: Test 81: Got unexpected color 0x00007f53 at (1, 2). d3d10core.c:7673: Test failed: Test 81: Got unexpected color 0x00007f53 at (2, 2). d3d10core.c:7673: Test failed: Test 81: Got unexpected color 0x00007f53 at (3, 2). d3d10core.c:7673: Test failed: Test 81: Got unexpected color 0xd05d1db0 at (0, 3). d3d10core.c:7673: Test failed: Test 81: Got unexpected color 0x00007f53 at (1, 3). d3d10core.c:7673: Test failed: Test 81: Got unexpected color 0x00007f53 at (2, 3). d3d10core.c:7673: Test failed: Test 81: Got unexpected color 0x00007f53 at (3, 3). d3d10core.c:7673: Test failed: Test 82: Got unexpected color 0xd05d1db0 at (0, 1). d3d10core.c:7673: Test failed: Test 82: Got unexpected color 0x00007f53 at (1, 1). d3d10core.c:7673: Test failed: Test 82: Got unexpected color 0x00007f53 at (2, 1). d3d10core.c:7673: Test failed: Test 82: Got unexpected color 0x00007f53 at (3, 1). d3d10core.c:7673: Test failed: Test 82: Got unexpected color 0xd05d1db0 at (0, 2). d3d10core.c:7673: Test failed: Test 82: Got unexpected color 0x00007f53 at (1, 2). d3d10core.c:7673: Test failed: Test 82: Got unexpected color 0x00007f53 at (2, 2). d3d10core.c:7673: Test failed: Test 82: Got unexpected color 0x00007f53 at (3, 2). d3d10core.c:7673: Test failed: Test 82: Got unexpected color 0xd05d1db0 at (0, 3). d3d10core.c:7673: Test failed: Test 82: Got unexpected color 0x00007f53 at (1, 3). d3d10core.c:7673: Test failed: Test 82: Got unexpected color 0x00007f53 at (2, 3). d3d10core.c:7673: Test failed: Test 82: Got unexpected color 0x00007f53 at (3, 3). d3d10core.c:7673: Test failed: Test 83: Got unexpected color 0xd05d1db0 at (0, 1). d3d10core.c:7673: Test failed: Test 83: Got unexpected color 0x00007f53 at (1, 1). d3d10core.c:7673: Test failed: Test 83: Got unexpected color 0x00007f53 at (2, 1). d3d10core.c:7673: Test failed: Test 83: Got unexpected color 0x00007f53 at (3, 1). d3d10core.c:7673: Test failed: Test 83: Got unexpected color 0xd05d1db0 at (0, 2). d3d10core.c:7673: Test failed: Test 83: Got unexpected color 0x00007f53 at (1, 2). d3d10core.c:7673: Test failed: Test 83: Got unexpected color 0x00007f53 at (2, 2). d3d10core.c:7673: Test failed: Test 83: Got unexpected color 0x00007f53 at (3, 2). d3d10core.c:7673: Test failed: Test 83: Got unexpected color 0xd05d1db0 at (0, 3). d3d10core.c:7673: Test failed: Test 83: Got unexpected color 0x00007f53 at (1, 3). d3d10core.c:7673: Test failed: Test 83: Got unexpected color 0x00007f53 at (2, 3). d3d10core.c:7673: Test failed: Test 83: Got unexpected color 0x00007f53 at (3, 3). d3d10core.c:7673: Test failed: Test 86: Got unexpected color 0x00000000 at (0, 1). d3d10core.c:7673: Test failed: Test 86: Got unexpected color 0x00000000 at (1, 1). d3d10core.c:7673: Test failed: Test 86: Got unexpected color 0x00000000 at (2, 1). d3d10core.c:7673: Test failed: Test 86: Got unexpected color 0x00000000 at (3, 1). d3d10core.c:7673: Test failed: Test 86: Got unexpected color 0x00000000 at (0, 2). d3d10core.c:7673: Test failed: Test 86: Got unexpected color 0x00000000 at (1, 2). d3d10core.c:7673: Test failed: Test 86: Got unexpected color 0x00000000 at (2, 2). d3d10core.c:7673: Test failed: Test 86: Got unexpected color 0x00000000 at (3, 2). d3d10core.c:7673: Test failed: Test 86: Got unexpected color 0x00000000 at (0, 3). d3d10core.c:7673: Test failed: Test 86: Got unexpected color 0x00000000 at (1, 3). d3d10core.c:7673: Test failed: Test 86: Got unexpected color 0x00000000 at (2, 3). d3d10core.c:7673: Test failed: Test 86: Got unexpected color 0x00000000 at (3, 3). d3d10core.c:7673: Test failed: Test 87: Got unexpected color 0x00000000 at (0, 1). d3d10core.c:7673: Test failed: Test 87: Got unexpected color 0x00000000 at (1, 1). d3d10core.c:7673: Test failed: Test 87: Got unexpected color 0x00000000 at (2, 1). d3d10core.c:7673: Test failed: Test 87: Got unexpected color 0x00000000 at (3, 1). d3d10core.c:7673: Test failed: Test 87: Got unexpected color 0x00000000 at (0, 2). d3d10core.c:7673: Test failed: Test 87: Got unexpected color 0x00000000 at (1, 2). d3d10core.c:7673: Test failed: Test 87: Got unexpected color 0x00000000 at (2, 2). d3d10core.c:7673: Test failed: Test 87: Got unexpected color 0x00000000 at (3, 2). d3d10core.c:7673: Test failed: Test 87: Got unexpected color 0x00000000 at (0, 3). d3d10core.c:7673: Test failed: Test 87: Got unexpected color 0x00000000 at (1, 3). d3d10core.c:7673: Test failed: Test 87: Got unexpected color 0x00000000 at (2, 3). d3d10core.c:7673: Test failed: Test 87: Got unexpected color 0x00000000 at (3, 3). d3d10core.c:7673: Test failed: Test 88: Got unexpected color 0x00000000 at (0, 1). d3d10core.c:7673: Test failed: Test 88: Got unexpected color 0x00000000 at (1, 1). d3d10core.c:7673: Test failed: Test 88: Got unexpected color 0x00000000 at (2, 1). d3d10core.c:7673: Test failed: Test 88: Got unexpected color 0x00000000 at (3, 1). d3d10core.c:7673: Test failed: Test 88: Got unexpected color 0x00000000 at (0, 2). d3d10core.c:7673: Test failed: Test 88: Got unexpected color 0x00000000 at (1, 2). d3d10core.c:7673: Test failed: Test 88: Got unexpected color 0x00000000 at (2, 2). d3d10core.c:7673: Test failed: Test 88: Got unexpected color 0x00000000 at (3, 2). d3d10core.c:7673: Test failed: Test 88: Got unexpected color 0x00000000 at (0, 3). d3d10core.c:7673: Test failed: Test 88: Got unexpected color 0x00000000 at (1, 3). d3d10core.c:7673: Test failed: Test 88: Got unexpected color 0x00000000 at (2, 3). d3d10core.c:7673: Test failed: Test 88: Got unexpected color 0x00000000 at (3, 3). d3d10core.c:7673: Test failed: Test 89: Got unexpected color 0x00000000 at (0, 1). d3d10core.c:7673: Test failed: Test 89: Got unexpected color 0x00000000 at (1, 1). d3d10core.c:7673: Test failed: Test 89: Got unexpected color 0x00000000 at (2, 1). d3d10core.c:7673: Test failed: Test 89: Got unexpected color 0x00000000 at (3, 1). d3d10core.c:7673: Test failed: Test 89: Got unexpected color 0x00000000 at (0, 2). d3d10core.c:7673: Test failed: Test 89: Got unexpected color 0x00000000 at (1, 2). d3d10core.c:7673: Test failed: Test 89: Got unexpected color 0x00000000 at (2, 2). d3d10core.c:7673: Test failed: Test 89: Got unexpected color 0x00000000 at (3, 2). d3d10core.c:7673: Test failed: Test 89: Got unexpected color 0x00000000 at (0, 3). d3d10core.c:7673: Test failed: Test 89: Got unexpected color 0x00000000 at (1, 3). d3d10core.c:7673: Test failed: Test 89: Got unexpected color 0x00000000 at (2, 3). d3d10core.c:7673: Test failed: Test 89: Got unexpected color 0x00000000 at (3, 3). d3d10core.c:7673: Test failed: Test 90: Got unexpected color 0x00000000 at (0, 1). d3d10core.c:7673: Test failed: Test 90: Got unexpected color 0x00000000 at (1, 1). d3d10core.c:7673: Test failed: Test 90: Got unexpected color 0x00000000 at (2, 1). d3d10core.c:7673: Test failed: Test 90: Got unexpected color 0x00000000 at (3, 1). d3d10core.c:7673: Test failed: Test 90: Got unexpected color 0x00000000 at (0, 2). d3d10core.c:7673: Test failed: Test 90: Got unexpected color 0x00000000 at (1, 2). d3d10core.c:7673: Test failed: Test 90: Got unexpected color 0x00000000 at (2, 2). d3d10core.c:7673: Test failed: Test 90: Got unexpected color 0x00000000 at (3, 2). d3d10core.c:7673: Test failed: Test 90: Got unexpected color 0x00000000 at (0, 3). d3d10core.c:7673: Test failed: Test 90: Got unexpected color 0x00000000 at (1, 3). d3d10core.c:7673: Test failed: Test 90: Got unexpected color 0x00000000 at (2, 3). d3d10core.c:7673: Test failed: Test 90: Got unexpected color 0x00000000 at (3, 3). d3d10core.c:7765: Test failed: Test 11: Got unexpected color 0x0000002d at (0, 3). d3d10core.c:7765: Test failed: Test 11: Got unexpected color 0x00000000 at (1, 3). d3d10core.c:7765: Test failed: Test 11: Got unexpected color 0x903a1f90 at (2, 3). d3d10core.c:7765: Test failed: Test 11: Got unexpected color 0x00007f54 at (3, 3). d3d10core.c:7765: Test failed: Test 12: Got unexpected color 0x903a1f90 at (0, 1). d3d10core.c:7765: Test failed: Test 12: Got unexpected color 0x00007f54 at (1, 1). d3d10core.c:7765: Test failed: Test 12: Got unexpected color 0x00007f54 at (2, 1). d3d10core.c:7765: Test failed: Test 12: Got unexpected color 0x00007f54 at (3, 1). d3d10core.c:7765: Test failed: Test 12: Got unexpected color 0x903a1f90 at (0, 2). d3d10core.c:7765: Test failed: Test 12: Got unexpected color 0x00007f54 at (1, 2). d3d10core.c:7765: Test failed: Test 12: Got unexpected color 0x00007f54 at (2, 2). d3d10core.c:7765: Test failed: Test 12: Got unexpected color 0x00007f54 at (3, 2). d3d10core.c:7765: Test failed: Test 12: Got unexpected color 0x903a1f90 at (0, 3). d3d10core.c:7765: Test failed: Test 12: Got unexpected color 0x00007f54 at (1, 3). d3d10core.c:7765: Test failed: Test 12: Got unexpected color 0x00007f54 at (2, 3). d3d10core.c:7765: Test failed: Test 12: Got unexpected color 0x00007f54 at (3, 3). d3d10core.c:7765: Test failed: Test 14: Got unexpected color 0x00000000 at (0, 1). d3d10core.c:7765: Test failed: Test 14: Got unexpected color 0x00000025 at (1, 1). d3d10core.c:7765: Test failed: Test 14: Got unexpected color 0x00000025 at (2, 1). d3d10core.c:7765: Test failed: Test 14: Got unexpected color 0x00000025 at (3, 1). d3d10core.c:7765: Test failed: Test 14: Got unexpected color 0x00000000 at (0, 2). d3d10core.c:7765: Test failed: Test 14: Got unexpected color 0x00000025 at (1, 2). d3d10core.c:7765: Test failed: Test 14: Got unexpected color 0x00000025 at (2, 2). d3d10core.c:7765: Test failed: Test 14: Got unexpected color 0x00000025 at (3, 2). d3d10core.c:7765: Test failed: Test 14: Got unexpected color 0x00000000 at (0, 3). d3d10core.c:7765: Test failed: Test 14: Got unexpected color 0x00000025 at (1, 3). d3d10core.c:7765: Test failed: Test 14: Got unexpected color 0x00000025 at (2, 3). d3d10core.c:7765: Test failed: Test 14: Got unexpected color 0x00000025 at (3, 3).
d3d11: d3d11.c:10472: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {5.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d11.c:14359: Test failed: Got colour 0x00000060 at (1, 2), expected 0xffff0000. d3d11.c:14359: Test failed: Got colour 0x00000000 at (2, 2), expected 0xffff00ff. d3d11.c:14431: Test failed: Got colour 0x0000002c at (0, 1), expected 0x80008000. d3d11.c:14431: Test failed: Got colour 0x80000080 at (1, 1), expected 0xff8080ff. d3d11.c:10472: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {2.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d11.c:10472: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {5.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d11.c:10472: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {7.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d11.c:10472: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {8.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d11.c:10472: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {1.10000000e+001, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d11.c:11503: Test failed: Got 0x00001050, expected 0x00000000 at (0, 8, 0), sub-resource 1. d3d11.c:11511: Test failed: Got 0x00001050, expected 0x00000000 at (0, 8, 0), sub-resource 1. d3d11.c:10472: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {1.40000000e+001, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d11.c:10472: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {1.70000000e+001, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d11.c:11503: Test failed: Got 0x00001050, expected 0x00000000 at (0, 8, 0), sub-resource 1. d3d11.c:11503: Test failed: Got 0x00001050, expected 0x00000000 at (0, 8, 0), sub-resource 1. d3d11.c:11511: Test failed: Got 0x00001050, expected 0x00000000 at (0, 8, 0), sub-resource 1. d3d11.c:10472: Test failed: Got {7.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {5.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d11.c:10472: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {1.70000000e+001, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d11.c:10073: Test failed: Test 87: Got unexpected colour 0xcc3864e0 at (0, 1). d3d11.c:10073: Test failed: Test 87: Got unexpected colour 0x00007f19 at (1, 1). d3d11.c:10073: Test failed: Test 87: Got unexpected colour 0x00007f19 at (2, 1). d3d11.c:10073: Test failed: Test 87: Got unexpected colour 0x00007f19 at (3, 1). d3d11.c:10073: Test failed: Test 87: Got unexpected colour 0xcc3864e0 at (0, 2). d3d11.c:10073: Test failed: Test 87: Got unexpected colour 0x00007f19 at (1, 2). d3d11.c:10073: Test failed: Test 87: Got unexpected colour 0x00007f19 at (2, 2). d3d11.c:10073: Test failed: Test 87: Got unexpected colour 0x00007f19 at (3, 2). d3d11.c:10073: Test failed: Test 87: Got unexpected colour 0xcc3864e0 at (0, 3). d3d11.c:10073: Test failed: Test 87: Got unexpected colour 0x00007f19 at (1, 3). d3d11.c:10073: Test failed: Test 87: Got unexpected colour 0x00007f19 at (2, 3). d3d11.c:10073: Test failed: Test 87: Got unexpected colour 0x00007f19 at (3, 3). d3d11.c:10073: Test failed: Test 88: Got unexpected colour 0xcc3864e0 at (0, 1). d3d11.c:10073: Test failed: Test 88: Got unexpected colour 0x00007f19 at (1, 1). d3d11.c:10073: Test failed: Test 88: Got unexpected colour 0x00007f19 at (2, 1). d3d11.c:10073: Test failed: Test 88: Got unexpected colour 0x00007f19 at (3, 1). d3d11.c:10073: Test failed: Test 88: Got unexpected colour 0xcc3864e0 at (0, 2). d3d11.c:10073: Test failed: Test 88: Got unexpected colour 0x00007f19 at (1, 2). d3d11.c:10073: Test failed: Test 88: Got unexpected colour 0x00007f19 at (2, 2). d3d11.c:10073: Test failed: Test 88: Got unexpected colour 0x00007f19 at (3, 2). d3d11.c:10073: Test failed: Test 88: Got unexpected colour 0xcc3864e0 at (0, 3). d3d11.c:10073: Test failed: Test 88: Got unexpected colour 0x00007f19 at (1, 3). d3d11.c:10073: Test failed: Test 88: Got unexpected colour 0x00007f19 at (2, 3). d3d11.c:10073: Test failed: Test 88: Got unexpected colour 0x00007f19 at (3, 3). d3d11.c:10472: Test failed: Got {4.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {2.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d11.c:10073: Test failed: Test 89: Got unexpected colour 0xcc3864e0 at (0, 1). d3d11.c:10073: Test failed: Test 89: Got unexpected colour 0x00007f19 at (1, 1). d3d11.c:10073: Test failed: Test 89: Got unexpected colour 0x00007f19 at (2, 1). d3d11.c:10073: Test failed: Test 89: Got unexpected colour 0x00007f19 at (3, 1). d3d11.c:10073: Test failed: Test 89: Got unexpected colour 0xcc3864e0 at (0, 2). d3d11.c:10073: Test failed: Test 89: Got unexpected colour 0x00007f19 at (1, 2). d3d11.c:10073: Test failed: Test 89: Got unexpected colour 0x00007f19 at (2, 2). d3d11.c:10073: Test failed: Test 89: Got unexpected colour 0x00007f19 at (3, 2). d3d11.c:10073: Test failed: Test 89: Got unexpected colour 0xcc3864e0 at (0, 3). d3d11.c:10073: Test failed: Test 89: Got unexpected colour 0x00007f19 at (1, 3). d3d11.c:10073: Test failed: Test 89: Got unexpected colour 0x00007f19 at (2, 3). d3d11.c:10073: Test failed: Test 89: Got unexpected colour 0x00007f19 at (3, 3). d3d11.c:10472: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {5.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d11.c:10073: Test failed: Test 90: Got unexpected colour 0xcc3864e0 at (0, 1). d3d11.c:10073: Test failed: Test 90: Got unexpected colour 0x00007f19 at (1, 1). d3d11.c:10073: Test failed: Test 90: Got unexpected colour 0x00007f19 at (2, 1). d3d11.c:10073: Test failed: Test 90: Got unexpected colour 0x00007f19 at (3, 1). d3d11.c:10073: Test failed: Test 90: Got unexpected colour 0xcc3864e0 at (0, 2). d3d11.c:10073: Test failed: Test 90: Got unexpected colour 0x00007f19 at (1, 2). d3d11.c:10073: Test failed: Test 90: Got unexpected colour 0x00007f19 at (2, 2). d3d11.c:10073: Test failed: Test 90: Got unexpected colour 0x00007f19 at (3, 2). d3d11.c:10073: Test failed: Test 90: Got unexpected colour 0xcc3864e0 at (0, 3). d3d11.c:10073: Test failed: Test 90: Got unexpected colour 0x00007f19 at (1, 3). d3d11.c:10073: Test failed: Test 90: Got unexpected colour 0x00007f19 at (2, 3). d3d11.c:10073: Test failed: Test 90: Got unexpected colour 0x00007f19 at (3, 3). d3d11.c:10472: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {7.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d11.c:10472: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {8.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d11.c:10073: Test failed: Test 91: Got unexpected colour 0xcc3864e0 at (0, 1). d3d11.c:10073: Test failed: Test 91: Got unexpected colour 0x00007f19 at (1, 1). d3d11.c:10073: Test failed: Test 91: Got unexpected colour 0x00007f19 at (2, 1). d3d11.c:10073: Test failed: Test 91: Got unexpected colour 0x00007f19 at (3, 1). d3d11.c:10073: Test failed: Test 91: Got unexpected colour 0xcc3864e0 at (0, 2). d3d11.c:10073: Test failed: Test 91: Got unexpected colour 0x00007f19 at (1, 2). d3d11.c:10073: Test failed: Test 91: Got unexpected colour 0x00007f19 at (2, 2). d3d11.c:10073: Test failed: Test 91: Got unexpected colour 0x00007f19 at (3, 2). d3d11.c:10073: Test failed: Test 91: Got unexpected colour 0xcc3864e0 at (0, 3). d3d11.c:10073: Test failed: Test 91: Got unexpected colour 0x00007f19 at (1, 3). d3d11.c:10073: Test failed: Test 91: Got unexpected colour 0x00007f19 at (2, 3). d3d11.c:10073: Test failed: Test 91: Got unexpected colour 0x00007f19 at (3, 3). d3d11.c:10472: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {1.10000000e+001, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d11.c:10073: Test failed: Test 94: Got unexpected colour 0x00000000 at (0, 1). d3d11.c:10073: Test failed: Test 94: Got unexpected colour 0x00000025 at (1, 1). d3d11.c:10073: Test failed: Test 94: Got unexpected colour 0x00000025 at (2, 1). d3d11.c:10073: Test failed: Test 94: Got unexpected colour 0x00000025 at (3, 1). d3d11.c:10073: Test failed: Test 94: Got unexpected colour 0x00000000 at (0, 2). d3d11.c:10073: Test failed: Test 94: Got unexpected colour 0x00000025 at (1, 2). d3d11.c:10073: Test failed: Test 94: Got unexpected colour 0x00000025 at (2, 2). d3d11.c:10073: Test failed: Test 94: Got unexpected colour 0x00000025 at (3, 2). d3d11.c:10073: Test failed: Test 94: Got unexpected colour 0x00000000 at (0, 3). d3d11.c:10073: Test failed: Test 94: Got unexpected colour 0x00000025 at (1, 3). d3d11.c:10073: Test failed: Test 94: Got unexpected colour 0x00000025 at (2, 3). d3d11.c:10073: Test failed: Test 94: Got unexpected colour 0x00000025 at (3, 3). d3d11.c:10073: Test failed: Test 95: Got unexpected colour 0x00000000 at (0, 1). d3d11.c:10073: Test failed: Test 95: Got unexpected colour 0x00000025 at (1, 1). d3d11.c:10073: Test failed: Test 95: Got unexpected colour 0x00000025 at (2, 1). d3d11.c:10073: Test failed: Test 95: Got unexpected colour 0x00000025 at (3, 1). d3d11.c:10073: Test failed: Test 95: Got unexpected colour 0x00000000 at (0, 2). d3d11.c:10073: Test failed: Test 95: Got unexpected colour 0x00000025 at (1, 2). d3d11.c:10073: Test failed: Test 95: Got unexpected colour 0x00000025 at (2, 2). d3d11.c:10073: Test failed: Test 95: Got unexpected colour 0x00000025 at (3, 2). d3d11.c:10073: Test failed: Test 95: Got unexpected colour 0x00000000 at (0, 3). d3d11.c:10073: Test failed: Test 95: Got unexpected colour 0x00000025 at (1, 3). d3d11.c:10073: Test failed: Test 95: Got unexpected colour 0x00000025 at (2, 3). d3d11.c:10073: Test failed: Test 95: Got unexpected colour 0x00000025 at (3, 3). d3d11.c:10472: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {1.40000000e+001, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d11.c:10073: Test failed: Test 96: Got unexpected colour 0x00000000 at (0, 1). d3d11.c:10073: Test failed: Test 96: Got unexpected colour 0x00000025 at (1, 1). d3d11.c:10073: Test failed: Test 96: Got unexpected colour 0x00000025 at (2, 1). d3d11.c:10073: Test failed: Test 96: Got unexpected colour 0x00000025 at (3, 1). d3d11.c:10073: Test failed: Test 96: Got unexpected colour 0x00000000 at (0, 2). d3d11.c:10073: Test failed: Test 96: Got unexpected colour 0x00000025 at (1, 2). d3d11.c:10073: Test failed: Test 96: Got unexpected colour 0x00000025 at (2, 2). d3d11.c:10073: Test failed: Test 96: Got unexpected colour 0x00000025 at (3, 2). d3d11.c:10073: Test failed: Test 96: Got unexpected colour 0x00000000 at (0, 3). d3d11.c:10073: Test failed: Test 96: Got unexpected colour 0x00000025 at (1, 3). d3d11.c:10073: Test failed: Test 96: Got unexpected colour 0x00000025 at (2, 3). d3d11.c:10073: Test failed: Test 96: Got unexpected colour 0x00000025 at (3, 3). d3d11.c:10472: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {1.70000000e+001, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d11.c:10073: Test failed: Test 97: Got unexpected colour 0x00000000 at (0, 1). d3d11.c:10073: Test failed: Test 97: Got unexpected colour 0x00000025 at (1, 1). d3d11.c:10073: Test failed: Test 97: Got unexpected colour 0x00000025 at (2, 1). d3d11.c:10073: Test failed: Test 97: Got unexpected colour 0x00000025 at (3, 1). d3d11.c:10073: Test failed: Test 97: Got unexpected colour 0x00000000 at (0, 2). d3d11.c:10073: Test failed: Test 97: Got unexpected colour 0x00000025 at (1, 2). d3d11.c:10073: Test failed: Test 97: Got unexpected colour 0x00000025 at (2, 2). d3d11.c:10073: Test failed: Test 97: Got unexpected colour 0x00000025 at (3, 2). d3d11.c:10073: Test failed: Test 97: Got unexpected colour 0x00000000 at (0, 3). d3d11.c:10073: Test failed: Test 97: Got unexpected colour 0x00000025 at (1, 3). d3d11.c:10073: Test failed: Test 97: Got unexpected colour 0x00000025 at (2, 3). d3d11.c:10073: Test failed: Test 97: Got unexpected colour 0x00000025 at (3, 3). d3d11.c:10073: Test failed: Test 98: Got unexpected colour 0x00000000 at (0, 1). d3d11.c:10073: Test failed: Test 98: Got unexpected colour 0x00000025 at (1, 1). d3d11.c:10073: Test failed: Test 98: Got unexpected colour 0x00000025 at (2, 1). d3d11.c:10073: Test failed: Test 98: Got unexpected colour 0x00000025 at (3, 1). d3d11.c:10073: Test failed: Test 98: Got unexpected colour 0x00000000 at (0, 2). d3d11.c:10073: Test failed: Test 98: Got unexpected colour 0x00000025 at (1, 2). d3d11.c:10073: Test failed: Test 98: Got unexpected colour 0x00000025 at (2, 2). d3d11.c:10073: Test failed: Test 98: Got unexpected colour 0x00000025 at (3, 2). d3d11.c:10073: Test failed: Test 98: Got unexpected colour 0x00000000 at (0, 3). d3d11.c:10073: Test failed: Test 98: Got unexpected colour 0x00000025 at (1, 3). d3d11.c:10073: Test failed: Test 98: Got unexpected colour 0x00000025 at (2, 3). d3d11.c:10073: Test failed: Test 98: Got unexpected colour 0x00000025 at (3, 3). d3d11.c:10472: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {2.00000000e+001, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d11.c:10472: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {2.30000000e+001, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d11.c:10472: Test failed: Got {2.60000000e+001, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {2.50000000e+001, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d11.c:10472: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {2.60000000e+001, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d11.c:10472: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {2.90000000e+001, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d11.c:10472: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {3.20000000e+001, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d11.c:10472: Test failed: Got {0.00000000e+000, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000}, expected {3.50000000e+001, 0.00000000e+000, 0.00000000e+000, 1.00000000e+000} at (100, 100), sub-resource 0. d3d11.c:10165: Test failed: Test 11: Got unexpected colour 0x0000002d at (0, 3). d3d11.c:10165: Test failed: Test 11: Got unexpected colour 0x00000000 at (1, 3). d3d11.c:10165: Test failed: Test 11: Got unexpected colour 0xffcae980 at (2, 3). d3d11.c:10165: Test failed: Test 11: Got unexpected colour 0x00007fff at (3, 3). d3d11.c:10165: Test failed: Test 12: Got unexpected colour 0xffcae980 at (0, 1). d3d11.c:10165: Test failed: Test 12: Got unexpected colour 0x00007fff at (1, 1). d3d11.c:10165: Test failed: Test 12: Got unexpected colour 0x00007fff at (2, 1). d3d11.c:10165: Test failed: Test 12: Got unexpected colour 0x00007fff at (3, 1). d3d11.c:10165: Test failed: Test 12: Got unexpected colour 0xffcae980 at (0, 2). d3d11.c:10165: Test failed: Test 12: Got unexpected colour 0x00007fff at (1, 2). d3d11.c:10165: Test failed: Test 12: Got unexpected colour 0x00007fff at (2, 2). d3d11.c:10165: Test failed: Test 12: Got unexpected colour 0x00007fff at (3, 2). d3d11.c:10165: Test failed: Test 12: Got unexpected colour 0xffcae980 at (0, 3). d3d11.c:10165: Test failed: Test 12: Got unexpected colour 0x00007fff at (1, 3). d3d11.c:10165: Test failed: Test 12: Got unexpected colour 0x00007fff at (2, 3). d3d11.c:10165: Test failed: Test 12: Got unexpected colour 0x00007fff at (3, 3). d3d11.c:10165: Test failed: Test 14: Got unexpected colour 0x00000000 at (0, 1). d3d11.c:10165: Test failed: Test 14: Got unexpected colour 0x00000000 at (1, 1). d3d11.c:10165: Test failed: Test 14: Got unexpected colour 0x00000000 at (2, 1). d3d11.c:10165: Test failed: Test 14: Got unexpected colour 0x00000000 at (3, 1). d3d11.c:10165: Test failed: Test 14: Got unexpected colour 0x00000000 at (0, 2). d3d11.c:10165: Test failed: Test 14: Got unexpected colour 0x00000000 at (1, 2). d3d11.c:10165: Test failed: Test 14: Got unexpected colour 0x00000000 at (2, 2). d3d11.c:10165: Test failed: Test 14: Got unexpected colour 0x00000000 at (3, 2). d3d11.c:10165: Test failed: Test 14: Got unexpected colour 0x00000000 at (0, 3). d3d11.c:10165: Test failed: Test 14: Got unexpected colour 0x00000000 at (1, 3). d3d11.c:10165: Test failed: Test 14: Got unexpected colour 0x00000000 at (2, 3). d3d11.c:10165: Test failed: Test 14: Got unexpected colour 0x00000000 at (3, 3). d3d11.c:33522: Test failed: Got unexpected colour 00000000.
d3dcompiler_43: Unhandled exception: page fault on read access to 0x0000000000000010 in 64-bit code (0x007ffffe53b785).
d3dcompiler_46: Unhandled exception: page fault on read access to 0x0000000000000010 in 64-bit code (0x007ffffe53b785).
d3dcompiler_47: Unhandled exception: page fault on read access to 0x0000000000000010 in 64-bit code (0x007ffffe53b785).
d3dx9_36: mesh.c:302: Test failed: Test createmesh1, vertex normal 0, result (3.63669e-038, -1.#IND, 4.59163e-041), expected (0, 0, 0) mesh.c:298: Test failed: Test createmesh1, vertex position 1, result (-1.#IND, 4.59163e-041, 0), expected (0, 0, 0) mesh.c:302: Test failed: Test createmesh2, vertex normal 0, result (0, -1.#IND, 4.59163e-041), expected (0, 0, 0) mesh.c:298: Test failed: Test createmesh2, vertex position 1, result (-1.#IND, 4.59163e-041, 0), expected (0, 0, 0) mesh.c:298: Test failed: Test createmesh2, vertex position 2, result (-1.#IND, 4.59163e-041, -1.#IND), expected (0, 0, 0) mesh.c:359: Test failed: Test createmesh2, face 0, result (4112, 4112, 4112), expected (0, 0, 0) mesh.c:302: Test failed: Test createmeshfvf, vertex normal 0, result (3.63669e-038, -1.#IND, 4.59163e-041), expected (0, 0, 0) mesh.c:298: Test failed: Test createmeshfvf, vertex position 1, result (-1.#IND, 4.59163e-041, 0), expected (0, 0, 0) mesh.c:298: Test failed: Test createmeshfvf, vertex position 2, result (-1.#IND, 4.59163e-041, -1.#IND), expected (0, 0, 0)
Report validation errors: d3d10core:d3d10core prints too much data (36260 bytes) quartz:vmr7 crashed (c0000005) quartz:vmr9 crashed (c0000005)
+ /* For small data, make a copy, schedule an in-band update and go home. The copy is placed on the + * CS buffer itself to avoid malloc/free in this performance critical path.
There are a few things I don't particularly like about this approach:
- It places the data inside the CS, and that could end up affecting the throughput of actual commands. - It prefers this path over map_upload_bo even for cases where that path would have given us a GPU bo. - It duplicates a bunch of code from both map_upload_bo and wined3d_device_context_emit_update_sub_resource() itself.
How does this compare with using a private heap (possibly with HEAP_NO_SERIALIZE) for these allocations, much like we do in wined3d_deferred_context_map_upload_bo()?
+ else + { + _aligned_free(buffer->resource.heap_memory); + buffer->resource.heap_memory = (void *)upload_bo->addr.addr; + wined3d_buffer_validate_location(buffer, WINED3D_LOCATION_SYSMEM); + wined3d_buffer_invalidate_location(buffer, ~WINED3D_LOCATION_SYSMEM); + /* We are done here. Due to the invalidated LOCATION_BUFFER the data will be uplooaded on the next draw. */ + return; + }
Does that make sense? I don't think you can assume WINED3D_RESOURCE_ACCESS_CPU here, and I wouldn't typically expect D3DUSAGE_DYNAMIC buffers to have it.
@@ -3138,8 +3138,12 @@ void wined3d_context_gl_copy_bo_address(struct wined3d_context_gl *context_gl, wined3d_context_gl_reference_bo(context_gl, dst_bo); } } - else + else if (dst->addr != src->addr) { + /* Copies between the same address can happen if we NOOVERWRITE mapped into heap_memory + * and buffer_get_location picked the sysmem location to copy the new data to (e.g. because + * the buffer has been invalidated after DISCARD. This function will get called again on + * the next draw to copy the data into the BO. */
wined3d_context_gl_copy_bo_address() doesn't know about buffer resources, and shouldn't have to care about them.
+ * heap_alloc + heap_free. It is incorrect for maps - even if we have a write-only map, there + * is no guarantee that the application will overwrite every single byte in the mapped range, + * so we would have to copy the current buffer data into the new buffer before returning it. */
...and maps don't use that path for pretty much that reason.
wined3d_cs_map_upload_bo() doesn't know about resource maps though, and shouldn't have to care about them. The issue here would be with WINED3D_MAP_NOOVERWRITE, which is supposed to return the existing bo for the resource; that's obviously incompatible with allocating a new bo.
+/* If RENAME_ON_UNMAP or FREE_ON_UNMAP are used, then the "const" qualifier in addr is wrong. In the + * first case the destination d3d buffer takes ownership of the BO (either GL/vulkan BO or sysmem + * allocation), in the second case the sysmem allocation is freed.
I don't think either of those operations modify the contents of the bo?