Signed-off-by: Ziqing Hui zhui@codeweavers.com ---
This patch is identical to patch 210309.
dlls/d2d1/tests/d2d1.c | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 72487692abf..629bbd65523 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -9680,13 +9680,14 @@ static void test_mt_factory(BOOL d3d11)
static void test_effect(BOOL d3d11) { - unsigned int i, min_inputs, max_inputs; + unsigned int i, min_inputs, max_inputs, str_size; D2D1_BUFFER_PRECISION precision; ID2D1Image *image_a, *image_b; struct d2d1_test_context ctx; ID2D1DeviceContext *context; ID2D1Factory1 *factory; ID2D1Effect *effect; + BYTE buffer[64]; BOOL cached; CLSID clsid; HRESULT hr; @@ -9735,6 +9736,33 @@ static void test_effect(BOOL d3d11)
todo_wine { + hr = ID2D1Effect_GetValue(effect, 0xdeadbeef, D2D1_PROPERTY_TYPE_CLSID, (BYTE *)&clsid, sizeof(clsid)); + ok(hr == D2DERR_INVALID_PROPERTY, "Got unexpected hr %#x.\n", hr); + + hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CLSID, D2D1_PROPERTY_TYPE_CLSID, buffer, sizeof(clsid) + 1); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CLSID, D2D1_PROPERTY_TYPE_CLSID, buffer, sizeof(clsid) - 1); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CLSID, D2D1_PROPERTY_TYPE_CLSID, buffer, sizeof(clsid)); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME, D2D1_PROPERTY_TYPE_STRING, buffer, sizeof(buffer)); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + str_size = (wcslen((WCHAR *)buffer) + 1) * sizeof(WCHAR); + hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME, D2D1_PROPERTY_TYPE_STRING, buffer, str_size); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_DISPLAYNAME, D2D1_PROPERTY_TYPE_STRING, buffer, str_size - 1); + ok(hr == D2DERR_INSUFFICIENT_BUFFER, "Got unexpected hr %#x.\n", hr); + + hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CLSID, 0xdeadbeef, (BYTE *)&clsid, sizeof(clsid)); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CLSID, D2D1_PROPERTY_TYPE_UNKNOWN, (BYTE *)&clsid, sizeof(clsid)); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CLSID, D2D1_PROPERTY_TYPE_VECTOR4, (BYTE *)&clsid, sizeof(clsid)); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CLSID, D2D1_PROPERTY_TYPE_VECTOR4, buffer, sizeof(buffer)); + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + hr = ID2D1Effect_GetValue(effect, D2D1_PROPERTY_CLSID, D2D1_PROPERTY_TYPE_CLSID, (BYTE *)&clsid, sizeof(clsid)); ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
Signed-off-by: Ziqing Hui zhui@codeweavers.com --- dlls/d2d1/tests/d2d1.c | 53 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-)
diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 629bbd65523..76ac27f11c6 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -9680,13 +9680,16 @@ static void test_mt_factory(BOOL d3d11)
static void test_effect(BOOL d3d11) { - unsigned int i, min_inputs, max_inputs, str_size; + unsigned int i, j, min_inputs, max_inputs, str_size, input_count; + D2D1_BITMAP_PROPERTIES bitmap_desc; D2D1_BUFFER_PRECISION precision; ID2D1Image *image_a, *image_b; struct d2d1_test_context ctx; ID2D1DeviceContext *context; ID2D1Factory1 *factory; + ID2D1Bitmap *bitmap; ID2D1Effect *effect; + D2D1_SIZE_U size; BYTE buffer[64]; BOOL cached; CLSID clsid; @@ -9797,6 +9800,54 @@ static void test_effect(BOOL d3d11) max_inputs, test->max_inputs); }
+ todo_wine + { + input_count = ID2D1Effect_GetInputCount(effect); + ok (input_count == 1 || input_count == 2, "Got unexpected input count %u.\n", input_count); + input_count = (test->max_inputs < 64 ? test->max_inputs + 1 : 64); + for (j = 0; j < input_count; ++j) + { + hr = ID2D1Effect_SetInputCount(effect, j); + if (j < test->min_inputs || j > test->max_inputs) + ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); + else + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + } + + input_count = ID2D1Effect_GetInputCount(effect); + for (j = 0; j < input_count + 8; ++j) + { + ID2D1Effect_GetInput(effect, j, &image_a); + ok(image_a == NULL, "Got unexpected image_a %p.\n", image_a); + } + } + + set_size_u(&size, 1, 1); + bitmap_desc.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM; + bitmap_desc.pixelFormat.alphaMode = D2D1_ALPHA_MODE_IGNORE; + bitmap_desc.dpiX = 96.0f; + bitmap_desc.dpiY = 96.0f; + hr = ID2D1RenderTarget_CreateBitmap(ctx.rt, size, NULL, 4, &bitmap_desc, &bitmap); + ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); + + todo_wine + { + ID2D1Effect_SetInput(effect, 0, (ID2D1Image *)bitmap, FALSE); + for (j = 0; j < input_count + 8; ++j) + { + if (j >= input_count) + ID2D1Effect_SetInput(effect, 0, (ID2D1Image *)bitmap, FALSE); + ID2D1Effect_GetInput(effect, j, &image_a); + if (j == 0) + ok(image_a == (ID2D1Image *)bitmap, "Got unexpected image_a %p.\n", image_a); + else + ok(image_a == NULL, "Got unexpected image_a %p.\n", image_a); + if (image_a) + ID2D1Image_Release(image_a); + } + ID2D1Bitmap_Release(bitmap); + } + ID2D1Effect_Release(effect); winetest_pop_context(); }
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=94715
Your paranoid android.
=== debiant2 (32 bit report) ===
d2d1: Unhandled exception: page fault on execute access to 0x00000080 in 32-bit code (0x00000080).
=== debiant2 (32 bit Arabic:Morocco report) ===
d2d1: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
=== debiant2 (32 bit German report) ===
d2d1: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
=== debiant2 (32 bit French report) ===
d2d1: Unhandled exception: page fault on execute access to 0x00000001 in 32-bit code (0x00000001).
=== debiant2 (32 bit Hebrew:Israel report) ===
d2d1: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
=== debiant2 (32 bit Hindi:India report) ===
d2d1: Unhandled exception: page fault on execute access to 0x00000001 in 32-bit code (0x00000001).
=== debiant2 (32 bit Japanese:Japan report) ===
d2d1: Unhandled exception: page fault on execute access to 0x04601f58 in 32-bit code (0x04601f58).
=== debiant2 (32 bit Chinese:China report) ===
d2d1: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
=== debiant2 (32 bit WoW report) ===
d2d1: Unhandled exception: page fault on execute access to 0x00000038 in 32-bit code (0x00000038).
=== debiant2 (64 bit WoW report) ===
d2d1: Unhandled exception: page fault on execute access to 0x00000000 in 64-bit code (0x0000000000000000).
Signed-off-by: Ziqing Hui zhui@codeweavers.com --- dlls/d2d1/d2d1_private.h | 4 +++ dlls/d2d1/effect.c | 61 ++++++++++++++++++++++++++++++++++++---- dlls/d2d1/tests/d2d1.c | 7 +---- 3 files changed, 60 insertions(+), 12 deletions(-)
diff --git a/dlls/d2d1/d2d1_private.h b/dlls/d2d1/d2d1_private.h index ce99e7c3432..a80e1b6a18d 100644 --- a/dlls/d2d1/d2d1_private.h +++ b/dlls/d2d1/d2d1_private.h @@ -572,6 +572,10 @@ struct d2d_effect LONG refcount;
ID2D1Factory *factory; + UINT32 min_inputs; + UINT32 max_inputs; + ID2D1Image **inputs; + UINT32 inputs_count; };
void d2d_effect_init(struct d2d_effect *effect, ID2D1Factory *factory) DECLSPEC_HIDDEN; diff --git a/dlls/d2d1/effect.c b/dlls/d2d1/effect.c index 40dd2187953..50b1c5917f4 100644 --- a/dlls/d2d1/effect.c +++ b/dlls/d2d1/effect.c @@ -67,12 +67,19 @@ static ULONG STDMETHODCALLTYPE d2d_effect_Release(ID2D1Effect *iface) { struct d2d_effect *effect = impl_from_ID2D1Effect(iface); ULONG refcount = InterlockedDecrement(&effect->refcount); + unsigned int i;
TRACE("%p decreasing refcount to %u.\n", iface, refcount);
if (!refcount) { ID2D1Factory_Release(effect->factory); + for (i = 0; i < effect->inputs_count; ++i) + { + if (effect->inputs[i]) + ID2D1Image_Release(effect->inputs[i]); + } + heap_free(effect->inputs); heap_free(effect); }
@@ -166,26 +173,64 @@ static HRESULT STDMETHODCALLTYPE d2d_effect_GetSubProperties(ID2D1Effect *iface,
static void STDMETHODCALLTYPE d2d_effect_SetInput(ID2D1Effect *iface, UINT32 index, ID2D1Image *input, BOOL invalidate) { - FIXME("iface %p, index %u, input %p, invalidate %d stub!\n", iface, index, input, invalidate); + struct d2d_effect *effect = impl_from_ID2D1Effect(iface); + + TRACE("iface %p, index %u, input %p, invalidate %d.\n", iface, index, input, invalidate); + + if (index < effect->inputs_count) + { + if (effect->inputs[index]) + ID2D1Image_Release(effect->inputs[index]); + ID2D1Image_AddRef(effect->inputs[index] = input); + } }
static HRESULT STDMETHODCALLTYPE d2d_effect_SetInputCount(ID2D1Effect *iface, UINT32 count) { - FIXME("iface %p, count %u stub!\n", iface, count); + struct d2d_effect *effect = impl_from_ID2D1Effect(iface); + unsigned int i;
- return E_NOTIMPL; + TRACE("iface %p, count %u.\n", iface, count); + + if (count < effect->min_inputs || count > effect->max_inputs) + return E_INVALIDARG; + + if (count != effect->inputs_count) + { + if (count < effect->inputs_count) + { + for (i = count; i < effect->inputs_count; ++i) + { + if (effect->inputs[i]) + ID2D1Image_Release(effect->inputs[i]); + } + } + effect->inputs_count = count; + HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, effect->inputs, sizeof(*effect->inputs) * count); + } + + return S_OK; }
static void STDMETHODCALLTYPE d2d_effect_GetInput(ID2D1Effect *iface, UINT32 index, ID2D1Image **input) { - FIXME("iface %p, index %u, input %p stub!\n", iface, index, input); + struct d2d_effect *effect = impl_from_ID2D1Effect(iface); + + TRACE("iface %p, index %u, input %p.\n", iface, index, input); + + if (index < effect->inputs_count && effect->inputs[index]) + ID2D1Image_AddRef(*input = effect->inputs[index]); + else + *input = NULL; }
static UINT32 STDMETHODCALLTYPE d2d_effect_GetInputCount(ID2D1Effect *iface) { - FIXME("iface %p stub!\n", iface); + struct d2d_effect *effect = impl_from_ID2D1Effect(iface);
- return 0; + TRACE("iface %p.\n", iface); + + return effect->inputs_count; }
static void STDMETHODCALLTYPE d2d_effect_GetOutput(ID2D1Effect *iface, ID2D1Image **output) @@ -274,5 +319,9 @@ void d2d_effect_init(struct d2d_effect *effect, ID2D1Factory *factory) effect->ID2D1Effect_iface.lpVtbl = &d2d_effect_vtbl; effect->ID2D1Image_iface.lpVtbl = &d2d_effect_image_vtbl; effect->refcount = 1; + effect->min_inputs = 1; + effect->max_inputs = 1; + effect->inputs_count = 1; + effect->inputs = heap_alloc_zero(sizeof(*effect->inputs)); ID2D1Factory_AddRef(effect->factory = factory); } diff --git a/dlls/d2d1/tests/d2d1.c b/dlls/d2d1/tests/d2d1.c index 76ac27f11c6..ff2d3c8c1ba 100644 --- a/dlls/d2d1/tests/d2d1.c +++ b/dlls/d2d1/tests/d2d1.c @@ -9800,8 +9800,6 @@ static void test_effect(BOOL d3d11) max_inputs, test->max_inputs); }
- todo_wine - { input_count = ID2D1Effect_GetInputCount(effect); ok (input_count == 1 || input_count == 2, "Got unexpected input count %u.\n", input_count); input_count = (test->max_inputs < 64 ? test->max_inputs + 1 : 64); @@ -9811,6 +9809,7 @@ static void test_effect(BOOL d3d11) if (j < test->min_inputs || j > test->max_inputs) ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr); else + todo_wine_if(test->max_inputs > 1 && j > 1) ok(hr == S_OK, "Got unexpected hr %#x.\n", hr); }
@@ -9820,7 +9819,6 @@ static void test_effect(BOOL d3d11) ID2D1Effect_GetInput(effect, j, &image_a); ok(image_a == NULL, "Got unexpected image_a %p.\n", image_a); } - }
set_size_u(&size, 1, 1); bitmap_desc.pixelFormat.format = DXGI_FORMAT_B8G8R8A8_UNORM; @@ -9830,8 +9828,6 @@ static void test_effect(BOOL d3d11) hr = ID2D1RenderTarget_CreateBitmap(ctx.rt, size, NULL, 4, &bitmap_desc, &bitmap); ok(hr == S_OK, "Got unexpected hr %#x.\n", hr);
- todo_wine - { ID2D1Effect_SetInput(effect, 0, (ID2D1Image *)bitmap, FALSE); for (j = 0; j < input_count + 8; ++j) { @@ -9846,7 +9842,6 @@ static void test_effect(BOOL d3d11) ID2D1Image_Release(image_a); } ID2D1Bitmap_Release(bitmap); - }
ID2D1Effect_Release(effect); winetest_pop_context();
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=94716
Your paranoid android.
=== debiant2 (32 bit Hebrew:Israel report) ===
Report validation errors: d2d1:d2d1 is missing some skip messages
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=94714
Your paranoid android.
=== w10pro64_ar (64 bit report) ===
d2d1: d2d1.c:8190: Test failed: Failed to get device interface, hr 0x80004002. 04c0:d2d1: unhandled exception c0000005 at 0000000000426A96