///////////////////////////////////////////////////////////////////////////////
/// @file Driver.cpp
///
/// @brief base class for drivers
///
/// @author Lightning
///
/// This file is the intellectual property of Novus Delta, LLC.. Usage of the
/// contents of this file is subject to the Destiny3D Member License which
/// can be found at http://www.destiny3d.com.  Any other usage is prohibited.
///
/// This file is distributed "AS IS" without warranty of any kind.  Novus
/// Delta, LLC. does not guarantee the fitness of the contents of this file
/// for any particular purpose.
///
/// Copyright (C) 2001-2003 Novus Delta, LLC. All Rights Reserved.
///
/// <hr>
///                                 Change History
/// <hr>
///
/// @date Aug 2001
/// @author Lightning
/// @remarks Creation
///
/// @date Jul 2004
/// @author poly-gone
/// @remarks BPP checking returns 64 or 128 if fp formats are detected
///
///////////////////////////////////////////////////////////////////////////////

//#include <windows.h>
#include <cstdio>

//include the needed driver headers
#include "deDriver_priv.hpp"
#include "deRenderStates.hpp"

extern deBoolean IdeRenderState_Initialize();
extern deBoolean IdeSurface_Initialize();

deBoolean IdeDriver_Initialize()
{
	if (!IdeRenderState_Initialize())
		return deFALSE;
	if (!IdeSurface_Initialize())
		return deFALSE;

	return deTRUE;
}

long IdeDriver_BPPBitDepth(IdeDriver::BPP BPPType)
{
// NOTICE!! NOTICE!! NOTICE!! NOTICE!! NOTICE!! NOTICE!!
// update the copy of this in deBitmap if you make changes
	switch (BPPType)
	{
	case IdeDriver::BPP_A8:
	case IdeDriver::BPP_R3G3B2:
	case IdeDriver::BPP_P8:
	case IdeDriver::BPP_L8:
	case IdeDriver::BPP_A4L4:
		return 8;

	case IdeDriver::BPP_X1R5G5B5:
	case IdeDriver::BPP_A1R5G5B5:
	case IdeDriver::BPP_A4R4G4B4:
	case IdeDriver::BPP_X4R4G4B4:
	case IdeDriver::BPP_A8R3G3B2:
	case IdeDriver::BPP_R5G6B5:
	case IdeDriver::BPP_A8P8:
	case IdeDriver::BPP_A8L8:
	case IdeDriver::BPP_V8U8:
	case IdeDriver::BPP_L6V5U5:
		return 16;

	case IdeDriver::BPP_R8G8B8:
		return 24;

	case IdeDriver::BPP_A2B10G10R10:
	case IdeDriver::BPP_G16R16:
	case IdeDriver::BPP_A8R8G8B8:
	case IdeDriver::BPP_X8R8G8B8:
	case IdeDriver::BPP_Q8W8V8U8:
	case IdeDriver::BPP_V16U16:
	case IdeDriver::BPP_W11V11U10:
	case IdeDriver::BPP_X8L8V8U8:
	case IdeDriver::BPP_A2W10V10U10:
		return 32;

	case IdeDriver::BPP_DXT1:
	case IdeDriver::BPP_DXT2:
	case IdeDriver::BPP_DXT3:
	case IdeDriver::BPP_DXT4:
	case IdeDriver::BPP_DXT5:
		return 16;

	// floating-point formats
	case IdeDriver::BPP_R16F:
		return 16;
		
	case IdeDriver::BPP_G16R16F:
	case IdeDriver::BPP_R32F:
		return 32;

	case IdeDriver::BPP_A16B16G16R16F:
	case IdeDriver::BPP_G32R32F:
		return 64;

	case IdeDriver::BPP_A32B32G32R32F:
		return 128;

	case IdeDriver::BPP_UYVY:
	case IdeDriver::BPP_YUY2:

	default:
		return 0;
	}
}


