Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
ef411902
Commit
ef411902
authored
Feb 06, 2008
by
Stefan Dösinger
Committed by
Alexandre Julliard
Feb 07, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d3d9: Implement the device lost state.
parent
b322f81b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
1 deletion
+40
-1
d3d9_private.h
dlls/d3d9/d3d9_private.h
+1
-0
device.c
dlls/d3d9/device.c
+12
-1
device.c
dlls/d3d9/tests/device.c
+27
-0
No files found.
dlls/d3d9/d3d9_private.h
View file @
ef411902
...
...
@@ -184,6 +184,7 @@ typedef struct IDirect3DDevice9Impl
IDirect3DVertexDeclaration9
**
convertedDecls
;
unsigned
int
numConvertedDecls
,
declArraySize
;
BOOL
notreset
;
}
IDirect3DDevice9Impl
;
...
...
dlls/d3d9/device.c
View file @
ef411902
...
...
@@ -85,11 +85,16 @@ static ULONG WINAPI IDirect3DDevice9Impl_Release(LPDIRECT3DDEVICE9 iface) {
static
HRESULT
WINAPI
IDirect3DDevice9Impl_TestCooperativeLevel
(
LPDIRECT3DDEVICE9
iface
)
{
IDirect3DDevice9Impl
*
This
=
(
IDirect3DDevice9Impl
*
)
iface
;
HRESULT
hr
;
TRACE
(
"(%p)
: Relay
\n
"
,
This
);
TRACE
(
"(%p)
\n
"
,
This
);
EnterCriticalSection
(
&
d3d9_cs
);
hr
=
IWineD3DDevice_TestCooperativeLevel
(
This
->
WineD3DDevice
);
LeaveCriticalSection
(
&
d3d9_cs
);
if
(
hr
==
WINED3D_OK
&&
This
->
notreset
)
{
TRACE
(
"D3D9 Device is marked not reset
\n
"
);
hr
=
D3DERR_DEVICENOTRESET
;
}
return
hr
;
}
...
...
@@ -331,6 +336,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_Reset(LPDIRECT3DDEVICE9 iface, D3DP
IWineD3DDevice_EnumResources
(
This
->
WineD3DDevice
,
reset_enum_callback
,
&
resources_ok
);
if
(
!
resources_ok
)
{
WARN
(
"The application is holding D3DPOOL_DEFAULT resources, rejecting reset
\n
"
);
This
->
notreset
=
TRUE
;
return
WINED3DERR_INVALIDCALL
;
}
...
...
@@ -352,6 +358,8 @@ static HRESULT WINAPI IDirect3DDevice9Impl_Reset(LPDIRECT3DDEVICE9 iface, D3DP
EnterCriticalSection
(
&
d3d9_cs
);
hr
=
IWineD3DDevice_Reset
(
This
->
WineD3DDevice
,
&
localParameters
);
LeaveCriticalSection
(
&
d3d9_cs
);
if
(
FAILED
(
hr
))
{
This
->
notreset
=
TRUE
;
pPresentationParameters
->
BackBufferWidth
=
localParameters
.
BackBufferWidth
;
pPresentationParameters
->
BackBufferHeight
=
localParameters
.
BackBufferHeight
;
...
...
@@ -367,6 +375,9 @@ static HRESULT WINAPI IDirect3DDevice9Impl_Reset(LPDIRECT3DDEVICE9 iface, D3DP
pPresentationParameters
->
Flags
=
localParameters
.
Flags
;
pPresentationParameters
->
FullScreen_RefreshRateInHz
=
localParameters
.
FullScreen_RefreshRateInHz
;
pPresentationParameters
->
PresentationInterval
=
localParameters
.
PresentationInterval
;
}
else
{
This
->
notreset
=
FALSE
;
}
return
hr
;
}
...
...
dlls/d3d9/tests/device.c
View file @
ef411902
...
...
@@ -770,6 +770,8 @@ static void test_reset(void)
skip
(
"could not create device, IDirect3D9_CreateDevice returned %#x
\n
"
,
hr
);
goto
cleanup
;
}
hr
=
IDirect3DDevice9_TestCooperativeLevel
(
pDevice
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_TestCooperativeLevel after creation returned %#x
\n
"
,
hr
);
width
=
GetSystemMetrics
(
SM_CXSCREEN
);
height
=
GetSystemMetrics
(
SM_CYSCREEN
);
...
...
@@ -802,6 +804,8 @@ static void test_reset(void)
d3dpp
.
BackBufferFormat
=
d3ddm
.
Format
;
hr
=
IDirect3DDevice9_Reset
(
pDevice
,
&
d3dpp
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Reset failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_TestCooperativeLevel
(
pDevice
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_TestCooperativeLevel after a successfull reset returned %#x
\n
"
,
hr
);
ZeroMemory
(
&
vp
,
sizeof
(
vp
));
hr
=
IDirect3DDevice9_GetViewport
(
pDevice
,
&
vp
);
...
...
@@ -843,6 +847,8 @@ static void test_reset(void)
d3dpp
.
BackBufferHeight
=
300
;
hr
=
IDirect3DDevice9_Reset
(
pDevice
,
&
d3dpp
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Reset failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_TestCooperativeLevel
(
pDevice
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_TestCooperativeLevel after a successfull reset returned %#x
\n
"
,
hr
);
width
=
GetSystemMetrics
(
SM_CXSCREEN
);
height
=
GetSystemMetrics
(
SM_CYSCREEN
);
...
...
@@ -888,26 +894,38 @@ static void test_reset(void)
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_CreateOffscreenPlainSurface returned %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_Reset
(
pDevice
,
&
d3dpp
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"IDirect3DDevice9_Reset failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_TestCooperativeLevel
(
pDevice
);
ok
(
hr
==
D3DERR_DEVICENOTRESET
,
"IDirect3DDevice9_TestCooperativeLevel after a failed reset returned %#x
\n
"
,
hr
);
IDirect3DSurface9_Release
(
surface
);
/* Reset again to get the device out of the lost state */
hr
=
IDirect3DDevice9_Reset
(
pDevice
,
&
d3dpp
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Reset failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_TestCooperativeLevel
(
pDevice
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_TestCooperativeLevel after a successfull reset returned %#x
\n
"
,
hr
);
/* Scratch, sysmem and managed pools are fine */
hr
=
IDirect3DDevice9_CreateOffscreenPlainSurface
(
pDevice
,
16
,
16
,
D3DFMT_R5G6B5
,
D3DPOOL_SCRATCH
,
&
surface
,
NULL
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_CreateOffscreenPlainSurface returned %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_Reset
(
pDevice
,
&
d3dpp
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Reset failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_TestCooperativeLevel
(
pDevice
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_TestCooperativeLevel after a successfull reset returned %#x
\n
"
,
hr
);
IDirect3DSurface9_Release
(
surface
);
hr
=
IDirect3DDevice9_CreateOffscreenPlainSurface
(
pDevice
,
16
,
16
,
D3DFMT_R5G6B5
,
D3DPOOL_SYSTEMMEM
,
&
surface
,
NULL
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_CreateOffscreenPlainSurface returned %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_Reset
(
pDevice
,
&
d3dpp
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Reset failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_TestCooperativeLevel
(
pDevice
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_TestCooperativeLevel after a successfull reset returned %#x
\n
"
,
hr
);
IDirect3DSurface9_Release
(
surface
);
hr
=
IDirect3DDevice9_CreateTexture
(
pDevice
,
16
,
16
,
0
,
0
,
D3DFMT_R5G6B5
,
D3DPOOL_MANAGED
,
&
texture
,
NULL
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_CreateTexture returned %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_Reset
(
pDevice
,
&
d3dpp
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Reset failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_TestCooperativeLevel
(
pDevice
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_TestCooperativeLevel after a successfull reset returned %#x
\n
"
,
hr
);
IDirect3DTexture9_Release
(
texture
);
/* A reference held to an implicit surface causes failures as well */
...
...
@@ -915,9 +933,13 @@ static void test_reset(void)
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_GetBackBuffer returned %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_Reset
(
pDevice
,
&
d3dpp
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"IDirect3DDevice9_Reset failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_TestCooperativeLevel
(
pDevice
);
ok
(
hr
==
D3DERR_DEVICENOTRESET
,
"IDirect3DDevice9_TestCooperativeLevel after a failed reset returned %#x
\n
"
,
hr
);
IDirect3DSurface9_Release
(
surface
);
hr
=
IDirect3DDevice9_Reset
(
pDevice
,
&
d3dpp
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Reset failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_TestCooperativeLevel
(
pDevice
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_TestCooperativeLevel after a successfull reset returned %#x
\n
"
,
hr
);
/* Shaders are fine as well */
hr
=
IDirect3DDevice9_CreateVertexShader
(
pDevice
,
simple_vs
,
&
shader
);
...
...
@@ -934,6 +956,9 @@ static void test_reset(void)
d3dpp
.
BackBufferHeight
=
32
;
hr
=
IDirect3DDevice9_Reset
(
pDevice
,
&
d3dpp
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"IDirect3DDevice9_Reset to w=32, h=32, windowed=FALSE failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_TestCooperativeLevel
(
pDevice
);
ok
(
hr
==
D3DERR_DEVICENOTRESET
,
"IDirect3DDevice9_TestCooperativeLevel after a failed reset returned %#x
\n
"
,
hr
);
ZeroMemory
(
&
d3dpp
,
sizeof
(
d3dpp
)
);
d3dpp
.
SwapEffect
=
D3DSWAPEFFECT_DISCARD
;
d3dpp
.
Windowed
=
FALSE
;
...
...
@@ -941,6 +966,8 @@ static void test_reset(void)
d3dpp
.
BackBufferHeight
=
600
;
hr
=
IDirect3DDevice9_Reset
(
pDevice
,
&
d3dpp
);
ok
(
hr
==
D3DERR_INVALIDCALL
,
"IDirect3DDevice9_Reset to w=801, h=600, windowed=FALSE failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_TestCooperativeLevel
(
pDevice
);
ok
(
hr
==
D3DERR_DEVICENOTRESET
,
"IDirect3DDevice9_TestCooperativeLevel after a failed reset returned %#x
\n
"
,
hr
);
cleanup:
if
(
pD3d
)
IDirect3D9_Release
(
pD3d
);
...
...
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