@@ -61,6 +61,10 @@ static Cvar::Cvar<bool> r_incrementalShaderCompilation(
6161 " r_incrementalShaderCompilation" , " Build separate shader units then link them alltogether at the end" ,
6262 Cvar::NONE, true );
6363
64+ static Cvar::Cvar<bool > r_useTexture3D (
65+ " r_useTexture3D" , " Use texture3D image format and sampler3D GLSL keyword" ,
66+ Cvar::CHEAT, true );
67+
6468static Cvar::Cvar<bool > r_useMat3x2 (
6569 " r_useMat3x2" , " Use mat3x2 GLSL type" ,
6670 Cvar::NONE, true );
@@ -2115,6 +2119,8 @@ static void GLimp_InitExtensions()
21152119
21162120 // Stubbed or broken drivers may report garbage.
21172121
2122+ glConfig.texture3DAvailable = r_useTexture3D.Get ();
2123+
21182124 if ( glConfig.maxTextureUnits < 0 )
21192125 {
21202126 Log::Warn ( " Bad GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS value: %d" , glConfig.maxTextureUnits );
@@ -2139,8 +2145,27 @@ static void GLimp_InitExtensions()
21392145 glConfig.maxCubeMapTextureSize = 0 ;
21402146 }
21412147
2148+ if ( glConfig.max3DTextureSize > 0 )
2149+ {
2150+ glConfig.texture3DAvailable = true ;
2151+ }
2152+ else
2153+ {
2154+ logger.Warn ( " Missing 3D texture support because of null max size" );
2155+ }
2156+
21422157 logger.Notice ( " ...using up to %d texture size." , glConfig.maxTextureSize );
2143- logger.Notice ( " ...using up to %d 3D texture size." , glConfig.max3DTextureSize );
2158+
2159+ if ( glConfig.texture3DAvailable )
2160+ {
2161+ logger.Notice ( " ...using up to %d 3D texture size." , glConfig.max3DTextureSize );
2162+ }
2163+ else
2164+ {
2165+ logger.Notice ( " ...not using 3D textures." );
2166+ glConfig.max3DTextureSize = 0 ;
2167+ }
2168+
21442169 logger.Notice ( " ...using up to %d cube map texture size." , glConfig.maxCubeMapTextureSize );
21452170 logger.Notice ( " ...using up to %d texture units." , glConfig.maxTextureUnits );
21462171
@@ -2755,7 +2780,7 @@ static void GLimp_EnableAvailableFeatures()
27552780 glConfig.realtimeLighting = false ;
27562781 }
27572782
2758- if ( glConfig.max3DTextureSize == 0 )
2783+ if ( ! glConfig.texture3DAvailable )
27592784 {
27602785 Log::Warn ( " Tiled dynamic light renderer disabled because of missing 3D texture support." );
27612786 glConfig.realtimeLighting = false ;
@@ -2789,7 +2814,7 @@ static void GLimp_EnableAvailableFeatures()
27892814
27902815 if ( glConfig.colorGrading )
27912816 {
2792- if ( glConfig.max3DTextureSize == 0 )
2817+ if ( ! glConfig.texture3DAvailable )
27932818 {
27942819 Log::Warn ( " Color grading disabled because of missing 3D texture support." );
27952820 glConfig.colorGrading = false ;
@@ -2966,6 +2991,7 @@ bool GLimp_Init()
29662991 Cvar::Latch ( workaround_glHardware_mthreads_disableTextureBarrier );
29672992
29682993 Cvar::Latch ( r_incrementalShaderCompilation );
2994+ Cvar::Latch ( r_useTexture3D );
29692995 Cvar::Latch ( r_useMat3x2 );
29702996
29712997 /* Enable S3TC on Mesa even if libtxc-dxtn is not available
0 commit comments