Changes in version 2 of this patchset:
*) Rename resource_acquire to resource_reference. *) Simplify the wrap-around logic (thanks Jan!).
Some updated benchmarking information: Keeping a separate counter for fencing instead of re-using head and tail has a measurable performance impact in my draw overhead microbenchmark.
In World of Tanks the full 32 bit head/tail numbers wrap around within 3-4 minutes rather than a few hours as I concluded earlier from my microbenchmarks. In a way this is welcome - the wrap-around logic is actually used rather than untested dead code. It might make the phantom waits described in patch 2 a bit more likely though. Should this become an issue I believe we can change head and tail to SIZE_T or ULONGLONG. I could not measure any performance impact of a 64 bit counter vs a 32 bit counter. I tested it in 32 bit client on a 64 bit CPU. I don't have a multicore 32 bit CPU available for testing in a pure 32 bit setup.
This is the patchset described in https://www.winehq.org/pipermail/wine-devel/2022-January/204020.html . It simplifies and speeds up d3d resource tracking in a few ways:
*) Completely remove any burden on the CS thread. *) Replace interlocked ops on the client thread with a plain assignment. *) Piggy-pack onto the queue's head and tail counters, which we already increment with interlocked ops.
I tested the impact with a microbenchmark: https://github.com/stefand/perftest/blob/main/resource_tracking_d3d11/resour...
Depending on the CPU it doubles or tripples draw speed in that microbenchmark. In real games the effect is much less pronounced, but I do see about a 2% gain in World of Tanks. I also see a gain in Rocket League, but only if I hack away other known issues with Rocket League (UpdateSubResource in particular).
I have further improvements to resource tracking in my mind that can be done on top of these patches: *) Separate read and write access times. *) Remove draw and compute tracking for d3d10+ clients and only track staging resources.
Matteo had some ideas to make the queue multi-writer thread safe to further reduce the use of wined3d_cs. This patchset makes this a bit more complicated because the head value cannot be infered from the return value of require_space() and thus needs to be passed around separately to submit(). This can be done either with thread local storage or via a separate parameter to require_space() and submit().
Stefan Dösinger (5): wined3d: Use extra bits in the queue head and tail counters. wined3d: Use the default queue index for resource fencing. wined3d: Remove the no-op wined3d_resource_release. wined3d: Remove the resource_acquire call in resource_cleanup. wined3d: Rename resource_acquire to resource_reference.
dlls/wined3d/cs.c | 276 +++++++++------------------------ dlls/wined3d/resource.c | 2 - dlls/wined3d/wined3d_private.h | 68 ++++++-- 3 files changed, 123 insertions(+), 223 deletions(-)
Signed-off-by: Stefan Dösinger stefan@codeweavers.com
---
The next patches will use them for resource fences. We want as many extra bits as possible to reduce phantom waits due to wrap-arounds, see the next patch for details. --- dlls/wined3d/cs.c | 28 ++++++++++++++-------------- dlls/wined3d/wined3d_private.h | 3 ++- 2 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index ce297d724f2..c4d68fd8f4f 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -624,7 +624,7 @@ static const char *debug_cs_op(enum wined3d_cs_op op)
static struct wined3d_cs_packet *wined3d_next_cs_packet(const uint8_t *data, SIZE_T *offset) { - struct wined3d_cs_packet *packet = (struct wined3d_cs_packet *)&data[*offset]; + struct wined3d_cs_packet *packet = (struct wined3d_cs_packet *)&data[WINED3D_CS_QUEUE_MASK(*offset)];
*offset += offsetof(struct wined3d_cs_packet, data[packet->size]);
@@ -3263,7 +3263,7 @@ static const struct wined3d_device_context_ops wined3d_cs_st_ops = static BOOL wined3d_cs_queue_is_empty(const struct wined3d_cs *cs, const struct wined3d_cs_queue *queue) { wined3d_from_cs(cs); - return *(volatile LONG *)&queue->head == queue->tail; + return *(volatile ULONG *)&queue->head == queue->tail; }
static void wined3d_cs_queue_submit(struct wined3d_cs_queue *queue, struct wined3d_cs *cs) @@ -3271,10 +3271,10 @@ static void wined3d_cs_queue_submit(struct wined3d_cs_queue *queue, struct wined struct wined3d_cs_packet *packet; size_t packet_size;
- packet = (struct wined3d_cs_packet *)&queue->data[queue->head]; + packet = (struct wined3d_cs_packet *)&queue->data[WINED3D_CS_QUEUE_MASK(queue->head)]; TRACE("Queuing op %s at %p.\n", debug_cs_op(*(const enum wined3d_cs_op *)packet->data), packet); packet_size = FIELD_OFFSET(struct wined3d_cs_packet, data[packet->size]); - InterlockedExchange(&queue->head, (queue->head + packet_size) & (WINED3D_CS_QUEUE_SIZE - 1)); + InterlockedExchange((LONG *)&queue->head, queue->head + packet_size);
if (InterlockedCompareExchange(&cs->waiting_for_event, FALSE, TRUE)) SetEvent(cs->event); @@ -3295,6 +3295,7 @@ static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size size_t queue_size = ARRAY_SIZE(queue->data); size_t header_size, packet_size, remaining; struct wined3d_cs_packet *packet; + ULONG head = WINED3D_CS_QUEUE_MASK(queue->head);
header_size = FIELD_OFFSET(struct wined3d_cs_packet, data[0]); packet_size = FIELD_OFFSET(struct wined3d_cs_packet, data[size]); @@ -3307,7 +3308,7 @@ static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size return NULL; }
- remaining = queue_size - queue->head; + remaining = queue_size - head; if (remaining < packet_size) { size_t nop_size = remaining - header_size; @@ -3321,19 +3322,19 @@ static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size nop->opcode = WINED3D_CS_OP_NOP;
wined3d_cs_queue_submit(queue, cs); - assert(!queue->head); + head = WINED3D_CS_QUEUE_MASK(queue->head); + assert(!head); }
for (;;) { - LONG tail = *(volatile LONG *)&queue->tail; - LONG head = queue->head; - LONG new_pos; + ULONG tail = WINED3D_CS_QUEUE_MASK(*(volatile ULONG *)&queue->tail); + ULONG new_pos;
/* Empty. */ if (head == tail) break; - new_pos = (head + packet_size) & (WINED3D_CS_QUEUE_SIZE - 1); + new_pos = WINED3D_CS_QUEUE_MASK(head + packet_size); /* Head ahead of tail. We checked the remaining size above, so we only * need to make sure we don't make head equal to tail. */ if (head > tail && (new_pos != tail)) @@ -3347,7 +3348,7 @@ static void *wined3d_cs_queue_require_space(struct wined3d_cs_queue *queue, size head, tail, (unsigned long)packet_size); }
- packet = (struct wined3d_cs_packet *)&queue->data[queue->head]; + packet = (struct wined3d_cs_packet *)&queue->data[head]; packet->size = size; return packet->data; } @@ -3370,7 +3371,7 @@ static void wined3d_cs_mt_finish(struct wined3d_device_context *context, enum wi if (cs->thread_id == GetCurrentThreadId()) return wined3d_cs_st_finish(context, queue_id);
- while (cs->queue[queue_id].head != *(volatile LONG *)&cs->queue[queue_id].tail) + while (cs->queue[queue_id].head != *(volatile ULONG *)&cs->queue[queue_id].tail) YieldProcessor(); }
@@ -3496,8 +3497,7 @@ static DWORD WINAPI wined3d_cs_run(void *ctx) TRACE("%s at %p executed.\n", debug_cs_op(opcode), packet); }
- tail &= (WINED3D_CS_QUEUE_SIZE - 1); - InterlockedExchange(&queue->tail, tail); + InterlockedExchange((LONG *)&queue->tail, tail); }
cs->queue[WINED3D_CS_QUEUE_MAP].tail = cs->queue[WINED3D_CS_QUEUE_MAP].head; diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 58ef6764f2d..895f7a76a26 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4904,10 +4904,11 @@ enum wined3d_push_constants #define WINED3D_CS_QUERY_POLL_INTERVAL 10u #define WINED3D_CS_QUEUE_SIZE 0x100000u #define WINED3D_CS_SPIN_COUNT 10000000u +#define WINED3D_CS_QUEUE_MASK(a) ((a) & (WINED3D_CS_QUEUE_SIZE - 1))
struct wined3d_cs_queue { - LONG head, tail; + ULONG head, tail; BYTE data[WINED3D_CS_QUEUE_SIZE]; };
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
This removes tracking work entirely from the CS thread and replaces interlocked with regular writes on the main thread. It also avoids accessing access_count in read-write mode from two threads.
Signed-off-by: Stefan Dösinger stefan@codeweavers.com --- dlls/wined3d/cs.c | 4 --- dlls/wined3d/wined3d_private.h | 65 ++++++++++++++++++++++++++-------- 2 files changed, 51 insertions(+), 18 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index c4d68fd8f4f..0d6cf747d8f 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -2755,8 +2755,6 @@ static void wined3d_cs_exec_update_sub_resource(struct wined3d_cs *cs, const voi
context_release(context);
- wined3d_resource_release(resource); - if (op->bo.flags & UPLOAD_BO_FREE_ON_UNMAP) { if (op->bo.addr.buffer_object) @@ -2803,8 +2801,6 @@ void wined3d_device_context_emit_update_sub_resource(struct wined3d_device_conte op->row_pitch = row_pitch; op->slice_pitch = slice_pitch;
- wined3d_device_context_acquire_resource(context, resource); - 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. */ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 895f7a76a26..c7f22fda1fa 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4270,7 +4270,7 @@ struct wined3d_resource LONG ref; LONG bind_count; LONG map_count; - LONG access_count; + ULONG access_time; struct wined3d_device *device; enum wined3d_resource_type type; enum wined3d_gl_resource_type gl_type; @@ -4314,17 +4314,6 @@ static inline ULONG wined3d_resource_decref(struct wined3d_resource *resource) return resource->resource_ops->resource_decref(resource); }
-static inline void wined3d_resource_acquire(struct wined3d_resource *resource) -{ - InterlockedIncrement(&resource->access_count); -} - -static inline void wined3d_resource_release(struct wined3d_resource *resource) -{ - LONG refcount = InterlockedDecrement(&resource->access_count); - assert(refcount >= 0); -} - static inline HRESULT wined3d_resource_get_sub_resource_desc(struct wined3d_resource *resource, unsigned int sub_resource_idx, struct wined3d_sub_resource_desc *desc) { @@ -5091,16 +5080,64 @@ void wined3d_device_context_emit_update_sub_resource(struct wined3d_device_conte HRESULT wined3d_device_context_emit_unmap(struct wined3d_device_context *context, struct wined3d_resource *resource, unsigned int sub_resource_idx) DECLSPEC_HIDDEN;
-static inline void wined3d_resource_wait_idle(struct wined3d_resource *resource) +static inline void wined3d_resource_acquire(struct wined3d_resource *resource) { const struct wined3d_cs *cs = resource->device->cs; + resource->access_time = cs->queue[WINED3D_CS_QUEUE_DEFAULT].head; +} + +static inline void wined3d_resource_release(struct wined3d_resource *resource) +{ +} + +static inline void wined3d_resource_wait_idle(const struct wined3d_resource *resource) +{ + const struct wined3d_cs *cs = resource->device->cs; + ULONG access_time, tail, head;
if (!cs->thread || cs->thread_id == GetCurrentThreadId()) return;
- while (InterlockedCompareExchange(&resource->access_count, 0, 0)) + access_time = resource->access_time; + head = cs->queue[WINED3D_CS_QUEUE_DEFAULT].head; + + /* The basic idea is that a resource is busy if tail < access_time <= head. + * But we have to be careful about wrap-around of the head and tail. The + * GE_WRAP macro below considers x >= y if x - y is smaller than half the + * UINT range. Head is at most WINED3D_CS_QUEUE_SIZE ahead of tail, because + * otherwise the queue memory is considered full and queue_require_space + * stalls. Thus GE_WRAP(head, tail) is always true. The C_ASSERT below ensures + * this in case we decide to grow the queue size in the future. + * + * It is possible that a resource has not been used for a long time and is idle, but the head and + * tail wrapped around in such a way that the previously set access time falls between head and tail. + * In this case we will incorrectly wait for the resource. Because we use the entire 32 bits of the + * counters and not just the bits needed to address the actual queue memory, this should happen rarely. + * If it turns out to be a problem we can switch to 64 bit counters or attempt to somehow mark the + * access time of resources invalid. CS packets are at least 4 byte aligned, so we could use the lower + * 2 bits in access_time for such a marker. + * + * Note that the access time is set before the command is submitted, so we have to wait until the + * tail is bigger than access_time, not equal. */ + +#define GE_WRAP(x, y) (((x)-(y)) < (UINT_MAX / 2)) + if (!GE_WRAP(head, access_time)) + return; + + while (1) + { + tail = *(volatile ULONG *)&cs->queue[WINED3D_CS_QUEUE_DEFAULT].tail; + if (head == tail) /* Queue empty. */ + break; + + if (!GE_WRAP(access_time, tail) && access_time != tail) + break; + YieldProcessor(); + } +#undef GE_WRAP } +C_ASSERT(WINED3D_CS_QUEUE_SIZE < UINT_MAX / 4);
/* TODO: Add tests and support for FLOAT16_4 POSITIONT, D3DCOLOR position, other * fixed function semantics as D3DCOLOR or FLOAT16 */
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
On Wed, 9 Mar 2022 at 11:48, Stefan Dösinger stefan@codeweavers.com wrote:
+#define GE_WRAP(x, y) (((x)-(y)) < (UINT_MAX / 2))
- if (!GE_WRAP(head, access_time))
return;
- while (1)
- {
tail = *(volatile ULONG *)&cs->queue[WINED3D_CS_QUEUE_DEFAULT].tail;
if (head == tail) /* Queue empty. */
break;
if (!GE_WRAP(access_time, tail) && access_time != tail)
break;
YieldProcessor();
- }
+#undef GE_WRAP } +C_ASSERT(WINED3D_CS_QUEUE_SIZE < UINT_MAX / 4);
GE_WRAP doesn't need to be a macro, and we typically use "for (;;)" instead of "while (1)"; I'm not going to hold the series for that though.
Am 09.03.2022 um 20:57 schrieb Henri Verbeet hverbeet@gmail.com:
On Wed, 9 Mar 2022 at 11:48, Stefan Dösinger stefan@codeweavers.com wrote:
+#define GE_WRAP(x, y) (((x)-(y)) < (UINT_MAX / 2))
- if (!GE_WRAP(head, access_time))
return;
- while (1)
- {
tail = *(volatile ULONG *)&cs->queue[WINED3D_CS_QUEUE_DEFAULT].tail;
if (head == tail) /* Queue empty. */
break;
if (!GE_WRAP(access_time, tail) && access_time != tail)
break;
YieldProcessor();
- }
+#undef GE_WRAP } +C_ASSERT(WINED3D_CS_QUEUE_SIZE < UINT_MAX / 4);
GE_WRAP doesn't need to be a macro, and we typically use "for (;;)" instead of "while (1)"; I'm not going to hold the series for that though.
I find GE_WRAP helpful for the comment explaining what we do here. I can remove it though if you prefer.
On Thu, 10 Mar 2022 at 08:44, Stefan Dösinger stefandoesinger@gmail.com wrote:
Am 09.03.2022 um 20:57 schrieb Henri Verbeet hverbeet@gmail.com: On Wed, 9 Mar 2022 at 11:48, Stefan Dösinger stefan@codeweavers.com wrote:
+#define GE_WRAP(x, y) (((x)-(y)) < (UINT_MAX / 2))
- if (!GE_WRAP(head, access_time))
return;
- while (1)
- {
tail = *(volatile ULONG *)&cs->queue[WINED3D_CS_QUEUE_DEFAULT].tail;
if (head == tail) /* Queue empty. */
break;
if (!GE_WRAP(access_time, tail) && access_time != tail)
break;
YieldProcessor();
- }
+#undef GE_WRAP } +C_ASSERT(WINED3D_CS_QUEUE_SIZE < UINT_MAX / 4);
GE_WRAP doesn't need to be a macro, and we typically use "for (;;)" instead of "while (1)"; I'm not going to hold the series for that though.
I find GE_WRAP helpful for the comment explaining what we do here.
Sure, but a regular function would also do that.
Signed-off-by: Stefan Dösinger stefan@codeweavers.com --- dlls/wined3d/cs.c | 138 ++------------------------------- dlls/wined3d/resource.c | 1 - dlls/wined3d/wined3d_private.h | 4 - 3 files changed, 5 insertions(+), 138 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 0d6cf747d8f..5b8c7275693 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -642,7 +642,6 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) const struct wined3d_cs_present *op = data; const struct wined3d_swapchain_desc *desc; struct wined3d_swapchain *swapchain; - unsigned int i;
swapchain = op->swapchain; desc = &swapchain->state.desc; @@ -713,12 +712,6 @@ static void wined3d_cs_exec_present(struct wined3d_cs *cs, const void *data) } }
- wined3d_resource_release(&swapchain->front_buffer->resource); - for (i = 0; i < desc->backbuffer_count; ++i) - { - wined3d_resource_release(&swapchain->back_buffers[i]->resource); - } - InterlockedDecrement(&cs->pending_presents); }
@@ -762,21 +755,9 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data) { struct wined3d_device *device = cs->c.device; const struct wined3d_cs_clear *op = data; - unsigned int i;
device->blitter->ops->blitter_clear(device->blitter, device, op->rt_count, &op->fb, op->rect_count, op->rects, &op->draw_rect, op->flags, &op->color, op->depth, op->stencil); - - if (op->flags & WINED3DCLEAR_TARGET) - { - for (i = 0; i < op->rt_count; ++i) - { - if (op->fb.render_targets[i]) - wined3d_resource_release(op->fb.render_targets[i]->resource); - } - } - if (op->flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) - wined3d_resource_release(op->fb.depth_stencil->resource); }
void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects, @@ -891,39 +872,6 @@ static void acquire_shader_resources(struct wined3d_device_context *context, uns } }
-static void release_shader_resources(const struct wined3d_state *state, unsigned int shader_mask) -{ - struct wined3d_shader_sampler_map_entry *entry; - struct wined3d_shader_resource_view *view; - struct wined3d_shader *shader; - unsigned int i, j; - - for (i = 0; i < WINED3D_SHADER_TYPE_COUNT; ++i) - { - if (!(shader_mask & (1u << i))) - continue; - - if (!(shader = state->shader[i])) - continue; - - for (j = 0; j < WINED3D_MAX_CBS; ++j) - { - if (state->cb[i][j].buffer) - wined3d_resource_release(&state->cb[i][j].buffer->resource); - } - - for (j = 0; j < shader->reg_maps.sampler_map.count; ++j) - { - entry = &shader->reg_maps.sampler_map.entries[j]; - - if (!(view = state->shader_resource_view[i][entry->resource_idx])) - continue; - - wined3d_resource_release(view->resource); - } - } -} - static void acquire_unordered_access_resources(struct wined3d_device_context *context, const struct wined3d_shader *shader, struct wined3d_unordered_access_view * const *views) { @@ -944,26 +892,6 @@ static void acquire_unordered_access_resources(struct wined3d_device_context *co } }
-static void release_unordered_access_resources(const struct wined3d_shader *shader, - struct wined3d_unordered_access_view * const *views) -{ - unsigned int i; - - if (!shader) - return; - - for (i = 0; i < MAX_UNORDERED_ACCESS_VIEWS; ++i) - { - if (!shader->reg_maps.uav_resource_info[i].type) - continue; - - if (!views[i]) - continue; - - wined3d_resource_release(views[i]->resource); - } -} - static void wined3d_cs_exec_dispatch(struct wined3d_cs *cs, const void *data) { const struct wined3d_cs_dispatch *op = data; @@ -973,13 +901,6 @@ static void wined3d_cs_exec_dispatch(struct wined3d_cs *cs, const void *data) WARN("No compute shader bound, skipping dispatch.\n"); else cs->c.device->adapter->adapter_ops->adapter_dispatch_compute(cs->c.device, state, &op->parameters); - - if (op->parameters.indirect) - wined3d_resource_release(&op->parameters.u.indirect.buffer->resource); - - release_shader_resources(state, 1u << WINED3D_SHADER_TYPE_COMPUTE); - release_unordered_access_resources(state->shader[WINED3D_SHADER_TYPE_COMPUTE], - state->unordered_access_view[WINED3D_PIPELINE_COMPUTE]); }
static void acquire_compute_pipeline_resources(struct wined3d_device_context *context) @@ -1080,40 +1001,6 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) state->patch_vertex_count = op->patch_vertex_count;
cs->c.device->adapter->adapter_ops->adapter_draw_primitive(cs->c.device, state, &op->parameters); - - if (op->parameters.indirect) - { - struct wined3d_buffer *buffer = op->parameters.u.indirect.buffer; - wined3d_resource_release(&buffer->resource); - } - - if (op->parameters.indexed) - wined3d_resource_release(&state->index_buffer->resource); - for (i = 0; i < ARRAY_SIZE(state->streams); ++i) - { - if (state->streams[i].buffer) - wined3d_resource_release(&state->streams[i].buffer->resource); - } - for (i = 0; i < ARRAY_SIZE(state->stream_output); ++i) - { - if (state->stream_output[i].buffer) - wined3d_resource_release(&state->stream_output[i].buffer->resource); - } - for (i = 0; i < ARRAY_SIZE(state->textures); ++i) - { - if (state->textures[i]) - wined3d_resource_release(&state->textures[i]->resource); - } - for (i = 0; i < d3d_info->limits.max_rt_count; ++i) - { - if (state->fb.render_targets[i]) - wined3d_resource_release(state->fb.render_targets[i]->resource); - } - if (state->fb.depth_stencil) - wined3d_resource_release(state->fb.depth_stencil->resource); - release_shader_resources(state, ~(1u << WINED3D_SHADER_TYPE_COMPUTE)); - release_unordered_access_resources(state->shader[WINED3D_SHADER_TYPE_PIXEL], - state->unordered_access_view[WINED3D_PIPELINE_GRAPHICS]); }
static void acquire_graphics_pipeline_resources(struct wined3d_device_context *context, @@ -2412,7 +2299,6 @@ static void wined3d_cs_exec_preload_resource(struct wined3d_cs *cs, const void * struct wined3d_resource *resource = op->resource;
resource->resource_ops->resource_preload(resource); - wined3d_resource_release(resource); }
void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) @@ -2434,7 +2320,6 @@ static void wined3d_cs_exec_unload_resource(struct wined3d_cs *cs, const void *d struct wined3d_resource *resource = op->resource;
resource->resource_ops->resource_unload(resource); - wined3d_resource_release(resource); }
void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resource *resource) @@ -2617,14 +2502,14 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void * { FIXME("Flags %#x not implemented for %s resources.\n", op->flags, debug_d3dresourcetype(op->dst_resource->type)); - goto error; + return; }
if (!(op->flags & WINED3D_BLT_RAW) && op->src_resource->format != op->dst_resource->format) { FIXME("Format conversion not implemented for %s resources.\n", debug_d3dresourcetype(op->dst_resource->type)); - goto error; + return; }
update_w = op->dst_box.right - op->dst_box.left; @@ -2636,7 +2521,7 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void * { FIXME("Stretching not implemented for %s resources.\n", debug_d3dresourcetype(op->dst_resource->type)); - goto error; + return; }
dst_texture = texture_from_resource(op->dst_resource); @@ -2655,7 +2540,7 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void * ERR("Failed to load source sub-resource into %s.\n", wined3d_debug_location(location)); context_release(context); - goto error; + return; }
level = op->dst_sub_resource_idx % dst_texture->level_count; @@ -2671,7 +2556,7 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void * { ERR("Failed to load destination sub-resource.\n"); context_release(context); - goto error; + return; }
wined3d_texture_get_bo_address(src_texture, op->src_sub_resource_idx, &addr, location); @@ -2694,11 +2579,6 @@ static void wined3d_cs_exec_blt_sub_resource(struct wined3d_cs *cs, const void * &op->src_box, op->flags, &op->fx, op->filter))) FIXME("Blit failed.\n"); } - -error: - if (op->src_resource) - wined3d_resource_release(op->src_resource); - wined3d_resource_release(op->dst_resource); }
void wined3d_device_context_emit_blt_sub_resource(struct wined3d_device_context *context, @@ -2824,8 +2704,6 @@ static void wined3d_cs_exec_add_dirty_texture_region(struct wined3d_cs *cs, cons ERR("Failed to load location %s.\n", wined3d_debug_location(texture->resource.map_binding)); } context_release(context); - - wined3d_resource_release(&texture->resource); }
void wined3d_cs_emit_add_dirty_texture_region(struct wined3d_cs *cs, @@ -2852,8 +2730,6 @@ static void wined3d_cs_exec_clear_unordered_access_view(struct wined3d_cs *cs, c context = context_acquire(cs->c.device, NULL, 0); cs->c.device->adapter->adapter_ops->adapter_clear_uav(context, view, &op->clear_value, op->fp); context_release(context); - - wined3d_resource_release(view->resource); }
void wined3d_device_context_emit_clear_uav(struct wined3d_device_context *context, @@ -2881,8 +2757,6 @@ static void wined3d_cs_exec_copy_uav_counter(struct wined3d_cs *cs, const void * context = context_acquire(cs->c.device, NULL, 0); wined3d_unordered_access_view_copy_counter(view, op->buffer, op->offset, context); context_release(context); - - wined3d_resource_release(&op->buffer->resource); }
void wined3d_device_context_emit_copy_uav_counter(struct wined3d_device_context *context, @@ -2910,8 +2784,6 @@ static void wined3d_cs_exec_generate_mipmaps(struct wined3d_cs *cs, const void * context = context_acquire(cs->c.device, NULL, 0); cs->c.device->adapter->adapter_ops->adapter_generate_mipmap(context, view); context_release(context); - - wined3d_resource_release(view->resource); }
void wined3d_device_context_emit_generate_mipmaps(struct wined3d_device_context *context, diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c index d599e1d7711..62f9604ebcc 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -235,7 +235,6 @@ static void wined3d_resource_destroy_object(void *object)
wined3d_resource_free_sysmem(resource); context_resource_released(resource->device, resource); - wined3d_resource_release(resource); }
void resource_cleanup(struct wined3d_resource *resource) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index c7f22fda1fa..e46b6dfb9e0 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -5086,10 +5086,6 @@ static inline void wined3d_resource_acquire(struct wined3d_resource *resource) resource->access_time = cs->queue[WINED3D_CS_QUEUE_DEFAULT].head; }
-static inline void wined3d_resource_release(struct wined3d_resource *resource) -{ -} - static inline void wined3d_resource_wait_idle(const struct wined3d_resource *resource) { const struct wined3d_cs *cs = resource->device->cs;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Stefan Dösinger stefan@codeweavers.com --- dlls/wined3d/resource.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c index 62f9604ebcc..06d35d32ea8 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -253,7 +253,6 @@ void resource_cleanup(struct wined3d_resource *resource)
device_resource_released(resource->device, resource); } - wined3d_resource_acquire(resource); wined3d_cs_destroy_object(resource->device->cs, wined3d_resource_destroy_object, resource); }
On Wed, 9 Mar 2022 at 11:48, Stefan Dösinger stefan@codeweavers.com wrote:
@@ -253,7 +253,6 @@ void resource_cleanup(struct wined3d_resource *resource)
device_resource_released(resource->device, resource); }
- wined3d_resource_acquire(resource); wined3d_cs_destroy_object(resource->device->cs, wined3d_resource_destroy_object, resource);
}
Is that safe? If yes, the reason why is useful information to include in the commit message.
Am 09.03.2022 um 20:57 schrieb Henri Verbeet hverbeet@gmail.com:
On Wed, 9 Mar 2022 at 11:48, Stefan Dösinger stefan@codeweavers.com wrote:
@@ -253,7 +253,6 @@ void resource_cleanup(struct wined3d_resource *resource)
device_resource_released(resource->device, resource); }
- wined3d_resource_acquire(resource); wined3d_cs_destroy_object(resource->device->cs, wined3d_resource_destroy_object, resource);
}
Is that safe? If yes, the reason why is useful information to include in the commit message.
Afaiu this codepath is called in case of a creation error, and the resource_acquire here is to balance the now-gone resource_release in the destroy callback. I'll double-check if I read things right and add more details in the commit.
On Thu, 10 Mar 2022 at 08:43, Stefan Dösinger stefandoesinger@gmail.com wrote:
Am 09.03.2022 um 20:57 schrieb Henri Verbeet hverbeet@gmail.com: On Wed, 9 Mar 2022 at 11:48, Stefan Dösinger stefan@codeweavers.com wrote:
@@ -253,7 +253,6 @@ void resource_cleanup(struct wined3d_resource *resource)
device_resource_released(resource->device, resource); }
- wined3d_resource_acquire(resource); wined3d_cs_destroy_object(resource->device->cs, wined3d_resource_destroy_object, resource);
}
Is that safe? If yes, the reason why is useful information to include in the commit message.
Afaiu this codepath is called in case of a creation error, and the resource_acquire here is to balance the now-gone resource_release in the destroy callback. I'll double-check if I read things right and add more details in the commit.
For textures in particular, when we take the wined3d_texture_cleanup_sync() path, we can't heap_free() the texture object until wined3d_resource_destroy_object() has finished executing.
Signed-off-by: Stefan Dösinger stefan@codeweavers.com --- dlls/wined3d/cs.c | 106 ++++++++++++++++----------------- dlls/wined3d/wined3d_private.h | 6 +- 2 files changed, 56 insertions(+), 56 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 5b8c7275693..d0ca29eaedf 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -550,10 +550,10 @@ static inline void wined3d_device_context_finish(struct wined3d_device_context * context->ops->finish(context, queue_id); }
-static inline void wined3d_device_context_acquire_resource(struct wined3d_device_context *context, +static inline void wined3d_device_context_reference_resource(struct wined3d_device_context *context, struct wined3d_resource *resource) { - context->ops->acquire_resource(context, resource); + context->ops->reference_resource(context, resource); }
static struct wined3d_cs *wined3d_cs_from_context(struct wined3d_device_context *context) @@ -734,10 +734,10 @@ void wined3d_cs_emit_present(struct wined3d_cs *cs, struct wined3d_swapchain *sw
pending = InterlockedIncrement(&cs->pending_presents);
- wined3d_resource_acquire(&swapchain->front_buffer->resource); + wined3d_resource_reference(&swapchain->front_buffer->resource); for (i = 0; i < swapchain->state.desc.backbuffer_count; ++i) { - wined3d_resource_acquire(&swapchain->back_buffers[i]->resource); + wined3d_resource_reference(&swapchain->back_buffers[i]->resource); }
wined3d_device_context_submit(&cs->c, WINED3D_CS_QUEUE_DEFAULT); @@ -789,12 +789,12 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT * for (i = 0; i < rt_count; ++i) { if ((view = state->fb.render_targets[i])) - wined3d_resource_acquire(view->resource); + wined3d_resource_reference(view->resource); } if (flags & (WINED3DCLEAR_ZBUFFER | WINED3DCLEAR_STENCIL)) { view = state->fb.depth_stencil; - wined3d_resource_acquire(view->resource); + wined3d_resource_reference(view->resource); }
wined3d_device_context_submit(&cs->c, WINED3D_CS_QUEUE_DEFAULT); @@ -831,14 +831,14 @@ void wined3d_device_context_emit_clear_rendertarget_view(struct wined3d_device_c op->rect_count = 1; op->rects[0] = *rect;
- wined3d_device_context_acquire_resource(context, view->resource); + wined3d_device_context_reference_resource(context, view->resource);
wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT); if (flags & WINED3DCLEAR_SYNCHRONOUS) wined3d_device_context_finish(context, WINED3D_CS_QUEUE_DEFAULT); }
-static void acquire_shader_resources(struct wined3d_device_context *context, unsigned int shader_mask) +static void reference_shader_resources(struct wined3d_device_context *context, unsigned int shader_mask) { const struct wined3d_state *state = context->state; struct wined3d_shader_sampler_map_entry *entry; @@ -857,7 +857,7 @@ static void acquire_shader_resources(struct wined3d_device_context *context, uns for (j = 0; j < WINED3D_MAX_CBS; ++j) { if (state->cb[i][j].buffer) - wined3d_device_context_acquire_resource(context, &state->cb[i][j].buffer->resource); + wined3d_device_context_reference_resource(context, &state->cb[i][j].buffer->resource); }
for (j = 0; j < shader->reg_maps.sampler_map.count; ++j) @@ -867,12 +867,12 @@ static void acquire_shader_resources(struct wined3d_device_context *context, uns if (!(view = state->shader_resource_view[i][entry->resource_idx])) continue;
- wined3d_device_context_acquire_resource(context, view->resource); + wined3d_device_context_reference_resource(context, view->resource); } } }
-static void acquire_unordered_access_resources(struct wined3d_device_context *context, +static void reference_unordered_access_resources(struct wined3d_device_context *context, const struct wined3d_shader *shader, struct wined3d_unordered_access_view * const *views) { unsigned int i; @@ -888,7 +888,7 @@ static void acquire_unordered_access_resources(struct wined3d_device_context *co if (!views[i]) continue;
- wined3d_device_context_acquire_resource(context, views[i]->resource); + wined3d_device_context_reference_resource(context, views[i]->resource); } }
@@ -903,12 +903,12 @@ static void wined3d_cs_exec_dispatch(struct wined3d_cs *cs, const void *data) cs->c.device->adapter->adapter_ops->adapter_dispatch_compute(cs->c.device, state, &op->parameters); }
-static void acquire_compute_pipeline_resources(struct wined3d_device_context *context) +static void reference_compute_pipeline_resources(struct wined3d_device_context *context) { const struct wined3d_state *state = context->state;
- acquire_shader_resources(context, 1u << WINED3D_SHADER_TYPE_COMPUTE); - acquire_unordered_access_resources(context, state->shader[WINED3D_SHADER_TYPE_COMPUTE], + reference_shader_resources(context, 1u << WINED3D_SHADER_TYPE_COMPUTE); + reference_unordered_access_resources(context, state->shader[WINED3D_SHADER_TYPE_COMPUTE], state->unordered_access_view[WINED3D_PIPELINE_COMPUTE]); }
@@ -925,7 +925,7 @@ void CDECL wined3d_device_context_dispatch(struct wined3d_device_context *contex op->parameters.u.direct.group_count_y = group_count_y; op->parameters.u.direct.group_count_z = group_count_z;
- acquire_compute_pipeline_resources(context); + reference_compute_pipeline_resources(context);
wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT); wined3d_device_context_unlock(context); @@ -943,8 +943,8 @@ void CDECL wined3d_device_context_dispatch_indirect(struct wined3d_device_contex op->parameters.u.indirect.buffer = buffer; op->parameters.u.indirect.offset = offset;
- acquire_compute_pipeline_resources(context); - wined3d_device_context_acquire_resource(context, &buffer->resource); + reference_compute_pipeline_resources(context); + wined3d_device_context_reference_resource(context, &buffer->resource);
wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT); wined3d_device_context_unlock(context); @@ -1003,38 +1003,38 @@ static void wined3d_cs_exec_draw(struct wined3d_cs *cs, const void *data) cs->c.device->adapter->adapter_ops->adapter_draw_primitive(cs->c.device, state, &op->parameters); }
-static void acquire_graphics_pipeline_resources(struct wined3d_device_context *context, +static void reference_graphics_pipeline_resources(struct wined3d_device_context *context, BOOL indexed, const struct wined3d_d3d_info *d3d_info) { const struct wined3d_state *state = context->state; unsigned int i;
if (indexed) - wined3d_device_context_acquire_resource(context, &state->index_buffer->resource); + wined3d_device_context_reference_resource(context, &state->index_buffer->resource); for (i = 0; i < ARRAY_SIZE(state->streams); ++i) { if (state->streams[i].buffer) - wined3d_device_context_acquire_resource(context, &state->streams[i].buffer->resource); + wined3d_device_context_reference_resource(context, &state->streams[i].buffer->resource); } for (i = 0; i < ARRAY_SIZE(state->stream_output); ++i) { if (state->stream_output[i].buffer) - wined3d_device_context_acquire_resource(context, &state->stream_output[i].buffer->resource); + wined3d_device_context_reference_resource(context, &state->stream_output[i].buffer->resource); } for (i = 0; i < ARRAY_SIZE(state->textures); ++i) { if (state->textures[i]) - wined3d_device_context_acquire_resource(context, &state->textures[i]->resource); + wined3d_device_context_reference_resource(context, &state->textures[i]->resource); } for (i = 0; i < d3d_info->limits.max_rt_count; ++i) { if (state->fb.render_targets[i]) - wined3d_device_context_acquire_resource(context, state->fb.render_targets[i]->resource); + wined3d_device_context_reference_resource(context, state->fb.render_targets[i]->resource); } if (state->fb.depth_stencil) - wined3d_device_context_acquire_resource(context, state->fb.depth_stencil->resource); - acquire_shader_resources(context, ~(1u << WINED3D_SHADER_TYPE_COMPUTE)); - acquire_unordered_access_resources(context, state->shader[WINED3D_SHADER_TYPE_PIXEL], + wined3d_device_context_reference_resource(context, state->fb.depth_stencil->resource); + reference_shader_resources(context, ~(1u << WINED3D_SHADER_TYPE_COMPUTE)); + reference_unordered_access_resources(context, state->shader[WINED3D_SHADER_TYPE_PIXEL], state->unordered_access_view[WINED3D_PIPELINE_GRAPHICS]); }
@@ -1058,7 +1058,7 @@ void wined3d_device_context_emit_draw(struct wined3d_device_context *context, op->parameters.u.direct.instance_count = instance_count; op->parameters.indexed = indexed;
- acquire_graphics_pipeline_resources(context, indexed, d3d_info); + reference_graphics_pipeline_resources(context, indexed, d3d_info);
wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT); } @@ -1080,8 +1080,8 @@ void CDECL wined3d_device_context_draw_indirect(struct wined3d_device_context *c op->parameters.u.indirect.offset = offset; op->parameters.indexed = indexed;
- acquire_graphics_pipeline_resources(context, indexed, d3d_info); - wined3d_device_context_acquire_resource(context, &buffer->resource); + reference_graphics_pipeline_resources(context, indexed, d3d_info); + wined3d_device_context_reference_resource(context, &buffer->resource);
wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT); wined3d_device_context_unlock(context); @@ -2260,7 +2260,7 @@ static void wined3d_cs_issue_query(struct wined3d_device_context *context, query->state = QUERY_SIGNALLED; }
-static void wined3d_cs_acquire_command_list(struct wined3d_device_context *context, struct wined3d_command_list *list) +static void wined3d_cs_reference_command_list(struct wined3d_device_context *context, struct wined3d_command_list *list) { struct wined3d_cs *cs = wined3d_cs_from_context(context); SIZE_T i; @@ -2284,10 +2284,10 @@ static void wined3d_cs_acquire_command_list(struct wined3d_device_context *conte }
for (i = 0; i < list->resource_count; ++i) - wined3d_resource_acquire(list->resources[i]); + wined3d_resource_reference(list->resources[i]);
for (i = 0; i < list->command_list_count; ++i) - wined3d_cs_acquire_command_list(context, list->command_lists[i]); + wined3d_cs_reference_command_list(context, list->command_lists[i]);
for (i = 0; i < list->upload_count; ++i) invalidate_client_address(list->uploads[i].resource); @@ -2309,7 +2309,7 @@ void wined3d_cs_emit_preload_resource(struct wined3d_cs *cs, struct wined3d_reso op->opcode = WINED3D_CS_OP_PRELOAD_RESOURCE; op->resource = resource;
- wined3d_resource_acquire(resource); + wined3d_resource_reference(resource);
wined3d_device_context_submit(&cs->c, WINED3D_CS_QUEUE_DEFAULT); } @@ -2332,7 +2332,7 @@ void wined3d_cs_emit_unload_resource(struct wined3d_cs *cs, struct wined3d_resou op->opcode = WINED3D_CS_OP_UNLOAD_RESOURCE; op->resource = resource;
- wined3d_resource_acquire(resource); + wined3d_resource_reference(resource);
wined3d_device_context_submit(&cs->c, WINED3D_CS_QUEUE_DEFAULT); } @@ -2356,7 +2356,7 @@ static void wined3d_device_context_upload_bo(struct wined3d_device_context *cont op->row_pitch = row_pitch; op->slice_pitch = slice_pitch;
- wined3d_device_context_acquire_resource(context, resource); + wined3d_device_context_reference_resource(context, resource);
wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT); } @@ -2608,9 +2608,9 @@ void wined3d_device_context_emit_blt_sub_resource(struct wined3d_device_context memset(&op->fx, 0, sizeof(op->fx)); op->filter = filter;
- wined3d_device_context_acquire_resource(context, dst_resource); + wined3d_device_context_reference_resource(context, dst_resource); if (src_resource) - wined3d_device_context_acquire_resource(context, src_resource); + wined3d_device_context_reference_resource(context, src_resource);
wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT); if (flags & WINED3D_BLT_SYNCHRONOUS) @@ -2716,7 +2716,7 @@ void wined3d_cs_emit_add_dirty_texture_region(struct wined3d_cs *cs, op->texture = texture; op->layer = layer;
- wined3d_resource_acquire(&texture->resource); + wined3d_resource_reference(&texture->resource);
wined3d_device_context_submit(&cs->c, WINED3D_CS_QUEUE_DEFAULT); } @@ -2743,7 +2743,7 @@ void wined3d_device_context_emit_clear_uav(struct wined3d_device_context *contex op->clear_value = *clear_value; op->fp = fp;
- wined3d_device_context_acquire_resource(context, view->resource); + wined3d_device_context_reference_resource(context, view->resource);
wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT); } @@ -2770,7 +2770,7 @@ void wined3d_device_context_emit_copy_uav_counter(struct wined3d_device_context op->offset = offset; op->view = uav;
- wined3d_device_context_acquire_resource(context, &dst_buffer->resource); + wined3d_device_context_reference_resource(context, &dst_buffer->resource);
wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT); } @@ -2795,7 +2795,7 @@ void wined3d_device_context_emit_generate_mipmaps(struct wined3d_device_context op->opcode = WINED3D_CS_OP_GENERATE_MIPMAPS; op->view = view;
- wined3d_device_context_acquire_resource(context, view->resource); + wined3d_device_context_reference_resource(context, view->resource);
wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT); } @@ -2811,9 +2811,9 @@ static void wined3d_cs_emit_stop(struct wined3d_cs *cs) wined3d_cs_finish(cs, WINED3D_CS_QUEUE_DEFAULT); }
-static void wined3d_cs_acquire_resource(struct wined3d_device_context *context, struct wined3d_resource *resource) +static void wined3d_cs_reference_resource(struct wined3d_device_context *context, struct wined3d_resource *resource) { - wined3d_resource_acquire(resource); + wined3d_resource_reference(resource); }
static void wined3d_cs_exec_execute_command_list(struct wined3d_cs *cs, const void *data); @@ -2902,7 +2902,7 @@ void wined3d_device_context_emit_execute_command_list(struct wined3d_device_cont op->opcode = WINED3D_CS_OP_EXECUTE_COMMAND_LIST; op->list = list;
- context->ops->acquire_command_list(context, list); + context->ops->reference_command_list(context, list);
wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT);
@@ -3124,8 +3124,8 @@ static const struct wined3d_device_context_ops wined3d_cs_st_ops = wined3d_cs_unmap_upload_bo, wined3d_cs_issue_query, wined3d_cs_flush, - wined3d_cs_acquire_resource, - wined3d_cs_acquire_command_list, + wined3d_cs_reference_resource, + wined3d_cs_reference_command_list, };
static BOOL wined3d_cs_queue_is_empty(const struct wined3d_cs *cs, const struct wined3d_cs_queue *queue) @@ -3253,8 +3253,8 @@ static const struct wined3d_device_context_ops wined3d_cs_mt_ops = wined3d_cs_unmap_upload_bo, wined3d_cs_issue_query, wined3d_cs_flush, - wined3d_cs_acquire_resource, - wined3d_cs_acquire_command_list, + wined3d_cs_reference_resource, + wined3d_cs_reference_command_list, };
static void poll_queries(struct wined3d_cs *cs) @@ -4143,7 +4143,7 @@ static void wined3d_deferred_context_flush(struct wined3d_device_context *contex FIXME("context %p, stub!\n", context); }
-static void wined3d_deferred_context_acquire_resource(struct wined3d_device_context *context, +static void wined3d_deferred_context_reference_resource(struct wined3d_device_context *context, struct wined3d_resource *resource) { struct wined3d_deferred_context *deferred = wined3d_deferred_context_from_context(context); @@ -4156,7 +4156,7 @@ static void wined3d_deferred_context_acquire_resource(struct wined3d_device_cont wined3d_resource_incref(resource); }
-static void wined3d_deferred_context_acquire_command_list(struct wined3d_device_context *context, +static void wined3d_deferred_context_reference_command_list(struct wined3d_device_context *context, struct wined3d_command_list *list) { struct wined3d_deferred_context *deferred = wined3d_deferred_context_from_context(context); @@ -4180,8 +4180,8 @@ static const struct wined3d_device_context_ops wined3d_deferred_context_ops = wined3d_deferred_context_unmap_upload_bo, wined3d_deferred_context_issue_query, wined3d_deferred_context_flush, - wined3d_deferred_context_acquire_resource, - wined3d_deferred_context_acquire_command_list, + wined3d_deferred_context_reference_resource, + wined3d_deferred_context_reference_command_list, };
HRESULT CDECL wined3d_deferred_context_create(struct wined3d_device *device, struct wined3d_device_context **context) diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index e46b6dfb9e0..088a1fe7188 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -4915,8 +4915,8 @@ struct wined3d_device_context_ops unsigned int sub_resource_idx, struct wined3d_box *box, struct upload_bo *upload_bo); void (*issue_query)(struct wined3d_device_context *context, struct wined3d_query *query, unsigned int flags); void (*flush)(struct wined3d_device_context *context); - void (*acquire_resource)(struct wined3d_device_context *context, struct wined3d_resource *resource); - void (*acquire_command_list)(struct wined3d_device_context *context, struct wined3d_command_list *list); + void (*reference_resource)(struct wined3d_device_context *context, struct wined3d_resource *resource); + void (*reference_command_list)(struct wined3d_device_context *context, struct wined3d_command_list *list); };
struct wined3d_device_context @@ -5080,7 +5080,7 @@ void wined3d_device_context_emit_update_sub_resource(struct wined3d_device_conte HRESULT wined3d_device_context_emit_unmap(struct wined3d_device_context *context, struct wined3d_resource *resource, unsigned int sub_resource_idx) DECLSPEC_HIDDEN;
-static inline void wined3d_resource_acquire(struct wined3d_resource *resource) +static inline void wined3d_resource_reference(struct wined3d_resource *resource) { const struct wined3d_cs *cs = resource->device->cs; resource->access_time = cs->queue[WINED3D_CS_QUEUE_DEFAULT].head;