[PATCH 06/10] wined3d: Require exclusive GPU access for rendertarget and depth/stencil resources.
Henri Verbeet
hverbeet at codeweavers.com
Sun Nov 18 12:39:17 CST 2018
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
dlls/d3d8/tests/device.c | 9 +++------
dlls/d3d9/tests/device.c | 9 +++------
dlls/wined3d/resource.c | 8 ++++++++
dlls/wined3d/texture.c | 2 --
4 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index 0b40253c58b..59eec656cdc 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -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))
diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c
index 4e620d59b84..f3b9a0ae26e 100644
--- a/dlls/d3d9/tests/device.c
+++ b/dlls/d3d9/tests/device.c
@@ -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))
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index 30a35c7d425..e5016e42e08 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -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");
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index ee3754f1c5d..dbc256f1102 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -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;
--
2.11.0
More information about the wine-devel
mailing list