From 03c1422a71b030dcfa931b4a2054fb26f65bacec Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Tue, 6 Nov 2018 13:42:59 +0330 Subject: [PATCH] wined3d: Get rid of WINED3DUSAGE_TEXTURE. Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d11/buffer.c | 2 +- dlls/d3d11/d3d11_private.h | 2 +- dlls/d3d11/texture.c | 6 +++--- dlls/d3d11/utils.c | 10 +--------- dlls/d3d8/texture.c | 4 +--- dlls/d3d9/texture.c | 4 +--- dlls/ddraw/surface.c | 3 --- dlls/dxgi/device.c | 2 -- dlls/wined3d/directx.c | 4 ---- dlls/wined3d/resource.c | 1 - dlls/wined3d/swapchain.c | 2 -- dlls/wined3d/utils.c | 1 - include/wine/wined3d.h | 7 +++---- 13 files changed, 11 insertions(+), 37 deletions(-) diff --git a/dlls/d3d11/buffer.c b/dlls/d3d11/buffer.c index fb5b8177516..f2d32ed0a9a 100644 --- a/dlls/d3d11/buffer.c +++ b/dlls/d3d11/buffer.c @@ -450,7 +450,7 @@ static HRESULT d3d_buffer_init(struct d3d_buffer *buffer, struct d3d_device *dev return E_INVALIDARG; wined3d_desc.byte_width = buffer->desc.ByteWidth; - wined3d_desc.usage = wined3d_usage_from_d3d11(0, buffer->desc.Usage); + wined3d_desc.usage = wined3d_usage_from_d3d11(buffer->desc.Usage); wined3d_desc.bind_flags = wined3d_bind_flags_from_d3d11(buffer->desc.BindFlags); wined3d_desc.access = wined3d_access_from_d3d11(buffer->desc.Usage, buffer->desc.CPUAccessFlags); wined3d_desc.misc_flags = buffer->desc.MiscFlags; diff --git a/dlls/d3d11/d3d11_private.h b/dlls/d3d11/d3d11_private.h index e3261a57c94..580f520aae9 100644 --- a/dlls/d3d11/d3d11_private.h +++ b/dlls/d3d11/d3d11_private.h @@ -65,7 +65,7 @@ void d3d11_primitive_topology_from_wined3d_primitive_type(enum wined3d_primitive void wined3d_primitive_type_from_d3d11_primitive_topology(D3D11_PRIMITIVE_TOPOLOGY topology, enum wined3d_primitive_type *type, unsigned int *patch_vertex_count) DECLSPEC_HIDDEN; unsigned int wined3d_getdata_flags_from_d3d11_async_getdata_flags(unsigned int d3d11_flags) DECLSPEC_HIDDEN; -DWORD wined3d_usage_from_d3d11(UINT bind_flags, enum D3D11_USAGE usage) DECLSPEC_HIDDEN; +DWORD wined3d_usage_from_d3d11(enum D3D11_USAGE usage) DECLSPEC_HIDDEN; struct wined3d_resource *wined3d_resource_from_d3d11_resource(ID3D11Resource *resource) DECLSPEC_HIDDEN; struct wined3d_resource *wined3d_resource_from_d3d10_resource(ID3D10Resource *resource) DECLSPEC_HIDDEN; DWORD wined3d_map_flags_from_d3d11_map_type(D3D11_MAP map_type) DECLSPEC_HIDDEN; diff --git a/dlls/d3d11/texture.c b/dlls/d3d11/texture.c index 9df8bae00c8..78821955604 100644 --- a/dlls/d3d11/texture.c +++ b/dlls/d3d11/texture.c @@ -456,7 +456,7 @@ HRESULT d3d_texture1d_create(struct d3d_device *device, const D3D11_TEXTURE1D_DE wined3d_desc.format = wined3dformat_from_dxgi_format(desc->Format); wined3d_desc.multisample_type = WINED3D_MULTISAMPLE_NONE; wined3d_desc.multisample_quality = 0; - wined3d_desc.usage = wined3d_usage_from_d3d11(desc->BindFlags, desc->Usage); + wined3d_desc.usage = wined3d_usage_from_d3d11(desc->Usage); wined3d_desc.bind_flags = wined3d_bind_flags_from_d3d11(desc->BindFlags); wined3d_desc.access = wined3d_access_from_d3d11(desc->Usage, desc->Usage == D3D11_USAGE_DEFAULT ? 0 : desc->CPUAccessFlags); @@ -1010,7 +1010,7 @@ HRESULT d3d_texture2d_create(struct d3d_device *device, const D3D11_TEXTURE2D_DE wined3d_desc.format = wined3dformat_from_dxgi_format(desc->Format); wined3d_desc.multisample_type = desc->SampleDesc.Count > 1 ? desc->SampleDesc.Count : WINED3D_MULTISAMPLE_NONE; wined3d_desc.multisample_quality = desc->SampleDesc.Quality; - wined3d_desc.usage = wined3d_usage_from_d3d11(desc->BindFlags, desc->Usage); + wined3d_desc.usage = wined3d_usage_from_d3d11(desc->Usage); wined3d_desc.bind_flags = wined3d_bind_flags_from_d3d11(desc->BindFlags); wined3d_desc.access = wined3d_access_from_d3d11(desc->Usage, desc->Usage == D3D11_USAGE_DEFAULT ? 0 : desc->CPUAccessFlags); @@ -1469,7 +1469,7 @@ static HRESULT d3d_texture3d_init(struct d3d_texture3d *texture, struct d3d_devi wined3d_desc.format = wined3dformat_from_dxgi_format(desc->Format); wined3d_desc.multisample_type = WINED3D_MULTISAMPLE_NONE; wined3d_desc.multisample_quality = 0; - wined3d_desc.usage = wined3d_usage_from_d3d11(desc->BindFlags, desc->Usage); + wined3d_desc.usage = wined3d_usage_from_d3d11(desc->Usage); wined3d_desc.bind_flags = wined3d_bind_flags_from_d3d11(desc->BindFlags); wined3d_desc.access = wined3d_access_from_d3d11(desc->Usage, desc->Usage == D3D11_USAGE_DEFAULT ? 0 : desc->CPUAccessFlags); diff --git a/dlls/d3d11/utils.c b/dlls/d3d11/utils.c index 1a619717587..cf40cc47eff 100644 --- a/dlls/d3d11/utils.c +++ b/dlls/d3d11/utils.c @@ -441,18 +441,10 @@ unsigned int wined3d_getdata_flags_from_d3d11_async_getdata_flags(unsigned int d return WINED3DGETDATA_FLUSH; } -DWORD wined3d_usage_from_d3d11(UINT bind_flags, enum D3D11_USAGE usage) +DWORD wined3d_usage_from_d3d11(enum D3D11_USAGE usage) { - static const DWORD handled = D3D11_BIND_SHADER_RESOURCE - | D3D11_BIND_RENDER_TARGET - | D3D11_BIND_DEPTH_STENCIL; DWORD wined3d_usage = 0; - if (bind_flags & D3D11_BIND_SHADER_RESOURCE) - wined3d_usage |= WINED3DUSAGE_TEXTURE; - if (bind_flags & ~handled) - FIXME("Unhandled bind flags %#x.\n", bind_flags & ~handled); - if (usage == D3D11_USAGE_DYNAMIC) wined3d_usage |= WINED3DUSAGE_DYNAMIC; diff --git a/dlls/d3d8/texture.c b/dlls/d3d8/texture.c index c952579ce61..1c144a14dae 100644 --- a/dlls/d3d8/texture.c +++ b/dlls/d3d8/texture.c @@ -1107,7 +1107,6 @@ HRESULT texture_init(struct d3d8_texture *texture, struct d3d8_device *device, desc.multisample_type = WINED3D_MULTISAMPLE_NONE; desc.multisample_quality = 0; desc.usage = usage & WINED3DUSAGE_MASK; - desc.usage |= WINED3DUSAGE_TEXTURE; if (pool == D3DPOOL_SCRATCH) desc.usage |= WINED3DUSAGE_SCRATCH; desc.bind_flags = wined3d_bind_flags_from_d3d8_usage(usage) | WINED3D_BIND_SHADER_RESOURCE; @@ -1156,7 +1155,7 @@ HRESULT cubetexture_init(struct d3d8_texture *texture, struct d3d8_device *devic desc.multisample_type = WINED3D_MULTISAMPLE_NONE; desc.multisample_quality = 0; desc.usage = usage & WINED3DUSAGE_MASK; - desc.usage |= WINED3DUSAGE_LEGACY_CUBEMAP | WINED3DUSAGE_TEXTURE; + desc.usage |= WINED3DUSAGE_LEGACY_CUBEMAP; if (pool == D3DPOOL_SCRATCH) desc.usage |= WINED3DUSAGE_SCRATCH; desc.bind_flags = wined3d_bind_flags_from_d3d8_usage(usage) | WINED3D_BIND_SHADER_RESOURCE; @@ -1204,7 +1203,6 @@ HRESULT volumetexture_init(struct d3d8_texture *texture, struct d3d8_device *dev desc.multisample_type = WINED3D_MULTISAMPLE_NONE; desc.multisample_quality = 0; desc.usage = usage & WINED3DUSAGE_MASK; - desc.usage |= WINED3DUSAGE_TEXTURE; if (pool == D3DPOOL_SCRATCH) desc.usage |= WINED3DUSAGE_SCRATCH; desc.bind_flags = wined3d_bind_flags_from_d3d8_usage(usage) | WINED3D_BIND_SHADER_RESOURCE; diff --git a/dlls/d3d9/texture.c b/dlls/d3d9/texture.c index 70d35fc50c1..5cb0b3967df 100644 --- a/dlls/d3d9/texture.c +++ b/dlls/d3d9/texture.c @@ -1311,7 +1311,6 @@ HRESULT texture_init(struct d3d9_texture *texture, struct d3d9_device *device, desc.multisample_type = WINED3D_MULTISAMPLE_NONE; desc.multisample_quality = 0; desc.usage = wined3dusage_from_d3dusage(usage); - desc.usage |= WINED3DUSAGE_TEXTURE; if (pool == D3DPOOL_SCRATCH) desc.usage |= WINED3DUSAGE_SCRATCH; desc.bind_flags = wined3d_bind_flags_from_d3d9_usage(usage) | WINED3D_BIND_SHADER_RESOURCE; @@ -1398,7 +1397,7 @@ HRESULT cubetexture_init(struct d3d9_texture *texture, struct d3d9_device *devic desc.multisample_type = WINED3D_MULTISAMPLE_NONE; desc.multisample_quality = 0; desc.usage = wined3dusage_from_d3dusage(usage); - desc.usage |= WINED3DUSAGE_LEGACY_CUBEMAP | WINED3DUSAGE_TEXTURE; + desc.usage |= WINED3DUSAGE_LEGACY_CUBEMAP; if (pool == D3DPOOL_SCRATCH) desc.usage |= WINED3DUSAGE_SCRATCH; desc.bind_flags = wined3d_bind_flags_from_d3d9_usage(usage) | WINED3D_BIND_SHADER_RESOURCE; @@ -1470,7 +1469,6 @@ HRESULT volumetexture_init(struct d3d9_texture *texture, struct d3d9_device *dev desc.multisample_type = WINED3D_MULTISAMPLE_NONE; desc.multisample_quality = 0; desc.usage = wined3dusage_from_d3dusage(usage); - desc.usage |= WINED3DUSAGE_TEXTURE; if (pool == D3DPOOL_SCRATCH) desc.usage |= WINED3DUSAGE_SCRATCH; desc.bind_flags = wined3d_bind_flags_from_d3d9_usage(usage) | WINED3D_BIND_SHADER_RESOURCE; diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index fb0cc85e7b0..7c13cbfa39c 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -6170,10 +6170,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ if (!(ddraw->flags & DDRAW_NO3D)) { if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE) - { - wined3d_desc.usage |= WINED3DUSAGE_TEXTURE; wined3d_desc.bind_flags |= WINED3D_BIND_SHADER_RESOURCE; - } if (desc->ddsCaps.dwCaps & DDSCAPS_ZBUFFER) wined3d_desc.bind_flags |= WINED3D_BIND_DEPTH_STENCIL; else if (desc->ddsCaps.dwCaps & DDSCAPS_3DDEVICE) diff --git a/dlls/dxgi/device.c b/dlls/dxgi/device.c index 9b57b46d1c7..c7481c6b6ef 100644 --- a/dlls/dxgi/device.c +++ b/dlls/dxgi/device.c @@ -188,8 +188,6 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_CreateSurface(IWineDXGIDevice *ifac &surface_desc.multisample_quality, &desc->SampleDesc); surface_desc.bind_flags = wined3d_bind_flags_from_dxgi_usage(usage); surface_desc.usage = 0; - if (surface_desc.bind_flags & WINED3D_BIND_SHADER_RESOURCE) - surface_desc.usage |= WINED3DUSAGE_TEXTURE; surface_desc.access = WINED3D_RESOURCE_ACCESS_GPU; surface_desc.width = desc->Width; surface_desc.height = desc->Height; diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index dab10cbf116..4a135860dcf 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -1541,10 +1541,6 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad adapter_format = wined3d_get_format(adapter, adapter_format_id, WINED3D_BIND_RENDER_TARGET); format = wined3d_get_format(adapter, check_format_id, bind_flags); - if (usage & WINED3DUSAGE_TEXTURE) - bind_flags |= WINED3D_BIND_SHADER_RESOURCE; - usage &= ~WINED3DUSAGE_TEXTURE; - switch (resource_type) { case WINED3D_RTYPE_NONE: diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c index 61143556e73..05fbafbfb35 100644 --- a/dlls/wined3d/resource.c +++ b/dlls/wined3d/resource.c @@ -37,7 +37,6 @@ static void resource_check_usage(DWORD usage) | WINED3DUSAGE_SCRATCH | WINED3DUSAGE_PRIVATE | WINED3DUSAGE_LEGACY_CUBEMAP - | WINED3DUSAGE_TEXTURE | ~WINED3DUSAGE_MASK; /* WINED3DUSAGE_WRITEONLY is supposed to result in write-combined mappings diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c index ba7c817adf5..f6963c4aba2 100644 --- a/dlls/wined3d/swapchain.c +++ b/dlls/wined3d/swapchain.c @@ -921,8 +921,6 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3 texture_desc.usage = 0; if (device->wined3d->flags & WINED3D_NO3D) texture_desc.usage |= WINED3DUSAGE_OWNDC; - if (texture_desc.bind_flags & WINED3D_BIND_SHADER_RESOURCE) - texture_desc.usage |= WINED3DUSAGE_TEXTURE; for (i = 0; i < swapchain->desc.backbuffer_count; ++i) { TRACE("Creating back buffer %u.\n", i); diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 4e5d36c7bd6..1fd3f321283 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -4524,7 +4524,6 @@ const char *debug_d3dusage(DWORD usage) WINED3DUSAGE_TO_STR(WINED3DUSAGE_DMAP); WINED3DUSAGE_TO_STR(WINED3DUSAGE_TEXTAPI); WINED3DUSAGE_TO_STR(WINED3DUSAGE_LEGACY_CUBEMAP); - WINED3DUSAGE_TO_STR(WINED3DUSAGE_TEXTURE); WINED3DUSAGE_TO_STR(WINED3DUSAGE_OWNDC); WINED3DUSAGE_TO_STR(WINED3DUSAGE_STATICDECL); WINED3DUSAGE_TO_STR(WINED3DUSAGE_OVERLAY); diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 0d98dfae890..70b27bb3d3a 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -928,10 +928,9 @@ enum wined3d_shader_type #define WINED3DUSAGE_TEXTAPI 0x10000000 #define WINED3DUSAGE_MASK 0x10007bf8 -#define WINED3DUSAGE_SCRATCH 0x00200000 -#define WINED3DUSAGE_PRIVATE 0x00400000 -#define WINED3DUSAGE_LEGACY_CUBEMAP 0x00800000 -#define WINED3DUSAGE_TEXTURE 0x01000000 +#define WINED3DUSAGE_SCRATCH 0x00400000 +#define WINED3DUSAGE_PRIVATE 0x00800000 +#define WINED3DUSAGE_LEGACY_CUBEMAP 0x01000000 #define WINED3DUSAGE_OWNDC 0x02000000 #define WINED3DUSAGE_STATICDECL 0x04000000 #define WINED3DUSAGE_OVERLAY 0x08000000