int IsTextureFormatOk( D3DFORMAT TextureFormat, D3DFORMAT AdapterFormat ) { int ret=0; HRESULT hr; hr = pD3D->CheckDeviceFormat( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, AdapterFormat, 0, D3DRTYPE_TEXTURE, TextureFormat ); if(D3D_OK == hr){ ret=1; } hr = pD3D->CheckDeviceFormat( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, AdapterFormat, D3DUSAGE_RENDERTARGET, D3DRTYPE_TEXTURE, TextureFormat ); if(D3D_OK == hr){ ret=2; } return ret; }
bool RageDisplay_D3D::SupportsTextureFormat( PixelFormat pixfmt, bool realtime ) { #if defined(XBOX) // Lazy... Xbox handles paletted textures completely differently // than D3D and I don't want to add a bunch of code for it. Also, // paletted textures result in worse cache efficiency (see "Xbox // Palettized Texture Performance" in XDK). So, we'll force 32bit // ARGB textures. -Chris // This is also needed for XGSwizzleRect(). return pixfmt == FMT_RGBA8; #endif // Some cards (Savage) don't support alpha in palettes. // Don't allow paletted textures if this is the case. if( pixfmt == FMT_PAL && !(g_DeviceCaps.TextureCaps & D3DPTEXTURECAPS_ALPHAPALETTE) ) return false; if( D3DFORMATS[pixfmt] == D3DFMT_UNKNOWN ) return false; D3DFORMAT d3dfmt = D3DFORMATS[pixfmt]; HRESULT hr = g_pd3d->CheckDeviceFormat( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, g_d3dpp.BackBufferFormat, 0, D3DRTYPE_TEXTURE, d3dfmt); return SUCCEEDED( hr ); }
bool RageDisplay_D3D::SupportsTextureFormat( PixelFormat pixfmt, bool realtime ) { // Some cards (Savage) don't support alpha in palettes. // Don't allow paletted textures if this is the case. if( pixfmt == PixelFormat_PAL && !(g_DeviceCaps.TextureCaps & D3DPTEXTURECAPS_ALPHAPALETTE) ) return false; if( D3DFORMATS[pixfmt] == D3DFMT_UNKNOWN ) return false; D3DFORMAT d3dfmt = D3DFORMATS[pixfmt]; HRESULT hr = g_pd3d->CheckDeviceFormat( D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, g_d3dpp.BackBufferFormat, 0, D3DRTYPE_TEXTURE, d3dfmt); return SUCCEEDED( hr ); }