@@ -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 );
@@ -2111,6 +2115,8 @@ static void GLimp_InitExtensions()
21112115
21122116 // Stubbed or broken drivers may report garbage.
21132117
2118+ glConfig.texture3DAvailable = r_useTexture3D.Get ();
2119+
21142120 if ( glConfig.maxTextureUnits < 0 )
21152121 {
21162122 Log::Warn ( " Bad GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS value: %d" , glConfig.maxTextureUnits );
@@ -2135,8 +2141,27 @@ static void GLimp_InitExtensions()
21352141 glConfig.maxCubeMapTextureSize = 0 ;
21362142 }
21372143
2144+ if ( glConfig.max3DTextureSize > 0 )
2145+ {
2146+ glConfig.texture3DAvailable = true ;
2147+ }
2148+ else
2149+ {
2150+ logger.Warn ( " Missing 3D texture support because of null max size" );
2151+ }
2152+
21382153 logger.Notice ( " ...using up to %d texture size." , glConfig.maxTextureSize );
2139- logger.Notice ( " ...using up to %d 3D texture size." , glConfig.max3DTextureSize );
2154+
2155+ if ( glConfig.texture3DAvailable )
2156+ {
2157+ logger.Notice ( " ...using up to %d 3D texture size." , glConfig.max3DTextureSize );
2158+ }
2159+ else
2160+ {
2161+ logger.Notice ( " ...not using 3D textures." );
2162+ glConfig.max3DTextureSize = 0 ;
2163+ }
2164+
21402165 logger.Notice ( " ...using up to %d cube map texture size." , glConfig.maxCubeMapTextureSize );
21412166 logger.Notice ( " ...using up to %d texture units." , glConfig.maxTextureUnits );
21422167
@@ -2775,6 +2800,7 @@ bool GLimp_Init()
27752800 Cvar::Latch ( workaround_glHardware_mthreads_disableTextureBarrier );
27762801
27772802 Cvar::Latch ( r_incrementalShaderCompilation );
2803+ Cvar::Latch ( r_useTexture3D );
27782804 Cvar::Latch ( r_useMat3x2 );
27792805
27802806 /* Enable S3TC on Mesa even if libtxc-dxtn is not available
0 commit comments