using latest love-android @ changeset 8659be0e75a3

This commit is contained in:
fysx
2014-05-25 16:05:26 +02:00
parent 1d29da2d80
commit 49265f0596
58 changed files with 2008 additions and 366 deletions
+33 -4
View File
@@ -25,6 +25,7 @@
#include "image/Image.h"
#include "image/ImageData.h"
#include "common/Matrix.h"
#include "common/StringMap.h"
#include "Texture.h"
#include "OpenGL.h"
@@ -39,7 +40,24 @@ class Canvas : public Texture
{
public:
Canvas(int width, int height, Texture::Format format = Texture::FORMAT_NORMAL, int fsaa = 0);
// Different Canvas render target formats.
enum Format
{
FORMAT_NORMAL, // Usually RGBA8 or a similar fallback. Always supported.
FORMAT_HDR, // Usually RGBA16F. Not always supported.
FORMAT_RGBA8, // RGBA with 8 bits per component.
FORMAT_RGBA4, // RGBA with 4 bits per component.
FORMAT_RGB5A1, // RGB with 5 bits per component, and A with 1 bit.
FORMAT_RGB565, // RGB with 5, 6, and 5 bits each, respectively.
FORMAT_RGB10A2, // RGB with 10 bits each, and A with 2 bits.
FORMAT_RG11B10F, // Floating point [0, +inf]. RG with 11 FP bits each, and B with 10 FP bits.
FORMAT_RGBA16F, // Floating point [-inf, +inf]. RGBA with 16 FP bits per component.
FORMAT_RGBA32F, // Floating point [-inf, +inf]. RGBA with 32 FP bits per component.
FORMAT_SRGB, // sRGB with 8 bits per component, plus 8 bit linear A.
FORMAT_MAX_ENUM
};
Canvas(int width, int height, Format format = FORMAT_NORMAL, int fsaa = 0);
virtual ~Canvas();
// Implements Volatile.
@@ -85,7 +103,7 @@ public:
return status;
}
inline Texture::Format getTextureFormat() const
inline Format getTextureFormat() const
{
return format;
}
@@ -98,9 +116,8 @@ public:
bool resolveMSAA();
static bool isSupported();
static bool isHDRSupported();
static bool isSRGBSupported();
static bool isMultiCanvasSupported();
static bool isFormatSupported(Format format);
static Canvas *current;
static void bindDefaultCanvas();
@@ -111,10 +128,16 @@ public:
// Whether the main screen should have linear -> sRGB conversions enabled.
static bool screenHasSRGB;
static bool getConstant(const char *in, Format &out);
static bool getConstant(Format in, const char *&out);
private:
bool createFSAAFBO(GLenum internalformat);
static Format getSizedFormat(Format format);
static void convertFormat(Format format, GLenum &internalformat, GLenum &externalformat, GLenum &type);
GLuint fbo;
GLuint resolve_fbo;
@@ -134,6 +157,12 @@ private:
void setupGrab();
void drawv(const Matrix &t, const Vertex *v);
static bool supportedFormats[FORMAT_MAX_ENUM];
static bool checkedFormats[FORMAT_MAX_ENUM];
static StringMap<Format, FORMAT_MAX_ENUM>::Entry formatEntries[];
static StringMap<Format, FORMAT_MAX_ENUM> formats;
}; // Canvas
} // opengl