mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
wined3d: Disallow dynamic rendertarget and depth/stencil resources.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0bae2bed43
commit
9bac6f159c
4 changed files with 26 additions and 12 deletions
|
@ -8944,7 +8944,7 @@ static void test_resource_access(void)
|
|||
case SURFACE_2D:
|
||||
hr = IDirect3DDevice8_CreateTexture(device, 16, 16, 1,
|
||||
tests[j].usage, format, tests[j].pool, &texture_2d);
|
||||
todo_wine_if(j == 10 || j == 13 || j == 16 || j == 23 || j == 30)
|
||||
todo_wine_if(!tests[j].valid && tests[j].format == FORMAT_DEPTH && !tests[j].usage)
|
||||
ok(hr == (tests[j].valid && (tests[j].format != FORMAT_DEPTH || depth_2d)
|
||||
? D3D_OK : D3DERR_INVALIDCALL),
|
||||
"Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr);
|
||||
|
@ -8959,7 +8959,7 @@ static void test_resource_access(void)
|
|||
case SURFACE_CUBE:
|
||||
hr = IDirect3DDevice8_CreateCubeTexture(device, 16, 1,
|
||||
tests[j].usage, format, tests[j].pool, &texture_cube);
|
||||
todo_wine_if(j == 10 || j == 13 || j == 16 || j == 23 || j == 30)
|
||||
todo_wine_if(!tests[j].valid && tests[j].format == FORMAT_DEPTH && !tests[j].usage)
|
||||
ok(hr == (tests[j].valid && (tests[j].format != FORMAT_DEPTH || depth_cube)
|
||||
? D3D_OK : D3DERR_INVALIDCALL),
|
||||
"Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr);
|
||||
|
@ -9091,7 +9091,8 @@ static void test_resource_access(void)
|
|||
|
||||
hr = IDirect3DDevice8_CreateVolumeTexture(device, 16, 16, 1, 1,
|
||||
tests[i].usage, format, tests[i].pool, &texture);
|
||||
todo_wine_if(tests[i].usage & D3DUSAGE_RENDERTARGET && tests[i].pool == D3DPOOL_DEFAULT)
|
||||
todo_wine_if(tests[i].usage & D3DUSAGE_RENDERTARGET
|
||||
&& !(tests[i].usage & D3DUSAGE_DYNAMIC) && tests[i].pool == D3DPOOL_DEFAULT)
|
||||
ok(hr == (!(tests[i].usage & ~D3DUSAGE_DYNAMIC) ? D3D_OK : D3DERR_INVALIDCALL),
|
||||
"Test %u: Got unexpected hr %#x.\n", i, hr);
|
||||
if (FAILED(hr))
|
||||
|
|
|
@ -12774,7 +12774,7 @@ static void test_resource_access(void)
|
|||
case SURFACE_2D:
|
||||
hr = IDirect3DDevice9_CreateTexture(device, 16, 16, 1,
|
||||
tests[j].usage, format, tests[j].pool, &texture_2d, NULL);
|
||||
todo_wine_if(j == 10 || j == 13 || j == 16 || j == 23 || j == 30)
|
||||
todo_wine_if(!tests[j].valid && tests[j].format == FORMAT_DEPTH && !tests[j].usage)
|
||||
ok(hr == (tests[j].valid && (tests[j].format != FORMAT_DEPTH || depth_2d)
|
||||
? D3D_OK : D3DERR_INVALIDCALL),
|
||||
"Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr);
|
||||
|
@ -12789,7 +12789,7 @@ static void test_resource_access(void)
|
|||
case SURFACE_CUBE:
|
||||
hr = IDirect3DDevice9_CreateCubeTexture(device, 16, 1,
|
||||
tests[j].usage, format, tests[j].pool, &texture_cube, NULL);
|
||||
todo_wine_if(j == 10 || j == 13 || j == 16 || j == 23 || j == 30)
|
||||
todo_wine_if(!tests[j].valid && tests[j].format == FORMAT_DEPTH && !tests[j].usage)
|
||||
ok(hr == (tests[j].valid && (tests[j].format != FORMAT_DEPTH || depth_cube)
|
||||
? D3D_OK : D3DERR_INVALIDCALL),
|
||||
"Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr);
|
||||
|
@ -12926,7 +12926,8 @@ static void test_resource_access(void)
|
|||
|
||||
hr = IDirect3DDevice9_CreateVolumeTexture(device, 16, 16, 1, 1,
|
||||
tests[i].usage, format, tests[i].pool, &texture, NULL);
|
||||
todo_wine_if(tests[i].usage & D3DUSAGE_RENDERTARGET && tests[i].pool == D3DPOOL_DEFAULT)
|
||||
todo_wine_if(tests[i].usage & D3DUSAGE_RENDERTARGET
|
||||
&& !(tests[i].usage & D3DUSAGE_DYNAMIC) && tests[i].pool == D3DPOOL_DEFAULT)
|
||||
ok(hr == (!(tests[i].usage & ~D3DUSAGE_DYNAMIC) ? D3D_OK : D3DERR_INVALIDCALL),
|
||||
"Test %u: Got unexpected hr %#x.\n", i, hr);
|
||||
if (FAILED(hr))
|
||||
|
|
|
@ -6189,7 +6189,9 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
/* Videomemory adds localvidmem. This is mutually exclusive with
|
||||
* systemmemory and texturemanage. */
|
||||
desc->ddsCaps.dwCaps |= DDSCAPS_LOCALVIDMEM;
|
||||
wined3d_desc.usage |= WINED3DUSAGE_DYNAMIC;
|
||||
/* Dynamic resources can't be written by the GPU. */
|
||||
if (!(wined3d_desc.bind_flags & (WINED3D_BIND_RENDER_TARGET | WINED3D_BIND_DEPTH_STENCIL)))
|
||||
wined3d_desc.usage |= WINED3DUSAGE_DYNAMIC;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -91,12 +91,22 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
|
|||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
if ((access & (WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_GPU)) != WINED3D_RESOURCE_ACCESS_GPU
|
||||
&& bind_flags & (WINED3D_BIND_RENDER_TARGET | WINED3D_BIND_DEPTH_STENCIL))
|
||||
if (bind_flags & (WINED3D_BIND_RENDER_TARGET | WINED3D_BIND_DEPTH_STENCIL))
|
||||
{
|
||||
WARN("Bind flags %s are incompatible with resource access %s.\n",
|
||||
wined3d_debug_bind_flags(bind_flags), wined3d_debug_resource_access(access));
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
if ((access & (WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_GPU)) != WINED3D_RESOURCE_ACCESS_GPU)
|
||||
{
|
||||
WARN("Bind flags %s are incompatible with resource access %s.\n",
|
||||
wined3d_debug_bind_flags(bind_flags), wined3d_debug_resource_access(access));
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
/* Dynamic usage is incompatible with GPU writes. */
|
||||
if (usage & WINED3DUSAGE_DYNAMIC)
|
||||
{
|
||||
WARN("Bind flags %s are incompatible with resource usage %s.\n",
|
||||
wined3d_debug_bind_flags(bind_flags), debug_d3dusage(usage));
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
}
|
||||
|
||||
if (!size)
|
||||
|
|
Loading…
Reference in a new issue