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
54c3f5c0
Commit
54c3f5c0
authored
Mar 07, 2017
by
Henri Verbeet
Committed by
Alexandre Julliard
Mar 07, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Validate blit parameters in wined3d_texture_blt().
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
aaa431d8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
25 deletions
+38
-25
surface.c
dlls/wined3d/surface.c
+3
-25
texture.c
dlls/wined3d/texture.c
+35
-0
No files found.
dlls/wined3d/surface.c
View file @
54c3f5c0
...
...
@@ -3598,7 +3598,6 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
unsigned
int
src_sub_resource_idx
=
0
;
DWORD
src_ds_flags
,
dst_ds_flags
;
BOOL
scale
,
convert
;
HRESULT
hr
;
static
const
DWORD
simple_blit
=
WINED3D_BLT_ASYNC
|
WINED3D_BLT_COLOR_FILL
...
...
@@ -3632,20 +3631,6 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
src_sub_resource_idx
=
surface_get_sub_resource_idx
(
src_surface
);
}
if
(
dst_texture
->
sub_resources
[
dst_sub_resource_idx
].
map_count
||
(
src_texture
&&
src_texture
->
sub_resources
[
src_sub_resource_idx
].
map_count
))
{
WARN
(
"Surface is busy, returning WINEDDERR_SURFACEBUSY.
\n
"
);
return
WINEDDERR_SURFACEBUSY
;
}
if
(
FAILED
(
hr
=
wined3d_texture_check_box_dimensions
(
dst_texture
,
dst_surface
->
texture_level
,
&
dst_box
)))
return
hr
;
if
(
src_texture
&&
FAILED
(
hr
=
wined3d_texture_check_box_dimensions
(
src_texture
,
src_surface
->
texture_level
,
&
src_box
)))
return
hr
;
if
(
!
fx
||
!
(
fx
->
fx
))
flags
&=
~
WINED3D_BLT_FX
;
...
...
@@ -3738,17 +3723,10 @@ HRESULT wined3d_surface_blt(struct wined3d_surface *dst_surface, const RECT *dst
if
(
SUCCEEDED
(
wined3d_surface_depth_fill
(
dst_surface
,
dst_rect
,
color
.
r
)))
return
WINED3D_OK
;
}
else
else
if
(
SUCCEEDED
(
wined3d_surface_depth_blt
(
src_surface
,
src_texture
->
resource
.
draw_binding
,
src_rect
,
dst_surface
,
dst_texture
->
resource
.
draw_binding
,
dst_rect
)))
{
if
(
src_ds_flags
!=
dst_ds_flags
)
{
WARN
(
"Rejecting depth / stencil blit between incompatible formats.
\n
"
);
return
WINED3DERR_INVALIDCALL
;
}
if
(
SUCCEEDED
(
wined3d_surface_depth_blt
(
src_surface
,
src_texture
->
resource
.
draw_binding
,
src_rect
,
dst_surface
,
dst_texture
->
resource
.
draw_binding
,
dst_rect
)))
return
WINED3D_OK
;
return
WINED3D_OK
;
}
}
else
...
...
dlls/wined3d/texture.c
View file @
54c3f5c0
...
...
@@ -2627,7 +2627,11 @@ HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned
const
RECT
*
dst_rect
,
struct
wined3d_texture
*
src_texture
,
unsigned
int
src_sub_resource_idx
,
const
RECT
*
src_rect
,
DWORD
flags
,
const
struct
wined3d_blt_fx
*
fx
,
enum
wined3d_texture_filter_type
filter
)
{
struct
wined3d_box
src_box
=
{
src_rect
->
left
,
src_rect
->
top
,
src_rect
->
right
,
src_rect
->
bottom
,
0
,
1
};
struct
wined3d_box
dst_box
=
{
dst_rect
->
left
,
dst_rect
->
top
,
dst_rect
->
right
,
dst_rect
->
bottom
,
0
,
1
};
struct
wined3d_texture_sub_resource
*
dst_resource
,
*
src_resource
=
NULL
;
unsigned
int
dst_format_flags
,
src_format_flags
=
0
;
HRESULT
hr
;
TRACE
(
"dst_texture %p, dst_sub_resource_idx %u, dst_rect %s, src_texture %p, "
"src_sub_resource_idx %u, src_rect %s, flags %#x, fx %p, filter %s.
\n
"
,
...
...
@@ -2638,11 +2642,42 @@ HRESULT CDECL wined3d_texture_blt(struct wined3d_texture *dst_texture, unsigned
||
dst_texture
->
resource
.
type
!=
WINED3D_RTYPE_TEXTURE_2D
)
return
WINED3DERR_INVALIDCALL
;
dst_format_flags
=
dst_texture
->
resource
.
format_flags
;
if
(
FAILED
(
hr
=
wined3d_texture_check_box_dimensions
(
dst_texture
,
dst_sub_resource_idx
%
dst_texture
->
level_count
,
&
dst_box
)))
return
hr
;
if
(
src_texture
)
{
if
(
!
(
src_resource
=
wined3d_texture_get_sub_resource
(
src_texture
,
src_sub_resource_idx
))
||
src_texture
->
resource
.
type
!=
WINED3D_RTYPE_TEXTURE_2D
)
return
WINED3DERR_INVALIDCALL
;
src_format_flags
=
src_texture
->
resource
.
format_flags
;
if
(
FAILED
(
hr
=
wined3d_texture_check_box_dimensions
(
src_texture
,
src_sub_resource_idx
%
src_texture
->
level_count
,
&
src_box
)))
return
hr
;
}
if
(
dst_texture
->
sub_resources
[
dst_sub_resource_idx
].
map_count
||
(
src_texture
&&
src_texture
->
sub_resources
[
src_sub_resource_idx
].
map_count
))
{
WARN
(
"Sub-resource is busy, returning WINEDDERR_SURFACEBUSY.
\n
"
);
return
WINEDDERR_SURFACEBUSY
;
}
if
((
dst_format_flags
&
WINED3DFMT_FLAG_BLOCKS
)
&&
(
flags
&
WINED3D_BLT_COLOR_FILL
))
{
WARN
(
"Color fill not supported on block-based formats.
\n
"
);
return
WINED3DERR_INVALIDCALL
;
}
if
((
src_format_flags
&
(
WINED3DFMT_FLAG_DEPTH
|
WINED3DFMT_FLAG_STENCIL
))
!=
(
dst_format_flags
&
(
WINED3DFMT_FLAG_DEPTH
|
WINED3DFMT_FLAG_STENCIL
))
&&
!
(
flags
&
WINED3D_BLT_DEPTH_FILL
))
{
WARN
(
"Rejecting depth/stencil blit between incompatible formats.
\n
"
);
return
WINED3DERR_INVALIDCALL
;
}
return
wined3d_surface_blt
(
dst_resource
->
u
.
surface
,
dst_rect
,
...
...
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