Source/ThirdParty/ANGLE/src/libGLESv2/Texture.cpp
D3DFORMAT Texture::selectFormat(GLenum format, GLenum type)
{
    if (format == GL_COMPRESSED_RGB_S3TC_DXT1_EXT ||
        format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT)
    {
        return D3DFMT_DXT1;
    }
    else if (type == GL_FLOAT)
    {
        return D3DFMT_A32B32G32R32F;
    }
    else if (type == GL_HALF_FLOAT_OES)
    {
        return D3DFMT_A16B16G16R16F;
    }
    else if (type == GL_UNSIGNED_BYTE)
    {
        if (format == GL_LUMINANCE && getContext()->supportsLuminanceTextures())
        {
            return D3DFMT_L8;
        }
        else if (format == GL_LUMINANCE_ALPHA && getContext()->supportsLuminanceAlphaTextures())
        {
            return D3DFMT_A8L8;
        }
        else if (format == GL_RGB)
        {
            return D3DFMT_X8R8G8B8;
        }

        return D3DFMT_A8R8G8B8;
    }

    return D3DFMT_A8R8G8B8;
}
// Selects an internal Direct3D 9 format for storing an Image
Selects an internal Direct3D 9 format for storing an Image
Selects an internal Direct3D 9 format for storing an Image
D3DFORMAT Texture::selectFormat(GLenum format, GLenum type)
{
    if (format == GL_COMPRESSED_RGB_S3TC_DXT1_EXT ||
        format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT)
    {
        return D3DFMT_DXT1;
    }
    else if (type == GL_FLOAT)
    {
        return D3DFMT_A32B32G32R32F;
    }
    else if (type == GL_HALF_FLOAT_OES)
    {
        return D3DFMT_A16B16G16R16F;
    }
    else if (type == GL_UNSIGNED_BYTE)
    {
        if (format == GL_LUMINANCE && getContext()->supportsLuminanceTextures())
        {
            return D3DFMT_L8;
        }
        else if (format == GL_LUMINANCE_ALPHA && getContext()->supportsLuminanceAlphaTextures())
        {
            return D3DFMT_A8L8;
        }
        else if (format == GL_RGB)
        {
            return D3DFMT_X8R8G8B8;
        }
        return D3DFMT_A8R8G8B8;
    }
    return D3DFMT_A8R8G8B8;
}
D3DFORMAT Texture :: selectFormat ( GLenum format , GLenum type ) { if ( format == GL_COMPRESSED_RGB_S3TC_DXT1_EXT || format == GL_COMPRESSED_RGBA_S3TC_DXT1_EXT ) { return D3DFMT_DXT1 ; } else if ( type == GL_FLOAT ) { return D3DFMT_A32B32G32R32F ; } else if ( type == GL_HALF_FLOAT_OES ) { return D3DFMT_A16B16G16R16F ; } else if ( type == GL_UNSIGNED_BYTE ) { if ( format == GL_LUMINANCE && getContext ( ) -> supportsLuminanceTextures ( ) ) { return D3DFMT_L8 ; } else if ( format == GL_LUMINANCE_ALPHA && getContext ( ) -> supportsLuminanceAlphaTextures ( ) ) { return D3DFMT_A8L8 ; } else if ( format == GL_RGB ) { return D3DFMT_X8R8G8B8 ; } return D3DFMT_A8R8G8B8 ; } return D3DFMT_A8R8G8B8 ; }
Selects an internal Direct3D 9 format for storing an Image
Selects an internal Direct3D 9 format for storing an Image