materialsystem/ctexture.cpp
bool CTexture::ConvertToActualFormat( IVTFTexture *pVTFTexture )
{
	if ( !g_pShaderDevice->IsUsingGraphics() )
		return false;

	bool bConverted = false;

	ImageFormat fmt = m_ImageFormat;
	ImageFormat dstFormat = ComputeActualFormat( pVTFTexture->Format() );
#ifdef PLATFORM_OSX
	if ( IsVolumeTexture() && ImageLoader::IsCompressed( dstFormat ) )
	{
		// OSX does not support compressed 3d textures
		dstFormat = IMAGE_FORMAT_RGBA8888;
	}
#endif
	if ( fmt != dstFormat )
	{
		Assert( !IsGameConsole() );
		pVTFTexture->ConvertImageFormat( dstFormat, false );
		m_ImageFormat = dstFormat;
		bConverted = true;
	}
#ifndef _PS3
	// No reason to do this conversion on PS3
	else if ( HardwareConfig()->GetHDRType() == HDR_TYPE_INTEGER &&
		     fmt == dstFormat && dstFormat == IMAGE_FORMAT_RGBA16161616F )
	{
		// This is to force at most the precision of int16 for fp16 texture when running the integer path.
		pVTFTexture->ConvertImageFormat( IMAGE_FORMAT_RGBA16161616, false );
		pVTFTexture->ConvertImageFormat( IMAGE_FORMAT_RGBA16161616F, false );
		bConverted = true;
	}
#endif // !_PS3

	return bConverted;
}
//-----------------------------------------------------------------------------
// Converts the texture to the actual format
// Returns true if conversion applied, false otherwise
//-----------------------------------------------------------------------------
Converts the texture to the actual format
Returns true if conversion applied, false otherwise
Converts the texture to the actual format Returns true if conversion applied false otherwise
bool CTexture::ConvertToActualFormat( IVTFTexture *pVTFTexture )
{
	if ( !g_pShaderDevice->IsUsingGraphics() )
		return false;
	bool bConverted = false;
	ImageFormat fmt = m_ImageFormat;
	ImageFormat dstFormat = ComputeActualFormat( pVTFTexture->Format() );
#ifdef PLATFORM_OSX
	if ( IsVolumeTexture() && ImageLoader::IsCompressed( dstFormat ) )
	{
		dstFormat = IMAGE_FORMAT_RGBA8888;
	}
#endif
	if ( fmt != dstFormat )
	{
		Assert( !IsGameConsole() );
		pVTFTexture->ConvertImageFormat( dstFormat, false );
		m_ImageFormat = dstFormat;
		bConverted = true;
	}
#ifndef _PS3
	else if ( HardwareConfig()->GetHDRType() == HDR_TYPE_INTEGER &&
		     fmt == dstFormat && dstFormat == IMAGE_FORMAT_RGBA16161616F )
	{
		pVTFTexture->ConvertImageFormat( IMAGE_FORMAT_RGBA16161616, false );
		pVTFTexture->ConvertImageFormat( IMAGE_FORMAT_RGBA16161616F, false );
		bConverted = true;
	}
#endif 
	return bConverted;
}
bool CTexture :: ConvertToActualFormat ( IVTFTexture * pVTFTexture ) { if ( ! g_pShaderDevice -> IsUsingGraphics ( ) ) return false ; bool bConverted = false ; ImageFormat fmt = m_ImageFormat ; ImageFormat dstFormat = ComputeActualFormat ( pVTFTexture -> Format ( ) ) ; #ifdef PLATFORM_OSX if ( IsVolumeTexture ( ) && ImageLoader :: IsCompressed ( dstFormat ) ) { dstFormat = IMAGE_FORMAT_RGBA8888 ; } #endif if ( fmt != dstFormat ) { Assert ( ! IsGameConsole ( ) ) ; pVTFTexture -> ConvertImageFormat ( dstFormat , false ) ; m_ImageFormat = dstFormat ; bConverted = true ; } #ifndef _PS3 else if ( HardwareConfig ( ) -> GetHDRType ( ) == HDR_TYPE_INTEGER && fmt == dstFormat && dstFormat == IMAGE_FORMAT_RGBA16161616F ) { pVTFTexture -> ConvertImageFormat ( IMAGE_FORMAT_RGBA16161616 , false ) ; pVTFTexture -> ConvertImageFormat ( IMAGE_FORMAT_RGBA16161616F , false ) ; bConverted = true ; } #endif return bConverted ; }
Converts the texture to the actual format
Returns true if conversion applied, false otherwise
Converts the texture to the actual format Returns true if conversion applied false otherwise
// OSX does not support compressed 3d textures // No reason to do this conversion on PS3 // This is to force at most the precision of int16 for fp16 texture when running the integer path. // !_PS3