Signed-off-by: Jan Sikorski jsikorski@codeweavers.com --- dlls/d3d11/tests/d3d11.c | 75 ++++++++++++++++++++++++++++++++++++++++ dlls/wined3d/cs.c | 67 ++++++++++++++++++++++++++++++++++- 2 files changed, 141 insertions(+), 1 deletion(-)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index d8c10ab054c..c0d3b650d79 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -33026,6 +33026,80 @@ static void test_deferred_context_rendering(void) release_test_context(&test_context); }
+static void test_deferred_context_queries(void) +{ + ID3D11DeviceContext *immediate, *deferred; + struct d3d11_test_context test_context; + D3D11_QUERY_DESC query_desc; + ID3D11Asynchronous *query; + ID3D11CommandList *list; + ID3D11Device *device; + HRESULT hr; + + union + { + UINT64 uint; + DWORD dword[2]; + } data; + + static const struct vec4 white = {1.0f, 1.0f, 1.0f, 1.0f}; + + if (!init_test_context(&test_context, NULL)) + return; + + device = test_context.device; + immediate = test_context.immediate_context; + + hr = ID3D11Device_CreateDeferredContext(device, 0, &deferred); + ok(hr == S_OK, "Failed to create deferred context, hr %#x.\n", hr); + + query_desc.Query = D3D11_QUERY_OCCLUSION; + query_desc.MiscFlags = 0; + hr = ID3D11Device_CreateQuery(device, &query_desc, (ID3D11Query **)&query); + ok(hr == S_OK, "Failed to create query, hr %#x.\n", hr); + + hr = ID3D11DeviceContext_GetData(deferred, query, NULL, 0, 0); + ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr); + hr = ID3D11DeviceContext_GetData(deferred, query, &data, sizeof(data), 0); + ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr); + + ID3D11DeviceContext_OMSetRenderTargets(deferred, 1, &test_context.backbuffer_rtv, NULL); + set_viewport(deferred, 0.0f, 0.0f, 640.0f, 480.0f, 0.0f, 1.0f); + + ID3D11DeviceContext_Begin(deferred, query); + + hr = ID3D11DeviceContext_GetData(deferred, query, &data, sizeof(data), 0); + ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr); + + test_context.immediate_context = deferred; + draw_color_quad(&test_context, &white); + test_context.immediate_context = immediate; + + ID3D11DeviceContext_End(deferred, query); + + hr = ID3D11DeviceContext_GetData(deferred, query, &data, sizeof(data), 0); + ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr); + hr = ID3D11DeviceContext_GetData(immediate, query, &data, sizeof(data), 0); + ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr); + + hr = ID3D11DeviceContext_FinishCommandList(deferred, FALSE, &list); + + hr = ID3D11DeviceContext_GetData(deferred, query, &data, sizeof(data), 0); + ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr); + hr = ID3D11DeviceContext_GetData(immediate, query, &data, sizeof(data), 0); + ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr); + + ID3D11DeviceContext_ExecuteCommandList(immediate, list, FALSE); + + get_query_data(immediate, query, &data, sizeof(data)); + ok(data.uint == 640 * 480, "Got unexpected query result 0x%08x%08x.\n", data.dword[1], data.dword[0]); + + ID3D11Asynchronous_Release(query); + ID3D11CommandList_Release(list); + ID3D11DeviceContext_Release(deferred); + release_test_context(&test_context); +} + static void test_deferred_context_map(void) { ID3D11DeviceContext *immediate, *deferred; @@ -33984,6 +34058,7 @@ START_TEST(d3d11) queue_test(test_deferred_context_swap_state); queue_test(test_deferred_context_rendering); queue_test(test_deferred_context_map); + queue_test(test_deferred_context_queries); queue_test(test_unbound_streams); queue_test(test_texture_compressed_3d); queue_test(test_constant_buffer_offset); diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 2d295d4660e..839853840e9 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -34,6 +34,12 @@ struct wined3d_deferred_upload struct wined3d_box box; };
+struct wined3d_deferred_query_issue +{ + struct wined3d_query *query; + unsigned int flags; +}; + struct wined3d_command_list { LONG refcount; @@ -54,6 +60,9 @@ struct wined3d_command_list * to hold a reference here (and in wined3d_deferred_context) as well. */ SIZE_T command_list_count; struct wined3d_command_list **command_lists; + + SIZE_T query_count; + struct wined3d_deferred_query_issue *queries; };
static void wined3d_command_list_destroy_object(void *object) @@ -70,6 +79,7 @@ static void wined3d_command_list_destroy_object(void *object) heap_free(list->uploads); heap_free(list->resources); heap_free(list->data); + heap_free(list->queries); heap_free(list); }
@@ -99,6 +109,8 @@ ULONG CDECL wined3d_command_list_decref(struct wined3d_command_list *list) wined3d_resource_decref(list->resources[i]); for (i = 0; i < list->upload_count; ++i) wined3d_resource_decref(list->uploads[i].resource); + for (i = 0; i < list->query_count; ++i) + wined3d_query_decref(list->queries[i].query);
wined3d_cs_destroy_object(device->cs, wined3d_command_list_destroy_object, list); } @@ -2368,8 +2380,27 @@ static void wined3d_cs_issue_query(struct wined3d_device_context *context,
static void wined3d_cs_acquire_command_list(struct wined3d_device_context *context, struct wined3d_command_list *list) { + struct wined3d_cs *cs = wined3d_cs_from_context(context); SIZE_T i;
+ if (list->query_count) + { + cs->queries_flushed = FALSE; + + for (i = 0; i < list->query_count; ++i) + { + if (list->queries[i].flags & WINED3DISSUE_END) + { + list->queries[i].query->counter_main++; + list->queries[i].query->state = QUERY_SIGNALLED; + } + else + { + list->queries[i].query->state = QUERY_BUILDING; + } + } + } + for (i = 0; i < list->resource_count; ++i) wined3d_resource_acquire(list->resources[i]);
@@ -3421,6 +3452,9 @@ struct wined3d_deferred_context * we need to hold a reference here and in wined3d_command_list as well. */ SIZE_T command_list_count, command_lists_capacity; struct wined3d_command_list **command_lists; + + SIZE_T query_count, queries_capacity; + struct wined3d_deferred_query_issue *queries; };
static struct wined3d_deferred_context *wined3d_deferred_context_from_context(struct wined3d_device_context *context) @@ -3569,7 +3603,25 @@ static bool wined3d_deferred_context_get_upload_bo(struct wined3d_device_context static void wined3d_deferred_context_issue_query(struct wined3d_device_context *context, struct wined3d_query *query, unsigned int flags) { - FIXME("context %p, query %p, flags %#x, stub!\n", context, query, flags); + struct wined3d_deferred_context *deferred = wined3d_deferred_context_from_context(context); + struct wined3d_cs_query_issue *op; + + op = wined3d_device_context_require_space(context, sizeof(*op), WINED3D_CS_QUEUE_DEFAULT); + op->opcode = WINED3D_CS_OP_QUERY_ISSUE; + op->query = query; + op->flags = flags; + + wined3d_device_context_submit(context, WINED3D_CS_QUEUE_DEFAULT); + + if (!wined3d_array_reserve((void **)&deferred->queries, &deferred->queries_capacity, + deferred->query_count + 1, sizeof(*deferred->queries))) + { + ERR("Failed to reserve memory.\n"); + return; + } + + deferred->queries[deferred->query_count].flags = flags; + wined3d_query_incref(deferred->queries[deferred->query_count++].query = query); }
static void wined3d_deferred_context_flush(struct wined3d_device_context *context) @@ -3669,6 +3721,10 @@ void CDECL wined3d_deferred_context_destroy(struct wined3d_device_context *conte wined3d_command_list_decref(deferred->command_lists[i]); heap_free(deferred->command_lists);
+ for (i = 0; i < deferred->query_count; ++i) + wined3d_query_decref(deferred->queries[i].query); + heap_free(deferred->queries); + wined3d_state_destroy(deferred->c.state); heap_free(deferred->data); heap_free(deferred); @@ -3712,10 +3768,17 @@ HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device deferred->command_list_count * sizeof(*object->command_lists)); /* Transfer our references to the command lists to the command list. */
+ if (!(object->queries = heap_alloc(deferred->query_count * sizeof(*object->queries)))) + goto out_free_command_lists; + object->query_count = deferred->query_count; + memcpy(object->queries, deferred->queries, deferred->query_count * sizeof(*object->queries)); + /* Transfer our references to the queries to the command list. */ + deferred->data_size = 0; deferred->resource_count = 0; deferred->upload_count = 0; deferred->command_list_count = 0; + deferred->query_count = 0;
/* This is in fact recorded into a subsequent command list. */ if (restore) @@ -3728,6 +3791,8 @@ HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device
return S_OK;
+out_free_command_lists: + heap_free(object->command_lists); out_free_uploads: heap_free(object->uploads); out_free_resources:
Signed-off-by: Jan Sikorski jsikorski@codeweavers.com --- dlls/d3d11/device.c | 4 ++++ dlls/d3d11/tests/d3d11.c | 5 +++++ 2 files changed, 9 insertions(+)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index c47b5208360..68b0333604f 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -1038,6 +1038,7 @@ static void STDMETHODCALLTYPE d3d11_device_context_End(ID3D11DeviceContext1 *ifa static HRESULT STDMETHODCALLTYPE d3d11_device_context_GetData(ID3D11DeviceContext1 *iface, ID3D11Asynchronous *asynchronous, void *data, UINT data_size, UINT data_flags) { + struct d3d11_device_context *context = impl_from_ID3D11DeviceContext1(iface); struct d3d_query *query = unsafe_impl_from_ID3D11Asynchronous(asynchronous); unsigned int wined3d_flags; HRESULT hr; @@ -1045,6 +1046,9 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_context_GetData(ID3D11DeviceContex TRACE("iface %p, asynchronous %p, data %p, data_size %u, data_flags %#x.\n", iface, asynchronous, data, data_size, data_flags);
+ if (context->type != D3D11_DEVICE_CONTEXT_IMMEDIATE) + return DXGI_ERROR_INVALID_CALL; + if (!data && data_size) return E_INVALIDARG;
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index c0d3b650d79..eb8cde40dcc 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -33091,6 +33091,11 @@ static void test_deferred_context_queries(void)
ID3D11DeviceContext_ExecuteCommandList(immediate, list, FALSE);
+ hr = ID3D11DeviceContext_GetData(deferred, query, &data, sizeof(data), 0); + ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr); + hr = ID3D11DeviceContext_GetData(deferred, query, NULL, 0, 0); + ok(hr == DXGI_ERROR_INVALID_CALL, "Got unexpected hr %#x.\n", hr); + get_query_data(immediate, query, &data, sizeof(data)); ok(data.uint == 640 * 480, "Got unexpected query result 0x%08x%08x.\n", data.dword[1], data.dword[0]);
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=99086
Your paranoid android.
=== w8 (32 bit report) ===
d3d11: d3d11.c:6250: Test failed: Got unexpected NumPrimitivesWritten: 0. d3d11.c:6253: Test failed: Got unexpected PrimitivesStorageNeeded: 4250669240.
=== w1064v1809 (32 bit report) ===
d3d11: d3d11.c:5920: Test failed: Got unexpected IAVertices count: 0. d3d11.c:5921: Test failed: Got unexpected IAPrimitives count: 0. d3d11.c:5922: Test failed: Got unexpected VSInvocations count: 0. d3d11.c:5925: Test failed: Got unexpected CInvocations count: 0. d3d11.c:5926: Test failed: Got unexpected CPrimitives count: 0.
=== w1064_tsign (32 bit report) ===
d3d11: d3d11.c:5920: Test failed: Got unexpected IAVertices count: 0. d3d11.c:5921: Test failed: Got unexpected IAPrimitives count: 0. d3d11.c:5922: Test failed: Got unexpected VSInvocations count: 0. d3d11.c:5925: Test failed: Got unexpected CInvocations count: 0. d3d11.c:5926: Test failed: Got unexpected CPrimitives count: 0.
=== w10pro64 (32 bit report) ===
d3d11: d3d11.c:5920: Test failed: Got unexpected IAVertices count: 0. d3d11.c:5921: Test failed: Got unexpected IAPrimitives count: 0. d3d11.c:5922: Test failed: Got unexpected VSInvocations count: 0. d3d11.c:5925: Test failed: Got unexpected CInvocations count: 0. d3d11.c:5926: Test failed: Got unexpected CPrimitives count: 0.
=== debiant2 (32 bit report) ===
d3d11: d3d11.c:5926: Test failed: d3d11.c:6253: Test marked todo: Got unexpected PrimitivesStorageNeeded: 2.
=== debiant2 (32 bit Arabic:Morocco report) ===
d3d11: d3d11.c:5926: Test failed: d3d11.c:6240: Test marked todo: Got unexpected hr 0x1.
=== debiant2 (32 bit Hindi:India report) ===
d3d11: d3d11.c:6263: Test failed: d3d11.c:7743: Test marked todo: Got unexpected PrimitivesStorageNeeded: 2.
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Jan Sikorski jsikorski@codeweavers.com --- dlls/wined3d/cs.c | 56 +++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 31 deletions(-)
diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c index 839853840e9..dbc277a491f 100644 --- a/dlls/wined3d/cs.c +++ b/dlls/wined3d/cs.c @@ -75,11 +75,6 @@ static void wined3d_command_list_destroy_object(void *object) for (i = 0; i < list->upload_count; ++i) heap_free(list->uploads[i].sysmem);
- heap_free(list->command_lists); - heap_free(list->uploads); - heap_free(list->resources); - heap_free(list->data); - heap_free(list->queries); heap_free(list); }
@@ -3735,45 +3730,56 @@ HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device { struct wined3d_deferred_context *deferred = wined3d_deferred_context_from_context(context); struct wined3d_command_list *object; + size_t offset; + BYTE *memory;
TRACE("context %p, list %p.\n", context, list);
- if (!(object = heap_alloc_zero(sizeof(*object)))) + memory = heap_alloc(sizeof(*object) + deferred->resource_count * sizeof(*object->resources) + + deferred->upload_count * sizeof(*object->uploads) + + deferred->command_list_count * sizeof(*object->command_lists) + + deferred->query_count * sizeof(*object->queries) + + deferred->data_size); + + if (!memory) return E_OUTOFMEMORY;
+ object = (void *)memory; + offset = sizeof(*object); + memset(object, 0, sizeof(*object)); + object->refcount = 1; object->device = deferred->c.device;
- if (!(object->data = heap_alloc(deferred->data_size))) - goto out_free_list; - object->data_size = deferred->data_size; - memcpy(object->data, deferred->data, deferred->data_size); - - if (!(object->resources = heap_alloc(deferred->resource_count * sizeof(*object->resources)))) - goto out_free_data; + object->resources = (void *)(memory + offset); + offset += deferred->resource_count * sizeof(*object->resources); object->resource_count = deferred->resource_count; memcpy(object->resources, deferred->resources, deferred->resource_count * sizeof(*object->resources)); /* Transfer our references to the resources to the command list. */
- if (!(object->uploads = heap_alloc(deferred->upload_count * sizeof(*object->uploads)))) - goto out_free_resources; + object->uploads = (void *)(memory + offset); + offset += deferred->upload_count * sizeof(*object->uploads); object->upload_count = deferred->upload_count; memcpy(object->uploads, deferred->uploads, deferred->upload_count * sizeof(*object->uploads)); /* Transfer our references to the resources to the command list. */
- if (!(object->command_lists = heap_alloc(deferred->command_list_count * sizeof(*object->command_lists)))) - goto out_free_uploads; + object->command_lists = (void *)(memory + offset); + offset += deferred->command_list_count * sizeof(*object->command_lists); object->command_list_count = deferred->command_list_count; memcpy(object->command_lists, deferred->command_lists, deferred->command_list_count * sizeof(*object->command_lists)); /* Transfer our references to the command lists to the command list. */
- if (!(object->queries = heap_alloc(deferred->query_count * sizeof(*object->queries)))) - goto out_free_command_lists; + object->queries = (void *)(memory + offset); + offset += deferred->query_count * sizeof(*object->queries); object->query_count = deferred->query_count; memcpy(object->queries, deferred->queries, deferred->query_count * sizeof(*object->queries)); /* Transfer our references to the queries to the command list. */
+ object->data = (void *)(memory + offset); + object->data_size = deferred->data_size; + memcpy(object->data, deferred->data, deferred->data_size); + deferred->data_size = 0; deferred->resource_count = 0; deferred->upload_count = 0; @@ -3790,16 +3796,4 @@ HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device *list = object;
return S_OK; - -out_free_command_lists: - heap_free(object->command_lists); -out_free_uploads: - heap_free(object->uploads); -out_free_resources: - heap_free(object->resources); -out_free_data: - heap_free(object->data); -out_free_list: - heap_free(object); - return E_OUTOFMEMORY; }
On Wed, 29 Sept 2021 at 17:40, Jan Sikorski jsikorski@codeweavers.com wrote:
dlls/wined3d/cs.c | 56 +++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 31 deletions(-)
Conceptually I think this is fine, although traditionally we'd use something like "wined3d: Use a single allocation for command list data." for the subject line.
@@ -3735,45 +3730,56 @@ HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device { struct wined3d_deferred_context *deferred = wined3d_deferred_context_from_context(context); struct wined3d_command_list *object;
- size_t offset;
- BYTE *memory;
We'd prefer uint8_t over BYTE here. (More broadly, we prefer standard types over Windows types inside wined3d.) You probably need neither "memory" nor "offset" though.
memory = heap_alloc(sizeof(*object) + deferred->resource_count * sizeof(*object->resources) +
deferred->upload_count * sizeof(*object->uploads) +
deferred->command_list_count * sizeof(*object->command_lists) +
deferred->query_count * sizeof(*object->queries) +
deferred->data_size);
if (!memory) return E_OUTOFMEMORY;
object = (void *)memory;
offset = sizeof(*object);
memset(object, 0, sizeof(*object));
object->refcount = 1; object->device = deferred->c.device;
- if (!(object->data = heap_alloc(deferred->data_size)))
goto out_free_list;
- object->data_size = deferred->data_size;
- memcpy(object->data, deferred->data, deferred->data_size);
- if (!(object->resources = heap_alloc(deferred->resource_count * sizeof(*object->resources))))
goto out_free_data;
- object->resources = (void *)(memory + offset);
- offset += deferred->resource_count * sizeof(*object->resources); object->resource_count = deferred->resource_count; memcpy(object->resources, deferred->resources, deferred->resource_count * sizeof(*object->resources)); /* Transfer our references to the resources to the command list. */
- if (!(object->uploads = heap_alloc(deferred->upload_count * sizeof(*object->uploads))))
goto out_free_resources;
- object->uploads = (void *)(memory + offset);
- offset += deferred->upload_count * sizeof(*object->uploads); object->upload_count = deferred->upload_count; memcpy(object->uploads, deferred->uploads, deferred->upload_count * sizeof(*object->uploads)); /* Transfer our references to the resources to the command list. */
We'd typically write that like this:
object = heap_alloc(...); ... object->resources = (struct wined3d_resource *)&object[1]; ... object->uploads = (struct wined3d_deferred_upload *)&object->resources[object->resource_count];
etc.
On 5 Oct 2021, at 15:33, Henri Verbeet hverbeet@gmail.com wrote:
On Wed, 29 Sept 2021 at 17:40, Jan Sikorski jsikorski@codeweavers.com wrote:
dlls/wined3d/cs.c | 56 +++++++++++++++++++++-------------------------- 1 file changed, 25 insertions(+), 31 deletions(-)
Conceptually I think this is fine, although traditionally we'd use something like "wined3d: Use a single allocation for command list data." for the subject line.
@@ -3735,45 +3730,56 @@ HRESULT CDECL wined3d_deferred_context_record_command_list(struct wined3d_device { struct wined3d_deferred_context *deferred = wined3d_deferred_context_from_context(context); struct wined3d_command_list *object;
- size_t offset;
- BYTE *memory;
We'd prefer uint8_t over BYTE here. (More broadly, we prefer standard types over Windows types inside wined3d.) You probably need neither "memory" nor "offset" though.
memory = heap_alloc(sizeof(*object) + deferred->resource_count * sizeof(*object->resources) +
deferred->upload_count * sizeof(*object->uploads) +
deferred->command_list_count * sizeof(*object->command_lists) +
deferred->query_count * sizeof(*object->queries) +
deferred->data_size);
if (!memory) return E_OUTOFMEMORY;
object = (void *)memory;
offset = sizeof(*object);
memset(object, 0, sizeof(*object));
object->refcount = 1; object->device = deferred->c.device;
- if (!(object->data = heap_alloc(deferred->data_size)))
goto out_free_list;
- object->data_size = deferred->data_size;
- memcpy(object->data, deferred->data, deferred->data_size);
- if (!(object->resources = heap_alloc(deferred->resource_count * sizeof(*object->resources))))
goto out_free_data;
- object->resources = (void *)(memory + offset);
- offset += deferred->resource_count * sizeof(*object->resources); object->resource_count = deferred->resource_count; memcpy(object->resources, deferred->resources, deferred->resource_count * sizeof(*object->resources)); /* Transfer our references to the resources to the command list. */
- if (!(object->uploads = heap_alloc(deferred->upload_count * sizeof(*object->uploads))))
goto out_free_resources;
- object->uploads = (void *)(memory + offset);
- offset += deferred->upload_count * sizeof(*object->uploads); object->upload_count = deferred->upload_count; memcpy(object->uploads, deferred->uploads, deferred->upload_count * sizeof(*object->uploads)); /* Transfer our references to the resources to the command list. */
We'd typically write that like this:
object = heap_alloc(...); ... object->resources = (struct wined3d_resource *)&object[1]; ... object->uploads = (struct wined3d_deferred_upload *)&object->resources[object->resource_count];
etc.
I’ve seen that elsewhere in the codebase, but I think it has some downsides. As is, each block of code only deals with a single field, and you can reorder these blocks around freely and add/remove without changing the ones next to it. Not that it’s a huge problem to do it, but are there reasons for this?
On Tue, 5 Oct 2021 at 15:52, Jan Sikorski jsikorski@codeweavers.com wrote:
On 5 Oct 2021, at 15:33, Henri Verbeet hverbeet@gmail.com wrote: We'd typically write that like this:
object = heap_alloc(...); ... object->resources = (struct wined3d_resource *)&object[1]; ... object->uploads = (struct wined3d_deferred_upload *)&object->resources[object->resource_count];
etc.
I’ve seen that elsewhere in the codebase, but I think it has some downsides. As is, each block of code only deals with a single field, and you can reorder these blocks around freely and add/remove without changing the ones next to it. Not that it’s a huge problem to do it, but are there reasons for this?
At the core, it's personal preference for the existing cases, and then consistency with existing code for new code.
If being able to easily reorder these is really a concern, I could live with something like the following:
offset = 0; memory = heap_alloc(...); ... object = (struct wined3d_command_list *)&memory[offset]; offset += sizeof(*object); ... object->resources = (struct wined3d_resource *)&memory[offset]; offset += object->resource_count * sizeof(*object->resources);
I'm not sure that's really worth it, but the issue I have with the existing patch is mostly the "void *" casts and using "+" instead of "[]" for address calculations, not the "memory"/"offset" scheme per se.
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=99085
Your paranoid android.
=== w1064v1809 (32 bit report) ===
d3d11: d3d11.c:5920: Test failed: Got unexpected IAVertices count: 0. d3d11.c:5921: Test failed: Got unexpected IAPrimitives count: 0. d3d11.c:5922: Test failed: Got unexpected VSInvocations count: 0. d3d11.c:5925: Test failed: Got unexpected CInvocations count: 0. d3d11.c:5926: Test failed: Got unexpected CPrimitives count: 0.
=== w10pro64 (32 bit report) ===
d3d11: d3d11.c:5920: Test failed: Got unexpected IAVertices count: 0. d3d11.c:5921: Test failed: Got unexpected IAPrimitives count: 0. d3d11.c:5922: Test failed: Got unexpected VSInvocations count: 0. d3d11.c:5925: Test failed: Got unexpected CInvocations count: 0. d3d11.c:5926: Test failed: Got unexpected CPrimitives count: 0. d3d11.c:5765: Test failed: Got unexpected query result 0x0000000000000000.
=== debiant2 (32 bit German report) ===
d3d11: d3d11.c:9770: Test failed: Got hr 0 for WRITE_DISCARD.