From: Matteo Bruni mbruni@codeweavers.com
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/ddraw/ddraw_private.h | 2 ++ dlls/ddraw/device.c | 4 ++++ dlls/ddraw/vertexbuffer.c | 4 ++++ 3 files changed, 10 insertions(+)
diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index 7929e9e1795..0c2a491d45b 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -22,6 +22,7 @@ #include <assert.h> #include <limits.h> #include <math.h> +#include <stdbool.h> #define COBJMACROS #define NONAMELESSSTRUCT #define NONAMELESSUNION @@ -598,6 +599,7 @@ struct d3d_vertex_buffer DWORD fvf; DWORD size; BOOL dynamic; + bool discarded; };
HRESULT d3d_vertex_buffer_create(struct d3d_vertex_buffer **buffer, struct ddraw *ddraw, diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c index 6e8f109173b..860dffc5045 100644 --- a/dlls/ddraw/device.c +++ b/dlls/ddraw/device.c @@ -4293,6 +4293,8 @@ static HRESULT d3d_device7_DrawPrimitiveVB(IDirect3DDevice7 *iface, D3DPRIMITIVE return D3D_OK; }
+ vb_impl->discarded = false; + stride = get_flexible_vertex_size(vb_impl->fvf);
if (vb_impl->Caps & D3DVBCAPS_SYSTEMMEMORY) @@ -4412,6 +4414,8 @@ static HRESULT d3d_device7_DrawIndexedPrimitiveVB(IDirect3DDevice7 *iface, return D3D_OK; }
+ vb_impl->discarded = false; + if (vb_impl->Caps & D3DVBCAPS_SYSTEMMEMORY) { TRACE("Drawing from D3DVBCAPS_SYSTEMMEMORY vertex buffer, forwarding to DrawIndexedPrimitive().\n"); diff --git a/dlls/ddraw/vertexbuffer.c b/dlls/ddraw/vertexbuffer.c index dd35b445cc5..fa0e4f4c41a 100644 --- a/dlls/ddraw/vertexbuffer.c +++ b/dlls/ddraw/vertexbuffer.c @@ -159,10 +159,14 @@ static HRESULT WINAPI d3d_vertex_buffer7_Lock(IDirect3DVertexBuffer7 *iface, if (buffer->version != 7) flags &= ~(DDLOCK_NOOVERWRITE | DDLOCK_DISCARDCONTENTS);
+ if (buffer->discarded) + flags &= ~DDLOCK_DISCARDCONTENTS; + if (!(flags & DDLOCK_WAIT)) flags |= DDLOCK_DONOTWAIT; if (flags & DDLOCK_DISCARDCONTENTS) { + buffer->discarded = true; if (!buffer->dynamic) { struct wined3d_buffer *new_buffer;
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/wined3d/adapter_gl.c | 43 ++++++++++++++++++++++++++++++++++ dlls/wined3d/buffer.c | 2 +- dlls/wined3d/cs.c | 36 ++++++++++++++++++++++++++++ dlls/wined3d/wined3d_private.h | 4 ++++ 4 files changed, 84 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/adapter_gl.c b/dlls/wined3d/adapter_gl.c index bc54f46222f..cb0c34823aa 100644 --- a/dlls/wined3d/adapter_gl.c +++ b/dlls/wined3d/adapter_gl.c @@ -4616,6 +4616,49 @@ static void adapter_gl_flush_bo_address(struct wined3d_context *context, static bool adapter_gl_alloc_bo(struct wined3d_device *device, struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_bo_address *addr) { + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; + struct wined3d_device_gl *device_gl = wined3d_device_gl(device); + + wined3d_not_from_cs(device->cs); + assert(device->context_count); + + if (resource->type == WINED3D_RTYPE_BUFFER) + { + GLenum usage = GL_STATIC_DRAW; + struct wined3d_bo_gl *bo_gl; + bool coherent = true; + + if (resource->usage & WINED3DUSAGE_DYNAMIC) + { + usage = GL_STREAM_DRAW_ARB; + coherent = false; + } + + if (!(bo_gl = heap_alloc(sizeof(*bo_gl)))) + return false; + + if (!(wined3d_device_gl_create_bo(device_gl, NULL, resource->size, + wined3d_buffer_gl_binding_from_bind_flags(gl_info, resource->bind_flags), + usage, coherent, wined3d_resource_gl_storage_flags(resource), bo_gl))) + { + WARN("Failed to create OpenGL buffer.\n"); + heap_free(bo_gl); + return false; + } + + addr->buffer_object = &bo_gl->b; + addr->addr = NULL; + + if (!bo_gl->b.map_ptr) + { + WARN_(d3d_perf)("BO %p (chunk %p) is not persistently mapped.\n", + bo_gl, bo_gl->memory ? bo_gl->memory->chunk : NULL); + wined3d_cs_map_bo_address(device->cs, addr, resource->size, WINED3D_MAP_WRITE | WINED3D_MAP_DISCARD); + } + + return true; + } + return false; }
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 7c3537e466e..434e21402db 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -137,7 +137,7 @@ void wined3d_buffer_invalidate_location(struct wined3d_buffer *buffer, DWORD loc wined3d_buffer_invalidate_range(buffer, location, 0, 0); }
-static GLenum wined3d_buffer_gl_binding_from_bind_flags(const struct wined3d_gl_info *gl_info, uint32_t bind_flags) +GLenum wined3d_buffer_gl_binding_from_bind_flags(const struct wined3d_gl_info *gl_info, uint32_t bind_flags) { if (!bind_flags) return GL_PIXEL_UNPACK_BUFFER; diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 56abc146733..0986165a59d 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -120,6 +120,7 @@ enum wined3d_cs_op WINED3D_CS_OP_UNLOAD_RESOURCE, WINED3D_CS_OP_MAP, WINED3D_CS_OP_UNMAP, + WINED3D_CS_OP_MAP_BO_ADDRESS, WINED3D_CS_OP_BLT_SUB_RESOURCE, WINED3D_CS_OP_UPDATE_SUB_RESOURCE, WINED3D_CS_OP_ADD_DIRTY_TEXTURE_REGION, @@ -454,6 +455,14 @@ struct wined3d_cs_unmap HRESULT *hr; };
+struct wined3d_cs_map_bo_address +{ + enum wined3d_cs_op opcode; + struct wined3d_bo_address addr; + size_t size; + uint32_t flags; +}; + struct wined3d_cs_blt_sub_resource { enum wined3d_cs_op opcode; @@ -594,6 +603,7 @@ static const char *debug_cs_op(enum wined3d_cs_op op) WINED3D_TO_STR(WINED3D_CS_OP_UNLOAD_RESOURCE); WINED3D_TO_STR(WINED3D_CS_OP_MAP); WINED3D_TO_STR(WINED3D_CS_OP_UNMAP); + WINED3D_TO_STR(WINED3D_CS_OP_MAP_BO_ADDRESS); WINED3D_TO_STR(WINED3D_CS_OP_BLT_SUB_RESOURCE); WINED3D_TO_STR(WINED3D_CS_OP_UPDATE_SUB_RESOURCE); WINED3D_TO_STR(WINED3D_CS_OP_ADD_DIRTY_TEXTURE_REGION); @@ -2550,6 +2560,31 @@ HRESULT wined3d_device_context_emit_unmap(struct wined3d_device_context *context return hr; }
+static void wined3d_cs_exec_map_bo_address(struct wined3d_cs *cs, const void *data) +{ + const struct wined3d_cs_map_bo_address *op = data; + struct wined3d_context *context; + + context = context_acquire(cs->c.device, NULL, 0); + wined3d_context_map_bo_address(context, &op->addr, op->size, op->flags); + context_release(context); +} + +void wined3d_cs_map_bo_address(struct wined3d_cs *cs, + struct wined3d_bo_address *addr, size_t size, unsigned int flags) +{ + struct wined3d_device_context *context = &cs->c; + struct wined3d_cs_map_bo_address *op; + + op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_MAP); + op->opcode = WINED3D_CS_OP_MAP_BO_ADDRESS; + op->addr = *addr; + op->size = size; + op->flags = flags; + wined3d_device_context_submit(context, WINED3D_CS_QUEUE_MAP); + wined3d_device_context_finish(context, WINED3D_CS_QUEUE_MAP); +} + static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void *data) { const struct wined3d_cs_blt_sub_resource *op = data; @@ -2968,6 +3003,7 @@ static void (* const wined3d_cs_op_handlers[])(struct wined3d_cs *cs, const void /* WINED3D_CS_OP_UNLOAD_RESOURCE */ wined3d_cs_exec_unload_resource, /* WINED3D_CS_OP_MAP */ wined3d_cs_exec_map, /* WINED3D_CS_OP_UNMAP */ wined3d_cs_exec_unmap, + /* WINED3D_CS_OP_MAP_BO_ADDRESS */ wined3d_cs_exec_map_bo_address, /* WINED3D_CS_OP_BLT_SUB_RESOURCE */ wined3d_cs_exec_blt_sub_resource, /* WINED3D_CS_OP_UPDATE_SUB_RESOURCE */ wined3d_cs_exec_update_sub_resource, /* WINED3D_CS_OP_ADD_DIRTY_TEXTURE_REGION */ wined3d_cs_exec_add_dirty_texture_region, diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 96ce75fbb58..b8e2a96001a 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -5018,6 +5018,8 @@ void wined3d_cs_emit_set_render_state(struct wined3d_cs *cs, void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) DECLSPEC_HIDDEN; void wined3d_cs_init_object(struct wined3d_cs *cs, void (*callback)(void *object), void *object) DECLSPEC_HIDDEN; +void wined3d_cs_map_bo_address(struct wined3d_cs *cs, + struct wined3d_bo_address *addr, size_t size, unsigned int flags) DECLSPEC_HIDDEN;
static inline void wined3d_cs_finish(struct wined3d_cs *cs, enum wined3d_cs_queue_id queue_id) { @@ -5201,6 +5203,8 @@ static inline const struct wined3d_buffer_gl *wined3d_buffer_gl_const(const stru return CONTAINING_RECORD(buffer, struct wined3d_buffer_gl, b); }
+GLenum wined3d_buffer_gl_binding_from_bind_flags(const struct wined3d_gl_info *gl_info, + uint32_t bind_flags) DECLSPEC_HIDDEN; HRESULT wined3d_buffer_gl_init(struct wined3d_buffer_gl *buffer_gl, struct wined3d_device *device, const struct wined3d_buffer_desc *desc, const struct wined3d_sub_resource_data *data, void *parent, const struct wined3d_parent_ops *parent_ops) DECLSPEC_HIDDEN;
On Thu, 17 Feb 2022 at 07:14, Zebediah Figura zfigura@codeweavers.com wrote:
Signed-off-by: Zebediah Figura zfigura@codeweavers.com
dlls/wined3d/adapter_gl.c | 43 ++++++++++++++++++++++++++++++++++ dlls/wined3d/buffer.c | 2 +- dlls/wined3d/cs.c | 36 ++++++++++++++++++++++++++++ dlls/wined3d/wined3d_private.h | 4 ++++ 4 files changed, 84 insertions(+), 1 deletion(-)
I'm still getting some test failures, this time from d3d8's test_pinned_buffers():
device.c:6820: Test failed: Test 0: got unexpected ptr2 5D744000, expected 005DC8F0. device.c:6825: Test failed: Test 0: got unexpected vertex 1 {0.00000000e+000, 0.00000000e+000, 0.00000000e+000}, expected {1.00000000e+000, 2.00000000e+000, 3.00000000e+000}.
Parallel to a5efc1d5e06bf1d88148b4800dc489a527e797c8. Unlike with the Vulkan backend, we cannot map chunks from the client thread, but we can access the mapped pointer and increase the map count of already mapped chunks.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/wined3d/context_gl.c | 25 ++++++++++++++++++------- dlls/wined3d/device.c | 3 +-- dlls/wined3d/wined3d_private.h | 15 +++++++++++++++ 3 files changed, 34 insertions(+), 9 deletions(-)
diff --git a/dlls/wined3d/context_gl.c b/dlls/wined3d/context_gl.c index 8217d04686c..b82849f8470 100644 --- a/dlls/wined3d/context_gl.c +++ b/dlls/wined3d/context_gl.c @@ -2778,9 +2778,12 @@ static void *wined3d_allocator_chunk_gl_map(struct wined3d_allocator_chunk_gl *c struct wined3d_context_gl *context_gl) { const struct wined3d_gl_info *gl_info = context_gl->gl_info; + void *map_ptr;
TRACE("chunk %p, gl_buffer %u, map_ptr %p.\n", chunk_gl, chunk_gl->gl_buffer, chunk_gl->c.map_ptr);
+ wined3d_allocator_chunk_gl_lock(chunk_gl); + if (!chunk_gl->c.map_ptr) { unsigned int flags = wined3d_device_gl_get_memory_type_flags(chunk_gl->memory_type) & ~GL_CLIENT_STORAGE_BIT; @@ -2795,6 +2798,7 @@ static void *wined3d_allocator_chunk_gl_map(struct wined3d_allocator_chunk_gl *c 0, WINED3D_ALLOCATOR_CHUNK_SIZE, flags)); if (!chunk_gl->c.map_ptr) { + wined3d_allocator_chunk_gl_unlock(chunk_gl); ERR("Failed to map chunk memory.\n"); return NULL; } @@ -2803,8 +2807,11 @@ static void *wined3d_allocator_chunk_gl_map(struct wined3d_allocator_chunk_gl *c }
++chunk_gl->c.map_count; + map_ptr = chunk_gl->c.map_ptr;
- return chunk_gl->c.map_ptr; + wined3d_allocator_chunk_gl_unlock(chunk_gl); + + return map_ptr; }
static void wined3d_allocator_chunk_gl_unmap(struct wined3d_allocator_chunk_gl *chunk_gl, @@ -2814,14 +2821,18 @@ static void wined3d_allocator_chunk_gl_unmap(struct wined3d_allocator_chunk_gl *
TRACE("chunk_gl %p, context_gl %p.\n", chunk_gl, context_gl);
- if (--chunk_gl->c.map_count) - return; + wined3d_allocator_chunk_gl_lock(chunk_gl);
- wined3d_context_gl_bind_bo(context_gl, GL_PIXEL_UNPACK_BUFFER, chunk_gl->gl_buffer); - GL_EXTCALL(glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER)); - chunk_gl->c.map_ptr = NULL; + if (!--chunk_gl->c.map_count) + { + wined3d_context_gl_bind_bo(context_gl, GL_PIXEL_UNPACK_BUFFER, chunk_gl->gl_buffer); + GL_EXTCALL(glUnmapBuffer(GL_PIXEL_UNPACK_BUFFER)); + chunk_gl->c.map_ptr = NULL;
- adapter_adjust_mapped_memory(context_gl->c.device->adapter, -WINED3D_ALLOCATOR_CHUNK_SIZE); + adapter_adjust_mapped_memory(context_gl->c.device->adapter, -WINED3D_ALLOCATOR_CHUNK_SIZE); + } + + wined3d_allocator_chunk_gl_unlock(chunk_gl); }
static void *wined3d_bo_gl_map(struct wined3d_bo_gl *bo, struct wined3d_context_gl *context_gl, uint32_t flags) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 9488e8c642e..f163e77fcf1 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -993,14 +993,13 @@ static struct wined3d_allocator_chunk *wined3d_allocator_gl_create_chunk(struct
static void wined3d_allocator_gl_destroy_chunk(struct wined3d_allocator_chunk *chunk) { + struct wined3d_device_gl *device_gl = wined3d_device_gl_from_allocator(chunk->allocator); struct wined3d_allocator_chunk_gl *chunk_gl = wined3d_allocator_chunk_gl(chunk); const struct wined3d_gl_info *gl_info; struct wined3d_context_gl *context_gl; - struct wined3d_device_gl *device_gl;
TRACE("chunk %p.\n", chunk);
- device_gl = CONTAINING_RECORD(chunk_gl->c.allocator, struct wined3d_device_gl, allocator); context_gl = wined3d_context_gl(context_acquire(&device_gl->d, NULL, 0)); gl_info = context_gl->gl_info;
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index b8e2a96001a..a6850aa6889 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4213,6 +4213,11 @@ static inline struct wined3d_device_gl *wined3d_device_gl(struct wined3d_device return CONTAINING_RECORD(device, struct wined3d_device_gl, d); }
+static inline struct wined3d_device_gl *wined3d_device_gl_from_allocator(struct wined3d_allocator *allocator) +{ + return CONTAINING_RECORD(allocator, struct wined3d_device_gl, allocator); +} + static inline void wined3d_device_gl_allocator_lock(struct wined3d_device_gl *device_gl) { EnterCriticalSection(&device_gl->allocator_cs); @@ -4223,6 +4228,16 @@ static inline void wined3d_device_gl_allocator_unlock(struct wined3d_device_gl * LeaveCriticalSection(&device_gl->allocator_cs); }
+static inline void wined3d_allocator_chunk_gl_lock(struct wined3d_allocator_chunk_gl *chunk_gl) +{ + wined3d_device_gl_allocator_lock(wined3d_device_gl_from_allocator(chunk_gl->c.allocator)); +} + +static inline void wined3d_allocator_chunk_gl_unlock(struct wined3d_allocator_chunk_gl *chunk_gl) +{ + wined3d_device_gl_allocator_unlock(wined3d_device_gl_from_allocator(chunk_gl->c.allocator)); +} + bool wined3d_device_gl_create_bo(struct wined3d_device_gl *device_gl, struct wined3d_context_gl *context_gl, GLsizeiptr size, GLenum binding, GLenum usage, bool coherent, GLbitfield flags, struct wined3d_bo_gl *bo) DECLSPEC_HIDDEN;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/wined3d/device.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index f163e77fcf1..b4948fa50ac 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1175,6 +1175,18 @@ bool wined3d_device_gl_create_bo(struct wined3d_device_gl *device_gl, struct win bo->b.map_ptr = NULL; bo->b.client_map_count = 0;
+ if (memory) + { + struct wined3d_allocator_chunk_gl *chunk = wined3d_allocator_chunk_gl(memory->chunk); + + wined3d_allocator_chunk_gl_lock(chunk); + + if ((bo->b.map_ptr = chunk->c.map_ptr)) + ++chunk->c.map_count; + + wined3d_allocator_chunk_gl_unlock(chunk); + } + return true; }
On Thu, 17 Feb 2022 at 07:31, Zebediah Figura zfigura@codeweavers.com wrote:
@@ -1175,6 +1175,18 @@ bool wined3d_device_gl_create_bo(struct wined3d_device_gl *device_gl, struct win bo->b.map_ptr = NULL; bo->b.client_map_count = 0;
- if (memory)
- {
struct wined3d_allocator_chunk_gl *chunk = wined3d_allocator_chunk_gl(memory->chunk);
wined3d_allocator_chunk_gl_lock(chunk);
if ((bo->b.map_ptr = chunk->c.map_ptr))
++chunk->c.map_count;
wined3d_allocator_chunk_gl_unlock(chunk);
- }
- return true;
}
I think it would make sense to do this in adapter_gl_alloc_bo(), analogous to the wined3d_bo_vk_map() call in adapter_vk_alloc_bo(), but it seems a little more questionable in wined3d_device_gl_create_bo() itself. In particular, adapter_gl_alloc_bo() is expected to return a mapped bo that in principle is expected to be unmapped once we're done with it (although I'm not sure we currently consistently do that in all cases), but there's no such expectation for wined3d_device_gl_create_bo(), so this is never going to get unmapped in the general case.
For the purposes of wined3d_cs_map_upload_bo().
That is, if a buffer was just created or just discarded [e.g. with wined3d_device_evict_managed_resources()], and then subsequently mapped with WINED3D_MAP_NOOVERWRITE, treat it as if it had been mapped with WINED3D_MAP_DISCARD instead, thus allowing the adapter_alloc_upload_bo callback to allocate a new buffer from the client thread.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- This was the source of a bunch of stalls in Grand Theft Auto V, although it's hard to measure a difference in performance.
dlls/wined3d/buffer.c | 3 +++ dlls/wined3d/cs.c | 13 ++++++++++++- dlls/wined3d/wined3d_private.h | 2 ++ 3 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 434e21402db..7e9416c8d5a 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -1322,6 +1322,9 @@ static HRESULT wined3d_buffer_init(struct wined3d_buffer *buffer, struct wined3d } buffer->maps_size = 1;
+ if (buffer->locations & WINED3D_LOCATION_DISCARDED) + buffer->resource.client.addr.buffer_object = CLIENT_BO_DISCARDED; + if (data) wined3d_buffer_init_data(buffer, device, data);
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 0986165a59d..aa1efa4793f 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -69,6 +69,14 @@ struct wined3d_command_list struct wined3d_deferred_query_issue *queries; };
+static void discard_client_address(struct wined3d_resource *resource) +{ + struct wined3d_client_resource *client = &resource->client; + + client->addr.buffer_object = CLIENT_BO_DISCARDED; + client->addr.addr = NULL; +} + static void invalidate_client_address(struct wined3d_resource *resource) { struct wined3d_client_resource *client = &resource->client; @@ -2432,7 +2440,7 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou { struct wined3d_cs_unload_resource *op;
- invalidate_client_address(resource); + discard_client_address(resource);
op = wined3d_device_context_require_space(&cs->c, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT); op->opcode = WINED3D_CS_OP_UNLOAD_RESOURCE; @@ -3130,6 +3138,9 @@ static bool wined3d_cs_map_upload_bo(struct wined3d_device_context *context, str return NULL; }
+ if ((flags & WINED3D_MAP_NOOVERWRITE) && client->addr.buffer_object == CLIENT_BO_DISCARDED) + flags = (flags & ~WINED3D_MAP_NOOVERWRITE) | WINED3D_MAP_DISCARD; + if (flags & WINED3D_MAP_DISCARD) { if (!device->adapter->adapter_ops->adapter_alloc_bo(device, resource, sub_resource_idx, &addr)) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index a6850aa6889..14302f7bbe9 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4276,6 +4276,8 @@ static inline ULONG wined3d_atomic_decrement_mutex_lock(volatile LONG *refcount) return count - 1; }
+#define CLIENT_BO_DISCARDED ((struct wined3d_bo *)~(UINT_PTR)0) + struct wined3d_client_resource { /* The resource's persistently mapped address, which we may use to perform
On 2/17/22 00:13, Zebediah Figura wrote:
For the purposes of wined3d_cs_map_upload_bo().
That is, if a buffer was just created or just discarded [e.g. with wined3d_device_evict_managed_resources()], and then subsequently mapped with WINED3D_MAP_NOOVERWRITE, treat it as if it had been mapped with WINED3D_MAP_DISCARD instead, thus allowing the adapter_alloc_upload_bo callback to allocate a new buffer from the client thread.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com
This was the source of a bunch of stalls in Grand Theft Auto V, although it's hard to measure a difference in performance.
Sorry, please ignore this one; it needs work...
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=108296
Your paranoid android.
=== debian11 (32 bit report) ===
ddraw: ddraw2.c:3632: Test failed: Expected resolution 1024x768, got 640x480. ddraw2.c:3649: Test failed: Expected surface width 1024, got 640. ddraw2.c:3675: Test failed: Expected screen size 1024x768, got 0x0. ddraw2.c:3694: Test failed: Expected surface width 1024, got 640. ddraw2.c:3747: Test failed: Expected screen size 2 1024x768, got 640x480. ddraw2.c:3767: Test failed: Expected surface width 1024, got 640.
=== debian11 (32 bit Chinese:China report) ===
ddraw: ddraw1.c:3529: Test failed: Expected resolution 640x480, got 720x480. ddraw1.c:3546: Test failed: Expected surface width 640, got 720.
=== debian11 (32 bit WoW report) ===
ddraw: ddraw2.c:712: Test failed: Got unexpected wparam 1 for message 5, expected 0. ddraw2.c:3228: Test failed: Expected message 0x7e, but didn't receive it. ddraw2.c:3233: Test failed: Got unexpected screen size 720x480. ddraw2.c:3289: Test failed: Expected screen size 1024x768, got 720x480. ddraw2.c:3295: Test failed: Expected (0,0)-(1024,768), got (0,0)-(720,480). ddraw2.c:3319: Test failed: Expected surface width 1024, got 720. ddraw2.c:3321: Test failed: Expected surface height 768, got 480. ddraw2.c:3325: Test failed: Expected (0,0)-(1024,768), got (0,0)-(720,480). ddraw2.c:3332: Test failed: Expected (0,0)-(1024,768), got (0,0)-(720,480). ddraw2.c:3337: Test failed: Expected surface width 1024, got 720. ddraw2.c:3339: Test failed: Expected surface height 768, got 480. ddraw2.c:3352: Test failed: Expected surface width 1024, got 720. ddraw2.c:3354: Test failed: Expected surface height 768, got 480. ddraw2.c:3358: Test failed: Expected (0,0)-(1024,768), got (0,0)-(720,480). ddraw2.c:3381: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw2.c:3390: Test failed: Got unexpected hr 0. ddraw2.c:3410: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw2.c:3415: Test failed: Expected surface width 1024, got 720. ddraw2.c:3417: Test failed: Expected surface height 768, got 480. ddraw2.c:3436: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw2.c:3456: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw2.c:3492: Test failed: Expected (0,0)-(1024,768), got (0,0)-(640,480). ddraw2.c:3502: Test failed: Expected (0,0)-(1024,768), got (0,0)-(720,480). ddraw2.c:3507: Test failed: Expected surface width 1024, got 720. ddraw2.c:3509: Test failed: Expected surface height 768, got 480. ddraw2.c:3522: Test failed: Expected surface width 1024, got 720. ddraw2.c:3524: Test failed: Expected surface height 768, got 480. ddraw2.c:3528: Test failed: Expected (0,0)-(1024,768), got (0,0)-(720,480). ddraw2.c:3551: Test failed: Expected (0,0)-(1024,768), got (0,0)-(720,480). ddraw2.c:3560: Test failed: Got unexpected hr 0. ddraw2.c:3573: Test failed: Expected (0,0)-(1024,768), got (0,0)-(720,480). ddraw2.c:3578: Test failed: Expected surface width 1024, got 720. ddraw2.c:3580: Test failed: Expected surface height 768, got 480. ddraw2.c:3599: Test failed: Expected (0,0)-(1024,768), got (0,0)-(720,480). ddraw2.c:3619: Test failed: Expected (0,0)-(1024,768), got (0,0)-(720,480). ddraw2.c:3632: Test failed: Expected resolution 1024x768, got 720x480. ddraw2.c:3649: Test failed: Expected surface width 1024, got 720. ddraw2.c:3651: Test failed: Expected surface height 768, got 480. ddraw2.c:3656: Test failed: Expected (0,0)-(1024,768), got (0,0)-(720,480).
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- Nice to see how the patch improved by removing stuff from my original version :D