From 5ffc4482cd2d55020f28e36775d8ae8ba7518fea Mon Sep 17 00:00:00 2001 From: PP Date: Fri, 5 Nov 2021 10:40:51 +0800 Subject: [PATCH] deprecate ENABLE_WEBGL_ANTIALIAS (#9626) * deprecate ENABLE_WEBGL_ANTIALIAS update * remove deprecation usage --- cocos/core/gfx/webgl/webgl-swapchain.ts | 2 +- cocos/core/gfx/webgl2/webgl2-swapchain.ts | 2 +- cocos/core/platform/deprecated.ts | 15 +++++++++++++-- cocos/core/platform/macro.ts | 2 ++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/cocos/core/gfx/webgl/webgl-swapchain.ts b/cocos/core/gfx/webgl/webgl-swapchain.ts index 11fb2eb027..9951e62206 100644 --- a/cocos/core/gfx/webgl/webgl-swapchain.ts +++ b/cocos/core/gfx/webgl/webgl-swapchain.ts @@ -204,7 +204,7 @@ export class WebGLSwapchain extends Swapchain { try { const webGLCtxAttribs: WebGLContextAttributes = { alpha: macro.ENABLE_TRANSPARENT_CANVAS, - antialias: EDITOR || macro.ENABLE_WEBGL_ANTIALIAS, + antialias: EDITOR || macro.ENABLE_ANTIALIAS_FXAA, depth: true, stencil: true, premultipliedAlpha: false, diff --git a/cocos/core/gfx/webgl2/webgl2-swapchain.ts b/cocos/core/gfx/webgl2/webgl2-swapchain.ts index 270901d11b..08a1bd82e8 100644 --- a/cocos/core/gfx/webgl2/webgl2-swapchain.ts +++ b/cocos/core/gfx/webgl2/webgl2-swapchain.ts @@ -131,7 +131,7 @@ export class WebGL2Swapchain extends Swapchain { try { const webGLCtxAttribs: WebGLContextAttributes = { alpha: macro.ENABLE_TRANSPARENT_CANVAS, - antialias: EDITOR || macro.ENABLE_WEBGL_ANTIALIAS, + antialias: EDITOR || macro.ENABLE_ANTIALIAS_FXAA, depth: true, stencil: true, premultipliedAlpha: false, diff --git a/cocos/core/platform/deprecated.ts b/cocos/core/platform/deprecated.ts index 1abb4f61c9..c2c9d9d769 100644 --- a/cocos/core/platform/deprecated.ts +++ b/cocos/core/platform/deprecated.ts @@ -23,13 +23,24 @@ THE SOFTWARE. */ -import { screenAdapter } from 'pal/screen-adapter'; import { markAsWarning, removeProperty, replaceProperty } from '../utils'; import { sys } from './sys'; import { View } from './view'; import { legacyCC } from '../global-exports'; import { screen } from './screen'; -import { Size } from '../math'; +import { macro } from './macro'; + +replaceProperty(macro, 'macro', [{ + name: 'ENABLE_WEBGL_ANTIALIAS', + newName: 'ENABLE_ANTIALIAS_FXAA', + suggest: 'macro.ENABLE_WEBGL_ANTIALIAS is now a readonly macro.', + customGetter () { + return macro.ENABLE_ANTIALIAS_FXAA; + }, + customSetter (v: boolean) { + // DO NOTHING + }, +}]); // #region deprecation on view removeProperty(View.prototype, 'View.prototype', [ diff --git a/cocos/core/platform/macro.ts b/cocos/core/platform/macro.ts index 123b0be712..511749010a 100644 --- a/cocos/core/platform/macro.ts +++ b/cocos/core/platform/macro.ts @@ -997,6 +997,8 @@ const macro = { * 你可以在 {{game.init}} 之前设置这个值,否则它不会生效。 * 仅影响 WebGL 后端 * @default true + * + * @deprecated since 3.4.0, please use macro.ENABLE_ANTIALIAS_FXAA instead. */ ENABLE_WEBGL_ANTIALIAS: true,