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
58719f60
Commit
58719f60
authored
Feb 17, 2016
by
Stefan Dösinger
Committed by
Alexandre Julliard
Feb 18, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Introduce wined3d_texture_check_block_align().
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
b162e29c
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
35 additions
and
58 deletions
+35
-58
surface.c
dlls/wined3d/surface.c
+2
-29
texture.c
dlls/wined3d/texture.c
+29
-0
volume.c
dlls/wined3d/volume.c
+2
-29
wined3d_private.h
dlls/wined3d/wined3d_private.h
+2
-0
No files found.
dlls/wined3d/surface.c
View file @
58719f60
...
...
@@ -1538,38 +1538,11 @@ void wined3d_surface_upload_data(struct wined3d_surface *surface, const struct w
}
}
static
BOOL
surface_check_block_align
(
struct
wined3d_surface
*
surface
,
const
struct
wined3d_box
*
box
)
{
UINT
width_mask
,
height_mask
;
if
(
!
box
->
left
&&
!
box
->
top
&&
box
->
right
==
surface
->
resource
.
width
&&
box
->
bottom
==
surface
->
resource
.
height
)
return
TRUE
;
if
((
box
->
left
>=
box
->
right
)
||
(
box
->
top
>=
box
->
bottom
)
||
(
box
->
right
>
surface
->
resource
.
width
)
||
(
box
->
bottom
>
surface
->
resource
.
height
))
return
FALSE
;
/* This assumes power of two block sizes, but NPOT block sizes would be
* silly anyway. */
width_mask
=
surface
->
resource
.
format
->
block_width
-
1
;
height_mask
=
surface
->
resource
.
format
->
block_height
-
1
;
if
(
!
(
box
->
left
&
width_mask
)
&&
!
(
box
->
top
&
height_mask
)
&&
!
(
box
->
right
&
width_mask
)
&&
!
(
box
->
bottom
&
height_mask
))
return
TRUE
;
return
FALSE
;
}
static
BOOL
surface_check_block_align_rect
(
struct
wined3d_surface
*
surface
,
const
RECT
*
rect
)
{
struct
wined3d_box
box
=
{
rect
->
left
,
rect
->
top
,
rect
->
right
,
rect
->
bottom
,
0
,
1
};
return
surface_check_block_align
(
surface
,
&
box
);
return
wined3d_texture_check_block_align
(
surface
->
container
,
surface
->
texture_level
,
&
box
);
}
HRESULT
surface_upload_from_surface
(
struct
wined3d_surface
*
dst_surface
,
const
POINT
*
dst_point
,
...
...
@@ -2301,7 +2274,7 @@ HRESULT wined3d_surface_map(struct wined3d_surface *surface, struct wined3d_map_
}
if
((
fmt_flags
&
WINED3DFMT_FLAG_BLOCKS
)
&&
box
&&
!
surface_check_block_align
(
surface
,
box
))
&&
!
wined3d_texture_check_block_align
(
surface
->
container
,
surface
->
texture_level
,
box
))
{
WARN
(
"Map box %s is misaligned for %ux%u blocks.
\n
"
,
debug_box
(
box
),
format
->
block_width
,
format
->
block_height
);
...
...
dlls/wined3d/texture.c
View file @
58719f60
...
...
@@ -1201,6 +1201,35 @@ static const struct wined3d_texture_ops texture3d_ops =
texture3d_prepare_texture
,
};
BOOL
wined3d_texture_check_block_align
(
const
struct
wined3d_texture
*
texture
,
unsigned
int
level
,
const
struct
wined3d_box
*
box
)
{
const
struct
wined3d_format
*
format
=
texture
->
resource
.
format
;
unsigned
int
height
=
max
(
1
,
texture
->
resource
.
height
>>
level
);
unsigned
int
width
=
max
(
1
,
texture
->
resource
.
width
>>
level
);
unsigned
int
width_mask
,
height_mask
;
if
((
box
->
left
>=
box
->
right
)
||
(
box
->
top
>=
box
->
bottom
)
||
(
box
->
right
>
width
)
||
(
box
->
bottom
>
height
))
return
FALSE
;
/* This assumes power of two block sizes, but NPOT block sizes would be
* silly anyway.
*
* This also assumes that the format's block depth is 1. */
width_mask
=
format
->
block_width
-
1
;
height_mask
=
format
->
block_height
-
1
;
if
((
box
->
left
&
width_mask
)
||
(
box
->
top
&
height_mask
)
||
(
box
->
right
&
width_mask
&&
box
->
right
!=
width
)
||
(
box
->
bottom
&
height_mask
&&
box
->
bottom
!=
height
))
return
FALSE
;
return
TRUE
;
}
static
HRESULT
texture3d_resource_sub_resource_map
(
struct
wined3d_resource
*
resource
,
unsigned
int
sub_resource_idx
,
struct
wined3d_map_desc
*
map_desc
,
const
struct
wined3d_box
*
box
,
DWORD
flags
)
{
...
...
dlls/wined3d/volume.c
View file @
58719f60
...
...
@@ -433,34 +433,6 @@ static void volume_unload(struct wined3d_resource *resource)
resource_unload
(
resource
);
}
static
BOOL
volume_check_block_align
(
const
struct
wined3d_volume
*
volume
,
const
struct
wined3d_box
*
box
)
{
UINT
width_mask
,
height_mask
;
const
struct
wined3d_format
*
format
=
volume
->
resource
.
format
;
if
(
!
box
)
return
TRUE
;
/* This assumes power of two block sizes, but NPOT block sizes would be
* silly anyway.
*
* This also assumes that the format's block depth is 1. */
width_mask
=
format
->
block_width
-
1
;
height_mask
=
format
->
block_height
-
1
;
if
(
box
->
left
&
width_mask
)
return
FALSE
;
if
(
box
->
top
&
height_mask
)
return
FALSE
;
if
(
box
->
right
&
width_mask
&&
box
->
right
!=
volume
->
resource
.
width
)
return
FALSE
;
if
(
box
->
bottom
&
height_mask
&&
box
->
bottom
!=
volume
->
resource
.
height
)
return
FALSE
;
return
TRUE
;
}
static
BOOL
wined3d_volume_check_box_dimensions
(
const
struct
wined3d_volume
*
volume
,
const
struct
wined3d_box
*
box
)
{
...
...
@@ -512,7 +484,8 @@ HRESULT wined3d_volume_map(struct wined3d_volume *volume,
WARN
(
"Map box is invalid.
\n
"
);
return
WINED3DERR_INVALIDCALL
;
}
if
((
fmt_flags
&
WINED3DFMT_FLAG_BLOCKS
)
&&
!
volume_check_block_align
(
volume
,
box
))
if
((
fmt_flags
&
WINED3DFMT_FLAG_BLOCKS
)
&&
box
&&
!
wined3d_texture_check_block_align
(
volume
->
container
,
volume
->
texture_level
,
box
))
{
WARN
(
"Map box %s is misaligned for %ux%u blocks.
\n
"
,
debug_box
(
box
),
format
->
block_width
,
format
->
block_height
);
...
...
dlls/wined3d/wined3d_private.h
View file @
58719f60
...
...
@@ -2405,6 +2405,8 @@ void wined3d_texture_bind(struct wined3d_texture *texture,
struct
wined3d_context
*
context
,
BOOL
srgb
)
DECLSPEC_HIDDEN
;
void
wined3d_texture_bind_and_dirtify
(
struct
wined3d_texture
*
texture
,
struct
wined3d_context
*
context
,
BOOL
srgb
)
DECLSPEC_HIDDEN
;
BOOL
wined3d_texture_check_block_align
(
const
struct
wined3d_texture
*
texture
,
unsigned
int
level
,
const
struct
wined3d_box
*
box
)
DECLSPEC_HIDDEN
;
void
wined3d_texture_force_reload
(
struct
wined3d_texture
*
texture
)
DECLSPEC_HIDDEN
;
void
wined3d_texture_load
(
struct
wined3d_texture
*
texture
,
struct
wined3d_context
*
context
,
BOOL
srgb
)
DECLSPEC_HIDDEN
;
...
...
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