wined3d: Require exclusive GPU access for 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:
Henri Verbeet 2018-11-18 22:09:17 +03:30 committed by Alexandre Julliard
parent 826be9ee10
commit 0bae2bed43
4 changed files with 14 additions and 14 deletions

View file

@ -8944,8 +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 == 17 || j == 20 || j == 23 || j == 24
|| j == 27 || j == 30 || j == 31 || j == 32 || j == 33 || j == 34)
todo_wine_if(j == 10 || j == 13 || j == 16 || j == 23 || j == 30)
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);
@ -8960,8 +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 == 17 || j == 20 || j == 23 || j == 24
|| j == 27 || j == 30 || j == 31 || j == 32 || j == 33 || j == 34)
todo_wine_if(j == 10 || j == 13 || j == 16 || j == 23 || j == 30)
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);
@ -9093,8 +9091,7 @@ 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_DEPTHSTENCIL && tests[i].pool == D3DPOOL_SCRATCH)
|| tests[i].usage & D3DUSAGE_RENDERTARGET)
todo_wine_if(tests[i].usage & D3DUSAGE_RENDERTARGET && 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))

View file

@ -12774,8 +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 == 17 || j == 20 || j == 23 || j == 24
|| j == 27 || j == 30 || j == 31 || j == 32 || j == 33 || j == 34)
todo_wine_if(j == 10 || j == 13 || j == 16 || j == 23 || j == 30)
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);
@ -12790,8 +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 == 17 || j == 20 || j == 23 || j == 24
|| j == 27 || j == 30 || j == 31 || j == 32 || j == 33 || j == 34)
todo_wine_if(j == 10 || j == 13 || j == 16 || j == 23 || j == 30)
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);
@ -12928,8 +12926,7 @@ 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_DEPTHSTENCIL && tests[i].pool == D3DPOOL_SCRATCH)
|| tests[i].usage & D3DUSAGE_RENDERTARGET)
todo_wine_if(tests[i].usage & D3DUSAGE_RENDERTARGET && 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))

View file

@ -91,6 +91,14 @@ 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))
{
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 (!size)
ERR("Attempting to create a zero-sized resource.\n");

View file

@ -2909,8 +2909,6 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
if ((flags & WINED3D_TEXTURE_CREATE_MAPPABLE) && !((desc->usage & WINED3DUSAGE_DYNAMIC)
|| (desc->bind_flags & (WINED3D_BIND_RENDER_TARGET | WINED3D_BIND_DEPTH_STENCIL))))
WARN("Creating a mappable texture that doesn't specify dynamic usage.\n");
if (desc->bind_flags & WINED3D_BIND_RENDER_TARGET && desc->access & WINED3D_RESOURCE_ACCESS_CPU)
FIXME("Trying to create a CPU accessible render target.\n");
pow2_width = desc->width;
pow2_height = desc->height;