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
078523f7
Commit
078523f7
authored
Jun 14, 2007
by
Stefan Dösinger
Committed by
Alexandre Julliard
Jun 14, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Present does not clear the depth stencil.
parent
c9b8a79e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
113 additions
and
15 deletions
+113
-15
visual.c
dlls/d3d8/tests/visual.c
+55
-0
visual.c
dlls/d3d9/tests/visual.c
+55
-0
swapchain.c
dlls/wined3d/swapchain.c
+3
-15
No files found.
dlls/d3d8/tests/visual.c
View file @
078523f7
...
...
@@ -116,6 +116,8 @@ static IDirect3DDevice8 *init_d3d8(void)
present_parameters
.
BackBufferWidth
=
640
;
present_parameters
.
BackBufferHeight
=
480
;
present_parameters
.
BackBufferFormat
=
D3DFMT_X8R8G8B8
;
present_parameters
.
EnableAutoDepthStencil
=
TRUE
;
present_parameters
.
AutoDepthStencilFormat
=
D3DFMT_D16
;
hr
=
IDirect3D8_CreateDevice
(
d3d8_ptr
,
D3DADAPTER_DEFAULT
,
D3DDEVTYPE_HAL
,
present_parameters
.
hDeviceWindow
,
D3DCREATE_SOFTWARE_VERTEXPROCESSING
,
&
present_parameters
,
&
device_ptr
);
ok
(
hr
==
D3D_OK
,
"IDirect3D_CreateDevice returned: %s
\n
"
,
DXGetErrorString8
(
hr
));
...
...
@@ -441,6 +443,58 @@ static void fog_test(IDirect3DDevice8 *device)
ok
(
hr
==
D3D_OK
,
"Turning off fog calculations returned %s
\n
"
,
DXGetErrorString8
(
hr
));
}
static
void
present_test
(
IDirect3DDevice8
*
device
)
{
struct
vertex
quad
[]
=
{
{
-
1
.
0
f
,
-
1
.
0
f
,
0
.
9
f
,
0xffff0000
},
{
-
1
.
0
f
,
1
.
0
f
,
0
.
9
f
,
0xffff0000
},
{
1
.
0
f
,
-
1
.
0
f
,
0
.
1
f
,
0xffff0000
},
{
1
.
0
f
,
1
.
0
f
,
0
.
1
f
,
0xffff0000
},
};
HRESULT
hr
;
DWORD
color
;
/* Does the Present clear the depth stencil? Clear the depth buffer with some value != 0,
* then call Present. Then clear the color buffer to make sure it has some defined content
* after the Present with D3DSWAPEFFECT_DISCARD. After that draw a plane that is somewhere cut
* by the depth value.
*/
hr
=
IDirect3DDevice8_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
|
D3DCLEAR_ZBUFFER
,
0xffffffff
,
0
.
75
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice8_Clear returned %s
\n
"
,
DXGetErrorString8
(
hr
));
hr
=
IDirect3DDevice8_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
hr
=
IDirect3DDevice8_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
,
0xffffffff
,
0
.
4
,
0
);
hr
=
IDirect3DDevice8_SetRenderState
(
device
,
D3DRS_ZENABLE
,
D3DZB_TRUE
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice8_SetRenderState returned %s
\n
"
,
DXGetErrorString8
(
hr
));
hr
=
IDirect3DDevice8_SetRenderState
(
device
,
D3DRS_ZFUNC
,
D3DCMP_GREATER
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice8_SetRenderState returned %s
\n
"
,
DXGetErrorString8
(
hr
));
hr
=
IDirect3DDevice8_SetVertexShader
(
device
,
D3DFVF_XYZ
|
D3DFVF_DIFFUSE
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice8_SetFVF returned %s
\n
"
,
DXGetErrorString8
(
hr
));
hr
=
IDirect3DDevice8_BeginScene
(
device
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice8_BeginScene failed with %s
\n
"
,
DXGetErrorString8
(
hr
));
if
(
hr
==
D3D_OK
)
{
/* No lights are defined... That means, lit vertices should be entirely black */
hr
=
IDirect3DDevice8_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
/*PrimCount */
,
quad
,
sizeof
(
quad
[
0
]));
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice8_DrawIndexedPrimitiveUP failed with %s
\n
"
,
DXGetErrorString8
(
hr
));
hr
=
IDirect3DDevice8_EndScene
(
device
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice8_EndScene failed with %s
\n
"
,
DXGetErrorString8
(
hr
));
}
hr
=
IDirect3DDevice8_SetRenderState
(
device
,
D3DRS_ZENABLE
,
D3DZB_FALSE
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice8_SetRenderState returned %s
\n
"
,
DXGetErrorString8
(
hr
));
hr
=
IDirect3DDevice8_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Present failed (0x%08x)
\n
"
,
hr
);
color
=
getPixelColor
(
device
,
512
,
240
);
ok
(
color
==
0x00ffffff
,
"Present failed: Got color 0x%08x, expected 0x00ffffff.
\n
"
,
color
);
color
=
getPixelColor
(
device
,
64
,
240
);
ok
(
color
==
0x00ff0000
,
"Present failed: Got color 0x%08x, expected 0x00ff0000.
\n
"
,
color
);
}
START_TEST
(
visual
)
{
IDirect3DDevice8
*
device_ptr
;
...
...
@@ -492,6 +546,7 @@ START_TEST(visual)
lighting_test
(
device_ptr
);
clear_test
(
device_ptr
);
fog_test
(
device_ptr
);
present_test
(
device_ptr
);
cleanup
:
if
(
device_ptr
)
IDirect3DDevice8_Release
(
device_ptr
);
...
...
dlls/d3d9/tests/visual.c
View file @
078523f7
...
...
@@ -116,6 +116,8 @@ static IDirect3DDevice9 *init_d3d9(void)
present_parameters
.
BackBufferWidth
=
640
;
present_parameters
.
BackBufferHeight
=
480
;
present_parameters
.
BackBufferFormat
=
D3DFMT_X8R8G8B8
;
present_parameters
.
EnableAutoDepthStencil
=
TRUE
;
present_parameters
.
AutoDepthStencilFormat
=
D3DFMT_D16
;
hr
=
IDirect3D9_CreateDevice
(
d3d9_ptr
,
D3DADAPTER_DEFAULT
,
D3DDEVTYPE_HAL
,
present_parameters
.
hDeviceWindow
,
D3DCREATE_SOFTWARE_VERTEXPROCESSING
,
&
present_parameters
,
&
device_ptr
);
ok
(
hr
==
D3D_OK
,
"IDirect3D_CreateDevice returned: %s
\n
"
,
DXGetErrorString9
(
hr
));
...
...
@@ -1114,6 +1116,58 @@ static void texbem_test(IDirect3DDevice9 *device)
}
}
static
void
present_test
(
IDirect3DDevice9
*
device
)
{
struct
vertex
quad
[]
=
{
{
-
1
.
0
f
,
-
1
.
0
f
,
0
.
9
f
,
0xffff0000
},
{
-
1
.
0
f
,
1
.
0
f
,
0
.
9
f
,
0xffff0000
},
{
1
.
0
f
,
-
1
.
0
f
,
0
.
1
f
,
0xffff0000
},
{
1
.
0
f
,
1
.
0
f
,
0
.
1
f
,
0xffff0000
},
};
HRESULT
hr
;
DWORD
color
;
/* Does the Present clear the depth stencil? Clear the depth buffer with some value != 0,
* then call Present. Then clear the color buffer to make sure it has some defined content
* after the Present with D3DSWAPEFFECT_DISCARD. After that draw a plane that is somewhere cut
* by the depth value.
*/
hr
=
IDirect3DDevice9_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
|
D3DCLEAR_ZBUFFER
,
0xffffffff
,
0
.
75
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Clear returned %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
hr
=
IDirect3DDevice9_Clear
(
device
,
0
,
NULL
,
D3DCLEAR_TARGET
,
0xffffffff
,
0
.
4
,
0
);
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_ZENABLE
,
D3DZB_TRUE
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetRenderState returned %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_ZFUNC
,
D3DCMP_GREATER
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetRenderState returned %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_SetFVF
(
device
,
D3DFVF_XYZ
|
D3DFVF_DIFFUSE
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetFVF returned %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_BeginScene
(
device
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_BeginScene failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
if
(
hr
==
D3D_OK
)
{
/* No lights are defined... That means, lit vertices should be entirely black */
hr
=
IDirect3DDevice9_DrawPrimitiveUP
(
device
,
D3DPT_TRIANGLESTRIP
,
2
/*PrimCount */
,
quad
,
sizeof
(
quad
[
0
]));
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_DrawIndexedPrimitiveUP failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_EndScene
(
device
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_EndScene failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
}
hr
=
IDirect3DDevice9_SetRenderState
(
device
,
D3DRS_ZENABLE
,
D3DZB_FALSE
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetRenderState returned %s
\n
"
,
DXGetErrorString9
(
hr
));
hr
=
IDirect3DDevice9_Present
(
device
,
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
SUCCEEDED
(
hr
),
"Present failed (0x%08x)
\n
"
,
hr
);
color
=
getPixelColor
(
device
,
512
,
240
);
ok
(
color
==
0x00ffffff
,
"Present failed: Got color 0x%08x, expected 0x00ffffff.
\n
"
,
color
);
color
=
getPixelColor
(
device
,
64
,
240
);
ok
(
color
==
0x00ff0000
,
"Present failed: Got color 0x%08x, expected 0x00ff0000.
\n
"
,
color
);
}
START_TEST
(
visual
)
{
IDirect3DDevice9
*
device_ptr
;
...
...
@@ -1169,6 +1223,7 @@ START_TEST(visual)
clear_test
(
device_ptr
);
fog_test
(
device_ptr
);
test_cube_wrap
(
device_ptr
);
present_test
(
device_ptr
);
if
(
caps
.
VertexShaderVersion
>=
D3DVS_VERSION
(
2
,
0
))
{
...
...
dlls/wined3d/swapchain.c
View file @
078523f7
...
...
@@ -148,7 +148,6 @@ static void WINAPI IWineD3DSwapChainImpl_Destroy(IWineD3DSwapChain *iface, D3DCB
static
HRESULT
WINAPI
IWineD3DSwapChainImpl_Present
(
IWineD3DSwapChain
*
iface
,
CONST
RECT
*
pSourceRect
,
CONST
RECT
*
pDestRect
,
HWND
hDestWindowOverride
,
CONST
RGNDATA
*
pDirtyRegion
,
DWORD
dwFlags
)
{
IWineD3DSwapChainImpl
*
This
=
(
IWineD3DSwapChainImpl
*
)
iface
;
DWORD
clear_flags
=
0
;
unsigned
int
sync
;
int
retval
;
...
...
@@ -298,22 +297,11 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
LEAVE_GL
();
if
(
This
->
wineD3DDevice
->
stencilBufferTarget
)
{
clear_flags
|=
WINED3DCLEAR_STENCIL
|
WINED3DCLEAR_ZBUFFER
;
}
/* Although this is not strictly required, a simple demo showed this does occur
on (at least non-debug) d3d */
if
(
This
->
presentParms
.
SwapEffect
==
WINED3DSWAPEFFECT_DISCARD
)
{
TRACE
(
"Clearing the color buffer with pink color
\n
"
);
TRACE
(
"Clearing
\n
"
);
IWineD3DDevice_Clear
((
IWineD3DDevice
*
)
This
->
wineD3DDevice
,
0
,
NULL
,
clear_flags
|
WINED3DCLEAR_TARGET
,
0x00
,
1
.
0
,
0
);
}
else
if
(
clear_flags
)
{
TRACE
(
"Clearing z/stencil buffer
\n
"
);
IWineD3DDevice_Clear
((
IWineD3DDevice
*
)
This
->
wineD3DDevice
,
0
,
NULL
,
clear_flags
,
0x00
,
1
.
0
,
0
);
IWineD3DDevice_Clear
((
IWineD3DDevice
*
)
This
->
wineD3DDevice
,
0
,
NULL
,
WINED3DCLEAR_TARGET
,
0xff00ffff
,
1
.
0
,
0
);
}
if
(((
IWineD3DSurfaceImpl
*
)
This
->
frontBuffer
)
->
Flags
&
SFLAG_INSYSMEM
||
...
...
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