From 46fad08e4cbf2ef9008c567cc7ee2e56d027cc12 Mon Sep 17 00:00:00 2001 From: HALX99 Date: Thu, 21 Jan 2021 12:41:01 +0800 Subject: [PATCH] Revert "Fix #313" --- cocos/renderer/backend/metal/DepthStencilStateMTL.mm | 4 ++-- cocos/renderer/backend/metal/RenderPipelineMTL.mm | 4 ++-- cocos/renderer/backend/metal/RenderTargetMTL.mm | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cocos/renderer/backend/metal/DepthStencilStateMTL.mm b/cocos/renderer/backend/metal/DepthStencilStateMTL.mm index 48cbb50746..bc3495192c 100644 --- a/cocos/renderer/backend/metal/DepthStencilStateMTL.mm +++ b/cocos/renderer/backend/metal/DepthStencilStateMTL.mm @@ -140,14 +140,14 @@ void DepthStencilStateMTL::update(const DepthStencilDescriptor& descriptor) MTLDepthStencilDescriptor* mtlDescriptor = [[MTLDepthStencilDescriptor alloc] init]; - if (bitmask::any(descriptor.depthStencilFlags, TargetBufferFlags::DEPTH_AND_STENCIL)) + if (bitmask::any(descriptor.depthStencilFlags, TargetBufferFlags::DEPTH)) mtlDescriptor.depthCompareFunction = toMTLCompareFunction(descriptor.depthCompareFunction); else mtlDescriptor.depthCompareFunction = MTLCompareFunctionAlways; mtlDescriptor.depthWriteEnabled = descriptor.depthWriteEnabled; - if (bitmask::any(descriptor.depthStencilFlags, TargetBufferFlags::DEPTH_AND_STENCIL)) + if (bitmask::any(descriptor.depthStencilFlags, TargetBufferFlags::STENCIL)) { setMTLStencilDescriptor(mtlDescriptor.frontFaceStencil, descriptor.frontFaceStencil); setMTLStencilDescriptor(mtlDescriptor.backFaceStencil, descriptor.backFaceStencil); diff --git a/cocos/renderer/backend/metal/RenderPipelineMTL.mm b/cocos/renderer/backend/metal/RenderPipelineMTL.mm index ec45e3e9b4..5d24966c71 100644 --- a/cocos/renderer/backend/metal/RenderPipelineMTL.mm +++ b/cocos/renderer/backend/metal/RenderPipelineMTL.mm @@ -305,8 +305,8 @@ void RenderPipelineMTL::chooseAttachmentFormat(const RenderTarget* renderTarget, } // choose depth and stencil attachment format, match RenderTargetMTL::applyRenderPassAttachments - depthFormat = bitmask::any(rtflags, RenderTargetFlag::DEPTH_AND_STENCIL) ? rtMTL->getDepthAttachmentPixelFormat() : PixelFormat::NONE; - stencilFormat = bitmask::any(rtflags, RenderTargetFlag::DEPTH_AND_STENCIL) ? rtMTL->getStencilAttachmentPixelFormat() : PixelFormat::NONE; + depthFormat = bitmask::any(rtflags, RenderTargetFlag::DEPTH) ? rtMTL->getDepthAttachmentPixelFormat() : PixelFormat::NONE; + stencilFormat = bitmask::any(rtflags, RenderTargetFlag::STENCIL) ? rtMTL->getStencilAttachmentPixelFormat() : PixelFormat::NONE; } void RenderPipelineMTL::setBlendStateAndFormat(const BlendDescriptor& blendDescriptor) diff --git a/cocos/renderer/backend/metal/RenderTargetMTL.mm b/cocos/renderer/backend/metal/RenderTargetMTL.mm index afc63d3dc5..b72c6d4268 100644 --- a/cocos/renderer/backend/metal/RenderTargetMTL.mm +++ b/cocos/renderer/backend/metal/RenderTargetMTL.mm @@ -97,7 +97,7 @@ void RenderTargetMTL::applyRenderPassAttachments(const RenderPassParams& params, } // Sets descriptor depth and stencil params, should match RenderTargetMTL::chooseAttachmentFormat - if(bitmask::any(this->_flags, RenderTargetFlag::DEPTH_AND_STENCIL)) { + if(bitmask::any(this->_flags, RenderTargetFlag::DEPTH)) { auto depthAttachment = getDepthAttachment(); if(depthAttachment){ descriptor.depthAttachment.texture = depthAttachment.texture; @@ -109,7 +109,7 @@ void RenderTargetMTL::applyRenderPassAttachments(const RenderPassParams& params, } } - if(bitmask::any(this->_flags, RenderTargetFlag::DEPTH_AND_STENCIL)) { + if(bitmask::any(this->_flags, RenderTargetFlag::STENCIL)) { auto stencilAttachment = getStencilAttachment(); if(stencilAttachment) { descriptor.stencilAttachment.texture = stencilAttachment.texture; @@ -177,7 +177,7 @@ PixelFormat RenderTargetMTL::getColorAttachmentPixelFormat(int index) const PixelFormat RenderTargetMTL::getDepthAttachmentPixelFormat() const { // FIXME: engine-x only support D24S8 - if(bitmask::any(_flags, TargetBufferFlags::DEPTH_AND_STENCIL)) { + if(bitmask::any(_flags, TargetBufferFlags::DEPTH)) { if(isDefaultRenderTarget() || !_depth) return PixelFormat::D24S8; return _depth.texture->getTextureFormat(); @@ -187,7 +187,7 @@ PixelFormat RenderTargetMTL::getDepthAttachmentPixelFormat() const PixelFormat RenderTargetMTL::getStencilAttachmentPixelFormat() const { // FIXME: engine-x only support D24S8 - if(bitmask::any(_flags, TargetBufferFlags::DEPTH_AND_STENCIL)) { + if(bitmask::any(_flags, TargetBufferFlags::STENCIL)) { if(isDefaultRenderTarget() || !_stencil) return PixelFormat::D24S8; return _stencil.texture->getTextureFormat();