diff --git a/dlls/d3d8/tests/texture.c b/dlls/d3d8/tests/texture.c index 3e0b805444c..df7da8b568f 100644 --- a/dlls/d3d8/tests/texture.c +++ b/dlls/d3d8/tests/texture.c @@ -101,6 +101,32 @@ static void test_texture_stage_states(IDirect3DDevice8 *device_ptr, int num_stag } } +static void test_cube_texture_from_pool(IDirect3DDevice8 *device_ptr, DWORD caps, D3DPOOL pool, BOOL need_cap) +{ + IDirect3DCubeTexture8 *texture_ptr = NULL; + HRESULT hr; + + hr = IDirect3DDevice8_CreateCubeTexture(device_ptr, 512, 1, 0, D3DFMT_X8R8G8B8, pool, &texture_ptr); + trace("pool=%d hr=0x%.8x\n", pool, hr); + + if((caps & D3DPTEXTURECAPS_CUBEMAP) || !need_cap) + ok(SUCCEEDED(hr), "hr=0x%.8x\n", hr); + else + ok(hr == D3DERR_INVALIDCALL, "hr=0x%.8x\n", hr); + + if(texture_ptr) IDirect3DCubeTexture8_Release(texture_ptr); +} + +static void test_cube_textures(IDirect3DDevice8 *device_ptr, DWORD caps) +{ + trace("texture caps: 0x%.8x\n", caps); + + test_cube_texture_from_pool(device_ptr, caps, D3DPOOL_DEFAULT, TRUE); + test_cube_texture_from_pool(device_ptr, caps, D3DPOOL_MANAGED, TRUE); + test_cube_texture_from_pool(device_ptr, caps, D3DPOOL_SYSTEMMEM, TRUE); + test_cube_texture_from_pool(device_ptr, caps, D3DPOOL_SCRATCH, FALSE); +} + START_TEST(texture) { D3DCAPS8 caps; @@ -120,4 +146,5 @@ START_TEST(texture) IDirect3DDevice8_GetDeviceCaps(device_ptr, &caps); test_texture_stage_states(device_ptr, caps.MaxTextureBlendStages); + test_cube_textures(device_ptr, caps.TextureCaps); } diff --git a/dlls/d3d9/tests/texture.c b/dlls/d3d9/tests/texture.c index d34ac4bbda8..79d855dcc95 100644 --- a/dlls/d3d9/tests/texture.c +++ b/dlls/d3d9/tests/texture.c @@ -100,6 +100,32 @@ static void test_texture_stage_states(IDirect3DDevice9 *device_ptr, int num_stag } } +static void test_cube_texture_from_pool(IDirect3DDevice9 *device_ptr, DWORD caps, D3DPOOL pool, BOOL need_cap) +{ + IDirect3DCubeTexture9 *texture_ptr = NULL; + HRESULT hr; + + hr = IDirect3DDevice9_CreateCubeTexture(device_ptr, 512, 1, 0, D3DFMT_X8R8G8B8, pool, &texture_ptr, NULL); + trace("pool=%d hr=0x%.8x\n", pool, hr); + + if((caps & D3DPTEXTURECAPS_CUBEMAP) || !need_cap) + ok(SUCCEEDED(hr), "hr=0x%.8x\n", hr); + else + ok(hr == D3DERR_INVALIDCALL, "hr=0x%.8x\n", hr); + + if(texture_ptr) IDirect3DCubeTexture9_Release(texture_ptr); +} + +static void test_cube_textures(IDirect3DDevice9 *device_ptr, DWORD caps) +{ + trace("texture caps: 0x%.8x\n", caps); + + test_cube_texture_from_pool(device_ptr, caps, D3DPOOL_DEFAULT, TRUE); + test_cube_texture_from_pool(device_ptr, caps, D3DPOOL_MANAGED, TRUE); + test_cube_texture_from_pool(device_ptr, caps, D3DPOOL_SYSTEMMEM, TRUE); + test_cube_texture_from_pool(device_ptr, caps, D3DPOOL_SCRATCH, FALSE); +} + START_TEST(texture) { D3DCAPS9 caps; @@ -119,4 +145,5 @@ START_TEST(texture) IDirect3DDevice9_GetDeviceCaps(device_ptr, &caps); test_texture_stage_states(device_ptr, caps.MaxTextureBlendStages); + test_cube_textures(device_ptr, caps.TextureCaps); } diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 78637149641..ea0978042ee 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -999,6 +999,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface return WINED3DERR_INVALIDCALL; } + if (!GL_SUPPORT(ARB_TEXTURE_CUBE_MAP) && Pool != WINED3DPOOL_SCRATCH) { + WARN("(%p) : Tried to create not supported cube texture\n", This); + return WINED3DERR_INVALIDCALL; + } + D3DCREATERESOURCEOBJECTINSTANCE(object, CubeTexture, WINED3DRTYPE_CUBETEXTURE, 0); D3DINITIALIZEBASETEXTURE(object->baseTexture);