Commit 7cba9157 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Pass correct bind flags to texture creation functions.

parent 3d5a2567
...@@ -451,7 +451,7 @@ static HRESULT d3d_buffer_init(struct d3d_buffer *buffer, struct d3d_device *dev ...@@ -451,7 +451,7 @@ static HRESULT d3d_buffer_init(struct d3d_buffer *buffer, struct d3d_device *dev
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(0, buffer->desc.Usage);
wined3d_desc.bind_flags = 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;
wined3d_desc.structure_byte_stride = buffer->desc.StructureByteStride; wined3d_desc.structure_byte_stride = buffer->desc.StructureByteStride;
......
...@@ -65,7 +65,6 @@ void d3d11_primitive_topology_from_wined3d_primitive_type(enum wined3d_primitive ...@@ -65,7 +65,6 @@ 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;
UINT d3d11_bind_flags_from_wined3d_usage(DWORD wined3d_usage) DECLSPEC_HIDDEN;
DWORD wined3d_usage_from_d3d11(UINT bind_flags, enum D3D11_USAGE usage) DECLSPEC_HIDDEN; DWORD wined3d_usage_from_d3d11(UINT bind_flags, 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;
...@@ -93,6 +92,16 @@ HRESULT d3d_set_private_data(struct wined3d_private_store *store, ...@@ -93,6 +92,16 @@ HRESULT d3d_set_private_data(struct wined3d_private_store *store,
HRESULT d3d_set_private_data_interface(struct wined3d_private_store *store, HRESULT d3d_set_private_data_interface(struct wined3d_private_store *store,
REFGUID guid, const IUnknown *object) DECLSPEC_HIDDEN; REFGUID guid, const IUnknown *object) DECLSPEC_HIDDEN;
static inline unsigned int wined3d_bind_flags_from_d3d11(UINT bind_flags)
{
return bind_flags;
}
static inline UINT d3d11_bind_flags_from_wined3d(unsigned int bind_flags)
{
return bind_flags;
}
static inline void read_dword(const char **ptr, DWORD *d) static inline void read_dword(const char **ptr, DWORD *d)
{ {
memcpy(d, *ptr, sizeof(*d)); memcpy(d, *ptr, sizeof(*d));
......
...@@ -6070,7 +6070,7 @@ static HRESULT CDECL device_parent_create_swapchain_texture(struct wined3d_devic ...@@ -6070,7 +6070,7 @@ static HRESULT CDECL device_parent_create_swapchain_texture(struct wined3d_devic
desc.SampleDesc.Count = wined3d_desc->multisample_type ? wined3d_desc->multisample_type : 1; desc.SampleDesc.Count = wined3d_desc->multisample_type ? wined3d_desc->multisample_type : 1;
desc.SampleDesc.Quality = wined3d_desc->multisample_quality; desc.SampleDesc.Quality = wined3d_desc->multisample_quality;
desc.Usage = D3D11_USAGE_DEFAULT; desc.Usage = D3D11_USAGE_DEFAULT;
desc.BindFlags = d3d11_bind_flags_from_wined3d_usage(wined3d_desc->usage); desc.BindFlags = d3d11_bind_flags_from_wined3d(wined3d_desc->bind_flags);
desc.CPUAccessFlags = 0; desc.CPUAccessFlags = 0;
desc.MiscFlags = 0; desc.MiscFlags = 0;
......
...@@ -457,6 +457,7 @@ HRESULT d3d_texture1d_create(struct d3d_device *device, const D3D11_TEXTURE1D_DE ...@@ -457,6 +457,7 @@ HRESULT d3d_texture1d_create(struct d3d_device *device, const D3D11_TEXTURE1D_DE
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->BindFlags, desc->Usage);
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);
wined3d_desc.width = desc->Width; wined3d_desc.width = desc->Width;
...@@ -1010,6 +1011,7 @@ HRESULT d3d_texture2d_create(struct d3d_device *device, const D3D11_TEXTURE2D_DE ...@@ -1010,6 +1011,7 @@ HRESULT d3d_texture2d_create(struct d3d_device *device, const D3D11_TEXTURE2D_DE
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->BindFlags, desc->Usage);
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);
wined3d_desc.width = desc->Width; wined3d_desc.width = desc->Width;
...@@ -1468,6 +1470,7 @@ static HRESULT d3d_texture3d_init(struct d3d_texture3d *texture, struct d3d_devi ...@@ -1468,6 +1470,7 @@ static HRESULT d3d_texture3d_init(struct d3d_texture3d *texture, struct d3d_devi
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->BindFlags, desc->Usage);
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);
wined3d_desc.width = desc->Width; wined3d_desc.width = desc->Width;
......
...@@ -441,21 +441,6 @@ unsigned int wined3d_getdata_flags_from_d3d11_async_getdata_flags(unsigned int d ...@@ -441,21 +441,6 @@ unsigned int wined3d_getdata_flags_from_d3d11_async_getdata_flags(unsigned int d
return WINED3DGETDATA_FLUSH; return WINED3DGETDATA_FLUSH;
} }
UINT d3d11_bind_flags_from_wined3d_usage(DWORD wined3d_usage)
{
UINT bind_flags = 0;
if (wined3d_usage & WINED3DUSAGE_TEXTURE)
bind_flags |= D3D11_BIND_SHADER_RESOURCE;
if (wined3d_usage & WINED3DUSAGE_RENDERTARGET)
bind_flags |= D3D11_BIND_RENDER_TARGET;
wined3d_usage &= ~(WINED3DUSAGE_TEXTURE | WINED3DUSAGE_RENDERTARGET);
if (wined3d_usage)
FIXME("Unhandled wined3d usage %#x.\n", wined3d_usage);
return bind_flags;
}
DWORD wined3d_usage_from_d3d11(UINT bind_flags, enum D3D11_USAGE usage) DWORD wined3d_usage_from_d3d11(UINT bind_flags, enum D3D11_USAGE usage)
{ {
static const DWORD handled = D3D11_BIND_SHADER_RESOURCE static const DWORD handled = D3D11_BIND_SHADER_RESOURCE
......
...@@ -229,7 +229,7 @@ static HRESULT WINAPI d3d8_vertexbuffer_GetDesc(IDirect3DVertexBuffer8 *iface, ...@@ -229,7 +229,7 @@ static HRESULT WINAPI d3d8_vertexbuffer_GetDesc(IDirect3DVertexBuffer8 *iface,
desc->Format = D3DFMT_VERTEXDATA; desc->Format = D3DFMT_VERTEXDATA;
desc->Type = D3DRTYPE_VERTEXBUFFER; desc->Type = D3DRTYPE_VERTEXBUFFER;
desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage); desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage); desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
desc->Size = wined3d_desc.size; desc->Size = wined3d_desc.size;
desc->FVF = buffer->fvf; desc->FVF = buffer->fvf;
...@@ -527,7 +527,7 @@ static HRESULT WINAPI d3d8_indexbuffer_GetDesc(IDirect3DIndexBuffer8 *iface, ...@@ -527,7 +527,7 @@ static HRESULT WINAPI d3d8_indexbuffer_GetDesc(IDirect3DIndexBuffer8 *iface,
desc->Format = d3dformat_from_wined3dformat(buffer->format); desc->Format = d3dformat_from_wined3dformat(buffer->format);
desc->Type = D3DRTYPE_INDEXBUFFER; desc->Type = D3DRTYPE_INDEXBUFFER;
desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage); desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage); desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
desc->Size = wined3d_desc.size; desc->Size = wined3d_desc.size;
......
...@@ -278,9 +278,14 @@ unsigned int wined3dmapflags_from_d3dmapflags(unsigned int flags) DECLSPEC_HIDDE ...@@ -278,9 +278,14 @@ unsigned int wined3dmapflags_from_d3dmapflags(unsigned int flags) DECLSPEC_HIDDE
void load_local_constants(const DWORD *d3d8_elements, struct wined3d_shader *wined3d_vertex_shader) DECLSPEC_HIDDEN; void load_local_constants(const DWORD *d3d8_elements, struct wined3d_shader *wined3d_vertex_shader) DECLSPEC_HIDDEN;
size_t parse_token(const DWORD *pToken) DECLSPEC_HIDDEN; size_t parse_token(const DWORD *pToken) DECLSPEC_HIDDEN;
static inline DWORD d3dusage_from_wined3dusage(unsigned int usage) static inline DWORD d3dusage_from_wined3dusage(unsigned int wined3d_usage, unsigned int bind_flags)
{ {
return usage & WINED3DUSAGE_MASK; DWORD usage = wined3d_usage & WINED3DUSAGE_MASK;
if (bind_flags & WINED3D_BIND_RENDER_TARGET)
usage |= D3DUSAGE_RENDERTARGET;
if (bind_flags & WINED3D_BIND_DEPTH_STENCIL)
usage |= D3DUSAGE_DEPTHSTENCIL;
return usage;
} }
static inline D3DPOOL d3dpool_from_wined3daccess(unsigned int access, unsigned int usage) static inline D3DPOOL d3dpool_from_wined3daccess(unsigned int access, unsigned int usage)
...@@ -318,4 +323,16 @@ static inline unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int ...@@ -318,4 +323,16 @@ static inline unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int
} }
} }
static inline unsigned int wined3d_bind_flags_from_d3d8_usage(DWORD usage)
{
unsigned int bind_flags = 0;
if (usage & D3DUSAGE_RENDERTARGET)
bind_flags |= WINED3D_BIND_RENDER_TARGET;
if (usage & D3DUSAGE_DEPTHSTENCIL)
bind_flags |= WINED3D_BIND_DEPTH_STENCIL;
return bind_flags;
}
#endif /* __WINE_D3DX8_PRIVATE_H */ #endif /* __WINE_D3DX8_PRIVATE_H */
...@@ -1165,6 +1165,7 @@ static HRESULT d3d8_device_create_surface(struct d3d8_device *device, UINT width ...@@ -1165,6 +1165,7 @@ static HRESULT d3d8_device_create_surface(struct d3d8_device *device, UINT width
desc.usage = usage & WINED3DUSAGE_MASK; desc.usage = usage & WINED3DUSAGE_MASK;
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);
desc.access = wined3daccess_from_d3dpool(pool, usage) desc.access = wined3daccess_from_d3dpool(pool, usage)
| WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W; | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.width = width; desc.width = width;
......
...@@ -191,7 +191,7 @@ static HRESULT WINAPI d3d8_surface_GetDesc(IDirect3DSurface8 *iface, D3DSURFACE_ ...@@ -191,7 +191,7 @@ static HRESULT WINAPI d3d8_surface_GetDesc(IDirect3DSurface8 *iface, D3DSURFACE_
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format); desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = D3DRTYPE_SURFACE; desc->Type = D3DRTYPE_SURFACE;
desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage); desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage); desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
desc->Size = wined3d_desc.size; desc->Size = wined3d_desc.size;
desc->MultiSampleType = wined3d_desc.multisample_type; desc->MultiSampleType = wined3d_desc.multisample_type;
......
...@@ -253,7 +253,7 @@ static HRESULT WINAPI d3d8_texture_2d_GetLevelDesc(IDirect3DTexture8 *iface, UIN ...@@ -253,7 +253,7 @@ static HRESULT WINAPI d3d8_texture_2d_GetLevelDesc(IDirect3DTexture8 *iface, UIN
{ {
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format); desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = D3DRTYPE_SURFACE; desc->Type = D3DRTYPE_SURFACE;
desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage); desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage); desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
desc->Size = wined3d_desc.size; desc->Size = wined3d_desc.size;
desc->MultiSampleType = wined3d_desc.multisample_type; desc->MultiSampleType = wined3d_desc.multisample_type;
...@@ -600,7 +600,7 @@ static HRESULT WINAPI d3d8_texture_cube_GetLevelDesc(IDirect3DCubeTexture8 *ifac ...@@ -600,7 +600,7 @@ static HRESULT WINAPI d3d8_texture_cube_GetLevelDesc(IDirect3DCubeTexture8 *ifac
{ {
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format); desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = D3DRTYPE_SURFACE; desc->Type = D3DRTYPE_SURFACE;
desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage); desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage); desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
desc->Size = wined3d_desc.size; desc->Size = wined3d_desc.size;
desc->MultiSampleType = wined3d_desc.multisample_type; desc->MultiSampleType = wined3d_desc.multisample_type;
...@@ -945,7 +945,7 @@ static HRESULT WINAPI d3d8_texture_3d_GetLevelDesc(IDirect3DVolumeTexture8 *ifac ...@@ -945,7 +945,7 @@ static HRESULT WINAPI d3d8_texture_3d_GetLevelDesc(IDirect3DVolumeTexture8 *ifac
{ {
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format); desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = D3DRTYPE_VOLUME; desc->Type = D3DRTYPE_VOLUME;
desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage); desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage); desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
desc->Size = wined3d_desc.size; desc->Size = wined3d_desc.size;
desc->Width = wined3d_desc.width; desc->Width = wined3d_desc.width;
...@@ -1110,6 +1110,7 @@ HRESULT texture_init(struct d3d8_texture *texture, struct d3d8_device *device, ...@@ -1110,6 +1110,7 @@ HRESULT texture_init(struct d3d8_texture *texture, struct d3d8_device *device,
desc.usage |= WINED3DUSAGE_TEXTURE; 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.access = wined3daccess_from_d3dpool(pool, usage) desc.access = wined3daccess_from_d3dpool(pool, usage)
| WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W; | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.width = width; desc.width = width;
...@@ -1158,6 +1159,7 @@ HRESULT cubetexture_init(struct d3d8_texture *texture, struct d3d8_device *devic ...@@ -1158,6 +1159,7 @@ HRESULT cubetexture_init(struct d3d8_texture *texture, struct d3d8_device *devic
desc.usage |= WINED3DUSAGE_LEGACY_CUBEMAP | WINED3DUSAGE_TEXTURE; desc.usage |= WINED3DUSAGE_LEGACY_CUBEMAP | 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.access = wined3daccess_from_d3dpool(pool, usage) desc.access = wined3daccess_from_d3dpool(pool, usage)
| WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W; | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.width = edge_length; desc.width = edge_length;
...@@ -1205,6 +1207,7 @@ HRESULT volumetexture_init(struct d3d8_texture *texture, struct d3d8_device *dev ...@@ -1205,6 +1207,7 @@ HRESULT volumetexture_init(struct d3d8_texture *texture, struct d3d8_device *dev
desc.usage |= WINED3DUSAGE_TEXTURE; 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.access = wined3daccess_from_d3dpool(pool, usage); desc.access = wined3daccess_from_d3dpool(pool, usage);
desc.width = width; desc.width = width;
desc.height = height; desc.height = height;
......
...@@ -125,7 +125,7 @@ static HRESULT WINAPI d3d8_volume_GetDesc(IDirect3DVolume8 *iface, D3DVOLUME_DES ...@@ -125,7 +125,7 @@ static HRESULT WINAPI d3d8_volume_GetDesc(IDirect3DVolume8 *iface, D3DVOLUME_DES
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format); desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = D3DRTYPE_VOLUME; desc->Type = D3DRTYPE_VOLUME;
desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage); desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage); desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
desc->Size = wined3d_desc.size; desc->Size = wined3d_desc.size;
desc->Width = wined3d_desc.width; desc->Width = wined3d_desc.width;
......
...@@ -230,7 +230,7 @@ static HRESULT WINAPI d3d9_vertexbuffer_GetDesc(IDirect3DVertexBuffer9 *iface, ...@@ -230,7 +230,7 @@ static HRESULT WINAPI d3d9_vertexbuffer_GetDesc(IDirect3DVertexBuffer9 *iface,
desc->Format = D3DFMT_VERTEXDATA; desc->Format = D3DFMT_VERTEXDATA;
desc->Type = D3DRTYPE_VERTEXBUFFER; desc->Type = D3DRTYPE_VERTEXBUFFER;
desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage); desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage); desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
desc->Size = wined3d_desc.size; desc->Size = wined3d_desc.size;
desc->FVF = buffer->fvf; desc->FVF = buffer->fvf;
...@@ -526,7 +526,7 @@ static HRESULT WINAPI d3d9_indexbuffer_GetDesc(IDirect3DIndexBuffer9 *iface, D3D ...@@ -526,7 +526,7 @@ static HRESULT WINAPI d3d9_indexbuffer_GetDesc(IDirect3DIndexBuffer9 *iface, D3D
desc->Format = d3dformat_from_wined3dformat(buffer->format); desc->Format = d3dformat_from_wined3dformat(buffer->format);
desc->Type = D3DRTYPE_INDEXBUFFER; desc->Type = D3DRTYPE_INDEXBUFFER;
desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage); desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage); desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
desc->Size = wined3d_desc.size; desc->Size = wined3d_desc.size;
......
...@@ -291,9 +291,14 @@ static inline struct d3d9_device *impl_from_IDirect3DDevice9Ex(IDirect3DDevice9E ...@@ -291,9 +291,14 @@ static inline struct d3d9_device *impl_from_IDirect3DDevice9Ex(IDirect3DDevice9E
return CONTAINING_RECORD(iface, struct d3d9_device, IDirect3DDevice9Ex_iface); return CONTAINING_RECORD(iface, struct d3d9_device, IDirect3DDevice9Ex_iface);
} }
static inline DWORD d3dusage_from_wined3dusage(unsigned int usage) static inline DWORD d3dusage_from_wined3dusage(unsigned int wined3d_usage, unsigned int bind_flags)
{ {
return usage & WINED3DUSAGE_MASK; DWORD usage = wined3d_usage & WINED3DUSAGE_MASK;
if (bind_flags & WINED3D_BIND_RENDER_TARGET)
usage |= D3DUSAGE_RENDERTARGET;
if (bind_flags & WINED3D_BIND_DEPTH_STENCIL)
usage |= D3DUSAGE_DEPTHSTENCIL;
return usage;
} }
static inline D3DPOOL d3dpool_from_wined3daccess(unsigned int access, unsigned int usage) static inline D3DPOOL d3dpool_from_wined3daccess(unsigned int access, unsigned int usage)
...@@ -331,6 +336,18 @@ static inline unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int ...@@ -331,6 +336,18 @@ static inline unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int
} }
} }
static inline unsigned int wined3d_bind_flags_from_d3d9_usage(DWORD usage)
{
unsigned int bind_flags = 0;
if (usage & D3DUSAGE_RENDERTARGET)
bind_flags |= WINED3D_BIND_RENDER_TARGET;
if (usage & D3DUSAGE_DEPTHSTENCIL)
bind_flags |= WINED3D_BIND_DEPTH_STENCIL;
return bind_flags;
}
static inline DWORD wined3dusage_from_d3dusage(unsigned int usage) static inline DWORD wined3dusage_from_d3dusage(unsigned int usage)
{ {
return usage & WINED3DUSAGE_MASK; return usage & WINED3DUSAGE_MASK;
......
...@@ -1392,6 +1392,7 @@ static HRESULT d3d9_device_create_surface(struct d3d9_device *device, UINT width ...@@ -1392,6 +1392,7 @@ static HRESULT d3d9_device_create_surface(struct d3d9_device *device, UINT width
desc.usage = usage & WINED3DUSAGE_MASK; desc.usage = usage & WINED3DUSAGE_MASK;
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);
desc.access = wined3daccess_from_d3dpool(pool, usage) desc.access = wined3daccess_from_d3dpool(pool, usage)
| WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W; | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.width = width; desc.width = width;
......
...@@ -223,7 +223,7 @@ static HRESULT WINAPI d3d9_surface_GetDesc(IDirect3DSurface9 *iface, D3DSURFACE_ ...@@ -223,7 +223,7 @@ static HRESULT WINAPI d3d9_surface_GetDesc(IDirect3DSurface9 *iface, D3DSURFACE_
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format); desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = D3DRTYPE_SURFACE; desc->Type = D3DRTYPE_SURFACE;
desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage); desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage); desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
desc->MultiSampleType = wined3d_desc.multisample_type; desc->MultiSampleType = wined3d_desc.multisample_type;
desc->MultiSampleQuality = wined3d_desc.multisample_quality; desc->MultiSampleQuality = wined3d_desc.multisample_quality;
......
...@@ -1314,6 +1314,7 @@ HRESULT texture_init(struct d3d9_texture *texture, struct d3d9_device *device, ...@@ -1314,6 +1314,7 @@ HRESULT texture_init(struct d3d9_texture *texture, struct d3d9_device *device,
desc.usage |= WINED3DUSAGE_TEXTURE; 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.access = wined3daccess_from_d3dpool(pool, usage) desc.access = wined3daccess_from_d3dpool(pool, usage)
| WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W; | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.width = width; desc.width = width;
...@@ -1399,6 +1400,7 @@ HRESULT cubetexture_init(struct d3d9_texture *texture, struct d3d9_device *devic ...@@ -1399,6 +1400,7 @@ HRESULT cubetexture_init(struct d3d9_texture *texture, struct d3d9_device *devic
desc.usage |= WINED3DUSAGE_LEGACY_CUBEMAP | WINED3DUSAGE_TEXTURE; desc.usage |= WINED3DUSAGE_LEGACY_CUBEMAP | 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.access = wined3daccess_from_d3dpool(pool, usage) desc.access = wined3daccess_from_d3dpool(pool, usage)
| WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W; | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.width = edge_length; desc.width = edge_length;
...@@ -1470,6 +1472,7 @@ HRESULT volumetexture_init(struct d3d9_texture *texture, struct d3d9_device *dev ...@@ -1470,6 +1472,7 @@ HRESULT volumetexture_init(struct d3d9_texture *texture, struct d3d9_device *dev
desc.usage |= WINED3DUSAGE_TEXTURE; 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.access = wined3daccess_from_d3dpool(pool, usage); desc.access = wined3daccess_from_d3dpool(pool, usage);
desc.width = width; desc.width = width;
desc.height = height; desc.height = height;
......
...@@ -126,7 +126,7 @@ static HRESULT WINAPI d3d9_volume_GetDesc(IDirect3DVolume9 *iface, D3DVOLUME_DES ...@@ -126,7 +126,7 @@ static HRESULT WINAPI d3d9_volume_GetDesc(IDirect3DVolume9 *iface, D3DVOLUME_DES
desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format); desc->Format = d3dformat_from_wined3dformat(wined3d_desc.format);
desc->Type = D3DRTYPE_VOLUME; desc->Type = D3DRTYPE_VOLUME;
desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage); desc->Usage = d3dusage_from_wined3dusage(wined3d_desc.usage, wined3d_desc.bind_flags);
desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage); desc->Pool = d3dpool_from_wined3daccess(wined3d_desc.access, wined3d_desc.usage);
desc->Width = wined3d_desc.width; desc->Width = wined3d_desc.width;
desc->Height = wined3d_desc.height; desc->Height = wined3d_desc.height;
......
...@@ -6065,6 +6065,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ ...@@ -6065,6 +6065,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
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 = 0; wined3d_desc.usage = 0;
wined3d_desc.bind_flags = 0;
wined3d_desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W; wined3d_desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
wined3d_desc.width = desc->dwWidth; wined3d_desc.width = desc->dwWidth;
wined3d_desc.height = desc->dwHeight; wined3d_desc.height = desc->dwHeight;
...@@ -6163,11 +6164,20 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ ...@@ -6163,11 +6164,20 @@ 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.usage |= WINED3DUSAGE_TEXTURE;
wined3d_desc.bind_flags |= WINED3D_BIND_SHADER_RESOURCE;
}
if (desc->ddsCaps.dwCaps & DDSCAPS_ZBUFFER) if (desc->ddsCaps.dwCaps & DDSCAPS_ZBUFFER)
{
wined3d_desc.usage |= WINED3DUSAGE_DEPTHSTENCIL; wined3d_desc.usage |= WINED3DUSAGE_DEPTHSTENCIL;
wined3d_desc.bind_flags |= WINED3D_BIND_DEPTH_STENCIL;
}
else if (desc->ddsCaps.dwCaps & DDSCAPS_3DDEVICE) else if (desc->ddsCaps.dwCaps & DDSCAPS_3DDEVICE)
{
wined3d_desc.usage |= WINED3DUSAGE_RENDERTARGET; wined3d_desc.usage |= WINED3DUSAGE_RENDERTARGET;
wined3d_desc.bind_flags |= WINED3D_BIND_RENDER_TARGET;
}
} }
if (desc->ddsCaps.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE)) if (desc->ddsCaps.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE))
......
...@@ -187,6 +187,11 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_CreateSurface(IWineDXGIDevice *ifac ...@@ -187,6 +187,11 @@ static HRESULT STDMETHODCALLTYPE dxgi_device_CreateSurface(IWineDXGIDevice *ifac
wined3d_sample_desc_from_dxgi(&surface_desc.multisample_type, wined3d_sample_desc_from_dxgi(&surface_desc.multisample_type,
&surface_desc.multisample_quality, &desc->SampleDesc); &surface_desc.multisample_quality, &desc->SampleDesc);
surface_desc.usage = wined3d_usage_from_dxgi_usage(usage); surface_desc.usage = wined3d_usage_from_dxgi_usage(usage);
surface_desc.bind_flags = 0;
if (surface_desc.usage & WINED3DUSAGE_RENDERTARGET)
surface_desc.bind_flags |= WINED3D_BIND_RENDER_TARGET;
if (surface_desc.usage & WINED3DUSAGE_TEXTURE)
surface_desc.bind_flags |= WINED3D_BIND_SHADER_RESOURCE;
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;
......
...@@ -7820,6 +7820,7 @@ static DWORD arbfp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bl ...@@ -7820,6 +7820,7 @@ static DWORD arbfp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bl
desc.multisample_type = src_texture->resource.multisample_type; desc.multisample_type = src_texture->resource.multisample_type;
desc.multisample_quality = src_texture->resource.multisample_quality; desc.multisample_quality = src_texture->resource.multisample_quality;
desc.usage = WINED3DUSAGE_PRIVATE; desc.usage = WINED3DUSAGE_PRIVATE;
desc.bind_flags = 0;
desc.access = WINED3D_RESOURCE_ACCESS_GPU; desc.access = WINED3D_RESOURCE_ACCESS_GPU;
desc.width = wined3d_texture_get_level_width(src_texture, src_level); desc.width = wined3d_texture_get_level_width(src_texture, src_level);
desc.height = wined3d_texture_get_level_height(src_texture, src_level); desc.height = wined3d_texture_get_level_height(src_texture, src_level);
......
...@@ -576,6 +576,7 @@ static void device_load_logo(struct wined3d_device *device, const char *filename ...@@ -576,6 +576,7 @@ static void device_load_logo(struct wined3d_device *device, const char *filename
desc.multisample_type = WINED3D_MULTISAMPLE_NONE; desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
desc.multisample_quality = 0; desc.multisample_quality = 0;
desc.usage = WINED3DUSAGE_DYNAMIC; desc.usage = WINED3DUSAGE_DYNAMIC;
desc.bind_flags = 0;
desc.access = WINED3D_RESOURCE_ACCESS_GPU; desc.access = WINED3D_RESOURCE_ACCESS_GPU;
desc.width = bm.bmWidth; desc.width = bm.bmWidth;
desc.height = bm.bmHeight; desc.height = bm.bmHeight;
...@@ -4548,6 +4549,7 @@ static struct wined3d_texture *wined3d_device_create_cursor_texture(struct wined ...@@ -4548,6 +4549,7 @@ static struct wined3d_texture *wined3d_device_create_cursor_texture(struct wined
desc.multisample_type = WINED3D_MULTISAMPLE_NONE; desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
desc.multisample_quality = 0; desc.multisample_quality = 0;
desc.usage = WINED3DUSAGE_DYNAMIC; desc.usage = WINED3DUSAGE_DYNAMIC;
desc.bind_flags = 0;
desc.access = WINED3D_RESOURCE_ACCESS_GPU; desc.access = WINED3D_RESOURCE_ACCESS_GPU;
desc.width = wined3d_texture_get_level_width(cursor_image, texture_level); desc.width = wined3d_texture_get_level_width(cursor_image, texture_level);
desc.height = wined3d_texture_get_level_height(cursor_image, texture_level); desc.height = wined3d_texture_get_level_height(cursor_image, texture_level);
...@@ -4897,6 +4899,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device, ...@@ -4897,6 +4899,7 @@ HRESULT CDECL wined3d_device_reset(struct wined3d_device *device,
texture_desc.multisample_type = swapchain->desc.multisample_type; texture_desc.multisample_type = swapchain->desc.multisample_type;
texture_desc.multisample_quality = swapchain->desc.multisample_quality; texture_desc.multisample_quality = swapchain->desc.multisample_quality;
texture_desc.usage = WINED3DUSAGE_DEPTHSTENCIL; texture_desc.usage = WINED3DUSAGE_DEPTHSTENCIL;
texture_desc.bind_flags = WINED3D_BIND_DEPTH_STENCIL;
texture_desc.access = WINED3D_RESOURCE_ACCESS_GPU; texture_desc.access = WINED3D_RESOURCE_ACCESS_GPU;
texture_desc.width = swapchain->desc.backbuffer_width; texture_desc.width = swapchain->desc.backbuffer_width;
texture_desc.height = swapchain->desc.backbuffer_height; texture_desc.height = swapchain->desc.backbuffer_height;
......
...@@ -13213,6 +13213,7 @@ static DWORD glsl_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bli ...@@ -13213,6 +13213,7 @@ static DWORD glsl_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_bli
desc.multisample_type = src_texture->resource.multisample_type; desc.multisample_type = src_texture->resource.multisample_type;
desc.multisample_quality = src_texture->resource.multisample_quality; desc.multisample_quality = src_texture->resource.multisample_quality;
desc.usage = WINED3DUSAGE_PRIVATE; desc.usage = WINED3DUSAGE_PRIVATE;
desc.bind_flags = 0;
desc.access = WINED3D_RESOURCE_ACCESS_GPU; desc.access = WINED3D_RESOURCE_ACCESS_GPU;
desc.width = wined3d_texture_get_level_width(src_texture, src_level); desc.width = wined3d_texture_get_level_width(src_texture, src_level);
desc.height = wined3d_texture_get_level_height(src_texture, src_level); desc.height = wined3d_texture_get_level_height(src_texture, src_level);
......
...@@ -289,6 +289,7 @@ void CDECL wined3d_resource_get_desc(const struct wined3d_resource *resource, st ...@@ -289,6 +289,7 @@ void CDECL wined3d_resource_get_desc(const struct wined3d_resource *resource, st
desc->multisample_type = resource->multisample_type; desc->multisample_type = resource->multisample_type;
desc->multisample_quality = resource->multisample_quality; desc->multisample_quality = resource->multisample_quality;
desc->usage = resource->usage; desc->usage = resource->usage;
desc->bind_flags = resource->bind_flags;
desc->access = resource->access; desc->access = resource->access;
desc->width = resource->width; desc->width = resource->width;
desc->height = resource->height; desc->height = resource->height;
......
...@@ -634,6 +634,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr ...@@ -634,6 +634,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
desc.multisample_type = WINED3D_MULTISAMPLE_NONE; desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
desc.multisample_quality = 0; desc.multisample_quality = 0;
desc.usage = WINED3DUSAGE_SCRATCH | WINED3DUSAGE_PRIVATE; desc.usage = WINED3DUSAGE_SCRATCH | WINED3DUSAGE_PRIVATE;
desc.bind_flags = 0;
desc.access = WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W; desc.access = WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.width = wined3d_texture_get_level_width(src_texture, texture_level); desc.width = wined3d_texture_get_level_width(src_texture, texture_level);
desc.height = wined3d_texture_get_level_height(src_texture, texture_level); desc.height = wined3d_texture_get_level_height(src_texture, texture_level);
...@@ -2146,6 +2147,7 @@ static DWORD ffp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit ...@@ -2146,6 +2147,7 @@ static DWORD ffp_blitter_blit(struct wined3d_blitter *blitter, enum wined3d_blit
desc.multisample_type = src_texture->resource.multisample_type; desc.multisample_type = src_texture->resource.multisample_type;
desc.multisample_quality = src_texture->resource.multisample_quality; desc.multisample_quality = src_texture->resource.multisample_quality;
desc.usage = WINED3DUSAGE_PRIVATE; desc.usage = WINED3DUSAGE_PRIVATE;
desc.bind_flags = 0;
desc.access = WINED3D_RESOURCE_ACCESS_GPU; desc.access = WINED3D_RESOURCE_ACCESS_GPU;
desc.width = wined3d_texture_get_level_width(src_texture, src_level); desc.width = wined3d_texture_get_level_width(src_texture, src_level);
desc.height = wined3d_texture_get_level_height(src_texture, src_level); desc.height = wined3d_texture_get_level_height(src_texture, src_level);
......
...@@ -836,6 +836,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3 ...@@ -836,6 +836,7 @@ 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;
texture_desc.bind_flags = 0;
texture_desc.access = WINED3D_RESOURCE_ACCESS_GPU; texture_desc.access = WINED3D_RESOURCE_ACCESS_GPU;
texture_desc.width = swapchain->desc.backbuffer_width; texture_desc.width = swapchain->desc.backbuffer_width;
texture_desc.height = swapchain->desc.backbuffer_height; texture_desc.height = swapchain->desc.backbuffer_height;
...@@ -919,6 +920,11 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3 ...@@ -919,6 +920,11 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
texture_desc.usage = swapchain->desc.backbuffer_usage; texture_desc.usage = swapchain->desc.backbuffer_usage;
if (device->wined3d->flags & WINED3D_NO3D) if (device->wined3d->flags & WINED3D_NO3D)
texture_desc.usage |= WINED3DUSAGE_OWNDC; texture_desc.usage |= WINED3DUSAGE_OWNDC;
texture_desc.bind_flags = 0;
if (texture_desc.usage & WINED3DUSAGE_RENDERTARGET)
texture_desc.bind_flags |= WINED3D_BIND_RENDER_TARGET;
if (texture_desc.usage & WINED3DUSAGE_TEXTURE)
texture_desc.bind_flags |= WINED3D_BIND_SHADER_RESOURCE;
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);
...@@ -944,6 +950,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3 ...@@ -944,6 +950,7 @@ static HRESULT swapchain_init(struct wined3d_swapchain *swapchain, struct wined3
texture_desc.format = swapchain->desc.auto_depth_stencil_format; texture_desc.format = swapchain->desc.auto_depth_stencil_format;
texture_desc.usage = WINED3DUSAGE_DEPTHSTENCIL; texture_desc.usage = WINED3DUSAGE_DEPTHSTENCIL;
texture_desc.bind_flags = WINED3D_BIND_DEPTH_STENCIL;
if (FAILED(hr = device->device_parent->ops->create_swapchain_texture(device->device_parent, if (FAILED(hr = device->device_parent->ops->create_swapchain_texture(device->device_parent,
device->device_parent, &texture_desc, texture_flags, &ds))) device->device_parent, &texture_desc, texture_flags, &ds)))
......
...@@ -2996,7 +2996,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc ...@@ -2996,7 +2996,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
return WINED3DERR_INVALIDCALL; return WINED3DERR_INVALIDCALL;
if (FAILED(hr = resource_init(&texture->resource, device, desc->resource_type, format, if (FAILED(hr = resource_init(&texture->resource, device, desc->resource_type, format,
desc->multisample_type, desc->multisample_quality, desc->usage, 0, desc->access, desc->multisample_type, desc->multisample_quality, desc->usage, desc->bind_flags, desc->access,
desc->width, desc->height, desc->depth, offset, parent, parent_ops, &texture_resource_ops))) desc->width, desc->height, desc->depth, offset, parent, parent_ops, &texture_resource_ops)))
{ {
static unsigned int once; static unsigned int once;
...@@ -3512,6 +3512,7 @@ HRESULT CDECL wined3d_texture_get_sub_resource_desc(const struct wined3d_texture ...@@ -3512,6 +3512,7 @@ HRESULT CDECL wined3d_texture_get_sub_resource_desc(const struct wined3d_texture
desc->multisample_type = resource->multisample_type; desc->multisample_type = resource->multisample_type;
desc->multisample_quality = resource->multisample_quality; desc->multisample_quality = resource->multisample_quality;
desc->usage = resource->usage; desc->usage = resource->usage;
desc->bind_flags = resource->bind_flags;
desc->access = resource->access; desc->access = resource->access;
level_idx = sub_resource_idx % texture->level_count; level_idx = sub_resource_idx % texture->level_count;
......
...@@ -1767,6 +1767,7 @@ struct wined3d_resource_desc ...@@ -1767,6 +1767,7 @@ struct wined3d_resource_desc
enum wined3d_multisample_type multisample_type; enum wined3d_multisample_type multisample_type;
unsigned int multisample_quality; unsigned int multisample_quality;
unsigned int usage; unsigned int usage;
unsigned int bind_flags;
unsigned int access; unsigned int access;
unsigned int width; unsigned int width;
unsigned int height; unsigned int height;
...@@ -1780,6 +1781,7 @@ struct wined3d_sub_resource_desc ...@@ -1780,6 +1781,7 @@ struct wined3d_sub_resource_desc
enum wined3d_multisample_type multisample_type; enum wined3d_multisample_type multisample_type;
unsigned int multisample_quality; unsigned int multisample_quality;
unsigned int usage; unsigned int usage;
unsigned int bind_flags;
unsigned int access; unsigned int access;
unsigned int width; unsigned int width;
unsigned int height; unsigned int height;
......
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