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

wined3d: Introduce a format flag for texturing.

parent 740c44f5
......@@ -3529,271 +3529,7 @@ static BOOL CheckRenderTargetCapability(const struct wined3d_adapter *adapter,
/* Check if a texture format is supported on the given adapter */
static BOOL CheckTextureCapability(const struct wined3d_adapter *adapter, const struct wined3d_format *format)
{
const struct wined3d_gl_info *gl_info = &adapter->gl_info;
switch (format->id)
{
/*****
* supported: RGB(A) formats
*/
case WINED3DFMT_B8G8R8_UNORM:
TRACE("[FAILED] - Not enumerated on Windows.\n");
return FALSE;
case WINED3DFMT_B8G8R8A8_UNORM:
case WINED3DFMT_B8G8R8X8_UNORM:
case WINED3DFMT_B5G6R5_UNORM:
case WINED3DFMT_B5G5R5X1_UNORM:
case WINED3DFMT_B5G5R5A1_UNORM:
case WINED3DFMT_B4G4R4A4_UNORM:
case WINED3DFMT_A8_UNORM:
case WINED3DFMT_B4G4R4X4_UNORM:
case WINED3DFMT_R8G8B8A8_UNORM:
case WINED3DFMT_R8G8B8X8_UNORM:
case WINED3DFMT_B10G10R10A2_UNORM:
case WINED3DFMT_R10G10B10A2_UNORM:
case WINED3DFMT_R16G16_UNORM:
TRACE("[OK]\n");
return TRUE;
case WINED3DFMT_B2G3R3_UNORM:
TRACE("[FAILED] - Not supported on Windows.\n");
return FALSE;
/*****
* Not supported: Palettized
* Only some Geforce/Voodoo3/G400 cards offer 8-bit textures in case of <=Direct3D7.
* Since it is not widely available, don't offer it. Further no Windows driver offers
* WINED3DFMT_P8_UINT_A8_NORM, so don't offer it either.
*/
case WINED3DFMT_P8_UINT:
case WINED3DFMT_P8_UINT_A8_UNORM:
return FALSE;
/*****
* Supported: (Alpha)-Luminance
*/
case WINED3DFMT_L8_UNORM:
case WINED3DFMT_L8A8_UNORM:
case WINED3DFMT_L16_UNORM:
TRACE("[OK]\n");
return TRUE;
/* Not supported on Windows, thus disabled */
case WINED3DFMT_L4A4_UNORM:
TRACE("[FAILED] - not supported on windows\n");
return FALSE;
/*****
* Supported: Depth/Stencil formats
*/
case WINED3DFMT_D16_LOCKABLE:
case WINED3DFMT_D16_UNORM:
case WINED3DFMT_X8D24_UNORM:
case WINED3DFMT_D24_UNORM_S8_UINT:
case WINED3DFMT_S8_UINT_D24_FLOAT:
case WINED3DFMT_D32_UNORM:
case WINED3DFMT_D32_FLOAT:
return TRUE;
case WINED3DFMT_INTZ:
if (gl_info->supported[EXT_PACKED_DEPTH_STENCIL]
|| gl_info->supported[ARB_FRAMEBUFFER_OBJECT])
return TRUE;
return FALSE;
/* Not supported on Windows */
case WINED3DFMT_S1_UINT_D15_UNORM:
case WINED3DFMT_S4X4_UINT_D24_UNORM:
TRACE("[FAILED] - not supported on windows\n");
return FALSE;
/*****
* Not supported everywhere(depends on GL_ATI_envmap_bumpmap or
* GL_NV_texture_shader). Emulated by shaders
*/
case WINED3DFMT_R8G8_SNORM:
case WINED3DFMT_R8G8_SNORM_L8X8_UNORM:
case WINED3DFMT_R5G5_SNORM_L6_UNORM:
case WINED3DFMT_R8G8B8A8_SNORM:
case WINED3DFMT_R16G16_SNORM:
/* Ask the shader backend if it can deal with the conversion. If
* we've got a GL extension giving native support this will be an
* identity conversion. */
if (adapter->shader_backend->shader_color_fixup_supported(format->color_fixup))
{
TRACE("[OK]\n");
return TRUE;
}
TRACE("[FAILED]\n");
return FALSE;
case WINED3DFMT_DXT1:
case WINED3DFMT_DXT2:
case WINED3DFMT_DXT3:
case WINED3DFMT_DXT4:
case WINED3DFMT_DXT5:
if (gl_info->supported[EXT_TEXTURE_COMPRESSION_S3TC])
{
TRACE("[OK]\n");
return TRUE;
}
TRACE("[FAILED]\n");
return FALSE;
/*****
* Odd formats - not supported
*/
case WINED3DFMT_VERTEXDATA:
case WINED3DFMT_R16_UINT:
case WINED3DFMT_R32_UINT:
case WINED3DFMT_R16G16B16A16_SNORM:
case WINED3DFMT_R10G10B10_SNORM_A2_UNORM:
case WINED3DFMT_R10G11B11_SNORM:
case WINED3DFMT_R16:
case WINED3DFMT_AL16:
TRACE("[FAILED]\n"); /* Enable when implemented */
return FALSE;
/*****
* WINED3DFMT_R8G8_SNORM_Cx: Not supported right now
*/
case WINED3DFMT_R8G8_SNORM_Cx:
TRACE("[FAILED]\n"); /* Enable when implemented */
return FALSE;
/* YUV formats */
case WINED3DFMT_UYVY:
case WINED3DFMT_YUY2:
if (gl_info->supported[APPLE_YCBCR_422])
{
TRACE("[OK]\n");
return TRUE;
}
TRACE("[FAILED]\n");
return FALSE;
case WINED3DFMT_YV12:
TRACE("[FAILED]\n");
return FALSE;
case WINED3DFMT_R16G16B16A16_UNORM:
if (gl_info->quirks & WINED3D_QUIRK_BROKEN_RGBA16)
{
TRACE("[FAILED]\n");
return FALSE;
}
TRACE("[OK]\n");
return TRUE;
/* Not supported */
case WINED3DFMT_B2G3R3A8_UNORM:
TRACE("[FAILED]\n"); /* Enable when implemented */
return FALSE;
/* Floating point formats */
case WINED3DFMT_R16_FLOAT:
case WINED3DFMT_R16G16_FLOAT:
case WINED3DFMT_R16G16B16A16_FLOAT:
if (gl_info->supported[ARB_TEXTURE_FLOAT] && gl_info->supported[ARB_HALF_FLOAT_PIXEL])
{
TRACE("[OK]\n");
return TRUE;
}
TRACE("[FAILED]\n");
return FALSE;
case WINED3DFMT_R32_FLOAT:
case WINED3DFMT_R32G32_FLOAT:
case WINED3DFMT_R32G32B32A32_FLOAT:
if (gl_info->supported[ARB_TEXTURE_FLOAT])
{
TRACE("[OK]\n");
return TRUE;
}
TRACE("[FAILED]\n");
return FALSE;
/* ATI instancing hack: Although ATI cards do not support Shader Model 3.0, they support
* instancing. To query if the card supports instancing CheckDeviceFormat with the special format
* MAKEFOURCC('I','N','S','T') is used. Should a (broken) app check for this provide a proper return value.
* We can do instancing with all shader versions, but we need vertex shaders.
*
* Additionally applications have to set the D3DRS_POINTSIZE render state to MAKEFOURCC('I','N','S','T') once
* to enable instancing. WineD3D doesn't need that and just ignores it.
*
* With Shader Model 3.0 capable cards Instancing 'just works' in Windows.
*/
case WINED3DFMT_INST:
TRACE("ATI Instancing check hack\n");
if (gl_info->supported[ARB_VERTEX_PROGRAM] || gl_info->supported[ARB_VERTEX_SHADER])
{
TRACE("[OK]\n");
return TRUE;
}
TRACE("[FAILED]\n");
return FALSE;
/* Some weird FOURCC formats */
case WINED3DFMT_R8G8_B8G8:
case WINED3DFMT_G8R8_G8B8:
case WINED3DFMT_MULTI2_ARGB8:
TRACE("[FAILED]\n");
return FALSE;
/* Vendor specific formats */
case WINED3DFMT_ATI2N:
if (gl_info->supported[ATI_TEXTURE_COMPRESSION_3DC]
|| gl_info->supported[ARB_TEXTURE_COMPRESSION_RGTC])
{
if (adapter->shader_backend->shader_color_fixup_supported(format->color_fixup)
&& adapter->fragment_pipe->color_fixup_supported(format->color_fixup))
{
TRACE("[OK]\n");
return TRUE;
}
}
TRACE("[FAILED]\n");
return FALSE;
/* Depth bound test. To query if the card supports it CheckDeviceFormat with the special
* format MAKEFOURCC('N','V','D','B') is used.
* It is enabled by setting D3DRS_ADAPTIVETESS_X render state to MAKEFOURCC('N','V','D','B') and
* then controlled by setting D3DRS_ADAPTIVETESS_Z (zMin) and D3DRS_ADAPTIVETESS_W (zMax)
* to test value.
*/
case WINED3DFMT_NVDB:
if (gl_info->supported[EXT_DEPTH_BOUNDS_TEST])
{
TRACE("[OK]\n");
return TRUE;
}
TRACE("[FAILED]\n");
return FALSE;
case WINED3DFMT_NVHU:
case WINED3DFMT_NVHS:
/* These formats seem to be similar to the HILO formats in GL_NV_texture_shader. NVHU
* is said to be GL_UNSIGNED_HILO16, NVHS GL_SIGNED_HILO16. Rumours say that d3d computes
* a 3rd channel similarly to D3DFMT_CxV8U8(So NVHS could be called D3DFMT_CxV16U16).
* ATI refused to support formats which can easily be emulated with pixel shaders, so
* Applications have to deal with not having NVHS and NVHU.
*/
TRACE("[FAILED]\n");
return FALSE;
case WINED3DFMT_NULL:
if (gl_info->supported[ARB_FRAMEBUFFER_OBJECT])
return TRUE;
return FALSE;
case WINED3DFMT_UNKNOWN:
return FALSE;
default:
ERR("Unhandled format %s.\n", debug_d3dformat(format->id));
break;
}
return FALSE;
return format->flags & WINED3DFMT_FLAG_TEXTURE;
}
static BOOL CheckSurfaceCapability(const struct wined3d_adapter *adapter,
......
......@@ -2790,6 +2790,7 @@ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN
#define WINED3DFMT_FLAG_BROKEN_PITCH 0x00010000
#define WINED3DFMT_FLAG_BLOCKS 0x00020000
#define WINED3DFMT_FLAG_HEIGHT_SCALE 0x00040000
#define WINED3DFMT_FLAG_TEXTURE 0x00080000
struct wined3d_rational
{
......
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