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
1e0603eb
Commit
1e0603eb
authored
Apr 13, 2016
by
Henri Verbeet
Committed by
Alexandre Julliard
Apr 14, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Store the power-of-two dimensions in the texture.
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
fca93ef0
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
26 deletions
+27
-26
surface.c
dlls/wined3d/surface.c
+2
-19
texture.c
dlls/wined3d/texture.c
+11
-7
wined3d_private.h
dlls/wined3d/wined3d_private.h
+14
-0
No files found.
dlls/wined3d/surface.c
View file @
1e0603eb
...
...
@@ -4501,25 +4501,6 @@ HRESULT wined3d_surface_init(struct wined3d_surface *surface, struct wined3d_tex
unsigned
int
resource_size
;
HRESULT
hr
;
if
(
container
->
flags
&
WINED3D_TEXTURE_COND_NP2_EMULATED
)
{
unsigned
int
pow2_width
=
1
,
pow2_height
=
1
;
/* Find the nearest pow2 match. */
while
(
pow2_width
<
desc
->
width
)
pow2_width
<<=
1
;
while
(
pow2_height
<
desc
->
height
)
pow2_height
<<=
1
;
surface
->
pow2Width
=
pow2_width
;
surface
->
pow2Height
=
pow2_height
;
}
else
{
surface
->
pow2Width
=
desc
->
width
;
surface
->
pow2Height
=
desc
->
height
;
}
/* Quick lockable sanity check.
* TODO: remove this after surfaces, usage and lockability have been debugged properly
* this function is too deep to need to care about things like this.
...
...
@@ -4564,6 +4545,8 @@ HRESULT wined3d_surface_init(struct wined3d_surface *surface, struct wined3d_tex
}
surface
->
container
=
container
;
surface
->
pow2Width
=
wined3d_texture_get_level_pow2_width
(
container
,
level
);
surface
->
pow2Height
=
wined3d_texture_get_level_pow2_height
(
container
,
level
);
surface
->
texture_target
=
target
;
surface
->
texture_level
=
level
;
surface
->
texture_layer
=
layer
;
...
...
dlls/wined3d/texture.c
View file @
1e0603eb
...
...
@@ -899,18 +899,20 @@ HRESULT CDECL wined3d_texture_update_desc(struct wined3d_texture *texture, UINT
&&
!
gl_info
->
supported
[
ARB_TEXTURE_RECTANGLE
]
&&
!
gl_info
->
supported
[
WINED3D_GL_NORMALIZED_TEXRECT
])
{
texture
->
flags
|=
WINED3D_TEXTURE_COND_NP2_EMULATED
;
surface
->
pow2Width
=
surface
->
pow2H
eight
=
1
;
while
(
surface
->
pow2W
idth
<
width
)
surface
->
pow2W
idth
<<=
1
;
while
(
surface
->
pow2H
eight
<
height
)
surface
->
pow2H
eight
<<=
1
;
texture
->
pow2_width
=
texture
->
pow2_h
eight
=
1
;
while
(
texture
->
pow2_w
idth
<
width
)
texture
->
pow2_w
idth
<<=
1
;
while
(
texture
->
pow2_h
eight
<
height
)
texture
->
pow2_h
eight
<<=
1
;
}
else
{
texture
->
flags
&=
~
WINED3D_TEXTURE_COND_NP2_EMULATED
;
surface
->
pow2W
idth
=
width
;
surface
->
pow2H
eight
=
height
;
texture
->
pow2_w
idth
=
width
;
texture
->
pow2_h
eight
=
height
;
}
surface
->
pow2Width
=
texture
->
pow2_width
;
surface
->
pow2Height
=
texture
->
pow2_height
;
sub_resource
->
locations
=
0
;
...
...
@@ -1556,6 +1558,8 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
texture
->
flags
|=
WINED3D_TEXTURE_COND_NP2_EMULATED
;
}
}
texture
->
pow2_width
=
pow2_width
;
texture
->
pow2_height
=
pow2_height
;
if
((
pow2_width
>
gl_info
->
limits
.
texture_size
||
pow2_height
>
gl_info
->
limits
.
texture_size
)
&&
(
desc
->
usage
&
WINED3DUSAGE_TEXTURE
))
...
...
dlls/wined3d/wined3d_private.h
View file @
1e0603eb
...
...
@@ -2449,6 +2449,8 @@ struct wined3d_texture
const
struct
wined3d_texture_ops
*
texture_ops
;
struct
gl_texture
texture_rgb
,
texture_srgb
;
struct
wined3d_swapchain
*
swapchain
;
unsigned
int
pow2_width
;
unsigned
int
pow2_height
;
UINT
layer_count
;
UINT
level_count
;
unsigned
int
download_count
;
...
...
@@ -2521,6 +2523,18 @@ static inline unsigned int wined3d_texture_get_level_depth(const struct wined3d_
return
max
(
1
,
texture
->
resource
.
depth
>>
level
);
}
static
inline
unsigned
int
wined3d_texture_get_level_pow2_width
(
const
struct
wined3d_texture
*
texture
,
unsigned
int
level
)
{
return
max
(
1
,
texture
->
pow2_width
>>
level
);
}
static
inline
unsigned
int
wined3d_texture_get_level_pow2_height
(
const
struct
wined3d_texture
*
texture
,
unsigned
int
level
)
{
return
max
(
1
,
texture
->
pow2_height
>>
level
);
}
void
wined3d_texture_apply_sampler_desc
(
struct
wined3d_texture
*
texture
,
const
struct
wined3d_sampler_desc
*
sampler_desc
,
const
struct
wined3d_context
*
context
)
DECLSPEC_HIDDEN
;
void
wined3d_texture_bind
(
struct
wined3d_texture
*
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