mirror of
https://github.com/reactos/wine.git
synced 2024-12-03 09:20:56 +00:00
wined3d: Introduce WINED3D_RESOURCE_ACCESS_MAP.
In order to distinguish between resources that exist purely in CPU memory and resources that exist in GPU memory but can be mapped. Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
d01306d1ee
commit
798504700b
@ -36,11 +36,11 @@ static DWORD resource_access_from_pool(enum wined3d_pool pool)
|
||||
return WINED3D_RESOURCE_ACCESS_GPU;
|
||||
|
||||
case WINED3D_POOL_MANAGED:
|
||||
return WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_CPU;
|
||||
return WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_MAP;
|
||||
|
||||
case WINED3D_POOL_SCRATCH:
|
||||
case WINED3D_POOL_SYSTEM_MEM:
|
||||
return WINED3D_RESOURCE_ACCESS_CPU;
|
||||
return WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_MAP;
|
||||
|
||||
default:
|
||||
FIXME("Unhandled pool %#x.\n", pool);
|
||||
@ -191,9 +191,9 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
|
||||
resource->multisample_quality = multisample_quality;
|
||||
resource->usage = usage;
|
||||
resource->pool = pool;
|
||||
resource->access_flags = resource_access_from_pool(pool);
|
||||
resource->access = resource_access_from_pool(pool);
|
||||
if (usage & WINED3DUSAGE_DYNAMIC)
|
||||
resource->access_flags |= WINED3D_RESOURCE_ACCESS_CPU;
|
||||
resource->access |= WINED3D_RESOURCE_ACCESS_MAP;
|
||||
resource->width = width;
|
||||
resource->height = height;
|
||||
resource->depth = depth;
|
||||
|
@ -33,7 +33,7 @@ WINE_DECLARE_DEBUG_CHANNEL(winediag);
|
||||
static BOOL wined3d_texture_use_pbo(const struct wined3d_texture *texture, const struct wined3d_gl_info *gl_info)
|
||||
{
|
||||
return texture->resource.pool == WINED3D_POOL_DEFAULT
|
||||
&& texture->resource.access_flags & WINED3D_RESOURCE_ACCESS_CPU
|
||||
&& texture->resource.access & WINED3D_RESOURCE_ACCESS_MAP
|
||||
&& gl_info->supported[ARB_PIXEL_BUFFER_OBJECT]
|
||||
&& !texture->resource.format->conv_byte_count
|
||||
&& !(texture->flags & (WINED3D_TEXTURE_PIN_SYSMEM | WINED3D_TEXTURE_COND_NP2_EMULATED));
|
||||
@ -243,9 +243,9 @@ BOOL wined3d_texture_load_location(struct wined3d_texture *texture,
|
||||
if (WARN_ON(d3d))
|
||||
{
|
||||
DWORD required_access = wined3d_resource_access_from_location(location);
|
||||
if ((texture->resource.access_flags & required_access) != required_access)
|
||||
if ((texture->resource.access & required_access) != required_access)
|
||||
WARN("Operation requires %#x access, but texture only has %#x.\n",
|
||||
required_access, texture->resource.access_flags);
|
||||
required_access, texture->resource.access);
|
||||
}
|
||||
|
||||
if (current & WINED3D_LOCATION_DISCARDED)
|
||||
@ -369,7 +369,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
|
||||
}
|
||||
wined3d_resource_update_draw_binding(&texture->resource);
|
||||
if ((flags & WINED3D_TEXTURE_CREATE_MAPPABLE) || desc->format == WINED3DFMT_D16_LOCKABLE)
|
||||
texture->resource.access_flags |= WINED3D_RESOURCE_ACCESS_CPU;
|
||||
texture->resource.access |= WINED3D_RESOURCE_ACCESS_MAP;
|
||||
|
||||
texture->texture_ops = texture_ops;
|
||||
|
||||
@ -1874,7 +1874,7 @@ static HRESULT texture_resource_sub_resource_map(struct wined3d_resource *resour
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
if (!(resource->access_flags & WINED3D_RESOURCE_ACCESS_CPU))
|
||||
if (!(resource->access & WINED3D_RESOURCE_ACCESS_MAP))
|
||||
{
|
||||
WARN("Trying to map unmappable texture.\n");
|
||||
if (resource->type != WINED3D_RTYPE_TEXTURE_2D)
|
||||
|
@ -2961,8 +2961,9 @@ static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD sta
|
||||
return context->isStateDirty[idx] & (1u << shift);
|
||||
}
|
||||
|
||||
#define WINED3D_RESOURCE_ACCESS_GPU 0x1
|
||||
#define WINED3D_RESOURCE_ACCESS_CPU 0x2
|
||||
#define WINED3D_RESOURCE_ACCESS_GPU 0x1u
|
||||
#define WINED3D_RESOURCE_ACCESS_CPU 0x2u
|
||||
#define WINED3D_RESOURCE_ACCESS_MAP 0x4u
|
||||
|
||||
struct wined3d_resource_ops
|
||||
{
|
||||
@ -2990,7 +2991,7 @@ struct wined3d_resource
|
||||
UINT multisample_quality;
|
||||
DWORD usage;
|
||||
enum wined3d_pool pool;
|
||||
DWORD access_flags;
|
||||
unsigned int access;
|
||||
WORD draw_binding;
|
||||
WORD map_binding;
|
||||
UINT width;
|
||||
|
Loading…
Reference in New Issue
Block a user