]> git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
added support for TEXTYPE_BGRA (GL_BGRA format), this doesn't require
authorhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 26 Nov 2007 22:05:56 +0000 (22:05 +0000)
committerhavoc <havoc@d7cf8633-e32d-0410-b094-e92efae38249>
Mon, 26 Nov 2007 22:05:56 +0000 (22:05 +0000)
any difference in processing functions, but the initial data must be
encoded accordingly
this format was added because it uploads faster on some hardware, and
the engine will be migrating over to using it

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@7717 d7cf8633-e32d-0410-b094-e92efae38249

gl_textures.c
r_textures.h

index 24c9d69fc2170bd2ee966d9b567c9e04e2bed281..976946b88508c90fb79d0b70c3cd35f30f0626cf 100644 (file)
@@ -49,12 +49,16 @@ textypeinfo_t;
 
 static textypeinfo_t textype_palette                = {TEXTYPE_PALETTE, 1, 4, 4.0f, GL_RGBA   , 3};
 static textypeinfo_t textype_rgba                   = {TEXTYPE_RGBA   , 4, 4, 4.0f, GL_RGBA   , 3};
+static textypeinfo_t textype_bgra                   = {TEXTYPE_BGRA   , 4, 4, 4.0f, GL_BGRA   , 3};
 static textypeinfo_t textype_palette_alpha          = {TEXTYPE_PALETTE, 1, 4, 4.0f, GL_RGBA   , 4};
 static textypeinfo_t textype_rgba_alpha             = {TEXTYPE_RGBA   , 4, 4, 4.0f, GL_RGBA   , 4};
+static textypeinfo_t textype_bgra_alpha             = {TEXTYPE_BGRA   , 4, 4, 4.0f, GL_BGRA   , 4};
 static textypeinfo_t textype_palette_compress       = {TEXTYPE_PALETTE, 1, 4, 0.5f, GL_RGBA   , GL_COMPRESSED_RGB_ARB};
 static textypeinfo_t textype_rgba_compress          = {TEXTYPE_RGBA   , 4, 4, 0.5f, GL_RGBA   , GL_COMPRESSED_RGB_ARB};
+static textypeinfo_t textype_bgra_compress          = {TEXTYPE_BGRA   , 4, 4, 0.5f, GL_BGRA   , GL_COMPRESSED_RGB_ARB};
 static textypeinfo_t textype_palette_alpha_compress = {TEXTYPE_PALETTE, 1, 4, 1.0f, GL_RGBA   , GL_COMPRESSED_RGBA_ARB};
 static textypeinfo_t textype_rgba_alpha_compress    = {TEXTYPE_RGBA   , 4, 4, 1.0f, GL_RGBA   , GL_COMPRESSED_RGBA_ARB};
+static textypeinfo_t textype_bgra_alpha_compress    = {TEXTYPE_BGRA   , 4, 4, 1.0f, GL_BGRA   , GL_COMPRESSED_RGBA_ARB};
 
 #define GLTEXTURETYPE_1D 0
 #define GLTEXTURETYPE_2D 1
@@ -152,6 +156,8 @@ static textypeinfo_t *R_GetTexTypeInfo(int textype, int flags)
                                return &textype_palette_alpha_compress;
                        case TEXTYPE_RGBA:
                                return &textype_rgba_alpha_compress;
+                       case TEXTYPE_BGRA:
+                               return &textype_bgra_alpha_compress;
                        default:
                                Host_Error("R_GetTexTypeInfo: unknown texture format");
                                return NULL;
@@ -165,6 +171,8 @@ static textypeinfo_t *R_GetTexTypeInfo(int textype, int flags)
                                return &textype_palette_compress;
                        case TEXTYPE_RGBA:
                                return &textype_rgba_compress;
+                       case TEXTYPE_BGRA:
+                               return &textype_bgra_compress;
                        default:
                                Host_Error("R_GetTexTypeInfo: unknown texture format");
                                return NULL;
@@ -181,6 +189,8 @@ static textypeinfo_t *R_GetTexTypeInfo(int textype, int flags)
                                return &textype_palette_alpha;
                        case TEXTYPE_RGBA:
                                return &textype_rgba_alpha;
+                       case TEXTYPE_BGRA:
+                               return &textype_bgra_alpha;
                        default:
                                Host_Error("R_GetTexTypeInfo: unknown texture format");
                                return NULL;
@@ -194,6 +204,8 @@ static textypeinfo_t *R_GetTexTypeInfo(int textype, int flags)
                                return &textype_palette;
                        case TEXTYPE_RGBA:
                                return &textype_rgba;
+                       case TEXTYPE_BGRA:
+                               return &textype_bgra;
                        default:
                                Host_Error("R_GetTexTypeInfo: unknown texture format");
                                return NULL;
@@ -981,6 +993,7 @@ static rtexture_t *R_SetupTexture(rtexturepool_t *rtexturepool, const char *iden
                }
                break;
        case TEXTYPE_RGBA:
+       case TEXTYPE_BGRA:
                if (flags & TEXF_ALPHA)
                {
                        flags &= ~TEXF_ALPHA;
index 4df426a6a4c249170651aa9be271a19ce2f6fa0b..4ad5f5e8d2ce9650e6a17241faaeb8d87f1d0404 100644 (file)
@@ -27,6 +27,8 @@
 #define TEXTYPE_PALETTE 1
 // 32bit RGBA
 #define TEXTYPE_RGBA 3
+// 32bit BGRA (preferred format due to faster uploads on most hardware)
+#define TEXTYPE_BGRA 4
 
 // contents of this structure are mostly private to gl_textures.c
 typedef struct rtexture_s