Commit 665fe4f1 authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

d3d9: Refuse to create D3DUSAGE_WRITEONLY textures.

parent 6e7a2bd3
...@@ -8051,6 +8051,11 @@ static void test_lockrect_invalid(void) ...@@ -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); ok(SUCCEEDED(hr), "Failed to unlock texture, hr %#x, type %s.\n", hr, resources[r].name);
IDirect3DTexture9_Release(texture); 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) if (cube_texture)
{ {
...@@ -8090,6 +8095,11 @@ static void test_lockrect_invalid(void) ...@@ -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); ok(SUCCEEDED(hr), "Failed to unlock texture, hr %#x, type %s.\n", hr, resources[r].name);
IDirect3DCubeTexture9_Release(cube_texture); 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) ...@@ -10269,6 +10279,11 @@ static void test_lockbox_invalid(void)
ok(SUCCEEDED(hr), "Failed to unlock volume texture, hr %#x.\n", hr); ok(SUCCEEDED(hr), "Failed to unlock volume texture, hr %#x.\n", hr);
IDirect3DVolumeTexture9_Release(texture); 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); refcount = IDirect3DDevice9_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount); ok(!refcount, "Device has %u references left.\n", refcount);
IDirect3D9_Release(d3d); IDirect3D9_Release(d3d);
......
...@@ -1330,6 +1330,11 @@ HRESULT texture_init(struct d3d9_texture *texture, struct d3d9_device *device, ...@@ -1330,6 +1330,11 @@ HRESULT texture_init(struct d3d9_texture *texture, struct d3d9_device *device,
if (is_gdi_compat_wined3dformat(desc.format)) if (is_gdi_compat_wined3dformat(desc.format))
flags |= WINED3D_TEXTURE_CREATE_GET_DC; 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 (usage & D3DUSAGE_AUTOGENMIPMAP)
{ {
if (pool == D3DPOOL_SYSTEMMEM) if (pool == D3DPOOL_SYSTEMMEM)
...@@ -1419,6 +1424,11 @@ HRESULT cubetexture_init(struct d3d9_texture *texture, struct d3d9_device *devic ...@@ -1419,6 +1424,11 @@ HRESULT cubetexture_init(struct d3d9_texture *texture, struct d3d9_device *devic
if (is_gdi_compat_wined3dformat(desc.format)) if (is_gdi_compat_wined3dformat(desc.format))
flags |= WINED3D_TEXTURE_CREATE_GET_DC; 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 (usage & D3DUSAGE_AUTOGENMIPMAP)
{ {
if (pool == D3DPOOL_SYSTEMMEM) if (pool == D3DPOOL_SYSTEMMEM)
...@@ -1493,6 +1503,11 @@ HRESULT volumetexture_init(struct d3d9_texture *texture, struct d3d9_device *dev ...@@ -1493,6 +1503,11 @@ HRESULT volumetexture_init(struct d3d9_texture *texture, struct d3d9_device *dev
desc.depth = depth; desc.depth = depth;
desc.size = 0; 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) if (usage & D3DUSAGE_AUTOGENMIPMAP)
{ {
WARN("D3DUSAGE_AUTOGENMIPMAP volume texture is not supported, returning D3DERR_INVALIDCALL.\n"); WARN("D3DUSAGE_AUTOGENMIPMAP volume texture is not supported, returning D3DERR_INVALIDCALL.\n");
......
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