Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix Native Pipeline with render texture. #15803

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions native/cocos/core/assets/EffectAsset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,16 @@ void EffectAsset::precompile() {
continue;
}

ccstd::vector<MacroRecord> defines = EffectAsset::doCombine(ccstd::vector<MacroRecord>(), 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<MacroRecord> defines = EffectAsset::doCombine(
ccstd::vector<MacroRecord>(), combination, combination.begin());
for (auto &define: defines) {
ProgramLib::getInstance()->getGFXShader(root->getDevice(), shader.name, define,
root->getPipeline());
}
}
}
}
Expand Down
16 changes: 14 additions & 2 deletions native/cocos/renderer/gfx-gles3/GLES3Commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1594,7 +1594,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);
Expand All @@ -1620,7 +1625,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);
Expand Down
13 changes: 2 additions & 11 deletions native/cocos/scene/Pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,17 +416,8 @@ void Pass::resetUBOs() {
ofs += size;
}
};
auto *programLib = render::getProgramLibrary();
if (programLib) {
const auto &set = _shaderInfo->descriptors.at(
static_cast<size_t>(pipeline::SetIndex::MATERIAL));
for (const auto &block : set.blocks) {
updateBuffer(block);
}
} else {
for (const auto &u : _shaderInfo->blocks) {
updateBuffer(u);
}
for (const auto &u : _shaderInfo->blocks) {
updateBuffer(u);
}
_rootBufferDirty = true;
}
Expand Down
Loading