d3d8: Refuse to create D3DUSAGE_WRITEONLY textures.
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
665fe4f1a4
commit
4e3ce8c1f0
|
@ -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);
|
ok(SUCCEEDED(hr), "Failed to unlock texture, hr %#x, type %s.\n", hr, resources[r].name);
|
||||||
|
|
||||||
IDirect3DTexture8_Release(texture);
|
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)
|
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);
|
ok(SUCCEEDED(hr), "Failed to unlock texture, hr %#x, type %s.\n", hr, resources[r].name);
|
||||||
|
|
||||||
IDirect3DTexture8_Release(cube_texture);
|
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);
|
ok(SUCCEEDED(hr), "Failed to unlock volume texture, hr %#x.\n", hr);
|
||||||
|
|
||||||
IDirect3DVolumeTexture8_Release(texture);
|
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);
|
refcount = IDirect3DDevice8_Release(device);
|
||||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||||
IDirect3D8_Release(d3d);
|
IDirect3D8_Release(d3d);
|
||||||
|
|
|
@ -1117,6 +1117,12 @@ HRESULT texture_init(struct d3d8_texture *texture, struct d3d8_device *device,
|
||||||
desc.depth = 1;
|
desc.depth = 1;
|
||||||
desc.size = 0;
|
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)
|
if (!levels)
|
||||||
levels = wined3d_log2i(max(width, height)) + 1;
|
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.depth = 1;
|
||||||
desc.size = 0;
|
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)
|
if (!levels)
|
||||||
levels = wined3d_log2i(edge_length) + 1;
|
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.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 (!levels)
|
if (!levels)
|
||||||
levels = wined3d_log2i(max(max(width, height), depth)) + 1;
|
levels = wined3d_log2i(max(max(width, height), depth)) + 1;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue