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
7c928b6c
Commit
7c928b6c
authored
Nov 13, 2013
by
Henri Verbeet
Committed by
Alexandre Julliard
Nov 13, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Create textures for converted surfaces.
parent
afe5ceb7
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
26 deletions
+20
-26
surface.c
dlls/wined3d/surface.c
+20
-26
No files found.
dlls/wined3d/surface.c
View file @
7c928b6c
...
...
@@ -3310,23 +3310,13 @@ static inline const struct d3dfmt_converter_desc *find_converter(enum wined3d_fo
return
NULL
;
}
/*****************************************************************************
* surface_convert_format
*
* Creates a duplicate of a surface in a different format. Is used by Blt to
* blit between surfaces with different formats.
*
* Parameters
* source: Source surface
* fmt: Requested destination format
*
*****************************************************************************/
static
struct
wined3d_surface
*
surface_convert_format
(
struct
wined3d_surface
*
source
,
enum
wined3d_format_id
to_fmt
)
static
struct
wined3d_texture
*
surface_convert_format
(
struct
wined3d_surface
*
source
,
enum
wined3d_format_id
to_fmt
)
{
struct
wined3d_map_desc
src_map
,
dst_map
;
const
struct
d3dfmt_converter_desc
*
conv
;
struct
wined3d_surface
*
ret
=
NULL
;
HRESULT
hr
;
struct
wined3d_texture
*
ret
=
NULL
;
struct
wined3d_resource_desc
desc
;
struct
wined3d_surface
*
dst
;
conv
=
find_converter
(
source
->
resource
.
format
->
id
,
to_fmt
);
if
(
!
conv
)
...
...
@@ -3337,35 +3327,39 @@ static struct wined3d_surface *surface_convert_format(struct wined3d_surface *so
}
/* FIXME: Multisampled conversion? */
if
(
FAILED
(
hr
=
wined3d_surface_create
(
source
->
resource
.
device
,
source
->
resource
.
width
,
source
->
resource
.
height
,
to_fmt
,
0
,
WINED3D_POOL_SCRATCH
,
WINED3D_MULTISAMPLE_NONE
,
0
,
wined3d_resource_get_desc
(
&
source
->
resource
,
&
desc
);
desc
.
format
=
to_fmt
;
desc
.
usage
=
0
;
desc
.
pool
=
WINED3D_POOL_SCRATCH
;
if
(
FAILED
(
wined3d_texture_create_2d
(
source
->
resource
.
device
,
&
desc
,
1
,
WINED3D_SURFACE_MAPPABLE
|
WINED3D_SURFACE_DISCARD
,
NULL
,
&
wined3d_null_parent_ops
,
&
ret
)))
{
ERR
(
"Failed to create a destination surface for conversion.
\n
"
);
return
NULL
;
}
dst
=
surface_from_resource
(
wined3d_texture_get_sub_resource
(
ret
,
0
));
memset
(
&
src_map
,
0
,
sizeof
(
src_map
));
memset
(
&
dst_map
,
0
,
sizeof
(
dst_map
));
if
(
FAILED
(
hr
=
wined3d_surface_map
(
source
,
&
src_map
,
NULL
,
WINED3D_MAP_READONLY
)))
if
(
FAILED
(
wined3d_surface_map
(
source
,
&
src_map
,
NULL
,
WINED3D_MAP_READONLY
)))
{
ERR
(
"Failed to lock the source surface.
\n
"
);
wined3d_
surfac
e_decref
(
ret
);
wined3d_
textur
e_decref
(
ret
);
return
NULL
;
}
if
(
FAILED
(
hr
=
wined3d_surface_map
(
re
t
,
&
dst_map
,
NULL
,
WINED3D_MAP_READONLY
)))
if
(
FAILED
(
wined3d_surface_map
(
ds
t
,
&
dst_map
,
NULL
,
WINED3D_MAP_READONLY
)))
{
ERR
(
"Failed to lock the destination surface.
\n
"
);
wined3d_surface_unmap
(
source
);
wined3d_
surfac
e_decref
(
ret
);
wined3d_
textur
e_decref
(
ret
);
return
NULL
;
}
conv
->
convert
(
src_map
.
data
,
dst_map
.
data
,
src_map
.
row_pitch
,
dst_map
.
row_pitch
,
source
->
resource
.
width
,
source
->
resource
.
height
);
wined3d_surface_unmap
(
re
t
);
wined3d_surface_unmap
(
ds
t
);
wined3d_surface_unmap
(
source
);
return
ret
;
...
...
@@ -5945,7 +5939,7 @@ static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *
{
int
bpp
,
srcheight
,
srcwidth
,
dstheight
,
dstwidth
,
width
;
const
struct
wined3d_format
*
src_format
,
*
dst_format
;
struct
wined3d_
surface
*
orig_src
=
src_surface
;
struct
wined3d_
texture
*
src_texture
=
NULL
;
struct
wined3d_map_desc
dst_map
,
src_map
;
const
BYTE
*
sbase
=
NULL
;
HRESULT
hr
=
WINED3D_OK
;
...
...
@@ -5971,13 +5965,13 @@ static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *
{
if
(
dst_surface
->
resource
.
format
->
id
!=
src_surface
->
resource
.
format
->
id
)
{
src_surface
=
surface_convert_format
(
src_surface
,
dst_format
->
id
);
if
(
!
src_surface
)
if
(
!
(
src_texture
=
surface_convert_format
(
src_surface
,
dst_format
->
id
)))
{
/* The conv function writes a FIXME */
WARN
(
"Cannot convert source surface format to dest format.
\n
"
);
goto
release
;
}
src_surface
=
surface_from_resource
(
wined3d_texture_get_sub_resource
(
src_texture
,
0
));
}
wined3d_surface_map
(
src_surface
,
&
src_map
,
NULL
,
WINED3D_MAP_READONLY
);
src_format
=
src_surface
->
resource
.
format
;
...
...
@@ -6431,8 +6425,8 @@ release:
if
(
src_surface
&&
src_surface
!=
dst_surface
)
wined3d_surface_unmap
(
src_surface
);
/* Release the converted surface, if any. */
if
(
src_
surface
&&
src_surface
!=
orig_src
)
wined3d_
surface_decref
(
src_surfac
e
);
if
(
src_
texture
)
wined3d_
texture_decref
(
src_textur
e
);
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