Commit aca61824 authored by Józef Kucia's avatar Józef Kucia Committed by Alexandre Julliard

d3d11/tests: Tests creating 2D array texture views.

parent 28f4b696
...@@ -1673,16 +1673,18 @@ static void test_create_depthstencil_view(void) ...@@ -1673,16 +1673,18 @@ static void test_create_depthstencil_view(void)
ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount); ok(refcount == expected_refcount, "Got unexpected refcount %u, expected %u.\n", refcount, expected_refcount);
ID3D11Device_Release(tmp); ID3D11Device_Release(tmp);
memset(&dsv_desc, 0, sizeof(dsv_desc));
ID3D11DepthStencilView_GetDesc(dsview, &dsv_desc); ID3D11DepthStencilView_GetDesc(dsview, &dsv_desc);
ok(dsv_desc.Format == texture_desc.Format, "Got unexpected format %#x.\n", dsv_desc.Format); ok(dsv_desc.Format == texture_desc.Format, "Got unexpected format %#x.\n", dsv_desc.Format);
ok(dsv_desc.ViewDimension == D3D11_DSV_DIMENSION_TEXTURE2D, ok(dsv_desc.ViewDimension == D3D11_DSV_DIMENSION_TEXTURE2D,
"Got unexpected view dimension %#x.\n", dsv_desc.ViewDimension); "Got unexpected view dimension %#x.\n", dsv_desc.ViewDimension);
ok(!dsv_desc.Flags, "Got unexpected flags %#x.\n", dsv_desc.Flags); ok(!dsv_desc.Flags, "Got unexpected flags %#x.\n", dsv_desc.Flags);
ok(U(dsv_desc).Texture2D.MipSlice == 0, "Got Unexpected mip slice %u.\n", U(dsv_desc).Texture2D.MipSlice); ok(!U(dsv_desc).Texture2D.MipSlice, "Got unexpected mip slice %u.\n", U(dsv_desc).Texture2D.MipSlice);
ID3D11DepthStencilView_Release(dsview); ID3D11DepthStencilView_Release(dsview);
dsv_desc.Format = DXGI_FORMAT_UNKNOWN; dsv_desc.Format = DXGI_FORMAT_UNKNOWN;
hr = ID3D11Device_CreateDepthStencilView(device, (ID3D11Resource *)texture, &dsv_desc, &dsview); hr = ID3D11Device_CreateDepthStencilView(device, (ID3D11Resource *)texture, &dsv_desc, &dsview);
ok(SUCCEEDED(hr), "Failed to create a depthstencil view, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to create a depthstencil view, hr %#x.\n", hr);
...@@ -1692,10 +1694,33 @@ static void test_create_depthstencil_view(void) ...@@ -1692,10 +1694,33 @@ static void test_create_depthstencil_view(void)
ok(dsv_desc.ViewDimension == D3D11_DSV_DIMENSION_TEXTURE2D, ok(dsv_desc.ViewDimension == D3D11_DSV_DIMENSION_TEXTURE2D,
"Got unexpected view dimension %#x.\n", dsv_desc.ViewDimension); "Got unexpected view dimension %#x.\n", dsv_desc.ViewDimension);
ok(!dsv_desc.Flags, "Got unexpected flags %#x.\n", dsv_desc.Flags); ok(!dsv_desc.Flags, "Got unexpected flags %#x.\n", dsv_desc.Flags);
ok(!U(dsv_desc).Texture2D.MipSlice, "Got Unexpected mip slice %u.\n", U(dsv_desc).Texture2D.MipSlice); ok(!U(dsv_desc).Texture2D.MipSlice, "Got unexpected mip slice %u.\n", U(dsv_desc).Texture2D.MipSlice);
ID3D11DepthStencilView_Release(dsview); ID3D11DepthStencilView_Release(dsview);
ID3D11Texture2D_Release(texture);
texture_desc.ArraySize = 4;
hr = ID3D11Device_CreateTexture2D(device, &texture_desc, NULL, &texture);
ok(SUCCEEDED(hr), "Failed to create 2d texture, hr %#x.\n", hr);
hr = ID3D11Device_CreateDepthStencilView(device, (ID3D11Resource *)texture, NULL, &dsview);
ok(SUCCEEDED(hr), "Failed to create depthstencil view, hr %#x.\n", hr);
memset(&dsv_desc, 0, sizeof(dsv_desc));
ID3D11DepthStencilView_GetDesc(dsview, &dsv_desc);
ok(dsv_desc.Format == texture_desc.Format, "Got unexpected format %#x.\n", dsv_desc.Format);
ok(dsv_desc.ViewDimension == D3D11_DSV_DIMENSION_TEXTURE2DARRAY,
"Got unexpected view dimension %#x.\n", dsv_desc.ViewDimension);
ok(!dsv_desc.Flags, "Got unexpected flags %#x.\n", dsv_desc.Flags);
ok(!U(dsv_desc).Texture2DArray.MipSlice, "Got unexpected mip slice %u.\n",
U(dsv_desc).Texture2DArray.MipSlice);
ok(!U(dsv_desc).Texture2DArray.FirstArraySlice, "Got unexpected first array slice %u.\n",
U(dsv_desc).Texture2DArray.FirstArraySlice);
todo_wine ok(U(dsv_desc).Texture2DArray.ArraySize == texture_desc.ArraySize,
"Got unexpected array size %u.\n", U(dsv_desc).Texture2DArray.ArraySize);
ID3D11DepthStencilView_Release(dsview);
ID3D11Texture2D_Release(texture); ID3D11Texture2D_Release(texture);
refcount = ID3D11Device_Release(device); refcount = ID3D11Device_Release(device);
...@@ -1858,11 +1883,12 @@ static void test_create_rendertarget_view(void) ...@@ -1858,11 +1883,12 @@ static void test_create_rendertarget_view(void)
hr = ID3D11Device_CreateRenderTargetView(device, (ID3D11Resource *)texture, NULL, &rtview); hr = ID3D11Device_CreateRenderTargetView(device, (ID3D11Resource *)texture, NULL, &rtview);
ok(SUCCEEDED(hr), "Failed to create a rendertarget view, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to create a rendertarget view, hr %#x.\n", hr);
memset(&rtv_desc, 0, sizeof(rtv_desc));
ID3D11RenderTargetView_GetDesc(rtview, &rtv_desc); ID3D11RenderTargetView_GetDesc(rtview, &rtv_desc);
ok(rtv_desc.Format == texture_desc.Format, "Got unexpected format %#x.\n", rtv_desc.Format); ok(rtv_desc.Format == texture_desc.Format, "Got unexpected format %#x.\n", rtv_desc.Format);
ok(rtv_desc.ViewDimension == D3D11_RTV_DIMENSION_TEXTURE2D, "Got unexpected view dimension %#x.\n", ok(rtv_desc.ViewDimension == D3D11_RTV_DIMENSION_TEXTURE2D, "Got unexpected view dimension %#x.\n",
rtv_desc.ViewDimension); rtv_desc.ViewDimension);
ok(U(rtv_desc).Texture2D.MipSlice == 0, "Got unexpected mip slice %#x.\n", U(rtv_desc).Texture2D.MipSlice); ok(!U(rtv_desc).Texture2D.MipSlice, "Got unexpected mip slice %u.\n", U(rtv_desc).Texture2D.MipSlice);
hr = ID3D11RenderTargetView_QueryInterface(rtview, &IID_ID3D10RenderTargetView, (void **)&iface); hr = ID3D11RenderTargetView_QueryInterface(rtview, &IID_ID3D10RenderTargetView, (void **)&iface);
ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */, ok(SUCCEEDED(hr) || broken(hr == E_NOINTERFACE) /* Not available on all Windows versions. */,
...@@ -1872,6 +1898,7 @@ static void test_create_rendertarget_view(void) ...@@ -1872,6 +1898,7 @@ static void test_create_rendertarget_view(void)
ID3D11RenderTargetView_Release(rtview); ID3D11RenderTargetView_Release(rtview);
rtv_desc.Format = DXGI_FORMAT_UNKNOWN; rtv_desc.Format = DXGI_FORMAT_UNKNOWN;
hr = ID3D11Device_CreateRenderTargetView(device, (ID3D11Resource *)texture, &rtv_desc, &rtview); hr = ID3D11Device_CreateRenderTargetView(device, (ID3D11Resource *)texture, &rtv_desc, &rtview);
ok(SUCCEEDED(hr), "Failed to create a rendertarget view, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to create a rendertarget view, hr %#x.\n", hr);
...@@ -1880,10 +1907,32 @@ static void test_create_rendertarget_view(void) ...@@ -1880,10 +1907,32 @@ static void test_create_rendertarget_view(void)
todo_wine ok(rtv_desc.Format == texture_desc.Format, "Got unexpected format %#x.\n", rtv_desc.Format); todo_wine ok(rtv_desc.Format == texture_desc.Format, "Got unexpected format %#x.\n", rtv_desc.Format);
ok(rtv_desc.ViewDimension == D3D11_RTV_DIMENSION_TEXTURE2D, "Got unexpected view dimension %#x.\n", ok(rtv_desc.ViewDimension == D3D11_RTV_DIMENSION_TEXTURE2D, "Got unexpected view dimension %#x.\n",
rtv_desc.ViewDimension); rtv_desc.ViewDimension);
ok(!U(rtv_desc).Texture2D.MipSlice, "Got unexpected mip slice %#x.\n", U(rtv_desc).Texture2D.MipSlice); ok(!U(rtv_desc).Texture2D.MipSlice, "Got unexpected mip slice %u.\n", U(rtv_desc).Texture2D.MipSlice);
ID3D11RenderTargetView_Release(rtview); ID3D11RenderTargetView_Release(rtview);
ID3D11Texture2D_Release(texture);
texture_desc.ArraySize = 4;
hr = ID3D11Device_CreateTexture2D(device, &texture_desc, NULL, &texture);
ok(SUCCEEDED(hr), "Failed to create 2d texture, hr %#x.\n", hr);
hr = ID3D11Device_CreateRenderTargetView(device, (ID3D11Resource *)texture, NULL, &rtview);
ok(SUCCEEDED(hr), "Failed to create rendertarget view, hr %#x.\n", hr);
memset(&rtv_desc, 0, sizeof(rtv_desc));
ID3D11RenderTargetView_GetDesc(rtview, &rtv_desc);
ok(rtv_desc.Format == texture_desc.Format, "Got unexpected format %#x.\n", rtv_desc.Format);
ok(rtv_desc.ViewDimension == D3D11_RTV_DIMENSION_TEXTURE2DARRAY, "Got unexpected view dimension %#x.\n",
rtv_desc.ViewDimension);
ok(!U(rtv_desc).Texture2DArray.MipSlice, "Got unexpected mip slice %u.\n",
U(rtv_desc).Texture2DArray.MipSlice);
ok(!U(rtv_desc).Texture2DArray.FirstArraySlice, "Got unexpected first array slice %u.\n",
U(rtv_desc).Texture2DArray.FirstArraySlice);
todo_wine ok(U(rtv_desc).Texture2DArray.ArraySize == texture_desc.ArraySize, "Got unexpected array size %u.\n",
U(rtv_desc).Texture2DArray.ArraySize);
ID3D11RenderTargetView_Release(rtview);
ID3D11Texture2D_Release(texture); ID3D11Texture2D_Release(texture);
refcount = ID3D11Device_Release(device); refcount = ID3D11Device_Release(device);
...@@ -1979,6 +2028,7 @@ static void test_create_shader_resource_view(void) ...@@ -1979,6 +2028,7 @@ static void test_create_shader_resource_view(void)
"Shader resource view should implement ID3D10ShaderResourceView1.\n"); "Shader resource view should implement ID3D10ShaderResourceView1.\n");
if (SUCCEEDED(hr)) IUnknown_Release(iface); if (SUCCEEDED(hr)) IUnknown_Release(iface);
memset(&srv_desc, 0, sizeof(srv_desc));
ID3D11ShaderResourceView_GetDesc(srview, &srv_desc); ID3D11ShaderResourceView_GetDesc(srview, &srv_desc);
ok(srv_desc.Format == texture_desc.Format, "Got unexpected format %#x.\n", srv_desc.Format); ok(srv_desc.Format == texture_desc.Format, "Got unexpected format %#x.\n", srv_desc.Format);
ok(srv_desc.ViewDimension == D3D11_SRV_DIMENSION_TEXTURE2D, ok(srv_desc.ViewDimension == D3D11_SRV_DIMENSION_TEXTURE2D,
...@@ -1990,6 +2040,8 @@ static void test_create_shader_resource_view(void) ...@@ -1990,6 +2040,8 @@ static void test_create_shader_resource_view(void)
ID3D11ShaderResourceView_Release(srview); ID3D11ShaderResourceView_Release(srview);
srv_desc.Format = DXGI_FORMAT_UNKNOWN; srv_desc.Format = DXGI_FORMAT_UNKNOWN;
U(srv_desc).Texture2D.MipLevels = -1;
hr = ID3D11Device_CreateShaderResourceView(device, (ID3D11Resource *)texture, &srv_desc, &srview); hr = ID3D11Device_CreateShaderResourceView(device, (ID3D11Resource *)texture, &srv_desc, &srview);
ok(SUCCEEDED(hr), "Failed to create a shader resource view, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to create a shader resource view, hr %#x.\n", hr);
...@@ -2000,10 +2052,35 @@ static void test_create_shader_resource_view(void) ...@@ -2000,10 +2052,35 @@ static void test_create_shader_resource_view(void)
"Got unexpected view dimension %#x.\n", srv_desc.ViewDimension); "Got unexpected view dimension %#x.\n", srv_desc.ViewDimension);
ok(U(srv_desc).Texture2D.MostDetailedMip == 0, "Got unexpected MostDetailedMip %u.\n", ok(U(srv_desc).Texture2D.MostDetailedMip == 0, "Got unexpected MostDetailedMip %u.\n",
U(srv_desc).Texture2D.MostDetailedMip); U(srv_desc).Texture2D.MostDetailedMip);
ok(U(srv_desc).Texture2D.MipLevels == 10, "Got unexpected MipLevels %u.\n", U(srv_desc).Texture2D.MipLevels); todo_wine ok(U(srv_desc).Texture2D.MipLevels == 10, "Got unexpected MipLevels %u.\n",
U(srv_desc).Texture2D.MipLevels);
ID3D11ShaderResourceView_Release(srview); ID3D11ShaderResourceView_Release(srview);
ID3D11Texture2D_Release(texture);
texture_desc.ArraySize = 4;
hr = ID3D11Device_CreateTexture2D(device, &texture_desc, NULL, &texture);
ok(SUCCEEDED(hr), "Failed to create 2d texture, hr %#x.\n", hr);
hr = ID3D11Device_CreateShaderResourceView(device, (ID3D11Resource *)texture, NULL, &srview);
ok(SUCCEEDED(hr), "Failed to create shader resource view, hr %#x.\n", hr);
memset(&srv_desc, 0, sizeof(srv_desc));
ID3D11ShaderResourceView_GetDesc(srview, &srv_desc);
ok(srv_desc.Format == texture_desc.Format, "Got unexpected format %#x.\n", srv_desc.Format);
ok(srv_desc.ViewDimension == D3D11_SRV_DIMENSION_TEXTURE2DARRAY,
"Got unexpected view dimension %#x.\n", srv_desc.ViewDimension);
ok(!U(srv_desc).Texture2DArray.MostDetailedMip, "Got unexpected MostDetailedMip %u.\n",
U(srv_desc).Texture2DArray.MostDetailedMip);
ok(U(srv_desc).Texture2DArray.MipLevels == 10, "Got unexpected MipLevels %u.\n",
U(srv_desc).Texture2DArray.MipLevels);
ok(!U(srv_desc).Texture2DArray.FirstArraySlice, "Got unexpected FirstArraySlice %u.\n",
U(srv_desc).Texture2DArray.FirstArraySlice);
ok(U(srv_desc).Texture2DArray.ArraySize == texture_desc.ArraySize, "Got unexpected ArraySize %u.\n",
U(srv_desc).Texture2DArray.ArraySize);
ID3D11ShaderResourceView_Release(srview);
ID3D11Texture2D_Release(texture); ID3D11Texture2D_Release(texture);
refcount = ID3D11Device_Release(device); refcount = ID3D11Device_Release(device);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment