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
90696dfe
Commit
90696dfe
authored
Feb 21, 2018
by
Henri Verbeet
Committed by
Alexandre Julliard
Feb 21, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Store overlay info in textures instead of in surfaces.
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d31651b7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
73 additions
and
48 deletions
+73
-48
texture.c
dlls/wined3d/texture.c
+64
-41
wined3d_private.h
dlls/wined3d/wined3d_private.h
+9
-7
No files found.
dlls/wined3d/texture.c
View file @
90696dfe
...
@@ -654,6 +654,21 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture)
...
@@ -654,6 +654,21 @@ static void wined3d_texture_cleanup(struct wined3d_texture *texture)
context_release
(
context
);
context_release
(
context
);
texture
->
texture_ops
->
texture_cleanup_sub_resources
(
texture
);
texture
->
texture_ops
->
texture_cleanup_sub_resources
(
texture
);
if
(
texture
->
overlay_info
)
{
for
(
i
=
0
;
i
<
sub_count
;
++
i
)
{
struct
wined3d_overlay_info
*
info
=
&
texture
->
overlay_info
[
i
];
struct
wined3d_overlay_info
*
overlay
,
*
cur
;
list_remove
(
&
info
->
entry
);
LIST_FOR_EACH_ENTRY_SAFE
(
overlay
,
cur
,
&
info
->
overlays
,
struct
wined3d_overlay_info
,
entry
)
{
list_remove
(
&
overlay
->
entry
);
}
}
heap_free
(
texture
->
overlay_info
);
}
wined3d_texture_unload_gl_texture
(
texture
);
wined3d_texture_unload_gl_texture
(
texture
);
}
}
...
@@ -1700,7 +1715,6 @@ static void texture2d_cleanup_sub_resources(struct wined3d_texture *texture)
...
@@ -1700,7 +1715,6 @@ static void texture2d_cleanup_sub_resources(struct wined3d_texture *texture)
struct
wined3d_renderbuffer_entry
*
entry
,
*
entry2
;
struct
wined3d_renderbuffer_entry
*
entry
,
*
entry2
;
const
struct
wined3d_gl_info
*
gl_info
=
NULL
;
const
struct
wined3d_gl_info
*
gl_info
=
NULL
;
struct
wined3d_context
*
context
=
NULL
;
struct
wined3d_context
*
context
=
NULL
;
struct
wined3d_surface
*
overlay
,
*
cur
;
struct
wined3d_surface
*
surface
;
struct
wined3d_surface
*
surface
;
unsigned
int
i
;
unsigned
int
i
;
...
@@ -1728,15 +1742,6 @@ static void texture2d_cleanup_sub_resources(struct wined3d_texture *texture)
...
@@ -1728,15 +1742,6 @@ static void texture2d_cleanup_sub_resources(struct wined3d_texture *texture)
if
(
surface
->
dc
)
if
(
surface
->
dc
)
texture2d_destroy_dc
(
surface
);
texture2d_destroy_dc
(
surface
);
if
(
surface
->
overlay_dest
)
list_remove
(
&
surface
->
overlay_entry
);
LIST_FOR_EACH_ENTRY_SAFE
(
overlay
,
cur
,
&
surface
->
overlays
,
struct
wined3d_surface
,
overlay_entry
)
{
list_remove
(
&
overlay
->
overlay_entry
);
overlay
->
overlay_dest
=
NULL
;
}
}
}
if
(
context
)
if
(
context
)
context_release
(
context
);
context_release
(
context
);
...
@@ -2031,7 +2036,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
...
@@ -2031,7 +2036,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
struct
wined3d_surface
*
surfaces
;
struct
wined3d_surface
*
surfaces
;
UINT
pow2_width
,
pow2_height
;
UINT
pow2_width
,
pow2_height
;
unsigned
int
i
,
j
;
unsigned
int
i
,
j
,
sub_count
;
HRESULT
hr
;
HRESULT
hr
;
if
(
!
(
desc
->
usage
&
WINED3DUSAGE_LEGACY_CUBEMAP
)
&&
layer_count
>
1
if
(
!
(
desc
->
usage
&
WINED3DUSAGE_LEGACY_CUBEMAP
)
&&
layer_count
>
1
...
@@ -2177,13 +2182,30 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
...
@@ -2177,13 +2182,30 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
if
(
wined3d_texture_use_pbo
(
texture
,
gl_info
))
if
(
wined3d_texture_use_pbo
(
texture
,
gl_info
))
texture
->
resource
.
map_binding
=
WINED3D_LOCATION_BUFFER
;
texture
->
resource
.
map_binding
=
WINED3D_LOCATION_BUFFER
;
if
(
level_count
>
~
(
SIZE_T
)
0
/
layer_count
sub_count
=
level_count
*
layer_count
;
||
!
(
surfaces
=
heap_calloc
(
level_count
*
layer_count
,
sizeof
(
*
surfaces
))))
if
(
sub_count
/
layer_count
!=
level_count
||
!
(
surfaces
=
heap_calloc
(
sub_count
,
sizeof
(
*
surfaces
))))
{
wined3d_texture_cleanup_sync
(
texture
);
return
E_OUTOFMEMORY
;
}
if
(
desc
->
usage
&
WINED3DUSAGE_OVERLAY
)
{
if
(
!
(
texture
->
overlay_info
=
heap_calloc
(
sub_count
,
sizeof
(
*
texture
->
overlay_info
))))
{
{
heap_free
(
surfaces
);
wined3d_texture_cleanup_sync
(
texture
);
wined3d_texture_cleanup_sync
(
texture
);
return
E_OUTOFMEMORY
;
return
E_OUTOFMEMORY
;
}
}
for
(
i
=
0
;
i
<
sub_count
;
++
i
)
{
list_init
(
&
texture
->
overlay_info
[
i
].
entry
);
list_init
(
&
texture
->
overlay_info
[
i
].
overlays
);
}
}
/* Generate all the surfaces. */
/* Generate all the surfaces. */
for
(
i
=
0
;
i
<
texture
->
level_count
;
++
i
)
for
(
i
=
0
;
i
<
texture
->
level_count
;
++
i
)
{
{
...
@@ -2208,7 +2230,6 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
...
@@ -2208,7 +2230,6 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
surface
->
texture_level
=
i
;
surface
->
texture_level
=
i
;
surface
->
texture_layer
=
j
;
surface
->
texture_layer
=
j
;
list_init
(
&
surface
->
renderbuffers
);
list_init
(
&
surface
->
renderbuffers
);
list_init
(
&
surface
->
overlays
);
sub_resource
=
&
texture
->
sub_resources
[
idx
];
sub_resource
=
&
texture
->
sub_resources
[
idx
];
sub_resource
->
locations
=
WINED3D_LOCATION_DISCARDED
;
sub_resource
->
locations
=
WINED3D_LOCATION_DISCARDED
;
...
@@ -2696,19 +2717,19 @@ HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned
...
@@ -2696,19 +2717,19 @@ HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned
HRESULT
CDECL
wined3d_texture_get_overlay_position
(
const
struct
wined3d_texture
*
texture
,
HRESULT
CDECL
wined3d_texture_get_overlay_position
(
const
struct
wined3d_texture
*
texture
,
unsigned
int
sub_resource_idx
,
LONG
*
x
,
LONG
*
y
)
unsigned
int
sub_resource_idx
,
LONG
*
x
,
LONG
*
y
)
{
{
struct
wined3d_
surface
*
surface
;
struct
wined3d_
overlay_info
*
overlay
;
TRACE
(
"texture %p, sub_resource_idx %u, x %p, y %p.
\n
"
,
texture
,
sub_resource_idx
,
x
,
y
);
TRACE
(
"texture %p, sub_resource_idx %u, x %p, y %p.
\n
"
,
texture
,
sub_resource_idx
,
x
,
y
);
if
(
!
(
texture
->
resource
.
usage
&
WINED3DUSAGE_OVERLAY
)
||
texture
->
resource
.
type
!=
WINED3D_RTYPE_TEXTURE_2D
if
(
!
(
texture
->
resource
.
usage
&
WINED3DUSAGE_OVERLAY
)
||
sub_resource_idx
>=
texture
->
level_count
*
texture
->
layer_count
)
||
sub_resource_idx
>=
texture
->
level_count
*
texture
->
layer_count
)
{
{
WARN
(
"Invalid sub-resource specified.
\n
"
);
WARN
(
"Invalid sub-resource specified.
\n
"
);
return
WINEDDERR_NOTAOVERLAYSURFACE
;
return
WINEDDERR_NOTAOVERLAYSURFACE
;
}
}
surface
=
texture
->
sub_resources
[
sub_resource_idx
].
u
.
surface
;
overlay
=
&
texture
->
overlay_info
[
sub_resource_idx
]
;
if
(
!
surface
->
overlay_de
st
)
if
(
!
overlay
->
d
st
)
{
{
TRACE
(
"Overlay not visible.
\n
"
);
TRACE
(
"Overlay not visible.
\n
"
);
*
x
=
0
;
*
x
=
0
;
...
@@ -2716,8 +2737,8 @@ HRESULT CDECL wined3d_texture_get_overlay_position(const struct wined3d_texture
...
@@ -2716,8 +2737,8 @@ HRESULT CDECL wined3d_texture_get_overlay_position(const struct wined3d_texture
return
WINEDDERR_OVERLAYNOTVISIBLE
;
return
WINEDDERR_OVERLAYNOTVISIBLE
;
}
}
*
x
=
surface
->
overlay_dest
rect
.
left
;
*
x
=
overlay
->
dst_
rect
.
left
;
*
y
=
surface
->
overlay_dest
rect
.
top
;
*
y
=
overlay
->
dst_
rect
.
top
;
TRACE
(
"Returning position %d, %d.
\n
"
,
*
x
,
*
y
);
TRACE
(
"Returning position %d, %d.
\n
"
,
*
x
,
*
y
);
...
@@ -2727,23 +2748,22 @@ HRESULT CDECL wined3d_texture_get_overlay_position(const struct wined3d_texture
...
@@ -2727,23 +2748,22 @@ HRESULT CDECL wined3d_texture_get_overlay_position(const struct wined3d_texture
HRESULT
CDECL
wined3d_texture_set_overlay_position
(
struct
wined3d_texture
*
texture
,
HRESULT
CDECL
wined3d_texture_set_overlay_position
(
struct
wined3d_texture
*
texture
,
unsigned
int
sub_resource_idx
,
LONG
x
,
LONG
y
)
unsigned
int
sub_resource_idx
,
LONG
x
,
LONG
y
)
{
{
struct
wined3d_texture_sub_resource
*
sub_resource
;
struct
wined3d_overlay_info
*
overlay
;
struct
wined3d_surface
*
surface
;
LONG
w
,
h
;
LONG
w
,
h
;
TRACE
(
"texture %p, sub_resource_idx %u, x %d, y %d.
\n
"
,
texture
,
sub_resource_idx
,
x
,
y
);
TRACE
(
"texture %p, sub_resource_idx %u, x %d, y %d.
\n
"
,
texture
,
sub_resource_idx
,
x
,
y
);
if
(
!
(
texture
->
resource
.
usage
&
WINED3DUSAGE_OVERLAY
)
||
texture
->
resource
.
type
!=
WINED3D_RTYPE_TEXTURE_2D
if
(
!
(
texture
->
resource
.
usage
&
WINED3DUSAGE_OVERLAY
)
||
!
(
sub_resource
=
wined3d_texture_get_sub_resource
(
texture
,
sub_resource_idx
))
)
||
sub_resource_idx
>=
texture
->
level_count
*
texture
->
layer_count
)
{
{
WARN
(
"Invalid sub-resource specified.
\n
"
);
WARN
(
"Invalid sub-resource specified.
\n
"
);
return
WINEDDERR_NOTAOVERLAYSURFACE
;
return
WINEDDERR_NOTAOVERLAYSURFACE
;
}
}
surface
=
sub_resource
->
u
.
surface
;
overlay
=
&
texture
->
overlay_info
[
sub_resource_idx
]
;
w
=
surface
->
overlay_destrect
.
right
-
surface
->
overlay_dest
rect
.
left
;
w
=
overlay
->
dst_rect
.
right
-
overlay
->
dst_
rect
.
left
;
h
=
surface
->
overlay_destrect
.
bottom
-
surface
->
overlay_dest
rect
.
top
;
h
=
overlay
->
dst_rect
.
bottom
-
overlay
->
dst_
rect
.
top
;
SetRect
(
&
surface
->
overlay_dest
rect
,
x
,
y
,
x
+
w
,
y
+
h
);
SetRect
(
&
overlay
->
dst_
rect
,
x
,
y
,
x
+
w
,
y
+
h
);
return
WINED3D_OK
;
return
WINED3D_OK
;
}
}
...
@@ -2754,6 +2774,7 @@ HRESULT CDECL wined3d_texture_update_overlay(struct wined3d_texture *texture, un
...
@@ -2754,6 +2774,7 @@ HRESULT CDECL wined3d_texture_update_overlay(struct wined3d_texture *texture, un
{
{
struct
wined3d_texture_sub_resource
*
sub_resource
,
*
dst_sub_resource
;
struct
wined3d_texture_sub_resource
*
sub_resource
,
*
dst_sub_resource
;
struct
wined3d_surface
*
surface
,
*
dst_surface
;
struct
wined3d_surface
*
surface
,
*
dst_surface
;
struct
wined3d_overlay_info
*
overlay
;
TRACE
(
"texture %p, sub_resource_idx %u, src_rect %s, dst_texture %p, "
TRACE
(
"texture %p, sub_resource_idx %u, src_rect %s, dst_texture %p, "
"dst_sub_resource_idx %u, dst_rect %s, flags %#x.
\n
"
,
"dst_sub_resource_idx %u, dst_rect %s, flags %#x.
\n
"
,
...
@@ -2774,42 +2795,44 @@ HRESULT CDECL wined3d_texture_update_overlay(struct wined3d_texture *texture, un
...
@@ -2774,42 +2795,44 @@ HRESULT CDECL wined3d_texture_update_overlay(struct wined3d_texture *texture, un
return
WINED3DERR_INVALIDCALL
;
return
WINED3DERR_INVALIDCALL
;
}
}
overlay
=
&
texture
->
overlay_info
[
sub_resource_idx
];
surface
=
sub_resource
->
u
.
surface
;
surface
=
sub_resource
->
u
.
surface
;
if
(
src_rect
)
if
(
src_rect
)
surface
->
overlay_src
rect
=
*
src_rect
;
overlay
->
src_
rect
=
*
src_rect
;
else
else
SetRect
(
&
surface
->
overlay_src
rect
,
0
,
0
,
SetRect
(
&
overlay
->
src_
rect
,
0
,
0
,
wined3d_texture_get_level_width
(
texture
,
surface
->
texture_level
),
wined3d_texture_get_level_width
(
texture
,
surface
->
texture_level
),
wined3d_texture_get_level_height
(
texture
,
surface
->
texture_level
));
wined3d_texture_get_level_height
(
texture
,
surface
->
texture_level
));
dst_surface
=
dst_sub_resource
->
u
.
surface
;
dst_surface
=
dst_sub_resource
->
u
.
surface
;
if
(
dst_rect
)
if
(
dst_rect
)
surface
->
overlay_dest
rect
=
*
dst_rect
;
overlay
->
dst_
rect
=
*
dst_rect
;
else
else
SetRect
(
&
surface
->
overlay_dest
rect
,
0
,
0
,
SetRect
(
&
overlay
->
dst_
rect
,
0
,
0
,
wined3d_texture_get_level_width
(
dst_texture
,
dst_surface
->
texture_level
),
wined3d_texture_get_level_width
(
dst_texture
,
dst_surface
->
texture_level
),
wined3d_texture_get_level_height
(
dst_texture
,
dst_surface
->
texture_level
));
wined3d_texture_get_level_height
(
dst_texture
,
dst_surface
->
texture_level
));
if
(
surface
->
overlay_dest
&&
(
surface
->
overlay_de
st
!=
dst_surface
||
flags
&
WINEDDOVER_HIDE
))
if
(
overlay
->
dst
&&
(
overlay
->
d
st
!=
dst_surface
||
flags
&
WINEDDOVER_HIDE
))
{
{
surface
->
overlay_de
st
=
NULL
;
overlay
->
d
st
=
NULL
;
list_remove
(
&
surface
->
overlay_
entry
);
list_remove
(
&
overlay
->
entry
);
}
}
if
(
flags
&
WINEDDOVER_SHOW
)
if
(
flags
&
WINEDDOVER_SHOW
)
{
{
if
(
surface
->
overlay_de
st
!=
dst_surface
)
if
(
overlay
->
d
st
!=
dst_surface
)
{
{
surface
->
overlay_de
st
=
dst_surface
;
overlay
->
d
st
=
dst_surface
;
list_add_tail
(
&
dst_surface
->
overlays
,
&
surface
->
overlay_
entry
);
list_add_tail
(
&
texture
->
overlay_info
[
dst_sub_resource_idx
].
overlays
,
&
overlay
->
entry
);
}
}
}
}
else
if
(
flags
&
WINEDDOVER_HIDE
)
else
if
(
flags
&
WINEDDOVER_HIDE
)
{
{
/* Tests show that the rectangles are erased on hide. */
/* Tests show that the rectangles are erased on hide. */
SetRectEmpty
(
&
surface
->
overlay_src
rect
);
SetRectEmpty
(
&
overlay
->
src_
rect
);
SetRectEmpty
(
&
surface
->
overlay_dest
rect
);
SetRectEmpty
(
&
overlay
->
dst_
rect
);
surface
->
overlay_de
st
=
NULL
;
overlay
->
d
st
=
NULL
;
}
}
return
WINED3D_OK
;
return
WINED3D_OK
;
...
...
dlls/wined3d/wined3d_private.h
View file @
90696dfe
...
@@ -3147,6 +3147,15 @@ struct wined3d_texture
...
@@ -3147,6 +3147,15 @@ struct wined3d_texture
DWORD
color_key_flags
;
DWORD
color_key_flags
;
}
async
;
}
async
;
struct
wined3d_overlay_info
{
struct
list
entry
;
struct
list
overlays
;
struct
wined3d_surface
*
dst
;
RECT
src_rect
;
RECT
dst_rect
;
}
*
overlay_info
;
struct
wined3d_texture_sub_resource
struct
wined3d_texture_sub_resource
{
{
void
*
parent
;
void
*
parent
;
...
@@ -3294,13 +3303,6 @@ struct wined3d_surface
...
@@ -3294,13 +3303,6 @@ struct wined3d_surface
struct
list
renderbuffers
;
struct
list
renderbuffers
;
const
struct
wined3d_renderbuffer_entry
*
current_renderbuffer
;
const
struct
wined3d_renderbuffer_entry
*
current_renderbuffer
;
/* DirectDraw Overlay handling */
RECT
overlay_srcrect
;
RECT
overlay_destrect
;
struct
wined3d_surface
*
overlay_dest
;
struct
list
overlays
;
struct
list
overlay_entry
;
};
};
static
inline
unsigned
int
surface_get_sub_resource_idx
(
const
struct
wined3d_surface
*
surface
)
static
inline
unsigned
int
surface_get_sub_resource_idx
(
const
struct
wined3d_surface
*
surface
)
...
...
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