Example #1
0
uint32_t Mapping::getDirect3D9Format(Renderer::TextureFormat::Enum textureFormat)
{
    // D3DFORMAT
#define MCHAR4(a, b, c, d) (a | (b << 8) | (c << 16) | (d << 24))
    static const uint32_t MAPPING[] =
    {
        D3DFMT_A8,					// Renderer::TextureFormat::A8            - 8-bit pixel format, all bits alpha
        D3DFMT_X8R8G8B8,			// Renderer::TextureFormat::R8G8B8        - 24-bit pixel format, 8 bits for red, green and blue - "D3DFMT_R8G8B8" is usually not supported
        D3DFMT_A8R8G8B8,			// Renderer::TextureFormat::R8G8B8A8      - 32-bit pixel format, 8 bits for red, green, blue and alpha
        D3DFMT_A16B16G16R16F,		// Renderer::TextureFormat::R16G16B16A16F - 64-bit float format using 16 bits for the each channel (red, green, blue, alpha)
        D3DFMT_A32B32G32R32F,		// Renderer::TextureFormat::R32G32B32A32F - 128-bit float format using 32 bits for the each channel (red, green, blue, alpha)
        D3DFMT_DXT1,				// Renderer::TextureFormat::BC1           - DXT1 compression (known as BC1 in DirectX 10, RGB compression: 8:1, 8 bytes per block)
        D3DFMT_DXT3,				// Renderer::TextureFormat::BC2           - DXT3 compression (known as BC2 in DirectX 10, RGBA compression: 4:1, 16 bytes per block)
        D3DFMT_DXT5,				// Renderer::TextureFormat::BC3           - DXT5 compression (known as BC3 in DirectX 10, RGBA compression: 4:1, 16 bytes per block)
        MCHAR4('A', 'T', 'I', '1'),	// Renderer::TextureFormat::BC4           - 1 component texture compression (also known as 3DC+/ATI1N, known as BC4 in DirectX 10, 8 bytes per block)
        MCHAR4('A', 'T', 'I', '2'),	// Renderer::TextureFormat::BC5           - 2 component texture compression (luminance & alpha compression 4:1 -> normal map compression, also known as 3DC/ATI2N, known as BC5 in DirectX 10, 16 bytes per block)
        D3DFMT_UNKNOWN,				// Renderer::TextureFormat::ETC1          - 3 component texture compression meant for mobile devices - not supported in Direct3D 9
        D3DFMT_D32F_LOCKABLE,		// Renderer::TextureFormat::D32_FLOAT     - 32-bit float depth format	TODO(co) Check this
        D3DFMT_UNKNOWN				// Renderer::TextureFormat::UNKNOWN       - Unknown
    };
#undef MCHAR4
    return MAPPING[textureFormat];
}
Example #2
0
CacheHeader_d::CacheHeader_d()
{
	fourCC = MCHAR4('S','H','I','T');//'XXXX'
	if( LLGL_Driver_Is_Direct3D ) {
		target = FX_Direct3D_MAGIC;
	} else {
		target = FX_OpenGL_MAGIC;
	}
	//timeStamp = FileTimeT::CurrentTime();
	//checksum = 0;
	//flags = 0;
	bufferSize = 0;
	mxZERO_OUT(numShaders);
	numPrograms = 0;
}