Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
58f16ddd
Commit
58f16ddd
authored
Dec 10, 2013
by
Stefan Dösinger
Committed by
Alexandre Julliard
Dec 10, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9: shared_handle must be NULL in non-ex d3d9.
parent
62df35c3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
157 additions
and
0 deletions
+157
-0
device.c
dlls/d3d9/device.c
+52
-0
device.c
dlls/d3d9/tests/device.c
+105
-0
No files found.
dlls/d3d9/device.c
View file @
58f16ddd
...
...
@@ -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
...
...
dlls/d3d9/tests/device.c
View file @
58f16ddd
...
...
@@ -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
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment