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
e4f8a2da
Commit
e4f8a2da
authored
Nov 10, 2007
by
Stefan Dösinger
Committed by
Alexandre Julliard
Nov 14, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Depth stencil fixes.
parent
9f41a359
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
93 additions
and
17 deletions
+93
-17
device.c
dlls/d3d9/device.c
+1
-0
device.c
dlls/d3d9/tests/device.c
+75
-1
device.c
dlls/wined3d/device.c
+13
-13
drawprim.c
dlls/wined3d/drawprim.c
+1
-1
state.c
dlls/wined3d/state.c
+1
-0
stateblock.c
dlls/wined3d/stateblock.c
+1
-1
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-1
No files found.
dlls/d3d9/device.c
View file @
e4f8a2da
...
...
@@ -603,6 +603,7 @@ static HRESULT WINAPI IDirect3DDevice9Impl_GetDepthStencilSurface(LPDIRECT3DDE
}
}
else
{
WARN
(
"Call to IWineD3DDevice_GetDepthStencilSurface failed
\n
"
);
*
ppZStencilSurface
=
NULL
;
}
LeaveCriticalSection
(
&
d3d9_cs
);
return
hr
;
...
...
dlls/d3d9/tests/device.c
View file @
e4f8a2da
...
...
@@ -1175,7 +1175,8 @@ static void test_depthstenciltest(void)
D3DPRESENT_PARAMETERS
d3dpp
;
D3DDISPLAYMODE
d3ddm
;
IDirect3DSurface9
*
pDepthStencil
=
NULL
;
DWORD
state
;
IDirect3DSurface9
*
pDepthStencil2
=
NULL
;
D3DZBUFFERTYPE
state
;
pD3d
=
pDirect3DCreate9
(
D3D_SDK_VERSION
);
ok
(
pD3d
!=
NULL
,
"Failed to create IDirect3D9 object
\n
"
);
...
...
@@ -1212,6 +1213,11 @@ static void test_depthstenciltest(void)
hr
=
IDirect3DDevice9_SetDepthStencilSurface
(
pDevice
,
NULL
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_SetDepthStencilSurface failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
/* Check if the set buffer is returned on a get. WineD3D had a bug with that once, prevent it from coming back */
hr
=
IDirect3DDevice9_GetDepthStencilSurface
(
pDevice
,
&
pDepthStencil2
);
ok
(
hr
==
D3DERR_NOTFOUND
&&
pDepthStencil2
==
NULL
,
"IDirect3DDevice9_GetDepthStencilSurface failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
if
(
pDepthStencil2
)
IDirect3DSurface9_Release
(
pDepthStencil2
);
/* This left the render states untouched! */
hr
=
IDirect3DDevice9_GetRenderState
(
pDevice
,
D3DRS_ZENABLE
,
&
state
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_GetRenderState failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
...
...
@@ -1244,6 +1250,74 @@ static void test_depthstenciltest(void)
hr
=
IDirect3DDevice9_Clear
(
pDevice
,
0
,
NULL
,
D3DCLEAR_ZBUFFER
,
0x00000000
,
1
.
0
,
0
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_Clear failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
if
(
pDepthStencil
)
IDirect3DSurface9_Release
(
pDepthStencil
);
if
(
pDevice
)
IDirect3D9_Release
(
pDevice
);
/* Now see if autodepthstencil disable is honored. First, without a format set */
ZeroMemory
(
&
d3dpp
,
sizeof
(
d3dpp
)
);
d3dpp
.
Windowed
=
TRUE
;
d3dpp
.
SwapEffect
=
D3DSWAPEFFECT_DISCARD
;
d3dpp
.
BackBufferWidth
=
800
;
d3dpp
.
BackBufferHeight
=
600
;
d3dpp
.
BackBufferFormat
=
d3ddm
.
Format
;
d3dpp
.
EnableAutoDepthStencil
=
FALSE
;
d3dpp
.
AutoDepthStencilFormat
=
D3DFMT_UNKNOWN
;
hr
=
IDirect3D9_CreateDevice
(
pD3d
,
D3DADAPTER_DEFAULT
,
D3DDEVTYPE_HAL
/* no NULLREF here */
,
hwnd
,
D3DCREATE_SOFTWARE_VERTEXPROCESSING
,
&
d3dpp
,
&
pDevice
);
ok
(
hr
==
D3D_OK
||
hr
==
D3DERR_NOTAVAILABLE
,
"IDirect3D9_CreateDevice failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
if
(
!
pDevice
)
{
skip
(
"Failed to create a d3d device
\n
"
);
goto
cleanup
;
}
pDepthStencil
=
NULL
;
hr
=
IDirect3DDevice9_GetDepthStencilSurface
(
pDevice
,
&
pDepthStencil
);
ok
(
hr
==
D3DERR_NOTFOUND
&&
pDepthStencil
==
NULL
,
"IDirect3DDevice9_GetDepthStencilSurface returned %s, surface = %p
\n
"
,
DXGetErrorString9
(
hr
),
pDepthStencil
);
if
(
pDepthStencil
)
{
IDirect3DSurface9_Release
(
pDepthStencil
);
pDepthStencil
=
NULL
;
}
/* Check the depth test state */
hr
=
IDirect3DDevice9_GetRenderState
(
pDevice
,
D3DRS_ZENABLE
,
&
state
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_GetRenderState failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
ok
(
state
==
D3DZB_FALSE
,
"D3DRS_ZENABLE is %s
\n
"
,
state
==
D3DZB_FALSE
?
"D3DZB_FALSE"
:
(
state
==
D3DZB_TRUE
?
"D3DZB_TRUE"
:
"D3DZB_USEW"
));
if
(
pDevice
)
IDirect3D9_Release
(
pDevice
);
/* Next, try EnableAutoDepthStencil FALSE with a depth stencil format set */
ZeroMemory
(
&
d3dpp
,
sizeof
(
d3dpp
)
);
d3dpp
.
Windowed
=
TRUE
;
d3dpp
.
SwapEffect
=
D3DSWAPEFFECT_DISCARD
;
d3dpp
.
BackBufferWidth
=
800
;
d3dpp
.
BackBufferHeight
=
600
;
d3dpp
.
BackBufferFormat
=
d3ddm
.
Format
;
d3dpp
.
EnableAutoDepthStencil
=
FALSE
;
d3dpp
.
AutoDepthStencilFormat
=
D3DFMT_D16
;
hr
=
IDirect3D9_CreateDevice
(
pD3d
,
D3DADAPTER_DEFAULT
,
D3DDEVTYPE_HAL
/* no NULLREF here */
,
hwnd
,
D3DCREATE_SOFTWARE_VERTEXPROCESSING
,
&
d3dpp
,
&
pDevice
);
ok
(
hr
==
D3D_OK
||
hr
==
D3DERR_NOTAVAILABLE
,
"IDirect3D9_CreateDevice failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
if
(
!
pDevice
)
{
skip
(
"Failed to create a d3d device
\n
"
);
goto
cleanup
;
}
pDepthStencil
=
NULL
;
hr
=
IDirect3DDevice9_GetDepthStencilSurface
(
pDevice
,
&
pDepthStencil
);
ok
(
hr
==
D3DERR_NOTFOUND
&&
pDepthStencil
==
NULL
,
"IDirect3DDevice9_GetDepthStencilSurface returned %s, surface = %p
\n
"
,
DXGetErrorString9
(
hr
),
pDepthStencil
);
if
(
pDepthStencil
)
{
IDirect3DSurface9_Release
(
pDepthStencil
);
pDepthStencil
=
NULL
;
}
hr
=
IDirect3DDevice9_GetRenderState
(
pDevice
,
D3DRS_ZENABLE
,
&
state
);
ok
(
hr
==
D3D_OK
,
"IDirect3DDevice9_GetRenderState failed with %s
\n
"
,
DXGetErrorString9
(
hr
));
ok
(
state
==
D3DZB_FALSE
,
"D3DRS_ZENABLE is %s
\n
"
,
state
==
D3DZB_FALSE
?
"D3DZB_FALSE"
:
(
state
==
D3DZB_TRUE
?
"D3DZB_TRUE"
:
"D3DZB_USEW"
));
cleanup:
if
(
pDepthStencil
)
IDirect3DSurface9_Release
(
pDepthStencil
);
if
(
pD3d
)
IDirect3D9_Release
(
pD3d
);
...
...
dlls/wined3d/device.c
View file @
e4f8a2da
...
...
@@ -1578,7 +1578,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
/* Under directX swapchains share the depth stencil, so only create one depth-stencil */
if
(
pPresentationParameters
->
EnableAutoDepthStencil
&&
hr
==
WINED3D_OK
)
{
TRACE
(
"Creating depth stencil buffer
\n
"
);
if
(
This
->
depthStencilB
uffer
==
NULL
)
{
if
(
This
->
auto_depth_stencil_b
uffer
==
NULL
)
{
hr
=
D3DCB_CreateDepthStencil
((
IUnknown
*
)
This
->
parent
,
parent
,
object
->
presentParms
.
BackBufferWidth
,
...
...
@@ -1587,10 +1587,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateAdditionalSwapChain(IWineD3DDevic
object
->
presentParms
.
MultiSampleType
,
object
->
presentParms
.
MultiSampleQuality
,
FALSE
/* FIXME: Discard */
,
&
This
->
depthStencilB
uffer
,
&
This
->
auto_depth_stencil_b
uffer
,
NULL
/* pShared (always null)*/
);
if
(
This
->
depthStencilB
uffer
!=
NULL
)
IWineD3DSurface_SetContainer
(
This
->
depthStencilB
uffer
,
0
);
if
(
This
->
auto_depth_stencil_b
uffer
!=
NULL
)
IWineD3DSurface_SetContainer
(
This
->
auto_depth_stencil_b
uffer
,
0
);
}
/** TODO: A check on width, height and multisample types
...
...
@@ -2054,7 +2054,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, WINED3DPR
This
->
lastThread
=
GetCurrentThreadId
();
/* Depth Stencil support */
This
->
stencilBufferTarget
=
This
->
depthStencilB
uffer
;
This
->
stencilBufferTarget
=
This
->
auto_depth_stencil_b
uffer
;
if
(
NULL
!=
This
->
stencilBufferTarget
)
{
IWineD3DSurface_AddRef
(
This
->
stencilBufferTarget
);
}
...
...
@@ -2206,8 +2206,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface, D3DCB_D
/* Release the buffers (with sanity checks)*/
TRACE
(
"Releasing the depth stencil buffer at %p
\n
"
,
This
->
stencilBufferTarget
);
if
(
This
->
stencilBufferTarget
!=
NULL
&&
(
IWineD3DSurface_Release
(
This
->
stencilBufferTarget
)
>
0
)){
if
(
This
->
depthStencilB
uffer
!=
This
->
stencilBufferTarget
)
FIXME
(
"(%p) Something's still holding the
depthStencilBuffer
\n
"
,
This
);
if
(
This
->
auto_depth_stencil_b
uffer
!=
This
->
stencilBufferTarget
)
FIXME
(
"(%p) Something's still holding the
stencilBufferTarget
\n
"
,
This
);
}
This
->
stencilBufferTarget
=
NULL
;
...
...
@@ -2218,11 +2218,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Uninit3D(IWineD3DDevice *iface, D3DCB_D
TRACE
(
"Setting rendertarget to NULL
\n
"
);
This
->
render_targets
[
0
]
=
NULL
;
if
(
This
->
depthStencilB
uffer
)
{
if
(
D3DCB_DestroyDepthStencilSurface
(
This
->
depthStencilB
uffer
)
>
0
)
{
FIXME
(
"(%p) Something's still holding the
depthStencilB
uffer
\n
"
,
This
);
if
(
This
->
auto_depth_stencil_b
uffer
)
{
if
(
D3DCB_DestroyDepthStencilSurface
(
This
->
auto_depth_stencil_b
uffer
)
>
0
)
{
FIXME
(
"(%p) Something's still holding the
auto depth stencil b
uffer
\n
"
,
This
);
}
This
->
depthStencilB
uffer
=
NULL
;
This
->
auto_depth_stencil_b
uffer
=
NULL
;
}
for
(
i
=
0
;
i
<
This
->
NumberOfSwapChains
;
i
++
)
{
...
...
@@ -6045,7 +6045,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetFrontBackBuffers(IWineD3DDevice *ifa
static
HRESULT
WINAPI
IWineD3DDeviceImpl_GetDepthStencilSurface
(
IWineD3DDevice
*
iface
,
IWineD3DSurface
**
ppZStencilSurface
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
*
ppZStencilSurface
=
This
->
depthStencilBuffer
;
*
ppZStencilSurface
=
This
->
stencilBufferTarget
;
TRACE
(
"(%p) : zStencilSurface returning %p
\n
"
,
This
,
*
ppZStencilSurface
);
if
(
*
ppZStencilSurface
!=
NULL
)
{
...
...
@@ -6387,7 +6387,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetDepthStencilSurface(IWineD3DDevice *
HRESULT
hr
=
WINED3D_OK
;
IWineD3DSurface
*
tmp
;
TRACE
(
"(%p) Swapping z-buffer
\n
"
,
This
);
TRACE
(
"(%p) Swapping z-buffer
. Old = %p, new = %p
\n
"
,
This
,
This
->
stencilBufferTarget
,
pNewZStencil
);
if
(
pNewZStencil
==
This
->
stencilBufferTarget
)
{
TRACE
(
"Trying to do a NOP SetRenderTarget operation
\n
"
);
...
...
dlls/wined3d/drawprim.c
View file @
e4f8a2da
...
...
@@ -630,7 +630,7 @@ static void depth_blt(IWineD3DDevice *iface, GLuint texture) {
static
void
depth_copy
(
IWineD3DDevice
*
iface
)
{
IWineD3DDeviceImpl
*
This
=
(
IWineD3DDeviceImpl
*
)
iface
;
IWineD3DSurfaceImpl
*
depth_stencil
=
(
IWineD3DSurfaceImpl
*
)
This
->
depthStencilB
uffer
;
IWineD3DSurfaceImpl
*
depth_stencil
=
(
IWineD3DSurfaceImpl
*
)
This
->
auto_depth_stencil_b
uffer
;
/* Only copy the depth buffer if there is one. */
if
(
!
depth_stencil
)
return
;
...
...
dlls/wined3d/state.c
View file @
e4f8a2da
...
...
@@ -107,6 +107,7 @@ static void state_lighting(DWORD state, IWineD3DStateBlockImpl *stateblock, Wine
static
void
state_zenable
(
DWORD
state
,
IWineD3DStateBlockImpl
*
stateblock
,
WineD3DContext
*
context
)
{
/* No z test without depth stencil buffers */
if
(
stateblock
->
wineD3DDevice
->
stencilBufferTarget
==
NULL
)
{
TRACE
(
"No Z buffer - disabling depth test
\n
"
);
glDisable
(
GL_DEPTH_TEST
);
/* This also disables z writing in gl */
checkGLcall
(
"glDisable GL_DEPTH_TEST"
);
return
;
...
...
dlls/wined3d/stateblock.c
View file @
e4f8a2da
...
...
@@ -1055,7 +1055,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat
TRACE
(
"Render states
\n
"
);
/* Render states: */
if
(
ThisDevice
->
depthStencilB
uffer
!=
NULL
)
{
if
(
ThisDevice
->
auto_depth_stencil_b
uffer
!=
NULL
)
{
IWineD3DDevice_SetRenderState
(
device
,
WINED3DRS_ZENABLE
,
WINED3DZB_TRUE
);
}
else
{
IWineD3DDevice_SetRenderState
(
device
,
WINED3DRS_ZENABLE
,
WINED3DZB_FALSE
);
...
...
dlls/wined3d/wined3d_private.h
View file @
e4f8a2da
...
...
@@ -685,7 +685,7 @@ struct IWineD3DDeviceImpl
/* Render Target Support */
IWineD3DSurface
**
render_targets
;
IWineD3DSurface
*
depthStencilB
uffer
;
IWineD3DSurface
*
auto_depth_stencil_b
uffer
;
IWineD3DSurface
**
fbo_color_attachments
;
IWineD3DSurface
*
fbo_depth_attachment
;
...
...
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