Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d10core/tests/d3d10core.c | 14 ++++++++++++ dlls/d3d11/device.c | 37 ++++++++++++++++++++++---------- dlls/d3d11/tests/d3d11.c | 14 ++++++++++++ 3 files changed, 54 insertions(+), 11 deletions(-)
diff --git a/dlls/d3d10core/tests/d3d10core.c b/dlls/d3d10core/tests/d3d10core.c index 6ec398269fa..b8338152bb7 100644 --- a/dlls/d3d10core/tests/d3d10core.c +++ b/dlls/d3d10core/tests/d3d10core.c @@ -5533,6 +5533,20 @@ float4 main(float4 color : COLOR) : SV_TARGET blend_factor[2] = 0.3f; blend_factor[3] = 0.4f; ID3D10Device_OMSetBlendState(device, blend_state, blend_factor, D3D10_DEFAULT_SAMPLE_MASK); + /* OMGetBlendState() arguments are optional */ + ID3D10Device_OMGetBlendState(device, NULL, NULL, NULL); + ID3D10Device_OMGetBlendState(device, &tmp_blend_state, NULL, NULL); + ID3D10BlendState_Release(tmp_blend_state); + sample_mask = 0; + ID3D10Device_OMGetBlendState(device, NULL, NULL, &sample_mask); + ok(sample_mask == D3D10_DEFAULT_SAMPLE_MASK, "Unexpected sample mask %#x.\n", sample_mask); + memset(tmp_blend_factor, 0, sizeof(tmp_blend_factor)); + ID3D10Device_OMGetBlendState(device, NULL, tmp_blend_factor, NULL); + ok(tmp_blend_factor[0] == 0.1f && tmp_blend_factor[1] == 0.2f + && tmp_blend_factor[2] == 0.3f && tmp_blend_factor[3] == 0.4f, + "Got unexpected blend factor {%.8e, %.8e, %.8e, %.8e}.\n", + tmp_blend_factor[0], tmp_blend_factor[1], tmp_blend_factor[2], tmp_blend_factor[3]); + ID3D10Device_OMGetBlendState(device, &tmp_blend_state, tmp_blend_factor, &sample_mask); ok(tmp_blend_factor[0] == 0.1f && tmp_blend_factor[1] == 0.2f && tmp_blend_factor[2] == 0.3f && tmp_blend_factor[3] == 0.4f, diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 8d88ee26222..2e62223e189 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -2190,20 +2190,26 @@ static void STDMETHODCALLTYPE d3d11_device_context_OMGetBlendState(ID3D11DeviceC struct d3d11_device_context *context = impl_from_ID3D11DeviceContext1(iface); struct wined3d_blend_state *wined3d_state; struct d3d_blend_state *blend_state_impl; + FLOAT tmp_blend_factor[4]; + UINT tmp_sample_mask;
TRACE("iface %p, blend_state %p, blend_factor %p, sample_mask %p.\n", iface, blend_state, blend_factor, sample_mask);
wined3d_mutex_lock(); - if ((wined3d_state = wined3d_device_context_get_blend_state(context->wined3d_context, - (struct wined3d_color *)blend_factor, sample_mask))) + if (!blend_factor) blend_factor = tmp_blend_factor; + if (!sample_mask) sample_mask = &tmp_sample_mask; + wined3d_state = wined3d_device_context_get_blend_state(context->wined3d_context, + (struct wined3d_color *)blend_factor, sample_mask); + if (blend_state) { - blend_state_impl = wined3d_blend_state_get_parent(wined3d_state); - ID3D11BlendState_AddRef(*blend_state = &blend_state_impl->ID3D11BlendState_iface); - } - else - { - *blend_state = NULL; + if (wined3d_state) + { + blend_state_impl = wined3d_blend_state_get_parent(wined3d_state); + ID3D11BlendState_AddRef(*blend_state = &blend_state_impl->ID3D11BlendState_iface); + } + else + *blend_state = NULL; } wined3d_mutex_unlock(); } @@ -5541,10 +5547,19 @@ static void STDMETHODCALLTYPE d3d10_device_OMGetBlendState(ID3D10Device1 *iface, d3d11_device_context_OMGetBlendState(&device->immediate_context.ID3D11DeviceContext1_iface, &d3d11_blend_state, blend_factor, sample_mask);
+ if (blend_state) + { + if (d3d11_blend_state) + { + *blend_state = (ID3D10BlendState *)&impl_from_ID3D11BlendState(d3d11_blend_state)->ID3D10BlendState1_iface; + ID3D10BlendState_AddRef(*blend_state); + } + else + *blend_state = NULL; + } + if (d3d11_blend_state) - *blend_state = (ID3D10BlendState *)&impl_from_ID3D11BlendState(d3d11_blend_state)->ID3D10BlendState1_iface; - else - *blend_state = NULL; + ID3D11BlendState_Release(d3d11_blend_state); }
static void STDMETHODCALLTYPE d3d10_device_OMGetDepthStencilState(ID3D10Device1 *iface, diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 553caa10e46..2ed9aed490e 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -12608,6 +12608,20 @@ static void test_clear_state(void) ID3D11DeviceContext_OMGetDepthStencilState(context, &tmp_ds_state, NULL); ok(tmp_ds_state == ds_state, "Got unexpected depth stencil state %p, expected %p.\n", tmp_ds_state, ds_state); ID3D11DepthStencilState_Release(tmp_ds_state); + /* OMGetBlendState() arguments are optional */ + ID3D11DeviceContext_OMGetBlendState(context, NULL, NULL, NULL); + ID3D11DeviceContext_OMGetBlendState(context, &tmp_blend_state, NULL, NULL); + ok(tmp_blend_state == blend_state, "Got unexpected blend state %p, expected %p.\n", tmp_blend_state, blend_state); + ID3D11BlendState_Release(tmp_blend_state); + sample_mask = 0; + ID3D11DeviceContext_OMGetBlendState(context, NULL, NULL, &sample_mask); + ok(sample_mask == 0xff00ff00, "Got unexpected sample mask %#x.\n", sample_mask); + memset(blend_factor, 0, sizeof(blend_factor)); + ID3D11DeviceContext_OMGetBlendState(context, NULL, blend_factor, NULL); + ok(blend_factor[0] == 0.1f && blend_factor[1] == 0.2f + && blend_factor[2] == 0.3f && blend_factor[3] == 0.4f, + "Got unexpected blend factor {%.8e, %.8e, %.8e, %.8e}.\n", + blend_factor[0], blend_factor[1], blend_factor[2], blend_factor[3]);
ID3D11DeviceContext_OMGetRenderTargets(context, D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT, tmp_rtv, &tmp_dsv); for (i = 0; i < D3D11_SIMULTANEOUS_RENDER_TARGET_COUNT - 1; ++i)
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=100698
Your paranoid android.
=== debiant2 (32 bit report) ===
d3d10core: d3d10core.c:7522: Test failed: d3d10core.c:12751: Test marked todo: Test 52: Got unexpected color 0xff000000 at (2, 1). d3d10core.c:7522: Test failed: Failed to create input layout for format 0x19, hr 0x80070057.
=== debiant2 (32 bit Hebrew:Israel report) ===
d3d11: d3d11.c:20111: Test failed: d3d11.c:16428: Test marked todo: Got 0xdeadbeef, expected 0x808080ff or 0x7f807f7f at 127, uvec4 0xff, 0x80, 0x80000080, 0x80.
=== debiant2 (32 bit Hindi:India report) ===
d3d11: d3d11.c:6263: Test failed: d3d11.c:7757: Test marked todo: Got unexpected buffer 004EBE78.
=== debiant2 (32 bit Chinese:China report) ===
d3d11: d3d11.c:9770: Test failed: d3d11.c:15246: Test marked todo: Got hr 0 for WRITE.
On Mon, 25 Oct 2021 at 12:10, Nikolay Sivov nsivov@codeweavers.com wrote:
@@ -2190,20 +2190,26 @@ static void STDMETHODCALLTYPE d3d11_device_context_OMGetBlendState(ID3D11DeviceC struct d3d11_device_context *context = impl_from_ID3D11DeviceContext1(iface); struct wined3d_blend_state *wined3d_state; struct d3d_blend_state *blend_state_impl;
- FLOAT tmp_blend_factor[4];
- UINT tmp_sample_mask;
I'd rather remove the existing FLOATs and UINTs than add more...