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
ecee205f
Commit
ecee205f
authored
Apr 14, 2016
by
Henri Verbeet
Committed by
Alexandre Julliard
Apr 15, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Check texture usage/pool/flags in texture_init().
Signed-off-by:
Henri Verbeet
<
hverbeet@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
4896cda6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
38 deletions
+12
-38
surface.c
dlls/wined3d/surface.c
+2
-36
texture.c
dlls/wined3d/texture.c
+9
-1
wined3d_private.h
dlls/wined3d/wined3d_private.h
+1
-1
No files found.
dlls/wined3d/surface.c
View file @
ecee205f
...
...
@@ -4469,48 +4469,16 @@ cpu:
}
HRESULT
wined3d_surface_init
(
struct
wined3d_surface
*
surface
,
struct
wined3d_texture
*
container
,
const
struct
wined3d_resource_desc
*
desc
,
GLenum
target
,
unsigned
int
level
,
unsigned
int
layer
,
DWORD
flags
)
const
struct
wined3d_resource_desc
*
desc
,
GLenum
target
,
unsigned
int
level
,
unsigned
int
layer
)
{
unsigned
int
sub_resource_idx
=
layer
*
container
->
level_count
+
level
;
struct
wined3d_device
*
device
=
container
->
resource
.
device
;
const
struct
wined3d_gl_info
*
gl_info
=
&
device
->
adapter
->
gl_info
;
const
struct
wined3d_format
*
format
=
wined3d_get_format
(
gl_info
,
desc
->
format
);
BOOL
lockable
=
flags
&
WINED3D_TEXTURE_CREATE_MAPPABLE
;
UINT
multisample_quality
=
desc
->
multisample_quality
;
unsigned
int
resource_size
;
HRESULT
hr
;
/* 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.
* Levels need to be checked too, since they all affect what can be done. */
switch
(
desc
->
pool
)
{
case
WINED3D_POOL_MANAGED
:
if
(
desc
->
usage
&
WINED3DUSAGE_DYNAMIC
)
FIXME
(
"Called with a pool of MANAGED and a usage of DYNAMIC which are mutually exclusive.
\n
"
);
break
;
case
WINED3D_POOL_DEFAULT
:
if
(
lockable
&&
!
(
desc
->
usage
&
(
WINED3DUSAGE_DYNAMIC
|
WINED3DUSAGE_RENDERTARGET
|
WINED3DUSAGE_DEPTHSTENCIL
)))
WARN
(
"Creating a lockable surface with a POOL of DEFAULT, that doesn't specify DYNAMIC usage.
\n
"
);
break
;
case
WINED3D_POOL_SCRATCH
:
case
WINED3D_POOL_SYSTEM_MEM
:
break
;
default:
FIXME
(
"Unknown pool %#x.
\n
"
,
desc
->
pool
);
break
;
};
if
(
desc
->
usage
&
WINED3DUSAGE_RENDERTARGET
&&
desc
->
pool
!=
WINED3D_POOL_DEFAULT
)
FIXME
(
"Trying to create a render target that isn't in the default pool.
\n
"
);
/* FIXME: Check that the format is supported by the device. */
resource_size
=
wined3d_format_calculate_size
(
format
,
device
->
surface_alignment
,
desc
->
width
,
desc
->
height
,
1
);
if
(
!
resource_size
)
return
WINED3DERR_INVALIDCALL
;
...
...
@@ -4522,6 +4490,7 @@ HRESULT wined3d_surface_init(struct wined3d_surface *surface, struct wined3d_tex
WARN
(
"Failed to initialize resource, returning %#x.
\n
"
,
hr
);
return
hr
;
}
surface
->
resource
.
access_flags
=
container
->
resource
.
access_flags
;
surface
->
container
=
container
;
surface
->
pow2Width
=
wined3d_texture_get_level_pow2_width
(
container
,
level
);
...
...
@@ -4533,9 +4502,6 @@ HRESULT wined3d_surface_init(struct wined3d_surface *surface, struct wined3d_tex
list_init
(
&
surface
->
renderbuffers
);
list_init
(
&
surface
->
overlays
);
if
(
lockable
||
desc
->
format
==
WINED3DFMT_D16_LOCKABLE
)
surface
->
resource
.
access_flags
|=
WINED3D_RESOURCE_ACCESS_CPU
;
wined3d_texture_validate_location
(
container
,
sub_resource_idx
,
WINED3D_LOCATION_SYSMEM
);
if
(
container
->
resource
.
usage
&
WINED3DUSAGE_DEPTHSTENCIL
)
container
->
sub_resources
[
sub_resource_idx
].
locations
=
WINED3D_LOCATION_DISCARDED
;
...
...
dlls/wined3d/texture.c
View file @
ecee205f
...
...
@@ -1507,6 +1507,14 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
return
WINED3DERR_INVALIDCALL
;
}
if
(
desc
->
usage
&
WINED3DUSAGE_DYNAMIC
&&
desc
->
pool
==
WINED3D_POOL_MANAGED
)
FIXME
(
"Trying to create a managed texture with dynamic usage.
\n
"
);
if
(
!
(
desc
->
usage
&
(
WINED3DUSAGE_DYNAMIC
|
WINED3DUSAGE_RENDERTARGET
|
WINED3DUSAGE_DEPTHSTENCIL
))
&&
(
flags
&
WINED3D_TEXTURE_CREATE_MAPPABLE
))
WARN
(
"Creating a mappable texture in the default pool that doesn't specify dynamic usage.
\n
"
);
if
(
desc
->
usage
&
WINED3DUSAGE_RENDERTARGET
&&
desc
->
pool
!=
WINED3D_POOL_DEFAULT
)
FIXME
(
"Trying to create a render target that isn't in the default pool.
\n
"
);
pow2_width
=
desc
->
width
;
pow2_height
=
desc
->
height
;
if
(((
desc
->
width
&
(
desc
->
width
-
1
))
||
(
desc
->
height
&
(
desc
->
height
-
1
)))
...
...
@@ -1653,7 +1661,7 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
struct
wined3d_surface
*
surface
;
surface
=
&
surfaces
[
idx
];
if
(
FAILED
(
hr
=
wined3d_surface_init
(
surface
,
texture
,
&
surface_desc
,
target
,
i
,
j
,
flags
)))
if
(
FAILED
(
hr
=
wined3d_surface_init
(
surface
,
texture
,
&
surface_desc
,
target
,
i
,
j
)))
{
WARN
(
"Failed to initialize surface, returning %#x.
\n
"
,
hr
);
wined3d_texture_cleanup
(
texture
);
...
...
dlls/wined3d/wined3d_private.h
View file @
ecee205f
...
...
@@ -2711,7 +2711,7 @@ void surface_get_drawable_size(const struct wined3d_surface *surface, const stru
unsigned
int
*
width
,
unsigned
int
*
height
)
DECLSPEC_HIDDEN
;
HRESULT
wined3d_surface_init
(
struct
wined3d_surface
*
surface
,
struct
wined3d_texture
*
container
,
const
struct
wined3d_resource_desc
*
desc
,
GLenum
target
,
unsigned
int
level
,
unsigned
int
layer
,
DWORD
flags
)
DECLSPEC_HIDDEN
;
GLenum
target
,
unsigned
int
level
,
unsigned
int
layer
)
DECLSPEC_HIDDEN
;
void
surface_load_fb_texture
(
struct
wined3d_surface
*
surface
,
BOOL
srgb
,
struct
wined3d_context
*
context
)
DECLSPEC_HIDDEN
;
HRESULT
surface_load_location
(
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