Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- dlls/d3d8/d3d8_private.h | 16 ++++++++++++++++ dlls/d3d8/surface.c | 2 +- dlls/d3d8/texture.c | 6 +++--- dlls/d3d8/volume.c | 2 +- dlls/d3d9/d3d9_private.h | 16 ++++++++++++++++ dlls/d3d9/device.c | 4 ++-- dlls/d3d9/surface.c | 2 +- dlls/d3d9/texture.c | 6 +++--- dlls/d3d9/volume.c | 2 +- dlls/wined3d/texture.c | 2 +- dlls/wined3d/wined3d_private.h | 4 ---- include/wine/wined3d.h | 18 +++++++++++------- 12 files changed, 56 insertions(+), 24 deletions(-)
diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index bb739a3..d18fdb8 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -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) diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c index f71f4c3..3ece82a 100644 --- a/dlls/d3d8/surface.c +++ b/dlls/d3d8/surface.c @@ -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; diff --git a/dlls/d3d8/texture.c b/dlls/d3d8/texture.c index 7be4046..ad25001 100644 --- a/dlls/d3d8/texture.c +++ b/dlls/d3d8/texture.c @@ -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; diff --git a/dlls/d3d8/volume.c b/dlls/d3d8/volume.c index ad78ea7..bcc6a93 100644 --- a/dlls/d3d8/volume.c +++ b/dlls/d3d8/volume.c @@ -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; diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h index aade880..3a1ec37 100644 --- a/dlls/d3d9/d3d9_private.h +++ b/dlls/d3d9/d3d9_private.h @@ -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) diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index c5348a4..8fec9b9 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -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) diff --git a/dlls/d3d9/surface.c b/dlls/d3d9/surface.c index a5b1b08..8c42a8c 100644 --- a/dlls/d3d9/surface.c +++ b/dlls/d3d9/surface.c @@ -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; diff --git a/dlls/d3d9/texture.c b/dlls/d3d9/texture.c index bdbaa25..4604b15 100644 --- a/dlls/d3d9/texture.c +++ b/dlls/d3d9/texture.c @@ -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; diff --git a/dlls/d3d9/volume.c b/dlls/d3d9/volume.c index 795da2f..08e0d77 100644 --- a/dlls/d3d9/volume.c +++ b/dlls/d3d9/volume.c @@ -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; diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c index e480a22..aa6e14c 100644 --- a/dlls/wined3d/texture.c +++ b/dlls/wined3d/texture.c @@ -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); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 8006f3a..eb8936a 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -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) diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 02c168e..d8d057d 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -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