@@ -1757,7 +1757,7 @@ unsafe void ApplyForcedFilter(Sampler sampler, ShaderAPITextureHandle_t textureH
17571757 glSamplerParameteri ( samplerObject , GL_TEXTURE_MIN_FILTER , mipped ? GL_NEAREST_MIPMAP_LINEAR : GL_NEAREST ) ;
17581758 break ;
17591759 case 3 :
1760- glSamplerParameterf ( samplerObject , GL_TEXTURE_MAX_ANISOTROPY , HardwareConfig . MaximumAnisotropicLevel ( ) ) ;
1760+ glSamplerParameterf ( samplerObject , GL_TEXTURE_MAX_ANISOTROPY , AnisotropicLevel ) ;
17611761 glSamplerParameteri ( samplerObject , GL_TEXTURE_MIN_FILTER , mipped ? GL_LINEAR_MIPMAP_LINEAR : GL_LINEAR ) ;
17621762 break ;
17631763 default :
@@ -2640,7 +2640,7 @@ public void TexMinFilter(TexFilterMode mode) {
26402640 glTextureParameteri ( GetModifyTexture ( ) , GL_TEXTURE_MIN_FILTER , GL_LINEAR_MIPMAP_LINEAR ) ;
26412641 break ;
26422642 case TexFilterMode . Anisotropic :
2643- glTextureParameterf ( GetModifyTexture ( ) , GL_TEXTURE_MAX_ANISOTROPY , HardwareConfig . MaximumAnisotropicLevel ( ) ) ;
2643+ glTextureParameterf ( GetModifyTexture ( ) , GL_TEXTURE_MAX_ANISOTROPY , AnisotropicLevel ) ;
26442644 glTextureParameteri ( GetModifyTexture ( ) , GL_TEXTURE_MIN_FILTER , GL_LINEAR_MIPMAP_LINEAR ) ;
26452645 break ;
26462646 default :
@@ -2670,7 +2670,7 @@ public void TexMagFilter(TexFilterMode mode) {
26702670 break ;
26712671 case TexFilterMode . Anisotropic :
26722672 glTextureParameteri ( GetModifyTexture ( ) , GL_TEXTURE_MAG_FILTER , GL_LINEAR ) ;
2673- glTextureParameterf ( GetModifyTexture ( ) , GL_TEXTURE_MAX_ANISOTROPY_EXT , 16.0f ) ;
2673+ glTextureParameterf ( GetModifyTexture ( ) , GL_TEXTURE_MAX_ANISOTROPY_EXT , AnisotropicLevel ) ;
26742674 break ;
26752675 default :
26762676 break ;
@@ -3251,8 +3251,13 @@ public int SelectionMode(bool selectionMode) {
32513251 throw new NotImplementedException ( "Incomplete port of IShaderAPI" ) ;
32523252 }
32533253
3254+ int AnisotropicLevel = 1 ;
32543255 public void SetAnisotropicLevel ( int anisotropyLevel ) {
3255- throw new NotImplementedException ( "Incomplete port of IShaderAPI" ) ;
3256+ int maxAnisotropy = HardwareConfig . MaximumAnisotropicLevel ( ) ;
3257+ if ( anisotropyLevel > maxAnisotropy || anisotropyLevel <= 1 )
3258+ anisotropyLevel = Math . Max ( 2 , Math . Min ( 8 , maxAnisotropy / 4 ) ) ;
3259+
3260+ AnisotropicLevel = anisotropyLevel ;
32563261 }
32573262
32583263 public void SetClipPlane ( int index , ReadOnlySpan < float > plane ) {
0 commit comments