Commit 916c13c6 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Replace the pool in struct wined3d_sub_resource_desc with resource access flags.

parent def83634
......@@ -280,6 +280,22 @@ static inline DWORD d3dusage_from_wined3dusage(unsigned int usage)
return usage & WINED3DUSAGE_MASK;
}
static inline D3DPOOL d3dpool_from_wined3daccess(unsigned int access, unsigned int usage)
{
switch (access & (WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_CPU))
{
default:
case WINED3D_RESOURCE_ACCESS_GPU:
return D3DPOOL_DEFAULT;
case WINED3D_RESOURCE_ACCESS_CPU:
if (usage & WINED3DUSAGE_SCRATCH)
return D3DPOOL_SCRATCH;
return D3DPOOL_SYSTEMMEM;
case WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_CPU:
return D3DPOOL_MANAGED;
}
}
static inline D3DPOOL d3dpool_from_wined3dpool(enum wined3d_pool pool, unsigned int usage)
{
if (pool == WINED3D_POOL_SYSTEM_MEM && usage & WINED3DUSAGE_SCRATCH)
......
......@@ -192,7 +192,7 @@ static HRESULT WINAPI d3d8_surface_GetDesc(IDirect3DSurface8 *iface, D3DSURFACE_
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = D3DRTYPE_SURFACE;
desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage);
desc->Pool = d3dpool_from_wined3dpool(wined3d_desc.pool, wined3d_desc.usage);
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
desc->Size = wined3d_desc.size;
desc->MultiSampleType = wined3d_desc.multisample_type;
desc->Width = wined3d_desc.width;
......
......@@ -254,7 +254,7 @@ static HRESULT WINAPI d3d8_texture_2d_GetLevelDesc(IDirect3DTexture8 *iface, UIN
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = D3DRTYPE_SURFACE;
desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage);
desc->Pool = d3dpool_from_wined3dpool(wined3d_desc.pool, wined3d_desc.usage);
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
desc->Size = wined3d_desc.size;
desc->MultiSampleType = wined3d_desc.multisample_type;
desc->Width = wined3d_desc.width;
......@@ -601,7 +601,7 @@ static HRESULT WINAPI d3d8_texture_cube_GetLevelDesc(IDirect3DCubeTexture8 *ifac
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = D3DRTYPE_SURFACE;
desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage);
desc->Pool = d3dpool_from_wined3dpool(wined3d_desc.pool, wined3d_desc.usage);
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
desc->Size = wined3d_desc.size;
desc->MultiSampleType = wined3d_desc.multisample_type;
desc->Width = wined3d_desc.width;
......@@ -946,7 +946,7 @@ static HRESULT WINAPI d3d8_texture_3d_GetLevelDesc(IDirect3DVolumeTexture8 *ifac
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = D3DRTYPE_VOLUME;
desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage);
desc->Pool = d3dpool_from_wined3dpool(wined3d_desc.pool, wined3d_desc.usage);
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
desc->Size = wined3d_desc.size;
desc->Width = wined3d_desc.width;
desc->Height = wined3d_desc.height;
......
......@@ -126,7 +126,7 @@ static HRESULT WINAPI d3d8_volume_GetDesc(IDirect3DVolume8 *iface, D3DVOLUME_DES
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = D3DRTYPE_VOLUME;
desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage);
desc->Pool = d3dpool_from_wined3dpool(wined3d_desc.pool, wined3d_desc.usage);
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
desc->Size = wined3d_desc.size;
desc->Width = wined3d_desc.width;
desc->Height = wined3d_desc.height;
......
......@@ -283,6 +283,22 @@ static inline DWORD d3dusage_from_wined3dusage(unsigned int usage)
return usage & WINED3DUSAGE_MASK;
}
static inline D3DPOOL d3dpool_from_wined3daccess(unsigned int access, unsigned int usage)
{
switch (access & (WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_CPU))
{
default:
case WINED3D_RESOURCE_ACCESS_GPU:
return D3DPOOL_DEFAULT;
case WINED3D_RESOURCE_ACCESS_CPU:
if (usage & WINED3DUSAGE_SCRATCH)
return D3DPOOL_SCRATCH;
return D3DPOOL_SYSTEMMEM;
case WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_CPU:
return D3DPOOL_MANAGED;
}
}
static inline D3DPOOL d3dpool_from_wined3dpool(enum wined3d_pool pool, unsigned int usage)
{
if (pool == WINED3D_POOL_SYSTEM_MEM && usage & WINED3DUSAGE_SCRATCH)
......
......@@ -1609,10 +1609,10 @@ static HRESULT WINAPI d3d9_device_ColorFill(IDirect3DDevice9Ex *iface,
return D3DERR_INVALIDCALL;
}
if (desc.pool != WINED3D_POOL_DEFAULT)
if (desc.access & WINED3D_RESOURCE_ACCESS_CPU)
{
wined3d_mutex_unlock();
WARN("Colorfill is not allowed on surfaces in pool %#x, returning D3DERR_INVALIDCALL.\n", desc.pool);
WARN("Colour fills are not allowed on surfaces with resource access %#x.\n", desc.access);
return D3DERR_INVALIDCALL;
}
if ((desc.usage & (WINED3DUSAGE_RENDERTARGET | WINED3DUSAGE_TEXTURE)) == WINED3DUSAGE_TEXTURE)
......
......@@ -224,7 +224,7 @@ static HRESULT WINAPI d3d9_surface_GetDesc(IDirect3DSurface9 *iface, D3DSURFACE_
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = D3DRTYPE_SURFACE;
desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage);
desc->Pool = d3dpool_from_wined3dpool(wined3d_desc.pool, wined3d_desc.usage);
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
desc->MultiSampleType = wined3d_desc.multisample_type;
desc->MultiSampleQuality = wined3d_desc.multisample_quality;
desc->Width = wined3d_desc.width;
......
......@@ -290,7 +290,7 @@ static HRESULT WINAPI d3d9_texture_2d_GetLevelDesc(IDirect3DTexture9 *iface, UIN
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = D3DRTYPE_SURFACE;
desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage);
desc->Pool = d3dpool_from_wined3dpool(wined3d_desc.pool, wined3d_desc.usage);
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
desc->MultiSampleType = wined3d_desc.multisample_type;
desc->MultiSampleQuality = wined3d_desc.multisample_quality;
desc->Width = wined3d_desc.width;
......@@ -677,7 +677,7 @@ static HRESULT WINAPI d3d9_texture_cube_GetLevelDesc(IDirect3DCubeTexture9 *ifac
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = D3DRTYPE_SURFACE;
desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage);
desc->Pool = d3dpool_from_wined3dpool(wined3d_desc.pool, wined3d_desc.usage);
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
desc->MultiSampleType = wined3d_desc.multisample_type;
desc->MultiSampleQuality = wined3d_desc.multisample_quality;
desc->Width = wined3d_desc.width;
......@@ -1060,7 +1060,7 @@ static HRESULT WINAPI d3d9_texture_3d_GetLevelDesc(IDirect3DVolumeTexture9 *ifac
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = D3DRTYPE_VOLUME;
desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage);
desc->Pool = d3dpool_from_wined3dpool(wined3d_desc.pool, wined3d_desc.usage);
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
desc->Width = wined3d_desc.width;
desc->Height = wined3d_desc.height;
desc->Depth = wined3d_desc.depth;
......
......@@ -127,7 +127,7 @@ static HRESULT WINAPI d3d9_volume_GetDesc(IDirect3DVolume9 *iface, D3DVOLUME_DES
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = D3DRTYPE_VOLUME;
desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage);
desc->Pool = d3dpool_from_wined3dpool(wined3d_desc.pool, wined3d_desc.usage);
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
desc->Width = wined3d_desc.width;
desc->Height = wined3d_desc.height;
desc->Depth = wined3d_desc.depth;
......
......@@ -2901,7 +2901,7 @@ HRESULT CDECL wined3d_texture_get_sub_resource_desc(const struct wined3d_texture
desc->multisample_type = resource->multisample_type;
desc->multisample_quality = resource->multisample_quality;
desc->usage = resource->usage;
desc->pool = resource->pool;
desc->access = resource->access;
level_idx = sub_resource_idx % texture->level_count;
desc->width = wined3d_texture_get_level_width(texture, level_idx);
......
......@@ -2961,10 +2961,6 @@ static inline BOOL isStateDirty(const struct wined3d_context *context, DWORD sta
return context->isStateDirty[idx] & (1u << shift);
}
#define WINED3D_RESOURCE_ACCESS_GPU 0x1u
#define WINED3D_RESOURCE_ACCESS_CPU 0x2u
#define WINED3D_RESOURCE_ACCESS_MAP 0x4u
const char *wined3d_debug_resource_access(DWORD access) DECLSPEC_HIDDEN;
static inline BOOL wined3d_resource_access_is_managed(unsigned int access)
......
......@@ -50,6 +50,10 @@
#define WINEDDERR_INVALIDRECT MAKE_WINED3DHRESULT(150)
#define WINEDDERR_OVERLAYNOTVISIBLE MAKE_WINED3DHRESULT(577)
#define WINED3D_RESOURCE_ACCESS_GPU 0x1u
#define WINED3D_RESOURCE_ACCESS_CPU 0x2u
#define WINED3D_RESOURCE_ACCESS_MAP 0x4u
enum wined3d_light_type
{
WINED3D_LIGHT_POINT = 1,
......@@ -1744,13 +1748,13 @@ struct wined3d_sub_resource_desc
{
enum wined3d_format_id format;
enum wined3d_multisample_type multisample_type;
UINT multisample_quality;
DWORD usage;
enum wined3d_pool pool;
UINT width;
UINT height;
UINT depth;
UINT size;
unsigned int multisample_quality;
unsigned int usage;
unsigned int access;
unsigned int width;
unsigned int height;
unsigned int depth;
unsigned int size;
};
struct wined3d_clip_status
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment