Commit 4e3ce8c1 authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

d3d8: Refuse to create D3DUSAGE_WRITEONLY textures.

parent 665fe4f1
......@@ -5163,6 +5163,11 @@ static void test_lockrect_invalid(void)
ok(SUCCEEDED(hr), "Failed to unlock texture, hr %#x, type %s.\n", hr, resources[r].name);
IDirect3DTexture8_Release(texture);
hr = IDirect3DDevice8_CreateTexture(device, 128, 128, 1, D3DUSAGE_WRITEONLY,
D3DFMT_A8R8G8B8, resources[r].pool, &texture);
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x for type %s.\n",
hr, resources[r].name);
}
if (cube_texture)
......@@ -5203,6 +5208,11 @@ static void test_lockrect_invalid(void)
ok(SUCCEEDED(hr), "Failed to unlock texture, hr %#x, type %s.\n", hr, resources[r].name);
IDirect3DTexture8_Release(cube_texture);
hr = IDirect3DDevice8_CreateCubeTexture(device, 128, 1, D3DUSAGE_WRITEONLY, D3DFMT_A8R8G8B8,
resources[r].pool, &cube_texture);
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x for type %s.\n",
hr, resources[r].name);
}
}
......@@ -6949,6 +6959,11 @@ static void test_lockbox_invalid(void)
ok(SUCCEEDED(hr), "Failed to unlock volume texture, hr %#x.\n", hr);
IDirect3DVolumeTexture8_Release(texture);
hr = IDirect3DDevice8_CreateVolumeTexture(device, 4, 4, 2, 1, D3DUSAGE_WRITEONLY,
D3DFMT_A8R8G8B8, D3DPOOL_SCRATCH, &texture);
ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr);
refcount = IDirect3DDevice8_Release(device);
ok(!refcount, "Device has %u references left.\n", refcount);
IDirect3D8_Release(d3d);
......
......@@ -1117,6 +1117,12 @@ HRESULT texture_init(struct d3d8_texture *texture, struct d3d8_device *device,
desc.depth = 1;
desc.size = 0;
if (usage & D3DUSAGE_WRITEONLY)
{
WARN("Texture can't be created with the D3DUSAGE_WRITEONLY flag, returning D3DERR_INVALIDCALL.\n");
return D3DERR_INVALIDCALL;
}
if (!levels)
levels = wined3d_log2i(max(width, height)) + 1;
......@@ -1162,6 +1168,12 @@ HRESULT cubetexture_init(struct d3d8_texture *texture, struct d3d8_device *devic
desc.depth = 1;
desc.size = 0;
if (usage & D3DUSAGE_WRITEONLY)
{
WARN("Texture can't be created with the D3DUSAGE_WRITEONLY flag, returning D3DERR_INVALIDCALL.\n");
return D3DERR_INVALIDCALL;
}
if (!levels)
levels = wined3d_log2i(edge_length) + 1;
......@@ -1209,6 +1221,12 @@ HRESULT volumetexture_init(struct d3d8_texture *texture, struct d3d8_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 (!levels)
levels = wined3d_log2i(max(max(width, height), depth)) + 1;
......
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