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
c70376af
Commit
c70376af
authored
Sep 19, 2013
by
Henri Verbeet
Committed by
Alexandre Julliard
Sep 19, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Verify that the surface is in video memory in SetRenderTarget().
This is where things become a bit of a mess, because the error checking is inconsistent between versions.
parent
ed923693
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
87 additions
and
26 deletions
+87
-26
device.c
dlls/ddraw/device.c
+87
-26
No files found.
dlls/ddraw/device.c
View file @
c70376af
...
...
@@ -1810,32 +1810,14 @@ static HRESULT d3d_device_set_render_target(struct d3d_device *device,
{
HRESULT
hr
;
wined3d_mutex_lock
();
if
(
!
validate_surface_palette
(
target
))
{
WARN
(
"Surface %p has an indexed pixel format, but no palette.
\n
"
,
target
);
wined3d_mutex_unlock
();
return
DDERR_INVALIDCAPS
;
}
if
(
!
(
target
->
surface_desc
.
ddsCaps
.
dwCaps
&
DDSCAPS_3DDEVICE
))
{
WARN
(
"Surface %p is not a render target.
\n
"
,
target
);
wined3d_mutex_unlock
();
return
DDERR_INVALIDCAPS
;
}
if
(
device
->
rt_iface
==
rt_iface
)
{
TRACE
(
"No-op SetRenderTarget operation, not doing anything
\n
"
);
wined3d_mutex_unlock
();
return
D3D_OK
;
}
if
(
!
target
)
{
WARN
(
"Trying to set render target to NULL.
\n
"
);
wined3d_mutex_unlock
();
return
DDERR_INVALIDPARAMS
;
}
...
...
@@ -1844,14 +1826,9 @@ static HRESULT d3d_device_set_render_target(struct d3d_device *device,
device
->
rt_iface
=
rt_iface
;
if
(
FAILED
(
hr
=
wined3d_device_set_render_target
(
device
->
wined3d_device
,
0
,
target
->
wined3d_surface
,
FALSE
)))
{
wined3d_mutex_unlock
();
return
hr
;
}
d3d_device_update_depth_stencil
(
device
);
wined3d_mutex_unlock
();
return
D3D_OK
;
}
...
...
@@ -1860,10 +1837,36 @@ static HRESULT d3d_device7_SetRenderTarget(IDirect3DDevice7 *iface,
{
struct
ddraw_surface
*
target_impl
=
unsafe_impl_from_IDirectDrawSurface7
(
target
);
struct
d3d_device
*
device
=
impl_from_IDirect3DDevice7
(
iface
);
HRESULT
hr
;
TRACE
(
"iface %p, target %p, flags %#x.
\n
"
,
iface
,
target
,
flags
);
return
d3d_device_set_render_target
(
device
,
target_impl
,
(
IUnknown
*
)
target
);
wined3d_mutex_lock
();
if
(
!
validate_surface_palette
(
target_impl
))
{
WARN
(
"Surface %p has an indexed pixel format, but no palette.
\n
"
,
target_impl
);
wined3d_mutex_unlock
();
return
DDERR_INVALIDCAPS
;
}
if
(
!
(
target_impl
->
surface_desc
.
ddsCaps
.
dwCaps
&
DDSCAPS_3DDEVICE
))
{
WARN
(
"Surface %p is not a render target.
\n
"
,
target_impl
);
wined3d_mutex_unlock
();
return
DDERR_INVALIDCAPS
;
}
if
(
!
(
target_impl
->
surface_desc
.
ddsCaps
.
dwCaps
&
DDSCAPS_VIDEOMEMORY
))
{
WARN
(
"Surface %p is not in video memory.
\n
"
,
target_impl
);
wined3d_mutex_unlock
();
return
DDERR_INVALIDPARAMS
;
}
hr
=
d3d_device_set_render_target
(
device
,
target_impl
,
(
IUnknown
*
)
target
);
wined3d_mutex_unlock
();
return
hr
;
}
static
HRESULT
WINAPI
d3d_device7_SetRenderTarget_FPUSetup
(
IDirect3DDevice7
*
iface
,
...
...
@@ -1890,10 +1893,39 @@ static HRESULT WINAPI d3d_device3_SetRenderTarget(IDirect3DDevice3 *iface,
{
struct
ddraw_surface
*
target_impl
=
unsafe_impl_from_IDirectDrawSurface4
(
target
);
struct
d3d_device
*
device
=
impl_from_IDirect3DDevice3
(
iface
);
HRESULT
hr
;
TRACE
(
"iface %p, target %p, flags %#x.
\n
"
,
iface
,
target
,
flags
);
return
d3d_device_set_render_target
(
device
,
target_impl
,
(
IUnknown
*
)
target
);
wined3d_mutex_lock
();
if
(
!
validate_surface_palette
(
target_impl
))
{
WARN
(
"Surface %p has an indexed pixel format, but no palette.
\n
"
,
target_impl
);
wined3d_mutex_unlock
();
return
DDERR_INVALIDCAPS
;
}
if
(
!
(
target_impl
->
surface_desc
.
ddsCaps
.
dwCaps
&
DDSCAPS_3DDEVICE
))
{
WARN
(
"Surface %p is not a render target.
\n
"
,
target_impl
);
wined3d_mutex_unlock
();
return
DDERR_INVALIDCAPS
;
}
if
(
!
(
target_impl
->
surface_desc
.
ddsCaps
.
dwCaps
&
DDSCAPS_VIDEOMEMORY
))
{
WARN
(
"Surface %p is not in video memory.
\n
"
,
target_impl
);
IDirectDrawSurface4_AddRef
(
target
);
IUnknown_Release
(
device
->
rt_iface
);
device
->
rt_iface
=
(
IUnknown
*
)
target
;
wined3d_mutex_unlock
();
return
D3D_OK
;
}
hr
=
d3d_device_set_render_target
(
device
,
target_impl
,
(
IUnknown
*
)
target
);
wined3d_mutex_unlock
();
return
hr
;
}
static
HRESULT
WINAPI
d3d_device2_SetRenderTarget
(
IDirect3DDevice2
*
iface
,
...
...
@@ -1901,10 +1933,39 @@ static HRESULT WINAPI d3d_device2_SetRenderTarget(IDirect3DDevice2 *iface,
{
struct
ddraw_surface
*
target_impl
=
unsafe_impl_from_IDirectDrawSurface
(
target
);
struct
d3d_device
*
device
=
impl_from_IDirect3DDevice2
(
iface
);
HRESULT
hr
;
TRACE
(
"iface %p, target %p, flags %#x.
\n
"
,
iface
,
target
,
flags
);
return
d3d_device_set_render_target
(
device
,
target_impl
,
(
IUnknown
*
)
target
);
wined3d_mutex_lock
();
if
(
!
validate_surface_palette
(
target_impl
))
{
WARN
(
"Surface %p has an indexed pixel format, but no palette.
\n
"
,
target_impl
);
wined3d_mutex_unlock
();
return
DDERR_INVALIDCAPS
;
}
if
(
!
(
target_impl
->
surface_desc
.
ddsCaps
.
dwCaps
&
DDSCAPS_3DDEVICE
))
{
WARN
(
"Surface %p is not a render target.
\n
"
,
target_impl
);
wined3d_mutex_unlock
();
return
DDERR_INVALIDCAPS
;
}
if
(
!
(
target_impl
->
surface_desc
.
ddsCaps
.
dwCaps
&
DDSCAPS_VIDEOMEMORY
))
{
WARN
(
"Surface %p is not in video memory.
\n
"
,
target_impl
);
IDirectDrawSurface_AddRef
(
target
);
IUnknown_Release
(
device
->
rt_iface
);
device
->
rt_iface
=
(
IUnknown
*
)
target
;
wined3d_mutex_unlock
();
return
D3D_OK
;
}
hr
=
d3d_device_set_render_target
(
device
,
target_impl
,
(
IUnknown
*
)
target
);
wined3d_mutex_unlock
();
return
hr
;
}
/*****************************************************************************
...
...
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