1
0
mirror of https://github.com/wine-mirror/wine synced 2024-07-08 20:06:18 +00:00

d3d11/tests: Test NV12 textures without render target.

This commit is contained in:
Giovanni Mascellani 2024-06-06 14:33:09 +02:00 committed by Alexandre Julliard
parent 7aad548155
commit 99c1305577

View File

@ -36335,6 +36335,8 @@ static void test_nv12(void)
winetest_push_context("test %u (%ux%u)", test_idx, width, height);
/* Apparently no Vulkan implementation supports rendering to a NV12 texture, so here we do
* not request D3D11_BIND_RENDER_TARGET. We will recreate it later for render target usage. */
desc.Width = width;
desc.Height = height;
desc.MipLevels = 1;
@ -36342,7 +36344,7 @@ static void test_nv12(void)
desc.Format = DXGI_FORMAT_NV12;
desc.SampleDesc.Count = 1;
desc.Usage = D3D11_USAGE_DEFAULT;
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
content = calloc(width * height * 3 / 2, 1);
ok(!!content, "Failed to allocate memory.\n");
@ -36427,6 +36429,31 @@ static void test_nv12(void)
check_readback_data_u8_with_buffer(&rb, content, width, 0);
release_resource_readback(&rb);
ID3D11ShaderResourceView_Release(srvs[0]);
ID3D11ShaderResourceView_Release(srvs[1]);
ID3D11Texture2D_Release(texture);
desc.Height = height;
desc.Format = DXGI_FORMAT_NV12;
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;
hr = ID3D11Device_CreateTexture2D(device, &desc, NULL, &texture);
todo_wine
ok(hr == S_OK, "Got hr %#lx.\n", hr);
if (FAILED(hr))
goto no_render_target;
srv_desc.Format = DXGI_FORMAT_R8_UINT;
hr = ID3D11Device_CreateShaderResourceView(device, (ID3D11Resource *)texture, &srv_desc, &srvs[0]);
ok(hr == S_OK, "Got hr %#lx.\n", hr);
srv_desc.Format = DXGI_FORMAT_R8G8_UINT;
hr = ID3D11Device_CreateShaderResourceView(device, (ID3D11Resource *)texture, &srv_desc, &srvs[1]);
ok(hr == S_OK, "Got hr %#lx.\n", hr);
rtv_desc.Format = DXGI_FORMAT_R8_UINT;
rtv_desc.ViewDimension = D3D11_RTV_DIMENSION_TEXTURE2D;
rtv_desc.Texture2D.MipSlice = 0;
@ -36466,6 +36493,8 @@ static void test_nv12(void)
ID3D11RenderTargetView_Release(rtv2);
ID3D11RenderTargetView_Release(rtv1);
no_render_target:
ID3D11Buffer_Release(cbuffer);
ID3D11UnorderedAccessView_Release(check_uav);
ID3D11ShaderResourceView_Release(srvs[1]);