Browse Source

Arm Mali Fxaa + nightly

sebastien 7 năm trước cách đây
mục cha
commit
05041086e0

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 13427 - 13426
Playground/babylon.d.txt


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 14267 - 14266
dist/preview release/babylon.d.ts


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 13 - 13
dist/preview release/babylon.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 30 - 3
dist/preview release/babylon.max.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 30 - 3
dist/preview release/babylon.no-module.max.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 13 - 13
dist/preview release/babylon.worker.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 30 - 3
dist/preview release/es6.js


+ 1 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.d.ts

@@ -797,7 +797,7 @@ declare module BABYLON.GLTF2.Extensions {
 
 declare module BABYLON.GLTF2.Extensions {
     /**
-     * [Specification](https://github.com/donmccurdy/glTF/tree/feat-khr-materials-cmnConstant/extensions/2.0/Khronos/KHR_materials_unlit) (Experimental)
+     * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit)
      */
     class KHR_materials_unlit extends GLTFLoaderExtension {
         readonly name: string;

+ 1 - 1
dist/preview release/loaders/babylon.glTF2FileLoader.js

@@ -2730,7 +2730,7 @@ var BABYLON;
         (function (Extensions) {
             var NAME = "KHR_materials_unlit";
             /**
-             * [Specification](https://github.com/donmccurdy/glTF/tree/feat-khr-materials-cmnConstant/extensions/2.0/Khronos/KHR_materials_unlit) (Experimental)
+             * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit)
              */
             var KHR_materials_unlit = /** @class */ (function (_super) {
                 __extends(KHR_materials_unlit, _super);

+ 1 - 1
dist/preview release/loaders/babylon.glTFFileLoader.d.ts

@@ -1373,7 +1373,7 @@ declare module BABYLON.GLTF2.Extensions {
 
 declare module BABYLON.GLTF2.Extensions {
     /**
-     * [Specification](https://github.com/donmccurdy/glTF/tree/feat-khr-materials-cmnConstant/extensions/2.0/Khronos/KHR_materials_unlit) (Experimental)
+     * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit)
      */
     class KHR_materials_unlit extends GLTFLoaderExtension {
         readonly name: string;

+ 1 - 1
dist/preview release/loaders/babylon.glTFFileLoader.js

@@ -4945,7 +4945,7 @@ var BABYLON;
         (function (Extensions) {
             var NAME = "KHR_materials_unlit";
             /**
-             * [Specification](https://github.com/donmccurdy/glTF/tree/feat-khr-materials-cmnConstant/extensions/2.0/Khronos/KHR_materials_unlit) (Experimental)
+             * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit)
              */
             var KHR_materials_unlit = /** @class */ (function (_super) {
                 __extends(KHR_materials_unlit, _super);

+ 1 - 1
dist/preview release/loaders/babylonjs.loaders.d.ts

@@ -1469,7 +1469,7 @@ declare module BABYLON.GLTF2.Extensions {
 
 declare module BABYLON.GLTF2.Extensions {
     /**
-     * [Specification](https://github.com/donmccurdy/glTF/tree/feat-khr-materials-cmnConstant/extensions/2.0/Khronos/KHR_materials_unlit) (Experimental)
+     * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit)
      */
     class KHR_materials_unlit extends GLTFLoaderExtension {
         readonly name: string;

+ 1 - 1
dist/preview release/loaders/babylonjs.loaders.js

@@ -5873,7 +5873,7 @@ var BABYLON;
         (function (Extensions) {
             var NAME = "KHR_materials_unlit";
             /**
-             * [Specification](https://github.com/donmccurdy/glTF/tree/feat-khr-materials-cmnConstant/extensions/2.0/Khronos/KHR_materials_unlit) (Experimental)
+             * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit)
              */
             var KHR_materials_unlit = /** @class */ (function (_super) {
                 __extends(KHR_materials_unlit, _super);

+ 1 - 1
dist/preview release/loaders/babylonjs.loaders.module.d.ts

@@ -1476,7 +1476,7 @@ declare module BABYLON.GLTF2.Extensions {
 
 declare module BABYLON.GLTF2.Extensions {
     /**
-     * [Specification](https://github.com/donmccurdy/glTF/tree/feat-khr-materials-cmnConstant/extensions/2.0/Khronos/KHR_materials_unlit) (Experimental)
+     * [Specification](https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_materials_unlit)
      */
     class KHR_materials_unlit extends GLTFLoaderExtension {
         readonly name: string;

Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 13 - 13
dist/preview release/viewer/babylon.viewer.js


Những thai đổi đã bị hủy bỏ vì nó quá lớn
+ 30 - 3
dist/preview release/viewer/babylon.viewer.max.js


+ 18 - 1
src/PostProcess/babylon.fxaaPostProcess.ts

@@ -4,12 +4,29 @@
         public texelHeight: number;
 
         constructor(name: string, options: number | PostProcessOptions, camera: Nullable<Camera> = null, samplingMode?: number, engine?: Engine, reusable?: boolean, textureType: number = Engine.TEXTURETYPE_UNSIGNED_INT) {
-            super(name, "fxaa", ["texelSize"], null, options, camera, samplingMode || Texture.BILINEAR_SAMPLINGMODE, engine, reusable, null, textureType, "fxaa");
+            super(name, "fxaa", ["texelSize"], null, options, camera, samplingMode || Texture.BILINEAR_SAMPLINGMODE, engine, reusable, null, textureType, "fxaa", undefined, true);
+
+            const defines = this._getDefines();
+            this.updateEffect(defines);
 
             this.onApplyObservable.add((effect: Effect) => {
                 var texelSize = this.texelSize;
                 effect.setFloat2("texelSize", texelSize.x, texelSize.y);
             });
         }
+
+        private _getDefines(): Nullable<string> {
+            const engine = this.getEngine();
+            if (!engine) {
+                return null;
+            }
+
+            const glInfo = engine.getGlInfo();
+            if (glInfo && glInfo.renderer && glInfo.renderer.toLowerCase().indexOf("mali") > -1) {
+                return "#define MALI 1\n";
+            }
+
+            return null;
+        }
     }
 }

+ 13 - 0
src/Shaders/fxaa.fragment.fx

@@ -42,11 +42,13 @@ void main(){
 	float range = rangeMax - rangeMin;
 	float rangeMaxClamped = max(fxaaQualityEdgeThresholdMin, rangeMaxScaled);
 
+#ifndef MALI
 	if(range < rangeMaxClamped) 
 	{
 		gl_FragColor = rgbyM;
 		return;
 	}
+#endif
 
 	float lumaNW = FxaaLuma(texture2D(textureSampler, sampleCoordNW, 0.0));
 	float lumaSE = FxaaLuma(texture2D(textureSampler, sampleCoordSE, 0.0));
@@ -231,5 +233,16 @@ void main(){
 		posM.y += pixelOffsetSubpix * lengthSign;
 	}
 
+#ifdef MALI
+	if(range < rangeMaxClamped) 
+	{
+		gl_FragColor = rgbyM;
+	}
+	else
+	{
+		gl_FragColor = texture2D(textureSampler, posM, 0.0);
+	}
+#else
 	gl_FragColor = texture2D(textureSampler, posM, 0.0);
+#endif
 }