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
ffae39c3
Commit
ffae39c3
authored
Apr 24, 2007
by
Stefan Dösinger
Committed by
Alexandre Julliard
May 01, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Update the wined3d depth stencil on device creation, render.
parent
37800544
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
60 additions
and
28 deletions
+60
-28
ddraw_private.h
dlls/ddraw/ddraw_private.h
+1
-0
device.c
dlls/ddraw/device.c
+50
-3
direct3d.c
dlls/ddraw/direct3d.c
+3
-15
surface.c
dlls/ddraw/surface.c
+6
-10
No files found.
dlls/ddraw/ddraw_private.h
View file @
ffae39c3
...
...
@@ -360,6 +360,7 @@ const GUID IID_D3DDEVICE_WineD3D;
/* Helper functions */
HRESULT
IDirect3DImpl_GetCaps
(
IWineD3D
*
WineD3D
,
D3DDEVICEDESC
*
Desc123
,
D3DDEVICEDESC7
*
Desc7
);
DWORD
IDirect3DDeviceImpl_CreateHandle
(
IDirect3DDeviceImpl
*
This
);
WINED3DZBUFFERTYPE
IDirect3DDeviceImpl_UpdateDepthStencil
(
IDirect3DDeviceImpl
*
This
);
/* Structures */
struct
EnumTextureFormatsCBS
...
...
dlls/ddraw/device.c
View file @
ffae39c3
...
...
@@ -1742,13 +1742,23 @@ IDirect3DDeviceImpl_7_SetRenderTarget(IDirect3DDevice7 *iface,
{
ICOM_THIS_FROM
(
IDirect3DDeviceImpl
,
IDirect3DDevice7
,
iface
);
IDirectDrawSurfaceImpl
*
Target
=
ICOM_OBJECT
(
IDirectDrawSurfaceImpl
,
IDirectDrawSurface7
,
NewTarget
);
HRESULT
hr
;
TRACE
(
"(%p)->(%p,%08x): Relay
\n
"
,
This
,
NewTarget
,
Flags
);
/* Flags: Not used */
return
IWineD3DDevice_SetRenderTarget
(
This
->
wineD3DDevice
,
0
,
Target
?
Target
->
WineD3DSurface
:
NULL
);
hr
=
IWineD3DDevice_SetRenderTarget
(
This
->
wineD3DDevice
,
0
,
Target
?
Target
->
WineD3DSurface
:
NULL
);
if
(
hr
!=
D3D_OK
)
{
return
hr
;
}
IDirectDrawSurface7_AddRef
(
NewTarget
);
IDirectDrawSurface7_Release
(
ICOM_INTERFACE
(
This
->
target
,
IDirectDrawSurface7
));
This
->
target
=
Target
;
IDirect3DDeviceImpl_UpdateDepthStencil
(
This
);
return
D3D_OK
;
}
static
HRESULT
WINAPI
...
...
@@ -5135,3 +5145,40 @@ IDirect3DDeviceImpl_CreateHandle(IDirect3DDeviceImpl *This)
TRACE
(
"Returning %d
\n
"
,
This
->
numHandles
);
return
This
->
numHandles
;
}
/*****************************************************************************
* IDirect3DDeviceImpl_UpdateDepthStencil
*
* Checks the current render target for attached depth stencils and sets the
* WineD3D depth stencil accordingly.
*
* Returns:
* The depth stencil state to set if creating the device
*
*****************************************************************************/
WINED3DZBUFFERTYPE
IDirect3DDeviceImpl_UpdateDepthStencil
(
IDirect3DDeviceImpl
*
This
)
{
IDirectDrawSurface7
*
depthStencil
=
NULL
;
IDirectDrawSurfaceImpl
*
dsi
;
static
DDSCAPS2
depthcaps
=
{
DDSCAPS_ZBUFFER
,
0
,
0
,
0
};
IDirectDrawSurface7_GetAttachedSurface
(
ICOM_INTERFACE
(
This
->
target
,
IDirectDrawSurface7
),
&
depthcaps
,
&
depthStencil
);
if
(
!
depthStencil
)
{
TRACE
(
"Setting wined3d depth stencil to NULL
\n
"
);
IWineD3DDevice_SetDepthStencilSurface
(
This
->
wineD3DDevice
,
NULL
);
return
WINED3DZB_FALSE
;
}
dsi
=
ICOM_OBJECT
(
IDirectDrawSurfaceImpl
,
IDirectDrawSurface7
,
depthStencil
);
TRACE
(
"Setting wined3d depth stencil to %p (wined3d %p)
\n
"
,
dsi
,
dsi
->
WineD3DSurface
);
IWineD3DDevice_SetDepthStencilSurface
(
This
->
wineD3DDevice
,
dsi
->
WineD3DSurface
);
IDirectDrawSurface7_Release
(
depthStencil
);
return
WINED3DZB_TRUE
;
}
dlls/ddraw/direct3d.c
View file @
ffae39c3
...
...
@@ -735,8 +735,6 @@ IDirect3DImpl_7_CreateDevice(IDirect3D7 *iface,
IParentImpl
*
IndexBufferParent
;
HRESULT
hr
;
IDirectDrawSurfaceImpl
*
target
=
ICOM_OBJECT
(
IDirectDrawSurfaceImpl
,
IDirectDrawSurface7
,
Surface
);
IDirectDrawSurface7
*
depthbuffer
=
NULL
;
static
DDSCAPS2
depthcaps
=
{
DDSCAPS_ZBUFFER
,
0
,
0
,
0
};
TRACE
(
"(%p)->(%s,%p,%p)
\n
"
,
iface
,
debugstr_guid
(
refiid
),
Surface
,
Device
);
*
Device
=
NULL
;
...
...
@@ -876,19 +874,9 @@ IDirect3DImpl_7_CreateDevice(IDirect3D7 *iface,
This
->
d3ddevice
=
object
;
/* Look for a depth buffer and enable the Z test if one is found */
hr
=
IDirectDrawSurface7_GetAttachedSurface
(
Surface
,
&
depthcaps
,
&
depthbuffer
);
if
(
depthbuffer
)
{
TRACE
(
"(%p) Depth buffer found, enabling Z test
\n
"
,
object
);
IWineD3DDevice_SetRenderState
(
This
->
wineD3DDevice
,
WINED3DRS_ZENABLE
,
TRUE
);
IDirectDrawSurface7_Release
(
depthbuffer
);
}
IWineD3DDevice_SetRenderState
(
This
->
wineD3DDevice
,
WINED3DRS_ZENABLE
,
IDirect3DDeviceImpl_UpdateDepthStencil
(
object
));
return
D3D_OK
;
}
...
...
dlls/ddraw/surface.c
View file @
ffae39c3
...
...
@@ -825,12 +825,10 @@ IDirectDrawSurfaceImpl_AddAttachedSurface(IDirectDrawSurface7 *iface,
Surf
->
first_attached
=
This
->
first_attached
;
This
->
next_attached
=
Surf
;
/* Check if we attach a back buffer to the primary */
if
(
Surf
->
surface_desc
.
ddsCaps
.
dwCaps
&
DDSCAPS_ZBUFFER
&&
This
->
surface_desc
.
ddsCaps
.
dwCaps
&
DDSCAPS_PRIMARYSURFACE
)
/* Check if the WineD3D depth stencil needs updating */
if
(
This
->
ddraw
->
d3ddevice
)
{
IWineD3DDevice_SetDepthStencilSurface
(
This
->
ddraw
->
wineD3DDevice
,
Surf
->
WineD3DSurface
);
IDirect3DDeviceImpl_UpdateDepthStencil
(
This
->
ddraw
->
d3ddevice
);
}
/* MSDN:
...
...
@@ -892,12 +890,10 @@ IDirectDrawSurfaceImpl_DeleteAttachedSurface(IDirectDrawSurface7 *iface,
Surf
->
next_attached
=
NULL
;
Surf
->
first_attached
=
Surf
;
/* Check if we attach a back buffer to the primary */
if
(
Surf
->
surface_desc
.
ddsCaps
.
dwCaps
&
DDSCAPS_ZBUFFER
&&
This
->
surface_desc
.
ddsCaps
.
dwCaps
&
DDSCAPS_PRIMARYSURFACE
)
/* Check if the WineD3D depth stencil needs updating */
if
(
This
->
ddraw
->
d3ddevice
)
{
IWineD3DDevice_SetDepthStencilSurface
(
This
->
ddraw
->
wineD3DDevice
,
NULL
);
IDirect3DDeviceImpl_UpdateDepthStencil
(
This
->
ddraw
->
d3ddevice
);
}
IDirectDrawSurface7_Release
(
Attach
);
...
...
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