mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
Fixed the issue that web offscreen MSAA does not take effect when postprocessing is not enabled (#18925)
This commit is contained in:
@@ -53,7 +53,6 @@ import { Swapchain } from './swapchain';
|
||||
* @zh GFX 设备。
|
||||
*/
|
||||
export abstract class Device {
|
||||
|
||||
constructor () {}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3277,11 +3277,6 @@ export function WebGL2CmdFuncBlitTexture (
|
||||
gl.framebufferRenderbuffer(WebGLConstants.READ_FRAMEBUFFER, srcAttachment, WebGLConstants.RENDERBUFFER, src.glRenderbuffer);
|
||||
}
|
||||
|
||||
if (dst.glTexture) {
|
||||
gl.framebufferTexture2D(WebGLConstants.DRAW_FRAMEBUFFER, dstAttachment, dst.glTarget, dst.glTexture, dstMip);
|
||||
} else {
|
||||
gl.framebufferRenderbuffer(WebGLConstants.DRAW_FRAMEBUFFER, dstAttachment, WebGLConstants.RENDERBUFFER, dst.glRenderbuffer);
|
||||
}
|
||||
const status = gl.checkFramebufferStatus(gl.READ_FRAMEBUFFER);
|
||||
if (status !== gl.FRAMEBUFFER_COMPLETE) {
|
||||
warnID(16318);
|
||||
|
||||
@@ -838,6 +838,7 @@ class DeviceRenderPass implements RecordingInterface {
|
||||
depAtt.depthStoreOp = rasterV.storeOp;
|
||||
depAtt.stencilStoreOp = rasterV.storeOp;
|
||||
depAtt.depthLoadOp = rasterV.loadOp;
|
||||
depAtt.sampleCount = resTex.description!.sampleCount;
|
||||
depAtt.stencilLoadOp = rasterV.loadOp;
|
||||
depAtt.barrier = device.getGeneralBarrier(new GeneralBarrierInfo(
|
||||
rasterV.loadOp === LoadOp.LOAD ? AccessFlagBit.DEPTH_STENCIL_ATTACHMENT_WRITE : AccessFlagBit.NONE,
|
||||
|
||||
@@ -1747,7 +1747,6 @@ export class WebPipeline extends WebSetter implements BasicPipeline {
|
||||
return this.addRenderPassImpl(width, height, layoutName);
|
||||
}
|
||||
addMultisampleRenderPass (width: number, height: number, count: number, quality: number, layoutName = 'default'): BasicMultisampleRenderPassBuilder {
|
||||
assert(count > 1);
|
||||
const rasterPassBuilder = this.addRenderPassImpl(width, height, layoutName, count, quality) as WebRenderPassBuilder;
|
||||
rasterPassBuilder.addRenderSubpass();
|
||||
return rasterPassBuilder;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
import {
|
||||
assert, cclegacy, clamp, geometry, gfx, Layers, Material, pipeline,
|
||||
PipelineEventProcessor, PipelineEventType, ReflectionProbeManager, renderer,
|
||||
rendering, sys, Vec2, Vec3, Vec4, warn,
|
||||
rendering, sys, Vec2, Vec3, Vec4, warn, macro,
|
||||
} from 'cc';
|
||||
|
||||
import { DEBUG, EDITOR } from 'cc/env';
|
||||
@@ -77,6 +77,7 @@ function getCsmMainLightViewport(
|
||||
export class PipelineConfigs {
|
||||
isWeb = false;
|
||||
isWebGL1 = false;
|
||||
isWebGL2 = false;
|
||||
isWebGPU = false;
|
||||
isMobile = false;
|
||||
isHDR = false;
|
||||
@@ -102,6 +103,7 @@ function setupPipelineConfigs(
|
||||
// Platform
|
||||
configs.isWeb = !sys.isNative;
|
||||
configs.isWebGL1 = device.gfxAPI === gfx.API.WEBGL;
|
||||
configs.isWebGL2 = device.gfxAPI === gfx.API.WEBGL2;
|
||||
configs.isWebGPU = device.gfxAPI === gfx.API.WEBGPU;
|
||||
configs.isMobile = sys.isMobile;
|
||||
|
||||
@@ -436,6 +438,7 @@ export class BuiltinForwardPassBuilder implements rendering.PipelinePassBuilder
|
||||
|
||||
// MSAA
|
||||
cameraConfigs.enableMSAA = cameraConfigs.settings.msaa.enabled
|
||||
&& (!pipelineConfigs.isWebGL2 || (cameraConfigs.remainingPasses > 0 || (!macro.ENABLE_WEBGL_ANTIALIAS && macro.ENABLE_TRANSPARENT_CANVAS)))
|
||||
&& !cameraConfigs.enableStoreSceneDepth // Cannot store MS depth, resolve depth is also not cross-platform
|
||||
&& !pipelineConfigs.isWebGL1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user