Implementation of sRGB image support. Overhauls the linearization setup to utilize the sRGB image types, as well as refactors the use of ColorF and ColorI to be properly internally consistent. ColorIs are used only for front-facing/editing/UI settings, and ColorFs, now renamed to LinearColorF to reduce confusion of purpose, are used for color info in the engine itself. This avoids confusing and expensive conversions back and forth between types and avoids botches with linearity. Majority work done by @rextimmy

This commit is contained in:
Areloch 2017-06-23 11:36:20 -05:00
parent 8780f83262
commit 25686ed4be
294 changed files with 3894 additions and 2813 deletions

View file

@ -142,11 +142,17 @@ void GFXGLEnumTranslate::init()
GFXGLTextureInternalFormat[GFXFormatD24X8] = GL_DEPTH24_STENCIL8;
GFXGLTextureInternalFormat[GFXFormatD24S8] = GL_DEPTH24_STENCIL8;
GFXGLTextureInternalFormat[GFXFormatR16G16B16A16] = GL_RGBA16;
GFXGLTextureInternalFormat[GFXFormatDXT1] = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
GFXGLTextureInternalFormat[GFXFormatDXT2] = GL_ZERO;
GFXGLTextureInternalFormat[GFXFormatDXT3] = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
GFXGLTextureInternalFormat[GFXFormatDXT4] = GL_ZERO;
GFXGLTextureInternalFormat[GFXFormatDXT5] = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
GFXGLTextureInternalFormat[GFXFormatBC1] = GL_COMPRESSED_RGBA_S3TC_DXT1_EXT;
GFXGLTextureInternalFormat[GFXFormatBC2] = GL_COMPRESSED_RGBA_S3TC_DXT3_EXT;
GFXGLTextureInternalFormat[GFXFormatBC3] = GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
GFXGLTextureInternalFormat[GFXFormatBC4] = GL_COMPRESSED_RED_RGTC1;
GFXGLTextureInternalFormat[GFXFormatBC5] = GL_COMPRESSED_RG_RGTC2;
//sRGB
GFXGLTextureInternalFormat[GFXFormatR8G8B8_SRGB] = GL_SRGB8;
GFXGLTextureInternalFormat[GFXFormatR8G8B8A8_SRGB] = GL_SRGB8_ALPHA8;
GFXGLTextureInternalFormat[GFXFormatBC1_SRGB] = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;
GFXGLTextureInternalFormat[GFXFormatBC2_SRGB] = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;
GFXGLTextureInternalFormat[GFXFormatBC3_SRGB] = GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;
GFXGLTextureFormat[GFXFormatA8] = GL_RED;
GFXGLTextureFormat[GFXFormatL8] = GL_RED;
@ -163,11 +169,17 @@ void GFXGLEnumTranslate::init()
GFXGLTextureFormat[GFXFormatD24X8] = GL_DEPTH_STENCIL;
GFXGLTextureFormat[GFXFormatD24S8] = GL_DEPTH_STENCIL;
GFXGLTextureFormat[GFXFormatR16G16B16A16] = GL_RGBA;
GFXGLTextureFormat[GFXFormatDXT1] = GL_RGBA;
GFXGLTextureFormat[GFXFormatDXT2] = GL_ZERO;
GFXGLTextureFormat[GFXFormatDXT3] = GL_RGBA;
GFXGLTextureFormat[GFXFormatDXT4] = GL_ZERO;
GFXGLTextureFormat[GFXFormatDXT5] = GL_RGBA;
GFXGLTextureFormat[GFXFormatBC1] = GL_RGBA;
GFXGLTextureFormat[GFXFormatBC2] = GL_RGBA;
GFXGLTextureFormat[GFXFormatBC3] = GL_RGBA;
GFXGLTextureFormat[GFXFormatBC4] = GL_RED;
GFXGLTextureFormat[GFXFormatBC5] = GL_RG;
//sRGB
GFXGLTextureFormat[GFXFormatR8G8B8_SRGB] = GL_RGB;
GFXGLTextureFormat[GFXFormatR8G8B8A8_SRGB] = GL_RGBA;
GFXGLTextureFormat[GFXFormatBC1_SRGB] = GL_RGBA;
GFXGLTextureFormat[GFXFormatBC2_SRGB] = GL_RGBA;
GFXGLTextureFormat[GFXFormatBC3_SRGB] = GL_RGBA;
GFXGLTextureType[GFXFormatA8] = GL_UNSIGNED_BYTE;
GFXGLTextureType[GFXFormatL8] = GL_UNSIGNED_BYTE;
@ -184,13 +196,18 @@ void GFXGLEnumTranslate::init()
GFXGLTextureType[GFXFormatD24X8] = GL_UNSIGNED_INT_24_8;
GFXGLTextureType[GFXFormatD24S8] = GL_UNSIGNED_INT_24_8;
GFXGLTextureType[GFXFormatR16G16B16A16] = GL_UNSIGNED_SHORT;
GFXGLTextureType[GFXFormatDXT1] = GL_UNSIGNED_BYTE;
GFXGLTextureType[GFXFormatDXT2] = GL_ZERO;
GFXGLTextureType[GFXFormatDXT3] = GL_UNSIGNED_BYTE;
GFXGLTextureType[GFXFormatDXT4] = GL_ZERO;
GFXGLTextureType[GFXFormatDXT5] = GL_UNSIGNED_BYTE;
GFXGLTextureType[GFXFormatBC1] = GL_UNSIGNED_BYTE;
GFXGLTextureType[GFXFormatBC2] = GL_UNSIGNED_BYTE;
GFXGLTextureType[GFXFormatBC3] = GL_UNSIGNED_BYTE;
GFXGLTextureType[GFXFormatBC4] = GL_UNSIGNED_BYTE;
GFXGLTextureType[GFXFormatBC5] = GL_UNSIGNED_BYTE;
// sRGB
GFXGLTextureType[GFXFormatR8G8B8_SRGB] = GL_UNSIGNED_BYTE;
GFXGLTextureType[GFXFormatR8G8B8A8_SRGB] = GL_UNSIGNED_BYTE;
GFXGLTextureType[GFXFormatBC1_SRGB] = GL_UNSIGNED_BYTE;
GFXGLTextureType[GFXFormatBC2_SRGB] = GL_UNSIGNED_BYTE;
GFXGLTextureType[GFXFormatBC3_SRGB] = GL_UNSIGNED_BYTE;
GFXGLTextureType[GFXFormatR8G8B8A8_SRGB] = GL_SRGB8_ALPHA8;
static GLint Swizzle_GFXFormatA8[] = { GL_NONE, GL_NONE, GL_NONE, GL_RED };
static GLint Swizzle_GFXFormatL[] = { GL_RED, GL_RED, GL_RED, GL_ALPHA };