wined3d: Get rid of WINED3DUSAGE_TEXTURE.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-11-06 13:42:59 +03:30 committed by Alexandre Julliard
parent a0d6ef5bb4
commit 03c1422a71
13 changed files with 11 additions and 37 deletions

View File

@ -450,7 +450,7 @@ static HRESULT d3d_buffer_init(struct d3d_buffer *buffer, struct d3d_device *dev
return E_INVALIDARG; return E_INVALIDARG;
wined3d_desc.byte_width = buffer->desc.ByteWidth; 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.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.access = wined3d_access_from_d3d11(buffer->desc.Usage, buffer->desc.CPUAccessFlags);
wined3d_desc.misc_flags = buffer->desc.MiscFlags; wined3d_desc.misc_flags = buffer->desc.MiscFlags;

View File

@ -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, void wined3d_primitive_type_from_d3d11_primitive_topology(D3D11_PRIMITIVE_TOPOLOGY topology,
enum wined3d_primitive_type *type, unsigned int *patch_vertex_count) DECLSPEC_HIDDEN; 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; 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_d3d11_resource(ID3D11Resource *resource) DECLSPEC_HIDDEN;
struct wined3d_resource *wined3d_resource_from_d3d10_resource(ID3D10Resource *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; DWORD wined3d_map_flags_from_d3d11_map_type(D3D11_MAP map_type) DECLSPEC_HIDDEN;

View File

@ -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.format = wined3dformat_from_dxgi_format(desc->Format);
wined3d_desc.multisample_type = WINED3D_MULTISAMPLE_NONE; wined3d_desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
wined3d_desc.multisample_quality = 0; 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.bind_flags = wined3d_bind_flags_from_d3d11(desc->BindFlags);
wined3d_desc.access = wined3d_access_from_d3d11(desc->Usage, wined3d_desc.access = wined3d_access_from_d3d11(desc->Usage,
desc->Usage == D3D11_USAGE_DEFAULT ? 0 : desc->CPUAccessFlags); 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.format = wined3dformat_from_dxgi_format(desc->Format);
wined3d_desc.multisample_type = desc->SampleDesc.Count > 1 ? desc->SampleDesc.Count : WINED3D_MULTISAMPLE_NONE; wined3d_desc.multisample_type = desc->SampleDesc.Count > 1 ? desc->SampleDesc.Count : WINED3D_MULTISAMPLE_NONE;
wined3d_desc.multisample_quality = desc->SampleDesc.Quality; 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.bind_flags = wined3d_bind_flags_from_d3d11(desc->BindFlags);
wined3d_desc.access = wined3d_access_from_d3d11(desc->Usage, wined3d_desc.access = wined3d_access_from_d3d11(desc->Usage,
desc->Usage == D3D11_USAGE_DEFAULT ? 0 : desc->CPUAccessFlags); 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.format = wined3dformat_from_dxgi_format(desc->Format);
wined3d_desc.multisample_type = WINED3D_MULTISAMPLE_NONE; wined3d_desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
wined3d_desc.multisample_quality = 0; 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.bind_flags = wined3d_bind_flags_from_d3d11(desc->BindFlags);
wined3d_desc.access = wined3d_access_from_d3d11(desc->Usage, wined3d_desc.access = wined3d_access_from_d3d11(desc->Usage,
desc->Usage == D3D11_USAGE_DEFAULT ? 0 : desc->CPUAccessFlags); desc->Usage == D3D11_USAGE_DEFAULT ? 0 : desc->CPUAccessFlags);

View File

@ -441,18 +441,10 @@ unsigned int wined3d_getdata_flags_from_d3d11_async_getdata_flags(unsigned int d
return WINED3DGETDATA_FLUSH; 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; 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) if (usage == D3D11_USAGE_DYNAMIC)
wined3d_usage |= WINED3DUSAGE_DYNAMIC; wined3d_usage |= WINED3DUSAGE_DYNAMIC;

View File

@ -1107,7 +1107,6 @@ HRESULT texture_init(struct d3d8_texture *texture, struct d3d8_device *device,
desc.multisample_type = WINED3D_MULTISAMPLE_NONE; desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
desc.multisample_quality = 0; desc.multisample_quality = 0;
desc.usage = usage & WINED3DUSAGE_MASK; desc.usage = usage & WINED3DUSAGE_MASK;
desc.usage |= WINED3DUSAGE_TEXTURE;
if (pool == D3DPOOL_SCRATCH) if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH; desc.usage |= WINED3DUSAGE_SCRATCH;
desc.bind_flags = wined3d_bind_flags_from_d3d8_usage(usage) | WINED3D_BIND_SHADER_RESOURCE; 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_type = WINED3D_MULTISAMPLE_NONE;
desc.multisample_quality = 0; desc.multisample_quality = 0;
desc.usage = usage & WINED3DUSAGE_MASK; desc.usage = usage & WINED3DUSAGE_MASK;
desc.usage |= WINED3DUSAGE_LEGACY_CUBEMAP | WINED3DUSAGE_TEXTURE; desc.usage |= WINED3DUSAGE_LEGACY_CUBEMAP;
if (pool == D3DPOOL_SCRATCH) if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH; desc.usage |= WINED3DUSAGE_SCRATCH;
desc.bind_flags = wined3d_bind_flags_from_d3d8_usage(usage) | WINED3D_BIND_SHADER_RESOURCE; 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_type = WINED3D_MULTISAMPLE_NONE;
desc.multisample_quality = 0; desc.multisample_quality = 0;
desc.usage = usage & WINED3DUSAGE_MASK; desc.usage = usage & WINED3DUSAGE_MASK;
desc.usage |= WINED3DUSAGE_TEXTURE;
if (pool == D3DPOOL_SCRATCH) if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH; desc.usage |= WINED3DUSAGE_SCRATCH;
desc.bind_flags = wined3d_bind_flags_from_d3d8_usage(usage) | WINED3D_BIND_SHADER_RESOURCE; desc.bind_flags = wined3d_bind_flags_from_d3d8_usage(usage) | WINED3D_BIND_SHADER_RESOURCE;

View File

@ -1311,7 +1311,6 @@ HRESULT texture_init(struct d3d9_texture *texture, struct d3d9_device *device,
desc.multisample_type = WINED3D_MULTISAMPLE_NONE; desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
desc.multisample_quality = 0; desc.multisample_quality = 0;
desc.usage = wined3dusage_from_d3dusage(usage); desc.usage = wined3dusage_from_d3dusage(usage);
desc.usage |= WINED3DUSAGE_TEXTURE;
if (pool == D3DPOOL_SCRATCH) if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH; desc.usage |= WINED3DUSAGE_SCRATCH;
desc.bind_flags = wined3d_bind_flags_from_d3d9_usage(usage) | WINED3D_BIND_SHADER_RESOURCE; 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_type = WINED3D_MULTISAMPLE_NONE;
desc.multisample_quality = 0; desc.multisample_quality = 0;
desc.usage = wined3dusage_from_d3dusage(usage); desc.usage = wined3dusage_from_d3dusage(usage);
desc.usage |= WINED3DUSAGE_LEGACY_CUBEMAP | WINED3DUSAGE_TEXTURE; desc.usage |= WINED3DUSAGE_LEGACY_CUBEMAP;
if (pool == D3DPOOL_SCRATCH) if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH; desc.usage |= WINED3DUSAGE_SCRATCH;
desc.bind_flags = wined3d_bind_flags_from_d3d9_usage(usage) | WINED3D_BIND_SHADER_RESOURCE; 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_type = WINED3D_MULTISAMPLE_NONE;
desc.multisample_quality = 0; desc.multisample_quality = 0;
desc.usage = wined3dusage_from_d3dusage(usage); desc.usage = wined3dusage_from_d3dusage(usage);
desc.usage |= WINED3DUSAGE_TEXTURE;
if (pool == D3DPOOL_SCRATCH) if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH; desc.usage |= WINED3DUSAGE_SCRATCH;
desc.bind_flags = wined3d_bind_flags_from_d3d9_usage(usage) | WINED3D_BIND_SHADER_RESOURCE; desc.bind_flags = wined3d_bind_flags_from_d3d9_usage(usage) | WINED3D_BIND_SHADER_RESOURCE;

View File

@ -6170,10 +6170,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
if (!(ddraw->flags & DDRAW_NO3D)) if (!(ddraw->flags & DDRAW_NO3D))
{ {
if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE) if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
{
wined3d_desc.usage |= WINED3DUSAGE_TEXTURE;
wined3d_desc.bind_flags |= WINED3D_BIND_SHADER_RESOURCE; wined3d_desc.bind_flags |= WINED3D_BIND_SHADER_RESOURCE;
}
if (desc->ddsCaps.dwCaps & DDSCAPS_ZBUFFER) if (desc->ddsCaps.dwCaps & DDSCAPS_ZBUFFER)
wined3d_desc.bind_flags |= WINED3D_BIND_DEPTH_STENCIL; wined3d_desc.bind_flags |= WINED3D_BIND_DEPTH_STENCIL;
else if (desc->ddsCaps.dwCaps & DDSCAPS_3DDEVICE) else if (desc->ddsCaps.dwCaps & DDSCAPS_3DDEVICE)

View File

@ -188,8 +188,6 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_CreateSurface(IWineDXGIDevice *ifac
&surface_desc.multisample_quality, &desc->SampleDesc); &surface_desc.multisample_quality, &desc->SampleDesc);
surface_desc.bind_flags = wined3d_bind_flags_from_dxgi_usage(usage); surface_desc.bind_flags = wined3d_bind_flags_from_dxgi_usage(usage);
surface_desc.usage = 0; 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.access = WINED3D_RESOURCE_ACCESS_GPU;
surface_desc.width = desc->Width; surface_desc.width = desc->Width;
surface_desc.height = desc->Height; surface_desc.height = desc->Height;

View File

@ -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); adapter_format = wined3d_get_format(adapter, adapter_format_id, WINED3D_BIND_RENDER_TARGET);
format = wined3d_get_format(adapter, check_format_id, bind_flags); 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) switch (resource_type)
{ {
case WINED3D_RTYPE_NONE: case WINED3D_RTYPE_NONE:

View File

@ -37,7 +37,6 @@ static void resource_check_usage(DWORD usage)
| WINED3DUSAGE_SCRATCH | WINED3DUSAGE_SCRATCH
| WINED3DUSAGE_PRIVATE | WINED3DUSAGE_PRIVATE
| WINED3DUSAGE_LEGACY_CUBEMAP | WINED3DUSAGE_LEGACY_CUBEMAP
| WINED3DUSAGE_TEXTURE
| ~WINED3DUSAGE_MASK; | ~WINED3DUSAGE_MASK;
/* WINED3DUSAGE_WRITEONLY is supposed to result in write-combined mappings /* WINED3DUSAGE_WRITEONLY is supposed to result in write-combined mappings

View File

@ -921,8 +921,6 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
texture_desc.usage = 0; texture_desc.usage = 0;
if (device->wined3d->flags & WINED3D_NO3D) if (device->wined3d->flags & WINED3D_NO3D)
texture_desc.usage |= WINED3DUSAGE_OWNDC; 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) for (i = 0; i < swapchain->desc.backbuffer_count; ++i)
{ {
TRACE("Creating back buffer %u.\n", i); TRACE("Creating back buffer %u.\n", i);

View File

@ -4524,7 +4524,6 @@ const char *debug_d3dusage(DWORD usage)
WINED3DUSAGE_TO_STR(WINED3DUSAGE_DMAP); WINED3DUSAGE_TO_STR(WINED3DUSAGE_DMAP);
WINED3DUSAGE_TO_STR(WINED3DUSAGE_TEXTAPI); WINED3DUSAGE_TO_STR(WINED3DUSAGE_TEXTAPI);
WINED3DUSAGE_TO_STR(WINED3DUSAGE_LEGACY_CUBEMAP); WINED3DUSAGE_TO_STR(WINED3DUSAGE_LEGACY_CUBEMAP);
WINED3DUSAGE_TO_STR(WINED3DUSAGE_TEXTURE);
WINED3DUSAGE_TO_STR(WINED3DUSAGE_OWNDC); WINED3DUSAGE_TO_STR(WINED3DUSAGE_OWNDC);
WINED3DUSAGE_TO_STR(WINED3DUSAGE_STATICDECL); WINED3DUSAGE_TO_STR(WINED3DUSAGE_STATICDECL);
WINED3DUSAGE_TO_STR(WINED3DUSAGE_OVERLAY); WINED3DUSAGE_TO_STR(WINED3DUSAGE_OVERLAY);

View File

@ -928,10 +928,9 @@ enum wined3d_shader_type
#define WINED3DUSAGE_TEXTAPI 0x10000000 #define WINED3DUSAGE_TEXTAPI 0x10000000
#define WINED3DUSAGE_MASK 0x10007bf8 #define WINED3DUSAGE_MASK 0x10007bf8
#define WINED3DUSAGE_SCRATCH 0x00200000 #define WINED3DUSAGE_SCRATCH 0x00400000
#define WINED3DUSAGE_PRIVATE 0x00400000 #define WINED3DUSAGE_PRIVATE 0x00800000
#define WINED3DUSAGE_LEGACY_CUBEMAP 0x00800000 #define WINED3DUSAGE_LEGACY_CUBEMAP 0x01000000
#define WINED3DUSAGE_TEXTURE 0x01000000
#define WINED3DUSAGE_OWNDC 0x02000000 #define WINED3DUSAGE_OWNDC 0x02000000
#define WINED3DUSAGE_STATICDECL 0x04000000 #define WINED3DUSAGE_STATICDECL 0x04000000
#define WINED3DUSAGE_OVERLAY 0x08000000 #define WINED3DUSAGE_OVERLAY 0x08000000