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
d6a511e0
Commit
d6a511e0
authored
Oct 09, 2014
by
Henri Verbeet
Committed by
Alexandre Julliard
Oct 09, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wined3d: Track system memory pinning per-texture.
parent
6d498018
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
23 deletions
+27
-23
surface.c
dlls/wined3d/surface.c
+12
-11
texture.c
dlls/wined3d/texture.c
+13
-10
wined3d_private.h
dlls/wined3d/wined3d_private.h
+2
-2
No files found.
dlls/wined3d/surface.c
View file @
d6a511e0
...
...
@@ -592,8 +592,8 @@ static void surface_evict_sysmem(struct wined3d_surface *surface)
* SFLAG_DYNLOCK: Avoid freeing the data for performance
* SFLAG_CLIENT: OpenGL uses our memory as backup */
if
(
surface
->
resource
.
map_count
||
surface
->
flags
&
(
SFLAG_DYNLOCK
|
SFLAG_CLIENT
|
SFLAG_PIN_SYSMEM
)
||
surface
->
container
->
flags
&
WINED3D_TEXTURE_CONVERTED
)
||
surface
->
flags
&
(
SFLAG_DYNLOCK
|
SFLAG_CLIENT
)
||
surface
->
container
->
flags
&
(
WINED3D_TEXTURE_CONVERTED
|
WINED3D_TEXTURE_PIN_SYSMEM
)
)
return
;
wined3d_resource_free_sysmem
(
&
surface
->
resource
);
...
...
@@ -625,12 +625,14 @@ static void surface_release_client_storage(struct wined3d_surface *surface)
static
BOOL
surface_use_pbo
(
const
struct
wined3d_surface
*
surface
)
{
const
struct
wined3d_gl_info
*
gl_info
=
&
surface
->
resource
.
device
->
adapter
->
gl_info
;
struct
wined3d_texture
*
texture
=
surface
->
container
;
return
surfac
e
->
resource
.
pool
==
WINED3D_POOL_DEFAULT
return
textur
e
->
resource
.
pool
==
WINED3D_POOL_DEFAULT
&&
surface
->
resource
.
access_flags
&
WINED3D_RESOURCE_ACCESS_CPU
&&
gl_info
->
supported
[
ARB_PIXEL_BUFFER_OBJECT
]
&&
!
surface
->
resource
.
format
->
convert
&&
!
(
surface
->
flags
&
(
SFLAG_NONPOW2
|
SFLAG_PIN_SYSMEM
));
&&
!
texture
->
resource
.
format
->
convert
&&
!
(
texture
->
flags
&
WINED3D_TEXTURE_PIN_SYSMEM
)
&&
!
(
surface
->
flags
&
SFLAG_NONPOW2
);
}
static
HRESULT
surface_private_setup
(
struct
wined3d_surface
*
surface
)
...
...
@@ -1481,8 +1483,8 @@ static void surface_upload_data(struct wined3d_surface *surface, const struct wi
if
(
surface
->
resource
.
map_count
)
{
WARN
(
"Uploading a surface that is currently mapped, setting
SFLAG
_PIN_SYSMEM.
\n
"
);
surface
->
flags
|=
SFLAG
_PIN_SYSMEM
;
WARN
(
"Uploading a surface that is currently mapped, setting
WINED3D_TEXTURE
_PIN_SYSMEM.
\n
"
);
surface
->
container
->
flags
|=
WINED3D_TEXTURE
_PIN_SYSMEM
;
}
if
(
format
->
flags
&
WINED3DFMT_FLAG_HEIGHT_SCALE
)
...
...
@@ -2742,7 +2744,7 @@ HRESULT CDECL wined3d_surface_getdc(struct wined3d_surface *surface, HDC *dc)
if
(
FAILED
(
hr
))
return
WINED3DERR_INVALIDCALL
;
if
(
!
(
surface
->
resource
.
map_binding
==
WINED3D_LOCATION_USER_MEMORY
||
surface
->
flags
&
SFLAG
_PIN_SYSMEM
||
surface
->
container
->
flags
&
WINED3D_TEXTURE
_PIN_SYSMEM
||
surface
->
pbo
))
surface
->
resource
.
map_binding
=
WINED3D_LOCATION_DIB
;
}
...
...
@@ -2776,7 +2778,8 @@ HRESULT CDECL wined3d_surface_releasedc(struct wined3d_surface *surface, HDC dc)
surface
->
resource
.
map_count
--
;
surface
->
flags
&=
~
SFLAG_DCINUSE
;
if
(
surface
->
resource
.
map_binding
==
WINED3D_LOCATION_USER_MEMORY
||
(
surface
->
flags
&
SFLAG_PIN_SYSMEM
if
(
surface
->
resource
.
map_binding
==
WINED3D_LOCATION_USER_MEMORY
||
(
surface
->
container
->
flags
&
WINED3D_TEXTURE_PIN_SYSMEM
&&
surface
->
resource
.
map_binding
!=
WINED3D_LOCATION_DIB
))
{
/* The game Salammbo modifies the surface contents without mapping the surface between
...
...
@@ -5546,8 +5549,6 @@ static HRESULT surface_init(struct wined3d_surface *surface, struct wined3d_text
surface
->
flags
|=
SFLAG_NORMCOORD
;
if
(
flags
&
WINED3D_SURFACE_DISCARD
)
surface
->
flags
|=
SFLAG_DISCARD
;
if
(
flags
&
WINED3D_SURFACE_PIN_SYSMEM
)
surface
->
flags
|=
SFLAG_PIN_SYSMEM
;
if
(
lockable
||
desc
->
format
==
WINED3DFMT_D16_LOCKABLE
)
surface
->
resource
.
access_flags
|=
WINED3D_RESOURCE_ACCESS_CPU
;
...
...
dlls/wined3d/texture.c
View file @
d6a511e0
...
...
@@ -28,19 +28,20 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d_texture);
WINE_DECLARE_DEBUG_CHANNEL
(
winediag
);
static
HRESULT
wined3d_texture_init
(
struct
wined3d_texture
*
texture
,
const
struct
wined3d_texture_ops
*
texture_ops
,
UINT
layer_count
,
UINT
level_count
,
const
struct
wined3d_resource_desc
*
desc
,
struct
wined3d_device
*
device
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
,
const
struct
wined3d_resource_ops
*
resource_ops
)
UINT
layer_count
,
UINT
level_count
,
const
struct
wined3d_resource_desc
*
desc
,
DWORD
surface_flags
,
struct
wined3d_device
*
device
,
void
*
parent
,
const
struct
wined3d_parent_ops
*
parent_ops
,
const
struct
wined3d_resource_ops
*
resource_ops
)
{
const
struct
wined3d_format
*
format
=
wined3d_get_format
(
&
device
->
adapter
->
gl_info
,
desc
->
format
);
HRESULT
hr
;
TRACE
(
"texture %p, texture_ops %p, layer_count %u, level_count %u, resource_type %s, format %s, "
"multisample_type %#x, multisample_quality %#x, usage %s, pool %s, width %u, height %u, depth %u, "
"device %p, parent %p, parent_ops %p, resource_ops %p.
\n
"
,
"
surface_flags %#x,
device %p, parent %p, parent_ops %p, resource_ops %p.
\n
"
,
texture
,
texture_ops
,
layer_count
,
level_count
,
debug_d3dresourcetype
(
desc
->
resource_type
),
debug_d3dformat
(
desc
->
format
),
desc
->
multisample_type
,
desc
->
multisample_quality
,
debug_d3dusage
(
desc
->
usage
),
debug_d3dpool
(
desc
->
pool
),
desc
->
width
,
desc
->
height
,
desc
->
depth
,
device
,
parent
,
parent_ops
,
resource_ops
);
surface_flags
,
device
,
parent
,
parent_ops
,
resource_ops
);
if
((
format
->
flags
&
(
WINED3DFMT_FLAG_BLOCKS
|
WINED3DFMT_FLAG_BLOCKS_NO_VERIFY
))
==
WINED3DFMT_FLAG_BLOCKS
)
{
...
...
@@ -81,6 +82,8 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
texture
->
filter_type
=
(
desc
->
usage
&
WINED3DUSAGE_AUTOGENMIPMAP
)
?
WINED3D_TEXF_LINEAR
:
WINED3D_TEXF_NONE
;
texture
->
lod
=
0
;
texture
->
flags
=
WINED3D_TEXTURE_POW2_MAT_IDENT
;
if
(
surface_flags
&
WINED3D_SURFACE_PIN_SYSMEM
)
texture
->
flags
|=
WINED3D_TEXTURE_PIN_SYSMEM
;
if
(
texture
->
resource
.
format
->
flags
&
WINED3DFMT_FLAG_FILTERING
)
{
...
...
@@ -1053,8 +1056,8 @@ static HRESULT cubetexture_init(struct wined3d_texture *texture, const struct wi
}
}
if
(
FAILED
(
hr
=
wined3d_texture_init
(
texture
,
&
texture2d_ops
,
6
,
levels
,
desc
,
device
,
parent
,
parent_ops
,
&
texture_resource_ops
)))
if
(
FAILED
(
hr
=
wined3d_texture_init
(
texture
,
&
texture2d_ops
,
6
,
levels
,
desc
,
surface_flags
,
device
,
parent
,
parent_ops
,
&
texture_resource_ops
)))
{
WARN
(
"Failed to initialize texture, returning %#x
\n
"
,
hr
);
return
hr
;
...
...
@@ -1178,8 +1181,8 @@ static HRESULT texture_init(struct wined3d_texture *texture, const struct wined3
TRACE
(
"Calculated levels = %u.
\n
"
,
levels
);
}
if
(
FAILED
(
hr
=
wined3d_texture_init
(
texture
,
&
texture2d_ops
,
1
,
levels
,
desc
,
device
,
parent
,
parent_ops
,
&
texture_resource_ops
)))
if
(
FAILED
(
hr
=
wined3d_texture_init
(
texture
,
&
texture2d_ops
,
1
,
levels
,
desc
,
surface_flags
,
device
,
parent
,
parent_ops
,
&
texture_resource_ops
)))
{
WARN
(
"Failed to initialize texture, returning %#x.
\n
"
,
hr
);
return
hr
;
...
...
@@ -1404,8 +1407,8 @@ static HRESULT volumetexture_init(struct wined3d_texture *texture, const struct
}
}
if
(
FAILED
(
hr
=
wined3d_texture_init
(
texture
,
&
texture3d_ops
,
1
,
levels
,
desc
,
device
,
parent
,
parent_ops
,
&
texture_resource_ops
)))
if
(
FAILED
(
hr
=
wined3d_texture_init
(
texture
,
&
texture3d_ops
,
1
,
levels
,
desc
,
0
,
device
,
parent
,
parent_ops
,
&
texture_resource_ops
)))
{
WARN
(
"Failed to initialize texture, returning %#x.
\n
"
,
hr
);
return
hr
;
...
...
dlls/wined3d/wined3d_private.h
View file @
d6a511e0
...
...
@@ -2129,6 +2129,7 @@ struct wined3d_texture_ops
#define WINED3D_TEXTURE_SRGB_ALLOCATED 0x00000020
#define WINED3D_TEXTURE_SRGB_VALID 0x00000040
#define WINED3D_TEXTURE_CONVERTED 0x00000080
#define WINED3D_TEXTURE_PIN_SYSMEM 0x00000100
struct
wined3d_texture
{
...
...
@@ -2351,11 +2352,10 @@ void flip_surface(struct wined3d_surface *front, struct wined3d_surface *back) D
#define SFLAG_NONPOW2 0x00000004
/* Surface sizes are not a power of 2 */
#define SFLAG_NORMCOORD 0x00000008
/* Set if GL texture coordinates are normalized (non-texture rectangle). */
#define SFLAG_DYNLOCK 0x00000010
/* Surface is often locked by the application. */
#define SFLAG_
PIN_SYSMEM 0x00000020
/* Keep the surface in sysmem, at the same address
. */
#define SFLAG_
CLIENT 0x00000020
/* GL_APPLE_client_storage is used with this surface
. */
#define SFLAG_DCINUSE 0x00000040
/* Set between GetDC and ReleaseDC calls. */
#define SFLAG_LOST 0x00000080
/* Surface lost flag for ddraw. */
#define SFLAG_GLCKEY 0x00000100
/* The GL texture was created with a color key. */
#define SFLAG_CLIENT 0x00000200
/* GL_APPLE_client_storage is used with this surface. */
struct
wined3d_sampler
{
...
...
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