@@ -176,6 +176,7 @@ class ListImagesCmd : public Cmd::StaticCmd
176176 { GL_RGBA32UI, { " RGBA32UI" , 16 } },
177177 { GL_ALPHA16F_ARB, { " A16F" , 2 } },
178178 { GL_ALPHA32F_ARB, { " A32F" , 4 } },
179+ { GL_RED, { " R8" , 1 } },
179180 { GL_R16F, { " R16F" , 2 } },
180181 { GL_R32F, { " R32F" , 4 } },
181182 { GL_LUMINANCE_ALPHA16F_ARB, { " LA16F" , 4 } },
@@ -933,6 +934,18 @@ void R_UploadImage( const char *name, const byte **dataArray, int numLayers, int
933934 format = GL_DEPTH_STENCIL;
934935 internalFormat = GL_DEPTH24_STENCIL8;
935936 }
937+ else if ( image->bits & IF_RED )
938+ {
939+ if ( isSRGB && !glConfig2.textureSrgbR8Available )
940+ {
941+ Log::Warn (" red image '%s' cannot be loaded as sRGB" , image->name );
942+ internalFormat = GL_RGBA8;
943+ }
944+ else
945+ {
946+ internalFormat = GL_RED;
947+ }
948+ }
936949 else if ( image->bits & ( IF_RGBA16F | IF_RGBA32F | IF_TWOCOMP16F | IF_TWOCOMP32F | IF_ONECOMP16F | IF_ONECOMP32F ) )
937950 {
938951 if ( !glConfig2.textureFloatAvailable ) {
@@ -2433,6 +2446,11 @@ static void R_CreateFogImage()
24332446 imageParams.filterType = filterType_t::FT_DEFAULT;
24342447 imageParams.wrapType = wrapTypeEnum_t::WT_CLAMP;
24352448
2449+ if ( glConfig2.textureSrgbR8Available )
2450+ {
2451+ imageParams.bits |= IF_RED;
2452+ }
2453+
24362454 tr.fogImageNaive = R_CreateImage ( " _fogNaive" , ( const byte ** ) &data, FOG_S, FOG_T, 1 , imageParams );
24372455
24382456 imageParams.bits |= IF_SRGB;
0 commit comments