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
028960d9
Commit
028960d9
authored
Nov 28, 2013
by
Henri Verbeet
Committed by
Alexandre Julliard
Nov 28, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ddraw: Make the DDSURFACEDESC2 parameter to ddraw_surface_create_texture() const.
parent
2c109d2d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
26 deletions
+33
-26
ddraw.c
dlls/ddraw/ddraw.c
+4
-15
ddraw_private.h
dlls/ddraw/ddraw_private.h
+2
-2
surface.c
dlls/ddraw/surface.c
+27
-9
No files found.
dlls/ddraw/ddraw.c
View file @
028960d9
...
...
@@ -2808,21 +2808,13 @@ static HRESULT WINAPI ddraw7_StartModeTest(IDirectDraw7 *iface, SIZE *Modes, DWO
* DDERR_* if an error occurs
*
*****************************************************************************/
static
HRESULT
CreateSurface
(
struct
ddraw
*
ddraw
,
DDSURFACEDESC2
*
DDSD
,
static
HRESULT
CreateSurface
(
struct
ddraw
*
ddraw
,
const
DDSURFACEDESC2
*
surface_desc
,
struct
ddraw_surface
**
surface
,
IUnknown
*
UnkOuter
,
UINT
version
)
{
struct
ddraw_surface
*
object
=
NULL
;
HRESULT
hr
;
DDSURFACEDESC2
desc2
;
TRACE
(
"ddraw %p, surface_desc %p, surface %p, outer_unknown %p.
\n
"
,
ddraw
,
DDSD
,
surface
,
UnkOuter
);
/* Some checks before we start */
if
(
TRACE_ON
(
ddraw
))
{
TRACE
(
" (%p) Requesting surface desc :
\n
"
,
ddraw
);
DDRAW_dump_surface_desc
(
DDSD
);
}
TRACE
(
"ddraw %p, surface_desc %p, surface %p, outer_unknown %p.
\n
"
,
ddraw
,
surface_desc
,
surface
,
UnkOuter
);
if
(
UnkOuter
!=
NULL
)
{
...
...
@@ -2836,10 +2828,7 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD,
return
E_POINTER
;
/* unchecked */
}
/* Modify some flags */
copy_to_surfacedesc2
(
&
desc2
,
DDSD
);
if
(
FAILED
(
hr
=
ddraw_surface_create_texture
(
ddraw
,
&
desc2
,
version
,
&
object
)))
if
(
FAILED
(
hr
=
ddraw_surface_create_texture
(
ddraw
,
surface_desc
,
version
,
&
object
)))
{
WARN
(
"Failed to create texture, hr %#x.
\n
"
,
hr
);
return
hr
;
...
...
@@ -2848,7 +2837,7 @@ static HRESULT CreateSurface(struct ddraw *ddraw, DDSURFACEDESC2 *DDSD,
*
surface
=
object
;
if
(
desc2
.
ddsCaps
.
dwCaps
&
DDSCAPS_PRIMARYSURFACE
)
if
(
surface_desc
->
ddsCaps
.
dwCaps
&
DDSCAPS_PRIMARYSURFACE
)
ddraw
->
primary
=
object
;
return
hr
;
...
...
dlls/ddraw/ddraw_private.h
View file @
028960d9
...
...
@@ -193,7 +193,7 @@ struct ddraw_texture
struct
ddraw_surface
*
root
;
};
HRESULT
ddraw_surface_create_texture
(
struct
ddraw
*
ddraw
,
DDSURFACEDESC2
*
desc
,
HRESULT
ddraw_surface_create_texture
(
struct
ddraw
*
ddraw
,
const
DDSURFACEDESC2
*
desc
,
unsigned
int
version
,
struct
ddraw_surface
**
surface
)
DECLSPEC_HIDDEN
;
HRESULT
ddraw_surface_init
(
struct
ddraw_surface
*
surface
,
struct
ddraw
*
ddraw
,
struct
ddraw_texture
*
texture
,
struct
wined3d_surface
*
wined3d_surface
,
const
struct
wined3d_parent_ops
**
parent_ops
)
DECLSPEC_HIDDEN
;
...
...
@@ -611,7 +611,7 @@ struct member_info
#define SIZEOF_END_PADDING(type, last_field) \
(sizeof(type) - offsetof(type, last_field) - sizeof(((type *)0)->last_field))
static
inline
void
copy_to_surfacedesc2
(
DDSURFACEDESC2
*
to
,
DDSURFACEDESC2
*
from
)
static
inline
void
copy_to_surfacedesc2
(
DDSURFACEDESC2
*
to
,
const
DDSURFACEDESC2
*
from
)
{
DWORD
from_size
=
from
->
dwSize
;
if
(
from_size
==
sizeof
(
DDSURFACEDESC
))
...
...
dlls/ddraw/surface.c
View file @
028960d9
...
...
@@ -5589,7 +5589,7 @@ static HRESULT CDECL ddraw_reset_enum_callback(struct wined3d_resource *resource
return
DD_OK
;
}
HRESULT
ddraw_surface_create_texture
(
struct
ddraw
*
ddraw
,
DDSURFACEDESC2
*
desc
,
HRESULT
ddraw_surface_create_texture
(
struct
ddraw
*
ddraw
,
const
DDSURFACEDESC2
*
surface_
desc
,
unsigned
int
version
,
struct
ddraw_surface
**
surface
)
{
struct
ddraw_surface
*
root
,
*
mip
,
**
attach
;
...
...
@@ -5597,17 +5597,24 @@ HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, DDSURFACEDESC2 *desc,
struct
wined3d_texture
*
wined3d_texture
;
struct
wined3d_resource
*
resource
;
struct
wined3d_display_mode
mode
;
DDSURFACEDESC2
*
desc
,
*
mip_desc
;
struct
ddraw_texture
*
texture
;
UINT
layers
,
levels
,
i
,
j
;
DDSURFACEDESC2
*
mip_desc
;
HRESULT
hr
;
if
(
TRACE_ON
(
ddraw
))
{
TRACE
(
"Requesting surface desc:
\n
"
);
DDRAW_dump_surface_desc
(
desc
);
DDRAW_dump_surface_desc
(
surface_
desc
);
}
if
(
!
(
texture
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
texture
))))
return
E_OUTOFMEMORY
;
texture
->
version
=
version
;
copy_to_surfacedesc2
(
&
texture
->
surface_desc
,
surface_desc
);
desc
=
&
texture
->
surface_desc
;
/* Ensure DDSD_CAPS is always set. */
desc
->
dwFlags
|=
DDSD_CAPS
;
...
...
@@ -5621,6 +5628,7 @@ HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, DDSURFACEDESC2 *desc,
&&
!
(
ddraw
->
cooperative_level
&
DDSCL_EXCLUSIVE
))
{
WARN
(
"Tried to create a flippable primary surface without DDSCL_EXCLUSIVE.
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
texture
);
return
DDERR_NOEXCLUSIVEMODE
;
}
...
...
@@ -5628,6 +5636,7 @@ HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, DDSURFACEDESC2 *desc,
==
(
DDSCAPS_BACKBUFFER
|
DDSCAPS_PRIMARYSURFACE
))
{
WARN
(
"Tried to create a back buffer surface.
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
texture
);
return
DDERR_INVALIDCAPS
;
}
...
...
@@ -5636,6 +5645,7 @@ HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, DDSURFACEDESC2 *desc,
==
(
DDSCAPS_VIDEOMEMORY
|
DDSCAPS_SYSTEMMEMORY
))
{
WARN
(
"Tried to create a surface in both system and video memory.
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
texture
);
return
DDERR_INVALIDCAPS
;
}
...
...
@@ -5643,6 +5653,7 @@ HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, DDSURFACEDESC2 *desc,
&&
!
(
desc
->
ddsCaps
.
dwCaps2
&
DDSCAPS2_CUBEMAP
))
{
WARN
(
"Cube map faces requested without cube map flag.
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
texture
);
return
DDERR_INVALIDCAPS
;
}
...
...
@@ -5650,6 +5661,7 @@ HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, DDSURFACEDESC2 *desc,
&&
!
(
desc
->
ddsCaps
.
dwCaps2
&
DDSCAPS2_CUBEMAP_ALLFACES
))
{
WARN
(
"Cube map without faces requested.
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
texture
);
return
DDERR_INVALIDPARAMS
;
}
...
...
@@ -5662,12 +5674,14 @@ HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, DDSURFACEDESC2 *desc,
if
(
!
(
desc
->
ddsCaps
.
dwCaps
&
DDSCAPS_TEXTURE
))
{
WARN
(
"DDSCAPS2_TEXTUREMANAGE used without DDSCAPS_TEXTURE, returning DDERR_INVALIDCAPS.
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
texture
);
return
DDERR_INVALIDCAPS
;
}
if
(
desc
->
ddsCaps
.
dwCaps
&
(
DDSCAPS_VIDEOMEMORY
|
DDSCAPS_SYSTEMMEMORY
))
{
WARN
(
"DDSCAPS2_TEXTUREMANAGE used width DDSCAPS_VIDEOMEMORY "
"or DDSCAPS_SYSTEMMEMORY, returning DDERR_INVALIDCAPS.
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
texture
);
return
DDERR_INVALIDCAPS
;
}
}
...
...
@@ -5675,6 +5689,7 @@ HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, DDSURFACEDESC2 *desc,
if
(
FAILED
(
hr
=
wined3d_get_adapter_display_mode
(
ddraw
->
wined3d
,
WINED3DADAPTER_DEFAULT
,
&
mode
,
NULL
)))
{
ERR
(
"Failed to get display mode, hr %#x.
\n
"
,
hr
);
HeapFree
(
GetProcessHeap
(),
0
,
texture
);
return
hr
;
}
...
...
@@ -5690,6 +5705,7 @@ HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, DDSURFACEDESC2 *desc,
if
(
wined3d_desc
.
format
==
WINED3DFMT_UNKNOWN
)
{
WARN
(
"Unsupported / unknown pixelformat.
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
texture
);
return
DDERR_INVALIDPIXELFORMAT
;
}
...
...
@@ -5699,6 +5715,7 @@ HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, DDSURFACEDESC2 *desc,
if
(
!
(
desc
->
ddsCaps
.
dwCaps
&
DDSCAPS_PRIMARYSURFACE
))
{
WARN
(
"No width / height specified.
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
texture
);
return
DDERR_INVALIDPARAMS
;
}
...
...
@@ -5708,7 +5725,10 @@ HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, DDSURFACEDESC2 *desc,
}
if
(
!
desc
->
dwWidth
||
!
desc
->
dwHeight
)
{
HeapFree
(
GetProcessHeap
(),
0
,
texture
);
return
DDERR_INVALIDPARAMS
;
}
if
(
desc
->
ddsCaps
.
dwCaps
&
DDSCAPS_PRIMARYSURFACE
)
{
...
...
@@ -5728,6 +5748,7 @@ HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, DDSURFACEDESC2 *desc,
&
swapchain_desc
,
NULL
,
ddraw_reset_enum_callback
,
TRUE
)))
{
ERR
(
"Failed to reset device.
\n
"
);
HeapFree
(
GetProcessHeap
(),
0
,
texture
);
return
hr
;
}
}
...
...
@@ -5757,7 +5778,10 @@ HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, DDSURFACEDESC2 *desc,
{
/* Mipmap count is given, should not be 0. */
if
(
!
desc
->
u2
.
dwMipMapCount
)
{
HeapFree
(
GetProcessHeap
(),
0
,
texture
);
return
DDERR_INVALIDPARAMS
;
}
}
else
{
...
...
@@ -5853,12 +5877,6 @@ HRESULT ddraw_surface_create_texture(struct ddraw *ddraw, DDSURFACEDESC2 *desc,
if
(
desc
->
ddsCaps
.
dwCaps
&
DDSCAPS_OWNDC
)
wined3d_desc
.
usage
|=
WINED3DUSAGE_OWNDC
;
if
(
!
(
texture
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
texture
))))
return
E_OUTOFMEMORY
;
texture
->
version
=
version
;
copy_to_surfacedesc2
(
&
texture
->
surface_desc
,
desc
);
if
(
desc
->
ddsCaps
.
dwCaps2
&
DDSCAPS2_CUBEMAP
)
{
wined3d_desc
.
resource_type
=
WINED3D_RTYPE_CUBE_TEXTURE
;
...
...
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