Open
Description
if (needDepthTexture) {
const currentDepthTexture = <Texture2D>currentRenderTarget?.depthTexture;
const needDepthTexture = depthFormat
? PipelineUtils.recreateTextureIfNeeded(
engine,
currentDepthTexture,
width,
height,
depthFormat,
mipmap,
isSRGBColorSpace,
textureWrapMode,
textureFilterMode
)
: null;
// 此处应判断 currentRenderTarget?.antiAliasing !== antiAliasing
if (currentColorTexture !== colorTexture || currentDepthTexture !== needDepthTexture) {
currentRenderTarget?.destroy(true);
currentRenderTarget = new RenderTarget(engine, width, height, colorTexture, needDepthTexture, antiAliasing);
currentRenderTarget.isGCIgnored = true;
}
} else {
if (
currentColorTexture !== colorTexture ||
currentRenderTarget?._depthFormat !== depthFormat ||
currentRenderTarget.antiAliasing !== antiAliasing
) {
currentRenderTarget?.destroy(true);
currentRenderTarget = new RenderTarget(engine, width, height, colorTexture, depthFormat, antiAliasing);
currentRenderTarget.isGCIgnored = true;
}
}