Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/d3d9/tests/device.c | 15 +++++++++++++++ dlls/d3d9/texture.c | 15 +++++++++++++++ 2 files changed, 30 insertions(+)
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 859ca472948..9064a6701af 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -8051,6 +8051,11 @@ static void test_lockrect_invalid(void) ok(SUCCEEDED(hr), "Failed to unlock texture, hr %#x, type %s.\n", hr, resources[r].name);
IDirect3DTexture9_Release(texture); + + hr = IDirect3DDevice9_CreateTexture(device, 128, 128, 1, D3DUSAGE_WRITEONLY, + D3DFMT_A8R8G8B8, resources[r].pool, &texture, NULL); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x for type %s.\n", + hr, resources[r].name); } if (cube_texture) { @@ -8090,6 +8095,11 @@ static void test_lockrect_invalid(void) ok(SUCCEEDED(hr), "Failed to unlock texture, hr %#x, type %s.\n", hr, resources[r].name);
IDirect3DCubeTexture9_Release(cube_texture); + + hr = IDirect3DDevice9_CreateCubeTexture(device, 128, 1, D3DUSAGE_WRITEONLY, D3DFMT_A8R8G8B8, + resources[r].pool, &cube_texture, NULL); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x for type %s.\n", + hr, resources[r].name); } }
@@ -10269,6 +10279,11 @@ static void test_lockbox_invalid(void) ok(SUCCEEDED(hr), "Failed to unlock volume texture, hr %#x.\n", hr);
IDirect3DVolumeTexture9_Release(texture); + + hr = IDirect3DDevice9_CreateVolumeTexture(device, 4, 4, 2, 1, D3DUSAGE_WRITEONLY, + D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &texture, NULL); + ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + refcount = IDirect3DDevice9_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); IDirect3D9_Release(d3d); diff --git a/dlls/d3d9/texture.c b/dlls/d3d9/texture.c index 8dc1ceea698..9f367096b71 100644 --- a/dlls/d3d9/texture.c +++ b/dlls/d3d9/texture.c @@ -1330,6 +1330,11 @@ HRESULT texture_init(struct d3d9_texture *texture, struct d3d9_device *device, if (is_gdi_compat_wined3dformat(desc.format)) flags |= WINED3D_TEXTURE_CREATE_GET_DC;
+ if (usage & D3DUSAGE_WRITEONLY) + { + WARN("Texture can't be created with the D3DUSAGE_WRITEONLY flags, returning D3DERR_INVALIDCALL.\n"); + return D3DERR_INVALIDCALL; + } if (usage & D3DUSAGE_AUTOGENMIPMAP) { if (pool == D3DPOOL_SYSTEMMEM) @@ -1419,6 +1424,11 @@ HRESULT cubetexture_init(struct d3d9_texture *texture, struct d3d9_device *devic if (is_gdi_compat_wined3dformat(desc.format)) flags |= WINED3D_TEXTURE_CREATE_GET_DC;
+ if (usage & D3DUSAGE_WRITEONLY) + { + WARN("Texture can't be created with the D3DUSAGE_WRITEONLY flags, returning D3DERR_INVALIDCALL.\n"); + return D3DERR_INVALIDCALL; + } if (usage & D3DUSAGE_AUTOGENMIPMAP) { if (pool == D3DPOOL_SYSTEMMEM) @@ -1493,6 +1503,11 @@ HRESULT volumetexture_init(struct d3d9_texture *texture, struct d3d9_device *dev desc.depth = depth; desc.size = 0;
+ if (usage & D3DUSAGE_WRITEONLY) + { + WARN("Texture can't be created with the D3DUSAGE_WRITEONLY flags, returning D3DERR_INVALIDCALL.\n"); + return D3DERR_INVALIDCALL; + } if (usage & D3DUSAGE_AUTOGENMIPMAP) { WARN("D3DUSAGE_AUTOGENMIPMAP volume texture is not supported, returning D3DERR_INVALIDCALL.\n");