Zebediah Figura : d3d11/tests: Test implicit unbinding of an SRV when using the same resource as RTV in a deferred context.

Alexandre Julliard julliard at winehq.org
Thu May 6 14:56:18 CDT 2021


Module: wine
Branch: master
Commit: 23e244fd6041c709ea8ebfb6e80ddc5da8b7ac25
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=23e244fd6041c709ea8ebfb6e80ddc5da8b7ac25

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Wed May  5 22:23:14 2021 -0500

d3d11/tests: Test implicit unbinding of an SRV when using the same resource as RTV in a deferred context.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/d3d11/tests/d3d11.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
index 95d7c847720..df13d446de5 100644
--- a/dlls/d3d11/tests/d3d11.c
+++ b/dlls/d3d11/tests/d3d11.c
@@ -32226,8 +32226,12 @@ static void test_deferred_context_state(void)
 {
     ID3D11Buffer *green_buffer, *blue_buffer, *ret_buffer;
     ID3D11DeviceContext *immediate, *deferred;
+    ID3D11ShaderResourceView *srv, *ret_srv;
     struct d3d11_test_context test_context;
+    ID3D11RenderTargetView *rtv, *ret_rtv;
+    D3D11_TEXTURE2D_DESC texture_desc;
     ID3D11CommandList *list1, *list2;
+    ID3D11Texture2D *texture;
     ID3D11Device *device;
     HRESULT hr;
 
@@ -32287,6 +32291,32 @@ static void test_deferred_context_state(void)
     ID3D11DeviceContext_PSGetConstantBuffers(immediate, 0, 1, &ret_buffer);
     ok(!ret_buffer, "Got unexpected buffer %p.\n", ret_buffer);
 
+    /* Test unbinding an SRV when using the same resource as RTV. */
+
+    ID3D11Texture2D_GetDesc(test_context.backbuffer, &texture_desc);
+    texture_desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
+    hr = ID3D11Device_CreateTexture2D(device, &texture_desc, NULL, &texture);
+    ok(hr == S_OK, "Failed to create texture, hr %#x.\n", hr);
+    hr = ID3D11Device_CreateRenderTargetView(device, (ID3D11Resource *)texture, NULL, &rtv);
+    ok(hr == S_OK, "Failed to create view, hr %#x.\n", hr);
+    hr = ID3D11Device_CreateShaderResourceView(device, (ID3D11Resource *)texture, NULL, &srv);
+    ok(hr == S_OK, "Failed to create view, hr %#x.\n", hr);
+
+    ID3D11DeviceContext_PSSetShaderResources(deferred, 0, 1, &srv);
+    ID3D11DeviceContext_PSGetShaderResources(deferred, 0, 1, &ret_srv);
+    ok(ret_srv == srv, "Got unexpected SRV %p.\n", ret_srv);
+    ID3D11ShaderResourceView_Release(ret_srv);
+
+    ID3D11DeviceContext_OMSetRenderTargets(deferred, 1, &rtv, NULL);
+    ID3D11DeviceContext_OMGetRenderTargets(deferred, 1, &ret_rtv, NULL);
+    ok(ret_rtv == rtv, "Got unexpected RTV %p.\n", ret_rtv);
+    ID3D11RenderTargetView_Release(ret_rtv);
+    ID3D11DeviceContext_PSGetShaderResources(deferred, 0, 1, &ret_srv);
+    ok(!ret_srv, "Got unexpected SRV %p.\n", ret_srv);
+
+    ID3D11ShaderResourceView_Release(srv);
+    ID3D11RenderTargetView_Release(rtv);
+    ID3D11Texture2D_Release(texture);
     ID3D11CommandList_Release(list2);
     ID3D11CommandList_Release(list1);
     ID3D11DeviceContext_Release(deferred);




More information about the wine-cvs mailing list