d3d9: shared_handle must be NULL in non-ex d3d9.
This commit is contained in:
parent
62df35c312
commit
58f16ddd4e
|
@ -740,6 +740,12 @@ static HRESULT WINAPI d3d9_device_CreateTexture(IDirect3DDevice9Ex *iface,
|
|||
*texture = NULL;
|
||||
if (shared_handle)
|
||||
{
|
||||
if (!device->d3d_parent->extended)
|
||||
{
|
||||
WARN("Trying to create a shared or user memory texture on a non-ex device.\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
if (pool == D3DPOOL_SYSTEMMEM)
|
||||
{
|
||||
if (levels != 1)
|
||||
|
@ -801,6 +807,12 @@ static HRESULT WINAPI d3d9_device_CreateVolumeTexture(IDirect3DDevice9Ex *iface,
|
|||
*texture = NULL;
|
||||
if (shared_handle)
|
||||
{
|
||||
if (!device->d3d_parent->extended)
|
||||
{
|
||||
WARN("Trying to create a shared volume texture on a non-ex device.\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
if (pool != D3DPOOL_DEFAULT)
|
||||
{
|
||||
WARN("Trying to create a shared volume texture in pool %#x.\n", pool);
|
||||
|
@ -841,6 +853,12 @@ static HRESULT WINAPI d3d9_device_CreateCubeTexture(IDirect3DDevice9Ex *iface,
|
|||
*texture = NULL;
|
||||
if (shared_handle)
|
||||
{
|
||||
if (!device->d3d_parent->extended)
|
||||
{
|
||||
WARN("Trying to create a shared cube texture on a non-ex device.\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
if (pool != D3DPOOL_DEFAULT)
|
||||
{
|
||||
WARN("Trying to create a shared cube texture in pool %#x.\n", pool);
|
||||
|
@ -880,6 +898,12 @@ static HRESULT WINAPI d3d9_device_CreateVertexBuffer(IDirect3DDevice9Ex *iface,
|
|||
|
||||
if (shared_handle)
|
||||
{
|
||||
if (!device->d3d_parent->extended)
|
||||
{
|
||||
WARN("Trying to create a shared vertex buffer on a non-ex device.\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
if (pool != D3DPOOL_DEFAULT)
|
||||
{
|
||||
WARN("Trying to create a shared vertex buffer in pool %#x.\n", pool);
|
||||
|
@ -919,6 +943,12 @@ static HRESULT WINAPI d3d9_device_CreateIndexBuffer(IDirect3DDevice9Ex *iface, U
|
|||
|
||||
if (shared_handle)
|
||||
{
|
||||
if (!device->d3d_parent->extended)
|
||||
{
|
||||
WARN("Trying to create a shared index buffer on a non-ex device.\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
if (pool != D3DPOOL_DEFAULT)
|
||||
{
|
||||
WARN("Trying to create a shared index buffer in pool %#x.\n", pool);
|
||||
|
@ -1011,7 +1041,15 @@ static HRESULT WINAPI d3d9_device_CreateRenderTarget(IDirect3DDevice9Ex *iface,
|
|||
|
||||
*surface = NULL;
|
||||
if (shared_handle)
|
||||
{
|
||||
if (!device->d3d_parent->extended)
|
||||
{
|
||||
WARN("Trying to create a shared render target on a non-ex device.\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
FIXME("Resource sharing not implemented, *shared_handle %p.\n", *shared_handle);
|
||||
}
|
||||
|
||||
if (lockable)
|
||||
flags |= WINED3D_SURFACE_MAPPABLE;
|
||||
|
@ -1034,7 +1072,15 @@ static HRESULT WINAPI d3d9_device_CreateDepthStencilSurface(IDirect3DDevice9Ex *
|
|||
|
||||
*surface = NULL;
|
||||
if (shared_handle)
|
||||
{
|
||||
if (!device->d3d_parent->extended)
|
||||
{
|
||||
WARN("Trying to create a shared depth stencil on a non-ex device.\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
FIXME("Resource sharing not implemented, *shared_handle %p.\n", *shared_handle);
|
||||
}
|
||||
|
||||
if (discard)
|
||||
flags |= WINED3D_SURFACE_DISCARD;
|
||||
|
@ -1239,6 +1285,12 @@ static HRESULT WINAPI d3d9_device_CreateOffscreenPlainSurface(IDirect3DDevice9Ex
|
|||
|
||||
if (shared_handle)
|
||||
{
|
||||
if (!device->d3d_parent->extended)
|
||||
{
|
||||
WARN("Trying to create a shared or user memory surface on a non-ex device.\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
if (pool == D3DPOOL_SYSTEMMEM)
|
||||
user_mem = *shared_handle;
|
||||
else
|
||||
|
|
|
@ -7329,6 +7329,110 @@ static void test_lockbox_invalid(void)
|
|||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
static void test_shared_handle(void)
|
||||
{
|
||||
IDirect3DDevice9 *device;
|
||||
IDirect3D9 *d3d;
|
||||
ULONG refcount;
|
||||
HWND window;
|
||||
HRESULT hr;
|
||||
/* Native d3d9ex refuses to create a shared texture if the texture pointer
|
||||
* is not initialized to NULL. Make sure this doesn't cause issues here. */
|
||||
IDirect3DTexture9 *texture = NULL;
|
||||
IDirect3DSurface9 *surface = NULL;
|
||||
IDirect3DVertexBuffer9 *vertex_buffer = NULL;
|
||||
IDirect3DIndexBuffer9 *index_buffer = NULL;
|
||||
HANDLE handle = NULL;
|
||||
void *mem;
|
||||
D3DCAPS9 caps;
|
||||
|
||||
if (!(d3d = pDirect3DCreate9(D3D_SDK_VERSION)))
|
||||
{
|
||||
skip("Failed to create D3D object, skipping tests.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
window = CreateWindowA("d3d9_test_wc", "d3d9_test", WS_OVERLAPPEDWINDOW,
|
||||
0, 0, 640, 480, 0, 0, 0, 0);
|
||||
if (!(device = create_device(d3d, window, window, TRUE)))
|
||||
{
|
||||
skip("Failed to create a D3D device, skipping tests.\n");
|
||||
IDirect3D9_Release(d3d);
|
||||
DestroyWindow(window);
|
||||
return;
|
||||
}
|
||||
|
||||
hr = IDirect3DDevice9_GetDeviceCaps(device, &caps);
|
||||
ok(SUCCEEDED(hr), "Failed to get caps, hr %#x.\n", hr);
|
||||
mem = HeapAlloc(GetProcessHeap(), 0, 128 * 128 * 4);
|
||||
|
||||
/* Windows XP returns E_NOTIMPL, Windows 7 returns INVALIDCALL, except for
|
||||
* CreateVertexBuffer, where it returns NOTAVAILABLE. */
|
||||
hr = IDirect3DDevice9_CreateTexture(device, 128, 128, 1, 0, D3DFMT_A8R8G8B8,
|
||||
D3DPOOL_DEFAULT, &texture, &handle);
|
||||
ok(hr == E_NOTIMPL || broken(hr == D3DERR_INVALIDCALL), "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_CreateTexture(device, 128, 128, 1, 0, D3DFMT_A8R8G8B8,
|
||||
D3DPOOL_SYSTEMMEM, &texture, &mem);
|
||||
ok(hr == E_NOTIMPL || broken(hr == D3DERR_INVALIDCALL), "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 128, 128,
|
||||
D3DFMT_A8R8G8B8, D3DPOOL_DEFAULT, &surface, &handle);
|
||||
ok(hr == E_NOTIMPL || broken(hr == D3DERR_INVALIDCALL), "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_CreateOffscreenPlainSurface(device, 128, 128,
|
||||
D3DFMT_A8R8G8B8, D3DPOOL_SYSTEMMEM, &surface, &mem);
|
||||
ok(hr == E_NOTIMPL || broken(hr == D3DERR_INVALIDCALL), "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_CreateVertexBuffer(device, 16, 0, 0, D3DPOOL_DEFAULT,
|
||||
&vertex_buffer, &handle);
|
||||
ok(hr == E_NOTIMPL || broken(hr == D3DERR_INVALIDCALL), "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_CreateVertexBuffer(device, 16, 0, 0, D3DPOOL_SYSTEMMEM,
|
||||
&vertex_buffer, &mem);
|
||||
ok(hr == E_NOTIMPL || broken(hr == D3DERR_NOTAVAILABLE), "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_CreateIndexBuffer(device, 16, 0, 0, D3DPOOL_DEFAULT,
|
||||
&index_buffer, &handle);
|
||||
ok(hr == E_NOTIMPL || broken(hr == D3DERR_INVALIDCALL), "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_CreateIndexBuffer(device, 16, 0, 0, D3DPOOL_SYSTEMMEM,
|
||||
&index_buffer, &mem);
|
||||
ok(hr == E_NOTIMPL || broken(hr == D3DERR_INVALIDCALL), "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
if (caps.TextureCaps & D3DPTEXTURECAPS_CUBEMAP)
|
||||
{
|
||||
IDirect3DCubeTexture9 *cube_texture = NULL;
|
||||
hr = IDirect3DDevice9_CreateCubeTexture(device, 8, 0, 0, D3DFMT_A8R8G8B8,
|
||||
D3DPOOL_DEFAULT, &cube_texture, &handle);
|
||||
ok(hr == E_NOTIMPL || broken(hr == D3DERR_INVALIDCALL), "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_CreateCubeTexture(device, 8, 0, 0, D3DFMT_A8R8G8B8,
|
||||
D3DPOOL_SYSTEMMEM, &cube_texture, &mem);
|
||||
ok(hr == E_NOTIMPL || broken(hr == D3DERR_INVALIDCALL), "Got unexpected hr %#x.\n", hr);
|
||||
}
|
||||
|
||||
if (caps.TextureCaps & D3DPTEXTURECAPS_VOLUMEMAP)
|
||||
{
|
||||
IDirect3DVolumeTexture9 *volume_texture = NULL;
|
||||
hr = IDirect3DDevice9_CreateVolumeTexture(device, 4, 4, 4, 0, 0, D3DFMT_A8R8G8B8,
|
||||
D3DPOOL_DEFAULT, &volume_texture, &handle);
|
||||
ok(hr == E_NOTIMPL || broken(hr == D3DERR_INVALIDCALL), "Got unexpected hr %#x.\n", hr);
|
||||
hr = IDirect3DDevice9_CreateVolumeTexture(device, 4, 4, 4, 0, 0, D3DFMT_A8R8G8B8,
|
||||
D3DPOOL_SYSTEMMEM, &volume_texture, &mem);
|
||||
ok(hr == E_NOTIMPL || broken(hr == D3DERR_INVALIDCALL), "Got unexpected hr %#x.\n", hr);
|
||||
}
|
||||
|
||||
hr = IDirect3DDevice9_CreateRenderTarget(device, 128, 128, D3DFMT_A8R8G8B8,
|
||||
D3DMULTISAMPLE_NONE, 0, TRUE, &surface, &handle);
|
||||
ok(hr == E_NOTIMPL || broken(hr == D3DERR_INVALIDCALL), "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
hr = IDirect3DDevice9_CreateDepthStencilSurface(device, 128, 128, D3DFMT_D24X8,
|
||||
D3DMULTISAMPLE_NONE, 0, TRUE, &surface, &handle);
|
||||
ok(hr == E_NOTIMPL || broken(hr == D3DERR_INVALIDCALL), "Got unexpected hr %#x.\n", hr);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, mem);
|
||||
refcount = IDirect3DDevice9_Release(device);
|
||||
ok(!refcount, "Device has %u references left.\n", refcount);
|
||||
IDirect3D9_Release(d3d);
|
||||
DestroyWindow(window);
|
||||
}
|
||||
|
||||
START_TEST(device)
|
||||
{
|
||||
HMODULE d3d9_handle = LoadLibraryA( "d3d9.dll" );
|
||||
|
@ -7423,6 +7527,7 @@ START_TEST(device)
|
|||
test_create_rt_ds_fail();
|
||||
test_volume_blocks();
|
||||
test_lockbox_invalid();
|
||||
test_shared_handle();
|
||||
}
|
||||
|
||||
out:
|
||||
|
|
Loading…
Reference in New Issue