wined3d: Pass bind flags to wined3d_check_device_format().
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
543605ca9d
commit
ae6553bd0b
|
@ -3297,15 +3297,15 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFormatSupport(ID3D11Device2 *
|
|||
static const struct
|
||||
{
|
||||
enum wined3d_resource_type rtype;
|
||||
unsigned int usage;
|
||||
unsigned int bind_flags;
|
||||
D3D11_FORMAT_SUPPORT flag;
|
||||
}
|
||||
flag_mapping[] =
|
||||
{
|
||||
{WINED3D_RTYPE_TEXTURE_2D, WINED3DUSAGE_TEXTURE, D3D11_FORMAT_SUPPORT_TEXTURE2D},
|
||||
{WINED3D_RTYPE_TEXTURE_3D, WINED3DUSAGE_TEXTURE, D3D11_FORMAT_SUPPORT_TEXTURE3D},
|
||||
{WINED3D_RTYPE_NONE, WINED3DUSAGE_RENDERTARGET, D3D11_FORMAT_SUPPORT_RENDER_TARGET},
|
||||
{WINED3D_RTYPE_NONE, WINED3DUSAGE_DEPTHSTENCIL, D3D11_FORMAT_SUPPORT_DEPTH_STENCIL},
|
||||
{WINED3D_RTYPE_TEXTURE_2D, WINED3D_BIND_SHADER_RESOURCE, D3D11_FORMAT_SUPPORT_TEXTURE2D},
|
||||
{WINED3D_RTYPE_TEXTURE_3D, WINED3D_BIND_SHADER_RESOURCE, D3D11_FORMAT_SUPPORT_TEXTURE3D},
|
||||
{WINED3D_RTYPE_NONE, WINED3D_BIND_RENDER_TARGET, D3D11_FORMAT_SUPPORT_RENDER_TARGET},
|
||||
{WINED3D_RTYPE_NONE, WINED3D_BIND_DEPTH_STENCIL, D3D11_FORMAT_SUPPORT_DEPTH_STENCIL},
|
||||
};
|
||||
HRESULT hr;
|
||||
|
||||
|
@ -3327,7 +3327,7 @@ static HRESULT STDMETHODCALLTYPE d3d11_device_CheckFormatSupport(ID3D11Device2 *
|
|||
for (i = 0; i < ARRAY_SIZE(flag_mapping); ++i)
|
||||
{
|
||||
hr = wined3d_check_device_format(wined3d, params.adapter_idx, params.device_type,
|
||||
WINED3DFMT_UNKNOWN, flag_mapping[i].usage, flag_mapping[i].rtype, wined3d_format);
|
||||
WINED3DFMT_UNKNOWN, 0, flag_mapping[i].bind_flags, flag_mapping[i].rtype, wined3d_format);
|
||||
if (hr == WINED3DERR_NOTAVAILABLE || hr == WINED3DOK_NOMIPGEN)
|
||||
continue;
|
||||
if (hr != WINED3D_OK)
|
||||
|
|
|
@ -236,6 +236,7 @@ static HRESULT WINAPI d3d8_CheckDeviceFormat(IDirect3D8 *iface, UINT adapter, D3
|
|||
{
|
||||
struct d3d8 *d3d8 = impl_from_IDirect3D8(iface);
|
||||
enum wined3d_resource_type wined3d_rtype;
|
||||
unsigned int bind_flags;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, adapter %u, device_type %#x, adapter_format %#x, usage %#x, resource_type %#x, format %#x.\n",
|
||||
|
@ -247,20 +248,21 @@ static HRESULT WINAPI d3d8_CheckDeviceFormat(IDirect3D8 *iface, UINT adapter, D3
|
|||
return D3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
bind_flags = wined3d_bind_flags_from_d3d8_usage(usage);
|
||||
usage = usage & (WINED3DUSAGE_MASK | WINED3DUSAGE_QUERY_MASK);
|
||||
switch (resource_type)
|
||||
{
|
||||
case D3DRTYPE_CUBETEXTURE:
|
||||
usage |= WINED3DUSAGE_LEGACY_CUBEMAP;
|
||||
case D3DRTYPE_TEXTURE:
|
||||
usage |= WINED3DUSAGE_TEXTURE;
|
||||
bind_flags |= WINED3D_BIND_SHADER_RESOURCE;
|
||||
case D3DRTYPE_SURFACE:
|
||||
wined3d_rtype = WINED3D_RTYPE_TEXTURE_2D;
|
||||
break;
|
||||
|
||||
case D3DRTYPE_VOLUMETEXTURE:
|
||||
case D3DRTYPE_VOLUME:
|
||||
usage |= WINED3DUSAGE_TEXTURE;
|
||||
bind_flags |= WINED3D_BIND_SHADER_RESOURCE;
|
||||
wined3d_rtype = WINED3D_RTYPE_TEXTURE_3D;
|
||||
break;
|
||||
|
||||
|
@ -276,7 +278,7 @@ static HRESULT WINAPI d3d8_CheckDeviceFormat(IDirect3D8 *iface, UINT adapter, D3
|
|||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_check_device_format(d3d8->wined3d, adapter, device_type, wined3dformat_from_d3dformat(adapter_format),
|
||||
usage, wined3d_rtype, wined3dformat_from_d3dformat(format));
|
||||
usage, bind_flags, wined3d_rtype, wined3dformat_from_d3dformat(format));
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return hr;
|
||||
|
|
|
@ -249,6 +249,7 @@ static HRESULT WINAPI d3d9_CheckDeviceFormat(IDirect3D9Ex *iface, UINT adapter,
|
|||
{
|
||||
struct d3d9 *d3d9 = impl_from_IDirect3D9Ex(iface);
|
||||
enum wined3d_resource_type wined3d_rtype;
|
||||
unsigned int bind_flags;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("iface %p, adapter %u, device_type %#x, adapter_format %#x, usage %#x, resource_type %#x, format %#x.\n",
|
||||
|
@ -260,20 +261,21 @@ static HRESULT WINAPI d3d9_CheckDeviceFormat(IDirect3D9Ex *iface, UINT adapter,
|
|||
return D3DERR_INVALIDCALL;
|
||||
}
|
||||
|
||||
bind_flags = wined3d_bind_flags_from_d3d9_usage(usage);
|
||||
usage = usage & (WINED3DUSAGE_MASK | WINED3DUSAGE_QUERY_MASK);
|
||||
switch (resource_type)
|
||||
{
|
||||
case D3DRTYPE_CUBETEXTURE:
|
||||
usage |= WINED3DUSAGE_LEGACY_CUBEMAP;
|
||||
case D3DRTYPE_TEXTURE:
|
||||
usage |= WINED3DUSAGE_TEXTURE;
|
||||
bind_flags |= WINED3D_BIND_SHADER_RESOURCE;
|
||||
case D3DRTYPE_SURFACE:
|
||||
wined3d_rtype = WINED3D_RTYPE_TEXTURE_2D;
|
||||
break;
|
||||
|
||||
case D3DRTYPE_VOLUMETEXTURE:
|
||||
case D3DRTYPE_VOLUME:
|
||||
usage |= WINED3DUSAGE_TEXTURE;
|
||||
bind_flags |= WINED3D_BIND_SHADER_RESOURCE;
|
||||
wined3d_rtype = WINED3D_RTYPE_TEXTURE_3D;
|
||||
break;
|
||||
|
||||
|
@ -289,7 +291,7 @@ static HRESULT WINAPI d3d9_CheckDeviceFormat(IDirect3D9Ex *iface, UINT adapter,
|
|||
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_check_device_format(d3d9->wined3d, adapter, device_type, wined3dformat_from_d3dformat(adapter_format),
|
||||
usage, wined3d_rtype, wined3dformat_from_d3dformat(format));
|
||||
usage, bind_flags, wined3d_rtype, wined3dformat_from_d3dformat(format));
|
||||
wined3d_mutex_unlock();
|
||||
|
||||
return hr;
|
||||
|
|
|
@ -1341,8 +1341,9 @@ HRESULT texture_init(struct d3d9_texture *texture, struct d3d9_device *device,
|
|||
return D3DERR_INVALIDCALL;
|
||||
}
|
||||
wined3d_mutex_lock();
|
||||
hr = wined3d_check_device_format(device->d3d_parent->wined3d, 0, WINED3D_DEVICE_TYPE_HAL, WINED3DFMT_B8G8R8A8_UNORM,
|
||||
WINED3DUSAGE_TEXTURE | WINED3DUSAGE_QUERY_GENMIPMAP, WINED3D_RTYPE_TEXTURE_2D, wined3dformat_from_d3dformat(format));
|
||||
hr = wined3d_check_device_format(device->d3d_parent->wined3d, WINED3DADAPTER_DEFAULT,
|
||||
WINED3D_DEVICE_TYPE_HAL, WINED3DFMT_B8G8R8A8_UNORM, WINED3DUSAGE_QUERY_GENMIPMAP,
|
||||
WINED3D_BIND_SHADER_RESOURCE, WINED3D_RTYPE_TEXTURE_2D, wined3dformat_from_d3dformat(format));
|
||||
wined3d_mutex_unlock();
|
||||
if (hr == D3D_OK)
|
||||
{
|
||||
|
|
|
@ -1743,7 +1743,7 @@ static HRESULT WINAPI ddraw7_GetFourCCCodes(IDirectDraw7 *iface, DWORD *NumCodes
|
|||
for (i = 0; i < ARRAY_SIZE(formats); ++i)
|
||||
{
|
||||
if (SUCCEEDED(wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, WINED3D_DEVICE_TYPE_HAL,
|
||||
mode.format_id, 0, WINED3D_RTYPE_TEXTURE_2D, formats[i])))
|
||||
mode.format_id, 0, 0, WINED3D_RTYPE_TEXTURE_2D, formats[i])))
|
||||
{
|
||||
if (count < outsize)
|
||||
Codes[count] = formats[i];
|
||||
|
@ -4437,8 +4437,8 @@ static HRESULT WINAPI d3d7_EnumZBufferFormats(IDirect3D7 *iface, REFCLSID device
|
|||
|
||||
for (i = 0; i < ARRAY_SIZE(formats); ++i)
|
||||
{
|
||||
if (SUCCEEDED(wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, type, mode.format_id,
|
||||
WINED3DUSAGE_DEPTHSTENCIL, WINED3D_RTYPE_TEXTURE_2D, formats[i])))
|
||||
if (SUCCEEDED(wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, type,
|
||||
mode.format_id, 0, WINED3D_BIND_DEPTH_STENCIL, WINED3D_RTYPE_TEXTURE_2D, formats[i])))
|
||||
{
|
||||
DDPIXELFORMAT pformat;
|
||||
|
||||
|
@ -4462,7 +4462,7 @@ static HRESULT WINAPI d3d7_EnumZBufferFormats(IDirect3D7 *iface, REFCLSID device
|
|||
* pixel format, so we use dwZBufferBitDepth=32. Some games expect 24. Windows Vista and
|
||||
* newer enumerate both versions, so we do the same(bug 22434) */
|
||||
if (SUCCEEDED(wined3d_check_device_format(ddraw->wined3d, WINED3DADAPTER_DEFAULT, type, mode.format_id,
|
||||
WINED3DUSAGE_DEPTHSTENCIL, WINED3D_RTYPE_TEXTURE_2D, WINED3DFMT_X8D24_UNORM)))
|
||||
0, WINED3D_BIND_DEPTH_STENCIL, WINED3D_RTYPE_TEXTURE_2D, WINED3DFMT_X8D24_UNORM)))
|
||||
{
|
||||
DDPIXELFORMAT x8d24 =
|
||||
{
|
||||
|
|
|
@ -1089,7 +1089,7 @@ static HRESULT d3d_device7_EnumTextureFormats(IDirect3DDevice7 *iface,
|
|||
for (i = 0; i < ARRAY_SIZE(FormatList); ++i)
|
||||
{
|
||||
if (wined3d_check_device_format(device->ddraw->wined3d, WINED3DADAPTER_DEFAULT, WINED3D_DEVICE_TYPE_HAL,
|
||||
mode.format_id, WINED3DUSAGE_TEXTURE, WINED3D_RTYPE_TEXTURE_2D, FormatList[i]) == D3D_OK)
|
||||
mode.format_id, 0, WINED3D_BIND_SHADER_RESOURCE, WINED3D_RTYPE_TEXTURE_2D, FormatList[i]) == D3D_OK)
|
||||
{
|
||||
DDPIXELFORMAT pformat;
|
||||
|
||||
|
@ -1111,8 +1111,8 @@ static HRESULT d3d_device7_EnumTextureFormats(IDirect3DDevice7 *iface,
|
|||
for (i = 0; i < ARRAY_SIZE(BumpFormatList); ++i)
|
||||
{
|
||||
if (wined3d_check_device_format(device->ddraw->wined3d, WINED3DADAPTER_DEFAULT,
|
||||
WINED3D_DEVICE_TYPE_HAL, mode.format_id, WINED3DUSAGE_TEXTURE | WINED3DUSAGE_QUERY_LEGACYBUMPMAP,
|
||||
WINED3D_RTYPE_TEXTURE_2D, BumpFormatList[i]) == D3D_OK)
|
||||
WINED3D_DEVICE_TYPE_HAL, mode.format_id, WINED3DUSAGE_QUERY_LEGACYBUMPMAP,
|
||||
WINED3D_BIND_SHADER_RESOURCE, WINED3D_RTYPE_TEXTURE_2D, BumpFormatList[i]) == D3D_OK)
|
||||
{
|
||||
DDPIXELFORMAT pformat;
|
||||
|
||||
|
@ -1216,8 +1216,8 @@ static HRESULT WINAPI d3d_device2_EnumTextureFormats(IDirect3DDevice2 *iface,
|
|||
|
||||
for (i = 0; i < ARRAY_SIZE(FormatList); ++i)
|
||||
{
|
||||
if (wined3d_check_device_format(device->ddraw->wined3d, 0, WINED3D_DEVICE_TYPE_HAL,
|
||||
mode.format_id, WINED3DUSAGE_TEXTURE, WINED3D_RTYPE_TEXTURE_2D, FormatList[i]) == D3D_OK)
|
||||
if (wined3d_check_device_format(device->ddraw->wined3d, WINED3DADAPTER_DEFAULT, WINED3D_DEVICE_TYPE_HAL,
|
||||
mode.format_id, 0, WINED3D_BIND_SHADER_RESOURCE, WINED3D_RTYPE_TEXTURE_2D, FormatList[i]) == D3D_OK)
|
||||
{
|
||||
DDSURFACEDESC sdesc;
|
||||
|
||||
|
|
|
@ -6119,21 +6119,27 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
|
|||
{
|
||||
if (!(desc->ddsCaps.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE)))
|
||||
{
|
||||
unsigned int bind_flags = 0;
|
||||
DWORD usage = 0;
|
||||
|
||||
if (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP)
|
||||
usage |= WINED3DUSAGE_LEGACY_CUBEMAP | WINED3DUSAGE_TEXTURE;
|
||||
{
|
||||
usage |= WINED3DUSAGE_LEGACY_CUBEMAP;
|
||||
bind_flags |= WINED3D_BIND_SHADER_RESOURCE;
|
||||
}
|
||||
else if (desc->ddsCaps.dwCaps & DDSCAPS_TEXTURE)
|
||||
usage |= WINED3DUSAGE_TEXTURE;
|
||||
{
|
||||
bind_flags |= WINED3D_BIND_SHADER_RESOURCE;
|
||||
}
|
||||
|
||||
if (desc->ddsCaps.dwCaps & DDSCAPS_ZBUFFER)
|
||||
usage = WINED3DUSAGE_DEPTHSTENCIL;
|
||||
bind_flags |= WINED3D_BIND_DEPTH_STENCIL;
|
||||
else if (desc->ddsCaps.dwCaps & DDSCAPS_3DDEVICE)
|
||||
usage = WINED3DUSAGE_RENDERTARGET;
|
||||
bind_flags |= WINED3D_BIND_RENDER_TARGET;
|
||||
|
||||
if (!(ddraw->flags & DDRAW_NO3D) && SUCCEEDED(hr = wined3d_check_device_format(ddraw->wined3d,
|
||||
WINED3DADAPTER_DEFAULT, WINED3D_DEVICE_TYPE_HAL, mode.format_id,
|
||||
usage, WINED3D_RTYPE_TEXTURE_2D, wined3d_desc.format)))
|
||||
usage, bind_flags, WINED3D_RTYPE_TEXTURE_2D, wined3d_desc.format)))
|
||||
desc->ddsCaps.dwCaps |= DDSCAPS_VIDEOMEMORY;
|
||||
else
|
||||
desc->ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
|
||||
|
|
|
@ -1518,20 +1518,21 @@ static BOOL wined3d_check_surface_capability(const struct wined3d_format *format
|
|||
* restrict it to some should applications need that. */
|
||||
HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT adapter_idx,
|
||||
enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id, DWORD usage,
|
||||
enum wined3d_resource_type resource_type, enum wined3d_format_id check_format_id)
|
||||
unsigned int bind_flags, enum wined3d_resource_type resource_type, enum wined3d_format_id check_format_id)
|
||||
{
|
||||
const struct wined3d_format *adapter_format, *format;
|
||||
enum wined3d_gl_resource_type gl_type, gl_type_end;
|
||||
const struct wined3d_adapter *adapter;
|
||||
BOOL mipmap_gen_supported = TRUE;
|
||||
unsigned int allowed_bind_flags;
|
||||
DWORD format_flags = 0;
|
||||
DWORD allowed_usage;
|
||||
|
||||
TRACE("wined3d %p, adapter_idx %u, device_type %s, adapter_format %s, usage %s, %s, "
|
||||
"resource_type %s, check_format %s.\n",
|
||||
"bind_flags %s, resource_type %s, check_format %s.\n",
|
||||
wined3d, adapter_idx, debug_d3ddevicetype(device_type), debug_d3dformat(adapter_format_id),
|
||||
debug_d3dusage(usage), debug_d3dusagequery(usage), debug_d3dresourcetype(resource_type),
|
||||
debug_d3dformat(check_format_id));
|
||||
debug_d3dusage(usage), debug_d3dusagequery(usage), wined3d_debug_bind_flags(bind_flags),
|
||||
debug_d3dresourcetype(resource_type), debug_d3dformat(check_format_id));
|
||||
|
||||
if (adapter_idx >= wined3d->adapter_count)
|
||||
return WINED3DERR_INVALIDCALL;
|
||||
|
@ -1540,11 +1541,20 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad
|
|||
adapter_format = wined3d_get_format(adapter, adapter_format_id, WINED3DUSAGE_RENDERTARGET);
|
||||
format = wined3d_get_format(adapter, check_format_id, usage);
|
||||
|
||||
if (usage & WINED3DUSAGE_RENDERTARGET)
|
||||
bind_flags |= WINED3D_BIND_RENDER_TARGET;
|
||||
if (usage & WINED3DUSAGE_DEPTHSTENCIL)
|
||||
bind_flags |= WINED3D_BIND_DEPTH_STENCIL;
|
||||
if (usage & WINED3DUSAGE_TEXTURE)
|
||||
bind_flags |= WINED3D_BIND_SHADER_RESOURCE;
|
||||
usage &= ~(WINED3DUSAGE_RENDERTARGET | WINED3DUSAGE_DEPTHSTENCIL | WINED3DUSAGE_TEXTURE);
|
||||
|
||||
switch (resource_type)
|
||||
{
|
||||
case WINED3D_RTYPE_NONE:
|
||||
allowed_usage = WINED3DUSAGE_DEPTHSTENCIL
|
||||
| WINED3DUSAGE_RENDERTARGET;
|
||||
allowed_usage = 0;
|
||||
allowed_bind_flags = WINED3D_BIND_RENDER_TARGET
|
||||
| WINED3D_BIND_DEPTH_STENCIL;
|
||||
gl_type = WINED3D_GL_RES_TYPE_TEX_2D;
|
||||
gl_type_end = WINED3D_GL_RES_TYPE_TEX_3D;
|
||||
break;
|
||||
|
@ -1552,7 +1562,6 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad
|
|||
case WINED3D_RTYPE_TEXTURE_1D:
|
||||
allowed_usage = WINED3DUSAGE_DYNAMIC
|
||||
| WINED3DUSAGE_SOFTWAREPROCESSING
|
||||
| WINED3DUSAGE_TEXTURE
|
||||
| WINED3DUSAGE_QUERY_FILTER
|
||||
| WINED3DUSAGE_QUERY_GENMIPMAP
|
||||
| WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
|
||||
|
@ -1560,16 +1569,17 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad
|
|||
| WINED3DUSAGE_QUERY_SRGBWRITE
|
||||
| WINED3DUSAGE_QUERY_VERTEXTEXTURE
|
||||
| WINED3DUSAGE_QUERY_WRAPANDMIP;
|
||||
allowed_bind_flags = WINED3D_BIND_SHADER_RESOURCE;
|
||||
gl_type = gl_type_end = WINED3D_GL_RES_TYPE_TEX_1D;
|
||||
break;
|
||||
|
||||
case WINED3D_RTYPE_TEXTURE_2D:
|
||||
allowed_usage = WINED3DUSAGE_DEPTHSTENCIL
|
||||
| WINED3DUSAGE_RENDERTARGET
|
||||
| WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING;
|
||||
if (usage & WINED3DUSAGE_RENDERTARGET)
|
||||
allowed_usage = WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING;
|
||||
if (bind_flags & WINED3D_BIND_RENDER_TARGET)
|
||||
allowed_usage |= WINED3DUSAGE_QUERY_SRGBWRITE;
|
||||
if (!(usage & WINED3DUSAGE_TEXTURE))
|
||||
allowed_bind_flags = WINED3D_BIND_RENDER_TARGET
|
||||
| WINED3D_BIND_DEPTH_STENCIL;
|
||||
if (!(bind_flags & WINED3D_BIND_SHADER_RESOURCE))
|
||||
{
|
||||
if (!wined3d_check_surface_capability(format))
|
||||
{
|
||||
|
@ -1583,7 +1593,6 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad
|
|||
allowed_usage |= WINED3DUSAGE_DYNAMIC
|
||||
| WINED3DUSAGE_LEGACY_CUBEMAP
|
||||
| WINED3DUSAGE_SOFTWAREPROCESSING
|
||||
| WINED3DUSAGE_TEXTURE
|
||||
| WINED3DUSAGE_QUERY_FILTER
|
||||
| WINED3DUSAGE_QUERY_GENMIPMAP
|
||||
| WINED3DUSAGE_QUERY_LEGACYBUMPMAP
|
||||
|
@ -1591,13 +1600,15 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad
|
|||
| WINED3DUSAGE_QUERY_SRGBWRITE
|
||||
| WINED3DUSAGE_QUERY_VERTEXTEXTURE
|
||||
| WINED3DUSAGE_QUERY_WRAPANDMIP;
|
||||
allowed_bind_flags |= WINED3D_BIND_SHADER_RESOURCE;
|
||||
gl_type = gl_type_end = WINED3D_GL_RES_TYPE_TEX_2D;
|
||||
if (usage & WINED3DUSAGE_LEGACY_CUBEMAP)
|
||||
{
|
||||
allowed_usage &= ~(WINED3DUSAGE_DEPTHSTENCIL | WINED3DUSAGE_QUERY_LEGACYBUMPMAP);
|
||||
allowed_usage &= ~WINED3DUSAGE_QUERY_LEGACYBUMPMAP;
|
||||
allowed_bind_flags &= ~WINED3D_BIND_DEPTH_STENCIL;
|
||||
gl_type = gl_type_end = WINED3D_GL_RES_TYPE_TEX_CUBE;
|
||||
}
|
||||
else if ((usage & WINED3DUSAGE_DEPTHSTENCIL)
|
||||
else if ((bind_flags & WINED3D_BIND_DEPTH_STENCIL)
|
||||
&& (format->flags[WINED3D_GL_RES_TYPE_TEX_2D] & WINED3DFMT_FLAG_SHADOW)
|
||||
&& !adapter->gl_info.supported[ARB_SHADOW])
|
||||
{
|
||||
|
@ -1609,13 +1620,13 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad
|
|||
case WINED3D_RTYPE_TEXTURE_3D:
|
||||
allowed_usage = WINED3DUSAGE_DYNAMIC
|
||||
| WINED3DUSAGE_SOFTWAREPROCESSING
|
||||
| WINED3DUSAGE_TEXTURE
|
||||
| WINED3DUSAGE_QUERY_FILTER
|
||||
| WINED3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING
|
||||
| WINED3DUSAGE_QUERY_SRGBREAD
|
||||
| WINED3DUSAGE_QUERY_SRGBWRITE
|
||||
| WINED3DUSAGE_QUERY_VERTEXTEXTURE
|
||||
| WINED3DUSAGE_QUERY_WRAPANDMIP;
|
||||
allowed_bind_flags = WINED3D_BIND_SHADER_RESOURCE;
|
||||
gl_type = gl_type_end = WINED3D_GL_RES_TYPE_TEX_3D;
|
||||
break;
|
||||
|
||||
|
@ -1631,7 +1642,15 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad
|
|||
return WINED3DERR_NOTAVAILABLE;
|
||||
}
|
||||
|
||||
if (usage & WINED3DUSAGE_TEXTURE)
|
||||
if ((bind_flags & allowed_bind_flags) != bind_flags)
|
||||
{
|
||||
TRACE("Requested bind flags %s, but resource type %s only allows %s.\n",
|
||||
wined3d_debug_bind_flags(bind_flags), debug_d3dresourcetype(resource_type),
|
||||
wined3d_debug_bind_flags(allowed_bind_flags));
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
}
|
||||
|
||||
if (bind_flags & WINED3D_BIND_SHADER_RESOURCE)
|
||||
format_flags |= WINED3DFMT_FLAG_TEXTURE;
|
||||
if (usage & WINED3DUSAGE_QUERY_FILTER)
|
||||
format_flags |= WINED3DFMT_FLAG_FILTERING;
|
||||
|
@ -1661,22 +1680,22 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad
|
|||
return WINED3DERR_NOTAVAILABLE;
|
||||
}
|
||||
|
||||
if ((usage & WINED3DUSAGE_RENDERTARGET)
|
||||
if ((bind_flags & WINED3D_BIND_RENDER_TARGET)
|
||||
&& !CheckRenderTargetCapability(adapter, adapter_format, format, gl_type))
|
||||
{
|
||||
TRACE("Requested WINED3DUSAGE_RENDERTARGET, but format %s is not supported for render targets.\n",
|
||||
TRACE("Requested WINED3D_BIND_RENDER_TARGET, but format %s is not supported for render targets.\n",
|
||||
debug_d3dformat(check_format_id));
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
}
|
||||
|
||||
/* 3D depth / stencil textures are never supported. */
|
||||
if (usage == WINED3DUSAGE_DEPTHSTENCIL && gl_type == WINED3D_GL_RES_TYPE_TEX_3D)
|
||||
if (bind_flags == WINED3D_BIND_DEPTH_STENCIL && gl_type == WINED3D_GL_RES_TYPE_TEX_3D)
|
||||
continue;
|
||||
|
||||
if ((usage & WINED3DUSAGE_DEPTHSTENCIL)
|
||||
if ((bind_flags & WINED3D_BIND_DEPTH_STENCIL)
|
||||
&& !CheckDepthStencilCapability(adapter, adapter_format, format, gl_type))
|
||||
{
|
||||
TRACE("Requested WINED3DUSAGE_DEPTHSTENCIL, but format %s is not supported for depth / stencil buffers.\n",
|
||||
TRACE("Requested WINED3D_BIND_DEPTH_STENCIL, but format %s is not supported for depth/stencil buffers.\n",
|
||||
debug_d3dformat(check_format_id));
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
}
|
||||
|
@ -1827,7 +1846,7 @@ HRESULT CDECL wined3d_check_device_type(const struct wined3d *wined3d, UINT adap
|
|||
|
||||
/* Validate that the back buffer format is usable for render targets. */
|
||||
if (FAILED(wined3d_check_device_format(wined3d, adapter_idx, device_type, display_format,
|
||||
WINED3DUSAGE_RENDERTARGET, WINED3D_RTYPE_TEXTURE_2D, backbuffer_format)))
|
||||
0, WINED3D_BIND_RENDER_TARGET, WINED3D_RTYPE_TEXTURE_2D, backbuffer_format)))
|
||||
{
|
||||
TRACE("Format %s not allowed for render targets.\n", debug_d3dformat(backbuffer_format));
|
||||
return WINED3DERR_NOTAVAILABLE;
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
@ cdecl wined3d_calculate_format_pitch(ptr long long long)
|
||||
@ cdecl wined3d_check_depth_stencil_match(ptr long long long long long)
|
||||
@ cdecl wined3d_check_device_format(ptr long long long long long long)
|
||||
@ cdecl wined3d_check_device_format(ptr long long long long long long long)
|
||||
@ cdecl wined3d_check_device_format_conversion(ptr long long long long)
|
||||
@ cdecl wined3d_check_device_multisample_type(ptr long long long long long ptr)
|
||||
@ cdecl wined3d_check_device_type(ptr long long long long long)
|
||||
|
|
|
@ -2182,7 +2182,7 @@ HRESULT __cdecl wined3d_check_depth_stencil_match(const struct wined3d *wined3d,
|
|||
enum wined3d_format_id render_target_format_id, enum wined3d_format_id depth_stencil_format_id);
|
||||
HRESULT __cdecl wined3d_check_device_format(const struct wined3d *wined3d, UINT adaper_idx,
|
||||
enum wined3d_device_type device_type, enum wined3d_format_id adapter_format_id, DWORD usage,
|
||||
enum wined3d_resource_type resource_type, enum wined3d_format_id check_format_id);
|
||||
unsigned int bind_flags, enum wined3d_resource_type resource_type, enum wined3d_format_id check_format_id);
|
||||
HRESULT __cdecl wined3d_check_device_format_conversion(const struct wined3d *wined3d, UINT adapter_idx,
|
||||
enum wined3d_device_type device_type, enum wined3d_format_id source_format_id,
|
||||
enum wined3d_format_id target_format_id);
|
||||
|
|
Loading…
Reference in New Issue