diff --git a/native/cocos/core/assets/EffectAsset.cpp b/native/cocos/core/assets/EffectAsset.cpp index da675688ea5..3de9bb7c778 100644 --- a/native/cocos/core/assets/EffectAsset.cpp +++ b/native/cocos/core/assets/EffectAsset.cpp @@ -226,9 +226,16 @@ void EffectAsset::precompile() { continue; } - ccstd::vector defines = EffectAsset::doCombine(ccstd::vector(), combination, combination.begin()); - for (auto &define : defines) { - ProgramLib::getInstance()->getGFXShader(root->getDevice(), shader.name, define, root->getPipeline()); + // Native Program Lib can not precompile shader variant without phaseID. + // Shaders are compiled only during the compilation of PSO. A new mechanism may be needed for pre-compilation. + auto *programLib = render::getProgramLibrary(); + if (programLib == nullptr) { + ccstd::vector defines = EffectAsset::doCombine( + ccstd::vector(), combination, combination.begin()); + for (auto &define: defines) { + ProgramLib::getInstance()->getGFXShader(root->getDevice(), shader.name, define, + root->getPipeline()); + } } } } diff --git a/native/cocos/renderer/gfx-gles3/GLES3Commands.cpp b/native/cocos/renderer/gfx-gles3/GLES3Commands.cpp index afddfc2d1a7..ef6b638d93e 100644 --- a/native/cocos/renderer/gfx-gles3/GLES3Commands.cpp +++ b/native/cocos/renderer/gfx-gles3/GLES3Commands.cpp @@ -1583,7 +1583,12 @@ void cmdFuncGLES3CreateFramebuffer(GLES3Device *device, GLES3GPUFramebuffer *gpu if (lazilyAllocated && // MS attachment should be memoryless resolveView->gpuTexture->swapchain == nullptr && // not back buffer i < supportCount) { // extension limit - gpuFBO->framebuffer.bindColorMultiSample(resolveView, colorIndex, view->gpuTexture->glSamples, resolveDesc); + auto validateDesc = resolveDesc; + // implicit MS take color slot, so color loadOP should be used. + // resolve attachment with Store::Discard is meaningless. + validateDesc.loadOp = desc.loadOp; + validateDesc.storeOp = StoreOp::STORE; + gpuFBO->framebuffer.bindColorMultiSample(resolveView, colorIndex, view->gpuTexture->glSamples, validateDesc); } else { // implicit MS not supported, fallback to MS Renderbuffer gpuFBO->colorBlitPairs.emplace_back(colorIndex, resolveColorIndex); @@ -1609,7 +1614,14 @@ void cmdFuncGLES3CreateFramebuffer(GLES3Device *device, GLES3GPUFramebuffer *gpu resolveView->gpuTexture->swapchain == nullptr && // not back buffer supportCount > 1 && // extension limit useDsResolve) { // enable ds resolve - gpuFBO->framebuffer.bindDepthStencilMultiSample(resolveView, view->gpuTexture->glSamples, resolveDesc); + auto validateDesc = resolveDesc; + // implicit MS take ds slot, so ds MS loadOP should be used. + // resolve attachment with Store::Discard is meaningless. + validateDesc.depthLoadOp = desc.depthLoadOp; + validateDesc.depthStoreOp = StoreOp::STORE; + validateDesc.stencilLoadOp = desc.stencilLoadOp; + validateDesc.stencilStoreOp = StoreOp::STORE; + gpuFBO->framebuffer.bindDepthStencilMultiSample(resolveView, view->gpuTexture->glSamples, validateDesc); } else { // implicit MS not supported, fallback to MS Renderbuffer gpuFBO->dsResolveMask = getColorBufferMask(desc.format); diff --git a/native/cocos/renderer/pipeline/custom/NativeExecutor.cpp b/native/cocos/renderer/pipeline/custom/NativeExecutor.cpp index 23fdda466bc..9c6c4f2a7ae 100644 --- a/native/cocos/renderer/pipeline/custom/NativeExecutor.cpp +++ b/native/cocos/renderer/pipeline/custom/NativeExecutor.cpp @@ -232,7 +232,8 @@ PersistentRenderPassAndFramebuffer createPersistentRenderPassAndFramebuffer( [&](const IntrusivePtr& fb) { CC_EXPECTS(fb->getColorTextures().size() == 1); CC_EXPECTS(fb->getColorTextures().at(0)); - fbInfo.colorTextures.emplace_back(fb->getColorTextures()[index]); + // usually gfx::Framebuffer comes form RenderWindow, and use as color or resolve attachment. + fbInfo.colorTextures.emplace_back(fb->getColorTextures()[0]); // render window attaches a depthStencil by default, which may differs from renderpassInfo here. // data.framebuffer = fb; },