Forwards calls to CopySubresourceRegion ignoring copy flags.
Signed-off-by: Pablo Martin pmart-wine@riseup.net --- Some remarks:
- I changed argument names for consistency with d3d11_immediate_CopySubresourceRegion. - I believe inverse forwarding would be better (CopySubresourceRegion to CopySubresourceRegion1), but I'm initially implementing like this for consistency with UpdateSubresource1. I can invert this and UpdateSubresource1 in a further patch if this is desired. - I'm also not sure about the benefit in the double trace here, but again, doing it like UpdateSubresource1 is doing.
dlls/d3d11/device.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/dlls/d3d11/device.c b/dlls/d3d11/device.c index 5bc5018d63..c0e9b0d3dd 100644 --- a/dlls/d3d11/device.c +++ b/dlls/d3d11/device.c @@ -2606,12 +2606,19 @@ static HRESULT STDMETHODCALLTYPE d3d11_immediate_context_FinishCommandList(ID3D1 }
static void STDMETHODCALLTYPE d3d11_immediate_context_CopySubresourceRegion1(ID3D11DeviceContext1 *iface, - ID3D11Resource *resource, UINT subresource, UINT dst_x, UINT dst_y, UINT dst_z, ID3D11Resource *src_resource, - UINT src_subresource, const D3D11_BOX *src_box, UINT flags) + ID3D11Resource *dst_resource, UINT dst_subresource_idx, UINT dst_x, UINT dst_y, UINT dst_z, + ID3D11Resource *src_resource, UINT src_subresource_idx, const D3D11_BOX *src_box, UINT flags) { - FIXME("iface %p, resource %p, subresource %u, dst_x %u, dst_y %u, dst_z %u, src_resource %p, src_subresource %u, " - "src_box %p, flags %#x stub!\n", iface, resource, subresource, dst_x, dst_y, dst_z, src_resource, - src_subresource, src_box, flags); + TRACE("iface %p, dst_resource %p, dst_subresource_idx %u, dst_x %u, dst_y %u, dst_z %u, " + "src_resource %p, src_subresource_idx %u, src_box %p, flags %#x.\n", + iface, dst_resource, dst_subresource_idx, dst_x, dst_y, dst_z, + src_resource, src_subresource_idx, src_box, flags); + + if (flags) + FIXME("Ignoring flags %#x.\n", flags); + + d3d11_immediate_context_CopySubresourceRegion(iface, dst_resource, dst_subresource_idx, dst_x, dst_y, dst_z, + src_resource, src_subresource_idx, src_box); }
static void STDMETHODCALLTYPE d3d11_immediate_context_UpdateSubresource1(ID3D11DeviceContext1 *iface,
Signed-off-by: Pablo Martin pmart-wine@riseup.net --- Just doing a simple test to demonstrate behaviour, it also results in similarly testing other ID3D11DeviceContext1 methods in doing the setup. I didn't add more extensive tests since after all it's just forwarding behaviour to UpdateSubresource.
I run the tests locally on Ubuntu 17.10 and on all versions at testbot.
dlls/d3d11/tests/d3d11.c | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+)
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c index 9c12a768e2..625055a205 100644 --- a/dlls/d3d11/tests/d3d11.c +++ b/dlls/d3d11/tests/d3d11.c @@ -11455,6 +11455,7 @@ static void test_copy_subresource_region(void) ID3D11ShaderResourceView *ps_srv; D3D11_SAMPLER_DESC sampler_desc; ID3D11DeviceContext *context; + ID3D11DeviceContext1 *context1; struct vec4 float_colors[16]; struct resource_readback rb; ID3D11PixelShader *ps; @@ -11643,6 +11644,42 @@ static void test_copy_subresource_region(void) } release_resource_readback(&rb);
+ hr = ID3D11DeviceContext_QueryInterface(context, &IID_ID3D11DeviceContext1, (void **)&context1); + ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */, + "Failed to query ID3D11DeviceContext1, hr %#x.\n", hr); + + if (SUCCEEDED(hr)) + { + ID3D11DeviceContext1_ClearRenderTargetView(context1, test_context.backbuffer_rtv, red); + check_texture_color(test_context.backbuffer, 0x800000ff, 2); + + memset(float_colors, 0, sizeof(float_colors)); + ID3D11DeviceContext1_UpdateSubresource1(context1, (ID3D11Resource *)dst_texture, 0, NULL, + float_colors, 0, 0, 0); + draw_quad(&test_context); + check_texture_color(test_context.backbuffer, 0x00000000, 1); + + ID3D11DeviceContext1_CopySubresourceRegion1(context1, (ID3D11Resource *)dst_texture, 0, + 0, 0, 0, (ID3D11Resource *)src_texture, 0, NULL, 0); + draw_quad(&test_context); + + get_texture_readback(test_context.backbuffer, 0, &rb); + for (i = 0; i < 4; ++i) + { + for (j = 0; j < 4; ++j) + { + color = get_readback_color(&rb, 80 + j * 160, 60 + i * 120); + ok(compare_color(color, bitmap_data[j + i * 4], 1), + "Got unexpected color 0x%08x at (%u, %u), expected 0x%08x.\n", + color, j, i, bitmap_data[j + i * 4]); + } + } + release_resource_readback(&rb); + + ID3D11DeviceContext1_Release(context1); + } + + ID3D11PixelShader_Release(ps); hr = ID3D11Device_CreatePixelShader(device, ps_buffer_code, sizeof(ps_buffer_code), NULL, &ps); ok(SUCCEEDED(hr), "Failed to create pixel shader, hr %#x.\n", hr);
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
On Wed, May 16, 2018 at 11:30 AM, Pablo Martin pmart-wine@riseup.net wrote:
Forwards calls to CopySubresourceRegion ignoring copy flags.
Signed-off-by: Pablo Martin pmart-wine@riseup.net
Some remarks:
- I changed argument names for consistency with d3d11_immediate_CopySubresourceRegion.
- I believe inverse forwarding would be better (CopySubresourceRegion to CopySubresourceRegion1), but I'm initially implementing like this for consistency with UpdateSubresource1. I can invert this and UpdateSubresource1 in a further patch if this is desired.
- I'm also not sure about the benefit in the double trace here, but again, doing it like UpdateSubresource1 is doing.
Yes, the inverse forwarding could be better, but the the best option might be to simply add the "flags" parameter to wined3d_device_copy_sub_resource_region() and call wined3d_device_copy_sub_resource_region() directly from UpdateSubresource() and UpdateSubresource1().
On 2018-05-16 11:39, Józef Kucia wrote:
On Wed, May 16, 2018 at 11:30 AM, Pablo Martin pmart-wine@riseup.net wrote:
Forwards calls to CopySubresourceRegion ignoring copy flags.
Signed-off-by: Pablo Martin pmart-wine@riseup.net
Some remarks:
- I changed argument names for consistency with d3d11_immediate_CopySubresourceRegion.
- I believe inverse forwarding would be better (CopySubresourceRegion to CopySubresourceRegion1), but I'm initially implementing like this for consistency with UpdateSubresource1. I can invert this and UpdateSubresource1 in a further patch if this is desired.
- I'm also not sure about the benefit in the double trace here, but again, doing it like UpdateSubresource1 is doing.
Yes, the inverse forwarding could be better, but the the best option might be to simply add the "flags" parameter to wined3d_device_copy_sub_resource_region() and call wined3d_device_copy_sub_resource_region() directly from UpdateSubresource() and UpdateSubresource1().
Then I suppose the same can be done for UpdateSubresource. Should I remake this patch doing that for CopySubresourceRegion?
Then I can also do the same for UpdateSubresource/UpdateSubresource1. Otherwise if this patch goes through as is, I can also do it in another patch for both methods.
On 16 May 2018 at 14:18, Pablo Martin pmart-wine@riseup.net wrote:
Then I suppose the same can be done for UpdateSubresource. Should I remake this patch doing that for CopySubresourceRegion?
Then I can also do the same for UpdateSubresource/UpdateSubresource1. Otherwise if this patch goes through as is, I can also do it in another patch for both methods.
It's probably fine to go in as it is initially, and then extend the wined3d interface afterwards.
On 2018-05-16 15:15, Henri Verbeet wrote:
On 16 May 2018 at 14:18, Pablo Martin pmart-wine@riseup.net wrote:
Then I suppose the same can be done for UpdateSubresource. Should I remake this patch doing that for CopySubresourceRegion?
Then I can also do the same for UpdateSubresource/UpdateSubresource1. Otherwise if this patch goes through as is, I can also do it in another patch for both methods.
It's probably fine to go in as it is initially, and then extend the wined3d interface afterwards.
Ok. I'll follow this up and refactor both (CopySubresourceRegion/1 and UpdateSubresource/1) methods in an upcoming patch if you don't instruct me otherwise.