Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lorenzo Ferrillo
wine
Commits
cbc009b8
Commit
cbc009b8
authored
13 years ago
by
Henri Verbeet
Committed by
Alexandre Julliard
13 years ago
Browse files
Options
Downloads
Patches
Plain Diff
ddraw: Also check errors returned by ddraw_create_gdi_swapchain() in CreateSurface().
parent
19da825b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dlls/ddraw/ddraw.c
+42
-38
42 additions, 38 deletions
dlls/ddraw/ddraw.c
with
42 additions
and
38 deletions
dlls/ddraw/ddraw.c
+
42
−
38
View file @
cbc009b8
...
...
@@ -3209,49 +3209,57 @@ static HRESULT CreateSurface(IDirectDrawImpl *ddraw, DDSURFACEDESC2 *DDSD,
return
hr
;
}
/* If the implementation is OpenGL and there's no d3ddevice, attach a d3ddevice
* But attach the d3ddevice only if the currently created surface was
* a primary surface (2D app in 3D mode) or a 3DDEVICE surface (3D app)
* The only case I can think of where this doesn't apply is when a
* 2D app was configured by the user to run with OpenGL and it didn't create
* the render target as first surface. In this case the render target creation
* will cause the 3D init. */
if
(
DefaultSurfaceType
==
SURFACE_OPENGL
&&
!
ddraw
->
d3d_initialized
&&
desc2
.
ddsCaps
.
dwCaps
&
(
DDSCAPS_PRIMARYSURFACE
|
DDSCAPS_3DDEVICE
))
{
IDirectDrawSurfaceImpl
*
target
=
object
,
*
surface
;
struct
list
*
entry
;
/* Search for the primary to use as render target */
LIST_FOR_EACH
(
entry
,
&
ddraw
->
surface_list
)
if
(
!
ddraw
->
d3d_initialized
&&
desc2
.
ddsCaps
.
dwCaps
&
(
DDSCAPS_PRIMARYSURFACE
|
DDSCAPS_3DDEVICE
))
{
HRESULT
hr
=
WINED3D_OK
;
/* If the implementation is OpenGL and there's no d3ddevice, attach a
* d3ddevice. But attach the d3ddevice only if the currently created
* surface was a primary surface (2D app in 3D mode) or a 3DDEVICE
* surface (3D app). The only case I can think of where this doesn't
* apply is when a 2D app was configured by the user to run with
* OpenGL and it didn't create the render target as first surface. In
* this case the render target creation will cause the 3D init. */
if
(
DefaultSurfaceType
==
SURFACE_OPENGL
)
{
surface
=
LIST_ENTRY
(
entry
,
IDirectDrawSurfaceImpl
,
surface_list_entry
);
if
((
surface
->
surface_desc
.
ddsCaps
.
dwCaps
&
(
DDSCAPS_PRIMARYSURFACE
|
DDSCAPS_FRONTBUFFER
))
==
(
DDSCAPS_PRIMARYSURFACE
|
DDSCAPS_FRONTBUFFER
))
IDirectDrawSurfaceImpl
*
target
=
object
,
*
surface
;
struct
list
*
entry
;
/* Search for the primary to use as render target. */
LIST_FOR_EACH
(
entry
,
&
ddraw
->
surface_list
)
{
/* found */
target
=
surface
;
TRACE
(
"Using primary %p as render target
\n
"
,
target
);
break
;
surface
=
LIST_ENTRY
(
entry
,
IDirectDrawSurfaceImpl
,
surface_list_entry
);
if
((
surface
->
surface_desc
.
ddsCaps
.
dwCaps
&
(
DDSCAPS_PRIMARYSURFACE
|
DDSCAPS_FRONTBUFFER
))
==
(
DDSCAPS_PRIMARYSURFACE
|
DDSCAPS_FRONTBUFFER
))
{
TRACE
(
"Using primary %p as render target.
\n
"
,
target
);
target
=
surface
;
break
;
}
}
TRACE
(
"Attaching a D3DDevice, rendertarget = %p.
\n
"
,
target
);
hr
=
ddraw_attach_d3d_device
(
ddraw
,
target
);
}
else
if
(
desc2
.
ddsCaps
.
dwCaps
&
DDSCAPS_PRIMARYSURFACE
)
{
hr
=
ddraw_create_gdi_swapchain
(
ddraw
,
object
);
}
TRACE
(
"(%p) Attaching a D3DDevice, rendertarget = %p
\n
"
,
ddraw
,
target
);
hr
=
ddraw_attach_d3d_device
(
ddraw
,
target
);
if
(
hr
!=
D3D_OK
)
if
(
FAILED
(
hr
))
{
IDirectDrawSurfaceImpl
*
release_surf
;
ERR
(
"
ddraw_attach_d3d_device failed
, hr %#x
\n
"
,
hr
);
ERR
(
"
Failed to create swapchain
, hr %#x
.
\n
"
,
hr
);
*
Surf
=
NULL
;
/* The
before
created surface structures are in an incomplete
state here.
* Wine
D3D
holds the reference on the
IP
arents, and it
released them on the failure
* already. So the regular release
method implementation would fail on the attempt
*
to destroy either the IParents or the swapchain. So free the surface here.
*
The surface structure here is a list, not a tree, because onscreen targets
*
cannot be cube textures
*/
while
(
object
)
/* The
earlier
created surface structures are in an incomplete
*
state here.
Wine
d3d
holds the reference on the
p
arents, and it
*
released them on the failure
already. So the regular release
*
method implementation would fail on the attempt to destroy
*
either the parents or the swapchain. So free the surface here.
*
The surface structure here is a list, not a tree, because
* onscreen targets cannot be cube textures.
*/
while
(
object
)
{
release_surf
=
object
;
object
=
object
->
complex_array
[
0
];
...
...
@@ -3261,10 +3269,6 @@ static HRESULT CreateSurface(IDirectDrawImpl *ddraw, DDSURFACEDESC2 *DDSD,
return
hr
;
}
}
else
if
(
!
(
ddraw
->
d3d_initialized
)
&&
desc2
.
ddsCaps
.
dwCaps
&
DDSCAPS_PRIMARYSURFACE
)
{
ddraw_create_gdi_swapchain
(
ddraw
,
object
);
}
/* Create a WineD3DTexture if a texture was requested */
if
(
desc2
.
ddsCaps
.
dwCaps
&
DDSCAPS_TEXTURE
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment