mirror of
https://github.com/reactos/wine.git
synced 2024-12-04 01:41:18 +00:00
wined3d: Track SFLAG_DYNLOCK per-texture.
This commit is contained in:
parent
d6a511e022
commit
c5459881a3
@ -589,11 +589,11 @@ static void surface_evict_sysmem(struct wined3d_surface *surface)
|
||||
{
|
||||
/* In some conditions the surface memory must not be freed:
|
||||
* WINED3D_TEXTURE_CONVERTED: Converting the data back would take too long
|
||||
* SFLAG_DYNLOCK: Avoid freeing the data for performance
|
||||
* WINED3D_TEXTURE_DYNAMIC_MAP: 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)
|
||||
|| surface->container->flags & (WINED3D_TEXTURE_CONVERTED | WINED3D_TEXTURE_PIN_SYSMEM))
|
||||
if (surface->resource.map_count || surface->flags & SFLAG_CLIENT
|
||||
|| surface->container->flags & (WINED3D_TEXTURE_CONVERTED | WINED3D_TEXTURE_PIN_SYSMEM
|
||||
| WINED3D_TEXTURE_DYNAMIC_MAP))
|
||||
return;
|
||||
|
||||
wined3d_resource_free_sysmem(&surface->resource);
|
||||
@ -1450,8 +1450,8 @@ static void surface_download_data(struct wined3d_surface *surface, const struct
|
||||
* get a boxed texture with width pow2width and not a texture of width resource.width.
|
||||
*
|
||||
* Performance should not be an issue, because applications normally do not lock the surfaces when
|
||||
* rendering. If an app does, the SFLAG_DYNLOCK flag will kick in and the memory copy won't be released,
|
||||
* and doesn't have to be re-read. */
|
||||
* rendering. If an app does, the WINED3D_TEXTURE_DYNAMIC_MAP flag will kick in and the memory copy
|
||||
* won't be released, and doesn't have to be re-read. */
|
||||
src_data = mem;
|
||||
dst_data = data.addr;
|
||||
TRACE("(%p) : Repacking the surface data from pitch %d to pitch %d\n", surface, src_pitch, dst_pitch);
|
||||
@ -2617,13 +2617,15 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
|
||||
/* Performance optimization: Count how often a surface is mapped, if it is
|
||||
* mapped regularly do not throw away the system memory copy. This avoids
|
||||
* the need to download the surface from OpenGL all the time. The surface
|
||||
* is still downloaded if the OpenGL texture is changed. */
|
||||
if (!(surface->flags & SFLAG_DYNLOCK) && surface->resource.map_binding == WINED3D_LOCATION_SYSMEM)
|
||||
* is still downloaded if the OpenGL texture is changed. Note that this
|
||||
* only really makes sense for managed textures.*/
|
||||
if (!(surface->container->flags & WINED3D_TEXTURE_DYNAMIC_MAP)
|
||||
&& surface->resource.map_binding == WINED3D_LOCATION_SYSMEM)
|
||||
{
|
||||
if (++surface->lockCount > MAXLOCKCOUNT)
|
||||
{
|
||||
TRACE("Surface is mapped regularly, not freeing the system memory copy any more.\n");
|
||||
surface->flags |= SFLAG_DYNLOCK;
|
||||
surface->container->flags |= WINED3D_TEXTURE_DYNAMIC_MAP;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2130,6 +2130,7 @@ struct wined3d_texture_ops
|
||||
#define WINED3D_TEXTURE_SRGB_VALID 0x00000040
|
||||
#define WINED3D_TEXTURE_CONVERTED 0x00000080
|
||||
#define WINED3D_TEXTURE_PIN_SYSMEM 0x00000100
|
||||
#define WINED3D_TEXTURE_DYNAMIC_MAP 0x00000200
|
||||
|
||||
struct wined3d_texture
|
||||
{
|
||||
@ -2351,11 +2352,10 @@ void flip_surface(struct wined3d_surface *front, struct wined3d_surface *back) D
|
||||
#define SFLAG_DISCARD 0x00000002 /* ??? */
|
||||
#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_GLCKEY 0x00000010 /* The GL texture was created with a color key. */
|
||||
#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. */
|
||||
|
||||
struct wined3d_sampler
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user