Просмотр исходного кода

WebGPUTextureUtils: Fix usage of `Texture.anisotropy`. (#29654)

Michael Herzog 1 год назад
Родитель
Сommit
26efd87d9f
1 измененных файлов с 9 добавлено и 1 удалено
  1. 9 1
      src/renderers/webgpu/utils/WebGPUTextureUtils.js

+ 9 - 1
src/renderers/webgpu/utils/WebGPUTextureUtils.js

@@ -65,9 +65,17 @@ class WebGPUTextureUtils {
 			magFilter: this._convertFilterMode( texture.magFilter ),
 			minFilter: this._convertFilterMode( texture.minFilter ),
 			mipmapFilter: this._convertFilterMode( texture.minFilter ),
-			maxAnisotropy: texture.anisotropy
+			maxAnisotropy: 1
 		};
 
+		// anisotropy can only be used when all filter modes are set to linear.
+
+		if ( samplerDescriptorGPU.magFilter === GPUFilterMode.Linear && samplerDescriptorGPU.minFilter === GPUFilterMode.Linear && samplerDescriptorGPU.mipmapFilter === GPUFilterMode.Linear ) {
+
+			samplerDescriptorGPU.maxAnisotropy = texture.anisotropy;
+
+		}
+
 		if ( texture.isDepthTexture && texture.compareFunction !== null ) {
 
 			samplerDescriptorGPU.compare = _compareToWebGPU[ texture.compareFunction ];

粤ICP备19079148号