Commit 6334bf09 authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

d3d9/tests: Skip unsupported resources in test_resource_type.

parent 86168c4e
...@@ -8893,6 +8893,7 @@ static void test_resource_type(void) ...@@ -8893,6 +8893,7 @@ static void test_resource_type(void)
ULONG refcount; ULONG refcount;
HWND window; HWND window;
HRESULT hr; HRESULT hr;
D3DCAPS9 caps;
window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW, window = CreateWindowA("static", "d3d9_test", WS_OVERLAPPEDWINDOW,
0, 0, 640, 480, NULL, NULL, NULL, NULL); 0, 0, 640, 480, NULL, NULL, NULL, NULL);
...@@ -8906,6 +8907,9 @@ static void test_resource_type(void) ...@@ -8906,6 +8907,9 @@ static void test_resource_type(void)
return; return;
} }
hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
ok(SUCCEEDED(hr), "Failed to get device caps, hr %#x.\n", hr);
hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 4, 4, D3DFMT_X8R8G8B8, hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 4, 4, D3DFMT_X8R8G8B8,
D3DPOOL_SYSTEMMEM, &surface, NULL); D3DPOOL_SYSTEMMEM, &surface, NULL);
ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to create surface, hr %#x.\n", hr);
...@@ -8966,71 +8970,81 @@ static void test_resource_type(void) ...@@ -8966,71 +8970,81 @@ static void test_resource_type(void)
IDirect3DSurface9_Release(surface); IDirect3DSurface9_Release(surface);
IDirect3DTexture9_Release(texture); IDirect3DTexture9_Release(texture);
hr = IDirect3DDevice9_CreateCubeTexture(device, 1, 1, 0, D3DFMT_X8R8G8B8, if (caps.TextureCaps & D3DPTEXTURECAPS_CUBEMAP)
D3DPOOL_SYSTEMMEM, &cube_texture, NULL); {
ok(SUCCEEDED(hr), "Failed to create cube texture, hr %#x.\n", hr); hr = IDirect3DDevice9_CreateCubeTexture(device, 1, 1, 0, D3DFMT_X8R8G8B8,
type = IDirect3DCubeTexture9_GetType(cube_texture); D3DPOOL_SYSTEMMEM, &cube_texture, NULL);
ok(type == D3DRTYPE_CUBETEXTURE, "Expected type D3DRTYPE_CUBETEXTURE, got %u.\n", type); ok(SUCCEEDED(hr), "Failed to create cube texture, hr %#x.\n", hr);
type = IDirect3DCubeTexture9_GetType(cube_texture);
hr = IDirect3DCubeTexture9_GetCubeMapSurface(cube_texture, ok(type == D3DRTYPE_CUBETEXTURE, "Expected type D3DRTYPE_CUBETEXTURE, got %u.\n", type);
D3DCUBEMAP_FACE_NEGATIVE_X, 0, &surface);
ok(SUCCEEDED(hr), "Failed to get cube map surface, hr %#x.\n", hr); hr = IDirect3DCubeTexture9_GetCubeMapSurface(cube_texture,
type = IDirect3DSurface9_GetType(surface); D3DCUBEMAP_FACE_NEGATIVE_X, 0, &surface);
ok(type == D3DRTYPE_SURFACE, "Expected type D3DRTYPE_SURFACE, got %u.\n", type); ok(SUCCEEDED(hr), "Failed to get cube map surface, hr %#x.\n", hr);
hr = IDirect3DSurface9_GetDesc(surface, &surface_desc); type = IDirect3DSurface9_GetType(surface);
ok(SUCCEEDED(hr), "Failed to get surface description, hr %#x.\n", hr); ok(type == D3DRTYPE_SURFACE, "Expected type D3DRTYPE_SURFACE, got %u.\n", type);
ok(surface_desc.Type == D3DRTYPE_SURFACE, "Expected type D3DRTYPE_SURFACE, got %u.\n", hr = IDirect3DSurface9_GetDesc(surface, &surface_desc);
surface_desc.Type); ok(SUCCEEDED(hr), "Failed to get surface description, hr %#x.\n", hr);
hr = IDirect3DCubeTexture9_GetLevelDesc(cube_texture, 0, &surface_desc); ok(surface_desc.Type == D3DRTYPE_SURFACE, "Expected type D3DRTYPE_SURFACE, got %u.\n",
ok(SUCCEEDED(hr), "Failed to get level description, hr %#x.\n", hr); surface_desc.Type);
ok(surface_desc.Type == D3DRTYPE_SURFACE, "Expected type D3DRTYPE_SURFACE, got %u.\n", hr = IDirect3DCubeTexture9_GetLevelDesc(cube_texture, 0, &surface_desc);
surface_desc.Type); ok(SUCCEEDED(hr), "Failed to get level description, hr %#x.\n", hr);
IDirect3DSurface9_Release(surface); ok(surface_desc.Type == D3DRTYPE_SURFACE, "Expected type D3DRTYPE_SURFACE, got %u.\n",
IDirect3DCubeTexture9_Release(cube_texture); surface_desc.Type);
IDirect3DSurface9_Release(surface);
hr = IDirect3DDevice9_CreateVolumeTexture(device, 2, 4, 8, 4, 0, D3DFMT_X8R8G8B8, IDirect3DCubeTexture9_Release(cube_texture);
D3DPOOL_SYSTEMMEM, &volume_texture, NULL); }
type = IDirect3DVolumeTexture9_GetType(volume_texture); else
ok(type == D3DRTYPE_VOLUMETEXTURE, "Expected type D3DRTYPE_VOLUMETEXTURE, got %u.\n", type); skip("Cube maps not supported.\n");
hr = IDirect3DVolumeTexture9_GetVolumeLevel(volume_texture, 0, &volume); if (caps.TextureCaps & D3DPTEXTURECAPS_MIPVOLUMEMAP)
ok(SUCCEEDED(hr), "Failed to get volume level, hr %#x.\n", hr); {
/* IDirect3DVolume9 is not an IDirect3DResource9 and has no GetType method. */ hr = IDirect3DDevice9_CreateVolumeTexture(device, 2, 4, 8, 4, 0, D3DFMT_X8R8G8B8,
hr = IDirect3DVolume9_GetDesc(volume, &volume_desc); D3DPOOL_SYSTEMMEM, &volume_texture, NULL);
ok(SUCCEEDED(hr), "Failed to get volume description, hr %#x.\n", hr); type = IDirect3DVolumeTexture9_GetType(volume_texture);
ok(volume_desc.Type == D3DRTYPE_VOLUME, "Expected type D3DRTYPE_VOLUME, got %u.\n", ok(type == D3DRTYPE_VOLUMETEXTURE, "Expected type D3DRTYPE_VOLUMETEXTURE, got %u.\n", type);
volume_desc.Type);
ok(volume_desc.Width == 2, "Expected width 2, got %u.\n", volume_desc.Width); hr = IDirect3DVolumeTexture9_GetVolumeLevel(volume_texture, 0, &volume);
ok(volume_desc.Height == 4, "Expected height 4, got %u.\n", volume_desc.Height); ok(SUCCEEDED(hr), "Failed to get volume level, hr %#x.\n", hr);
ok(volume_desc.Depth == 8, "Expected depth 8, got %u.\n", volume_desc.Depth); /* IDirect3DVolume9 is not an IDirect3DResource9 and has no GetType method. */
hr = IDirect3DVolumeTexture9_GetLevelDesc(volume_texture, 0, &volume_desc); hr = IDirect3DVolume9_GetDesc(volume, &volume_desc);
ok(SUCCEEDED(hr), "Failed to get level description, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to get volume description, hr %#x.\n", hr);
ok(volume_desc.Type == D3DRTYPE_VOLUME, "Expected type D3DRTYPE_VOLUME, got %u.\n", ok(volume_desc.Type == D3DRTYPE_VOLUME, "Expected type D3DRTYPE_VOLUME, got %u.\n",
volume_desc.Type); volume_desc.Type);
ok(volume_desc.Width == 2, "Expected width 2, got %u.\n", volume_desc.Width); ok(volume_desc.Width == 2, "Expected width 2, got %u.\n", volume_desc.Width);
ok(volume_desc.Height == 4, "Expected height 4, got %u.\n", volume_desc.Height); ok(volume_desc.Height == 4, "Expected height 4, got %u.\n", volume_desc.Height);
ok(volume_desc.Depth == 8, "Expected depth 8, got %u.\n", volume_desc.Depth); ok(volume_desc.Depth == 8, "Expected depth 8, got %u.\n", volume_desc.Depth);
IDirect3DVolume9_Release(volume); hr = IDirect3DVolumeTexture9_GetLevelDesc(volume_texture, 0, &volume_desc);
ok(SUCCEEDED(hr), "Failed to get level description, hr %#x.\n", hr);
hr = IDirect3DVolumeTexture9_GetVolumeLevel(volume_texture, 2, &volume); ok(volume_desc.Type == D3DRTYPE_VOLUME, "Expected type D3DRTYPE_VOLUME, got %u.\n",
ok(SUCCEEDED(hr), "Failed to get volume level, hr %#x.\n", hr); volume_desc.Type);
/* IDirect3DVolume9 is not an IDirect3DResource9 and has no GetType method. */ ok(volume_desc.Width == 2, "Expected width 2, got %u.\n", volume_desc.Width);
hr = IDirect3DVolume9_GetDesc(volume, &volume_desc); ok(volume_desc.Height == 4, "Expected height 4, got %u.\n", volume_desc.Height);
ok(SUCCEEDED(hr), "Failed to get volume description, hr %#x.\n", hr); ok(volume_desc.Depth == 8, "Expected depth 8, got %u.\n", volume_desc.Depth);
ok(volume_desc.Type == D3DRTYPE_VOLUME, "Expected type D3DRTYPE_VOLUME, got %u.\n", IDirect3DVolume9_Release(volume);
volume_desc.Type);
ok(volume_desc.Width == 1, "Expected width 1, got %u.\n", volume_desc.Width); hr = IDirect3DVolumeTexture9_GetVolumeLevel(volume_texture, 2, &volume);
ok(volume_desc.Height == 1, "Expected height 1, got %u.\n", volume_desc.Height); ok(SUCCEEDED(hr), "Failed to get volume level, hr %#x.\n", hr);
ok(volume_desc.Depth == 2, "Expected depth 2, got %u.\n", volume_desc.Depth); /* IDirect3DVolume9 is not an IDirect3DResource9 and has no GetType method. */
hr = IDirect3DVolumeTexture9_GetLevelDesc(volume_texture, 2, &volume_desc); hr = IDirect3DVolume9_GetDesc(volume, &volume_desc);
ok(SUCCEEDED(hr), "Failed to get level description, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to get volume description, hr %#x.\n", hr);
ok(volume_desc.Type == D3DRTYPE_VOLUME, "Expected type D3DRTYPE_VOLUME, got %u.\n", ok(volume_desc.Type == D3DRTYPE_VOLUME, "Expected type D3DRTYPE_VOLUME, got %u.\n",
volume_desc.Type); volume_desc.Type);
ok(volume_desc.Width == 1, "Expected width 1, got %u.\n", volume_desc.Width); ok(volume_desc.Width == 1, "Expected width 1, got %u.\n", volume_desc.Width);
ok(volume_desc.Height == 1, "Expected height 1, got %u.\n", volume_desc.Height); ok(volume_desc.Height == 1, "Expected height 1, got %u.\n", volume_desc.Height);
ok(volume_desc.Depth == 2, "Expected depth 2, got %u.\n", volume_desc.Depth); ok(volume_desc.Depth == 2, "Expected depth 2, got %u.\n", volume_desc.Depth);
IDirect3DVolume9_Release(volume); hr = IDirect3DVolumeTexture9_GetLevelDesc(volume_texture, 2, &volume_desc);
IDirect3DVolumeTexture9_Release(volume_texture); ok(SUCCEEDED(hr), "Failed to get level description, hr %#x.\n", hr);
ok(volume_desc.Type == D3DRTYPE_VOLUME, "Expected type D3DRTYPE_VOLUME, got %u.\n",
volume_desc.Type);
ok(volume_desc.Width == 1, "Expected width 1, got %u.\n", volume_desc.Width);
ok(volume_desc.Height == 1, "Expected height 1, got %u.\n", volume_desc.Height);
ok(volume_desc.Depth == 2, "Expected depth 2, got %u.\n", volume_desc.Depth);
IDirect3DVolume9_Release(volume);
IDirect3DVolumeTexture9_Release(volume_texture);
}
else
skip("Mipmapped volume maps not supported.\n");
refcount = IDirect3DDevice9_Release(device); refcount = IDirect3DDevice9_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount); ok(!refcount, "Device has %u references left.\n", refcount);
......
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