diff --git a/.github/workflows/native-compile-platforms.yml b/.github/workflows/native-compile-platforms.yml index ef25d930929..4ce4adacb98 100644 --- a/.github/workflows/native-compile-platforms.yml +++ b/.github/workflows/native-compile-platforms.yml @@ -134,6 +134,25 @@ jobs: (! contains(github.event.pull_request.body, '[X] does not change any runtime related code or build configuration')) runs-on: ubuntu-latest steps: + - name: Before free space + run: | + df -h + + - name: Free Disk Space (Ubuntu) + uses: jlumbroso/free-disk-space@d5af243ce7bacb67384aa6c5b1fc5f169e30903e + with: + tool-cache: true + android: false + dotnet: true + haskell: true + large-packages: true + docker-images: true + swap-storage: true + + - name: After free space + run: | + df -h + - uses: actions/checkout@v2 - name: Download external libraries shell: bash diff --git a/EngineErrorMap.md b/EngineErrorMap.md index 2302385d19e..0b373c2aa2c 100644 --- a/EngineErrorMap.md +++ b/EngineErrorMap.md @@ -168,6 +168,14 @@ Expected 'data' dict, but not found. Config file: %s Please load the resource first : %s +### 1102 + +Effect settings not found, effects will not be imported. + +### 1103 + +Success to load scene: %s + ### 1200 cocos2d: Director: Error in gettimeofday diff --git a/cocos/core/platform/macro.ts b/cocos/core/platform/macro.ts index c27506d7dd4..612e15e4a0e 100644 --- a/cocos/core/platform/macro.ts +++ b/cocos/core/platform/macro.ts @@ -987,9 +987,9 @@ interface Macro { /** * @en - * Used to set float output, the default value is false. + * Used to set float output render target, more accurate multiple light sources, fog, and translucent effects, custom pipeline only, the default value is false. * @zh - * 用于开启浮点格式的输出, 默认值为 false。 + * 用于开启浮点格式的RT输出, 更精确的多光源、雾化和半透明效果, 仅用于自定义管线, 默认值为 false。 * @default false */ ENABLE_FLOAT_OUTPUT: boolean; diff --git a/cocos/game/game.ts b/cocos/game/game.ts index 14086b18be7..954f9a6459e 100644 --- a/cocos/game/game.ts +++ b/cocos/game/game.ts @@ -29,7 +29,7 @@ import { findCanvas, loadJsFile } from 'pal/env'; import { Pacer } from 'pal/pacer'; import { ConfigOrientation } from 'pal/screen-adapter'; import assetManager, { IAssetManagerOptions } from '../asset/asset-manager/asset-manager'; -import { EventTarget, AsyncDelegate, sys, macro, VERSION, cclegacy, screen, Settings, settings, assert, garbageCollectionManager, DebugMode, warn, log, _resetDebugSetting } from '../core'; +import { EventTarget, AsyncDelegate, sys, macro, VERSION, cclegacy, screen, Settings, settings, assert, garbageCollectionManager, DebugMode, warn, log, _resetDebugSetting, errorID, logID } from '../core'; import { input } from '../input'; import { deviceManager, LegacyRenderMode } from '../gfx'; import { SplashScreen } from './splash-screen'; @@ -723,6 +723,7 @@ export class Game extends EventTarget { }) .then((): void => { if (DEBUG) { + // eslint-disable-next-line no-console console.time('Init Base'); } const debugMode = config.debugMode || DebugMode.NONE; @@ -735,6 +736,7 @@ export class Game extends EventTarget { .then((): Promise => settings.init(config.settingsPath, config.overrideSettings)) .then((): Promise => { if (DEBUG) { + // eslint-disable-next-line no-console console.timeEnd('Init Base'); } this.emit(Game.EVENT_POST_BASE_INIT); @@ -748,6 +750,7 @@ export class Game extends EventTarget { }) .then((): void => { if (DEBUG) { + // eslint-disable-next-line no-console console.time('Init Infrastructure'); } macro.init(); @@ -769,6 +772,7 @@ export class Game extends EventTarget { Layers.init(); this.initPacer(); if (DEBUG) { + // eslint-disable-next-line no-console console.timeEnd('Init Infrastructure'); } }) @@ -795,13 +799,21 @@ export class Game extends EventTarget { } const data = effectSettings.data; if (data === null) { - console.error('Effect settings not found, effects will not be imported.'); + errorID(1102); return; } cclegacy.rendering.init(deviceManager.gfxDevice, data); }) + .then((): Promise => { + const scriptPackages = settings.querySettings(Settings.Category.SCRIPTING, 'scriptPackages'); + if (scriptPackages) { + return Promise.all(scriptPackages.map((pack): Promise => import(pack))); + } + return Promise.resolve([]); + }) .then((): Promise => { if (DEBUG) { + // eslint-disable-next-line no-console console.time('Init SubSystem'); } director.init(); @@ -809,13 +821,14 @@ export class Game extends EventTarget { }) .then((): Promise => { if (DEBUG) { + // eslint-disable-next-line no-console console.timeEnd('Init SubSystem'); } this.emit(Game.EVENT_POST_SUBSYSTEM_INIT); return this.onPostSubsystemInitDelegate.dispatch(); }) .then((): void => { - console.log(`Cocos Creator v${VERSION}`); + log(`Cocos Creator v${VERSION}`); this.emit(Game.EVENT_ENGINE_INITED); this._engineInited = true; }) @@ -827,6 +840,7 @@ export class Game extends EventTarget { }) .then((): Promise => { if (DEBUG) { + // eslint-disable-next-line no-console console.time('Init Project'); } const jsList = settings.querySettings(Settings.Category.PLUGINS, 'jsList'); @@ -838,13 +852,6 @@ export class Game extends EventTarget { } return promise; }) - .then((): Promise => { - const scriptPackages = settings.querySettings(Settings.Category.SCRIPTING, 'scriptPackages'); - if (scriptPackages) { - return Promise.all(scriptPackages.map((pack): Promise => import(pack))); - } - return Promise.resolve([]); - }) .then((): Promise => this._loadProjectBundles()) .then((): Promise => this._loadCCEScripts()) .then((): void | Promise => this._setupRenderPipeline()) @@ -855,6 +862,7 @@ export class Game extends EventTarget { }) .then((): Promise => { if (DEBUG) { + // eslint-disable-next-line no-console console.timeEnd('Init Project'); } this.emit(Game.EVENT_POST_PROJECT_INIT); @@ -1013,11 +1021,11 @@ export class Game extends EventTarget { SplashScreen.instance.update(this._calculateDT(false)); } else if (this._shouldLoadLaunchScene) { this._shouldLoadLaunchScene = false; - const launchScene = settings.querySettings(Settings.Category.LAUNCH, 'launchScene'); + const launchScene = settings.querySettings(Settings.Category.LAUNCH, 'launchScene') as string; if (launchScene) { // load scene director.loadScene(launchScene, (): void => { - console.log(`Success to load scene: ${launchScene}`); + logID(1103, launchScene); this._initTime = performance.now(); director.startAnimation(); this.onStart?.(); @@ -1098,7 +1106,7 @@ export class Game extends EventTarget { } private _setupRenderPipeline (): void | Promise { - const renderPipeline = settings.querySettings(Settings.Category.RENDERING, 'renderPipeline'); + const renderPipeline = settings.querySettings(Settings.Category.RENDERING, 'renderPipeline') as string; if (!renderPipeline) { return this._setRenderPipeline(); } @@ -1124,7 +1132,7 @@ export class Game extends EventTarget { this._safeEmit(Game.EVENT_RENDERER_INITED); } - private _safeEmit (event): void { + private _safeEmit (event: string | number): void { if (EDITOR) { try { this.emit(event); diff --git a/cocos/physics/framework/deprecated.ts b/cocos/physics/framework/deprecated.ts index 9854068b7c8..fdb15eec610 100644 --- a/cocos/physics/framework/deprecated.ts +++ b/cocos/physics/framework/deprecated.ts @@ -148,12 +148,6 @@ removeProperty(RigidBody.prototype, 'RigidBody.prototype', [ }, ]); -removeProperty(EConstraintType, 'EConstraintType.prototype', [ - { - name: 'CONE_TWIST', - }, -]); - /** * Alias of [[RigidBody]] * @deprecated Since v1.2 diff --git a/cocos/physics/framework/physics-enum.ts b/cocos/physics/framework/physics-enum.ts index 90766a75d69..9878463c04d 100644 --- a/cocos/physics/framework/physics-enum.ts +++ b/cocos/physics/framework/physics-enum.ts @@ -270,14 +270,6 @@ export enum EConstraintType { * 铰链约束。 */ HINGE, - /** - * @en - * Cone twist constraint. - * @zh - * 锥形扭转约束。 - * @deprecated coneTwist is deprecated, please use configurable instead - */ - CONE_TWIST, /** * @en * Fixed constraint. diff --git a/cocos/physics/framework/physics-selector.ts b/cocos/physics/framework/physics-selector.ts index f65b5cc6bc0..394c7a1c078 100644 --- a/cocos/physics/framework/physics-selector.ts +++ b/cocos/physics/framework/physics-selector.ts @@ -26,7 +26,7 @@ /* eslint-disable @typescript-eslint/restrict-template-expressions */ /* eslint-disable @typescript-eslint/no-unsafe-return */ import { EDITOR, TEST } from 'internal:constants'; -import { IBaseConstraint, IPointToPointConstraint, IHingeConstraint, IConeTwistConstraint, IFixedConstraint, +import { IBaseConstraint, IPointToPointConstraint, IHingeConstraint, IFixedConstraint, IConfigurableConstraint } from '../spec/i-physics-constraint'; import { IBoxShape, ISphereShape, ICapsuleShape, ITrimeshShape, ICylinderShape, @@ -58,10 +58,6 @@ interface IPhysicsWrapperObject { PlaneShape?: Constructor, PointToPointConstraint?: Constructor, HingeConstraint?: Constructor, - /** - * @deprecated cone twist constraint is deprecated, please use configurable instead - */ - ConeTwistConstraint?: Constructor, FixedConstraint?: Constructor, ConfigurableConstraint?: Constructor, } @@ -238,10 +234,6 @@ enum ECheckType { // JOINT // PointToPointConstraint, HingeConstraint, - /** - * @deprecated cone twist constraint is deprecated, please use configurable instead - */ - ConeTwistConstraint, FixedConstraint, ConfigurableConstraint, // CHARACTER CONTROLLER // @@ -424,7 +416,7 @@ function initColliderProxy (): void { const CREATE_CONSTRAINT_PROXY = { INITED: false }; -interface IEntireConstraint extends IPointToPointConstraint, IHingeConstraint, IConeTwistConstraint, IFixedConstraint, IConfigurableConstraint { } +interface IEntireConstraint extends IPointToPointConstraint, IHingeConstraint, IFixedConstraint, IConfigurableConstraint { } const ENTIRE_CONSTRAINT: IEntireConstraint = { impl: null, initialize: FUNC, @@ -490,11 +482,6 @@ function initConstraintProxy (): void { return new selector.wrapper.HingeConstraint!(); }; - CREATE_CONSTRAINT_PROXY[EConstraintType.CONE_TWIST] = function createConeTwistConstraint (): IConeTwistConstraint { - if (check(selector.wrapper.ConeTwistConstraint, ECheckType.ConeTwistConstraint)) { return ENTIRE_CONSTRAINT; } - return new selector.wrapper.ConeTwistConstraint!(); - }; - CREATE_CONSTRAINT_PROXY[EConstraintType.FIXED] = function createFixedConstraint (): IFixedConstraint { if (check(selector.wrapper.FixedConstraint, ECheckType.FixedConstraint)) { return ENTIRE_CONSTRAINT; } return new selector.wrapper.FixedConstraint!(); diff --git a/cocos/physics/spec/i-physics-constraint.ts b/cocos/physics/spec/i-physics-constraint.ts index 91664b25717..ad6692b20e5 100644 --- a/cocos/physics/spec/i-physics-constraint.ts +++ b/cocos/physics/spec/i-physics-constraint.ts @@ -96,8 +96,3 @@ export interface IConfigurableConstraint extends IBaseConstraint { setBreakForce(v: number): void; setBreakTorque(v: number): void; } - -/** - * @deprecated ConeTwistConstraint is deprecated, please use ConfigurableConstraint instead - */ -export type IConeTwistConstraint = IBaseConstraint diff --git a/cocos/rendering/custom/executor.ts b/cocos/rendering/custom/executor.ts index 95f9cbae566..a8c3a4695ea 100644 --- a/cocos/rendering/custom/executor.ts +++ b/cocos/rendering/custom/executor.ts @@ -715,13 +715,15 @@ class SubmitInfo { class RenderPassLayoutInfo { protected _layoutID = 0; + protected _vertID = -1; protected _stage: RenderStageData | null = null; protected _layout: PipelineLayoutData; protected _inputName: string; protected _descriptorSet: DescriptorSet | null = null; - constructor (layoutId: number, input: [string, ComputeView[]]) { + constructor (layoutId: number, vertId: number, input: [string, ComputeView[]]) { this._inputName = input[0]; this._layoutID = layoutId; + this._vertID = vertId; const lg = context.layoutGraph; this._stage = lg.getRenderStage(layoutId); this._layout = lg.getLayout(layoutId); @@ -778,6 +780,7 @@ class RenderPassLayoutInfo { } get descriptorSet (): DescriptorSet | null { return this._descriptorSet; } get layoutID (): number { return this._layoutID; } + get vertID (): number { return this._vertID; } get stage (): RenderStageData | null { return this._stage; } get layout (): PipelineLayoutData { return this._layout; } } @@ -992,7 +995,7 @@ class DeviceRenderPass { const layoutGraph = context.layoutGraph; const stageId = layoutGraph.locateChild(layoutGraph.nullVertex(), stageName); if (stageId !== 0xFFFFFFFF) { - this._layout = new RenderPassLayoutInfo(stageId, input); + this._layout = new RenderPassLayoutInfo(stageId, this.rasterPassInfo.id, input); } } } diff --git a/cocos/terrain/terrain.ts b/cocos/terrain/terrain.ts index e973a6b2e71..6711c4af64e 100644 --- a/cocos/terrain/terrain.ts +++ b/cocos/terrain/terrain.ts @@ -1997,7 +1997,7 @@ export class Terrain extends Component { if (EDITOR && this._asset) { this._asset.weights[index * 4 + 0] = w.x * 255; this._asset.weights[index * 4 + 1] = w.y * 255; - this._asset.weights[index * 4 + 2] = w.x * 255; + this._asset.weights[index * 4 + 2] = w.z * 255; this._asset.weights[index * 4 + 3] = w.w * 255; } } diff --git a/native/CMakeLists.txt b/native/CMakeLists.txt index d26dfee13c2..91155327302 100644 --- a/native/CMakeLists.txt +++ b/native/CMakeLists.txt @@ -3302,6 +3302,13 @@ if(APPLE) CC_KEYBOARD_SUPPORT ) elseif(IOS) + + if("${XCODE_VERSION}" VERSION_GREATER_EQUAL "15.0") + # For Xcode 15 and newer, add extra link flags to fix crash in __cxx_global_var_init. + message(STATUS "Using Xcode 15 or newer, adding extra link flags: -Wl,-ld_classic.") + target_link_options(${ENGINE_NAME} PUBLIC -Wl,-ld_classic) + endif() + target_link_libraries(${ENGINE_NAME} PUBLIC "-framework QuartzCore" "-framework MetalPerformanceShaders" diff --git a/native/cocos/core/builtin/DebugInfos.cpp b/native/cocos/core/builtin/DebugInfos.cpp index 31ed13ab8ee..d83f1db811f 100644 --- a/native/cocos/core/builtin/DebugInfos.cpp +++ b/native/cocos/core/builtin/DebugInfos.cpp @@ -35,6 +35,8 @@ ccstd::unordered_map debugInfos = { { 1008, "[Action reverse]. override me" }, { 1100, "Expected 'data' dict, but not found. Config file: %s" }, { 1101, "Please load the resource first : %s" }, +{ 1102, "Effect settings not found, effects will not be imported." }, +{ 1103, "Success to load scene: %s" }, { 1200, "cocos2d: Director: Error in gettimeofday" }, { 1204, "Running scene should not be null" }, { 1205, "The scene should not be null" }, diff --git a/native/cocos/renderer/pipeline/custom/FrameGraphDispatcher.cpp b/native/cocos/renderer/pipeline/custom/FrameGraphDispatcher.cpp index 0ac2474e733..109be98a321 100644 --- a/native/cocos/renderer/pipeline/custom/FrameGraphDispatcher.cpp +++ b/native/cocos/renderer/pipeline/custom/FrameGraphDispatcher.cpp @@ -38,6 +38,7 @@ #include "FGDispatcherTypes.h" #include "LayoutGraphGraphs.h" #include "LayoutGraphTypes.h" +#include "NativeRenderGraphUtils.h" #include "RenderGraphGraphs.h" #include "base/Log.h" #include "boost/graph/depth_first_search.hpp" @@ -56,7 +57,6 @@ #include "pipeline/custom/RenderCommonFwd.h" #include "pipeline/custom/RenderGraphTypes.h" #include "pipeline/custom/details/GslUtils.h" -#include "NativeRenderGraphUtils.h" #ifndef BRANCH_CULLING #define BRANCH_CULLING 0 @@ -133,8 +133,8 @@ ResourceGraph::vertex_descriptor FrameGraphDispatcher::realResourceID(const ccst } [[nodiscard]] ccstd::pmr::string getSubresNameByPlane(const ccstd::pmr::string &resName, - uint32_t planeID, const ResourceGraph &resg, - boost::container::pmr::memory_resource *scratch) { + uint32_t planeID, const ResourceGraph &resg, + boost::container::pmr::memory_resource *scratch) { const auto &desc = get(ResourceGraph::DescTag{}, resg, vertex(resName, resg)); // depth stencil if (desc.format == gfx::Format::DEPTH_STENCIL) { @@ -185,7 +185,7 @@ ResourceGraph::vertex_descriptor locateSubres(ResourceGraph::vertex_descriptor r return findVertex(resName, resg); } -ResourceGraph::vertex_descriptor locateSubres(const ccstd::pmr::string& originName, +ResourceGraph::vertex_descriptor locateSubres(const ccstd::pmr::string &originName, const ResourceGraph &resg, uint32_t basePlane, boost::container::pmr::memory_resource *scratch) { @@ -199,7 +199,7 @@ ResourceGraph::vertex_descriptor locateSubres(const ccstd::pmr::string& originNa ResourceGraph::vertex_descriptor locateSubres(const ccstd::pmr::string &originName, const ResourceGraph &resg, uint32_t basePlane, - const ResourceAccessGraph& rag, + const ResourceAccessGraph &rag, boost::container::pmr::memory_resource *scratch) { auto originID = findVertex(originName, resg); if (rag.movedSourceStatus.find(originName) != rag.movedSourceStatus.end()) { @@ -210,7 +210,6 @@ ResourceGraph::vertex_descriptor locateSubres(const ccstd::pmr::string &originNa return findVertex(resName, resg); } - PmrFlatMap FrameGraphDispatcher::buildDescriptorIndex( const PmrTransparentMap> &computeViews, boost::container::pmr::memory_resource *scratch) const { @@ -235,7 +234,6 @@ PmrFlatMap FrameGraphDispatcher:: const PmrTransparentMap> &computeViews, const PmrTransparentMap &rasterViews, boost::container::pmr::memory_resource *scratch) const { - auto resourceIndex = buildDescriptorIndex(computeViews, scratch); if (!rasterViews.empty()) { NameLocalID unused{128}; @@ -497,7 +495,7 @@ bool isResourceView(const ResourceGraph::vertex_descriptor v, const ResourceGrap } gfx::ResourceRange getResourceRange(const ResourceGraph::vertex_descriptor v, - const ResourceGraph &resg) { + const ResourceGraph &resg) { const auto &desc = get(ResourceGraph::DescTag{}, resg, v); gfx::ResourceRange range{ desc.width, @@ -619,7 +617,7 @@ auto dependencyCheck(ResourceAccessGraph &rag, ResourceAccessGraph::vertex_descr rag.leafPasses.erase(lastVertID); } - if(viewStatus.access != AccessType::WRITE) { + if (viewStatus.access != AccessType::WRITE) { subResourceFeedback(resourceGraph, resourceID, desc.format); } } @@ -811,10 +809,12 @@ struct ViewInfo { AttachmentType attachmentType; }; -using AttachmentMap = ccstd::pmr::map; +template +using AttachmentMap = ccstd::pmr::map; } // namespace -void fillRenderPassInfo(const AttachmentMap &colorMap, +template +void fillRenderPassInfo(const AttachmentMap &colorMap, FGRenderPassInfo &fgRenderpassInfo, const ResourceGraph &resg) { for (const auto &pair : colorMap) { @@ -923,11 +923,12 @@ void extractNames(const ccstd::pmr::string &resName, } } +template auto checkRasterViews(const Graphs &graphs, ResourceAccessGraph::vertex_descriptor ragVertID, ResourceAccessNode &node, const RasterViewsMap &rasterViews, - AttachmentMap &colorMap) { + AttachmentMap &colorMap) { const auto &[renderGraph, layoutGraphData, resourceGraph, resourceAccessGraph, relationGraph] = graphs; const auto passID = get(ResourceAccessGraph::PassIDTag{}, resourceAccessGraph, ragVertID); bool dependent = false; @@ -971,7 +972,7 @@ auto checkRasterViews(const Graphs &graphs, ccstd::pmr::vector> names(resourceAccessGraph.get_allocator()); extractNames(resName, rasterView, names); - for (const auto& [subresFullName, plane] : names) { + for (const auto &[subresFullName, plane] : names) { resourceAccessGraph.resourceIndex.emplace(subresFullName, vertex(subresFullName, resourceGraph)); } } @@ -1014,7 +1015,7 @@ bool checkComputeViews(const Graphs &graphs, ResourceAccessGraph::vertex_descrip dependent = lastVertId != EXPECT_START_ID; if (out_degree(resID, resourceGraph) && (computeView.plane != 0xFFFFFFFF)) { - const auto& subresFullName = getSubresNameByPlane(resName, computeView.plane, resourceGraph, resourceAccessGraph.resource()); + const auto &subresFullName = getSubresNameByPlane(resName, computeView.plane, resourceGraph, resourceAccessGraph.resource()); resourceAccessGraph.resourceIndex.emplace(subresFullName, vertex(subresFullName, resourceGraph)); } } @@ -1023,11 +1024,12 @@ bool checkComputeViews(const Graphs &graphs, ResourceAccessGraph::vertex_descrip return dependent; } +template bool checkResolveResource(const Graphs &graphs, uint32_t ragVertID, ResourceAccessNode &node, const ccstd::pmr::vector &resolves, - AttachmentMap &colorMap) { + AttachmentMap &colorMap) { const auto &[renderGraph, layoutGraphData, resourceGraph, resourceAccessGraph, relationGraph] = graphs; const auto passID = get(ResourceAccessGraph::PassIDTag{}, resourceAccessGraph, ragVertID); bool dependent = false; @@ -1139,7 +1141,7 @@ void startRenderPass(const Graphs &graphs, uint32_t passID, const RasterPass &pa auto &fgRenderPassInfo = get(ResourceAccessGraph::RenderPassInfoTag{}, resourceAccessGraph, vertID); if (pass.subpassGraph.subpasses.empty()) { - AttachmentMap colorMap(resourceAccessGraph.get_allocator()); + AttachmentMap colorMap(resourceAccessGraph.get_allocator()); auto &accessNode = get(ResourceAccessGraph::PassNodeTag{}, resourceAccessGraph, vertID); std::ignore = checkRasterViews(graphs, rlgVertID, accessNode, pass.rasterViews, colorMap); std::ignore = checkComputeViews(graphs, rlgVertID, accessNode, pass.computeViews); @@ -1221,90 +1223,107 @@ void startRenderSubpass(const Graphs &graphs, uint32_t passID, const RasterSubpa auto parentID = parent(passID, renderGraph); auto parentRagVertID = resourceAccessGraph.passIndex.at(parentID); auto &fgRenderpassInfo = get(ResourceAccessGraph::RenderPassInfoTag{}, resourceAccessGraph, parentRagVertID); - AttachmentMap colorMap(resourceAccessGraph.get_allocator()); - auto [hasDep, hasDS] = checkRasterViews(graphs, rlgVertID, accessNode, pass.rasterViews, colorMap); - hasDep |= checkComputeViews(graphs, rlgVertID, accessNode, pass.computeViews); - hasDep |= checkResolveResource(graphs, rlgVertID, accessNode, pass.resolvePairs, colorMap); - fillRenderPassInfo(colorMap, fgRenderpassInfo, resourceGraph); - - auto &subpassInfo = fgRenderpassInfo.rpInfo.subpasses.emplace_back(); - auto &dependencies = fgRenderpassInfo.rpInfo.dependencies; + const auto &rg = renderGraph; + auto &rag = resourceAccessGraph; + auto &resg = resourceGraph; - // subpass info & subpass dependencies - for (const auto &pair : colorMap) { - const auto &sortKey = pair.first; - const std::string_view name = sortKey.name; - auto resID = vertex(sortKey.name, resourceGraph); - const auto &desc = get(ResourceGraph::DescTag{}, resourceGraph, resID); - const auto &[ignored, cIndex, isResolveView] = fgRenderpassInfo.viewIndex.at(name.data()); - if (isResolveView) { - auto resolveIter = std::find_if(pass.resolvePairs.begin(), pass.resolvePairs.end(), [&name](const ResolvePair &resolve) { - return strcmp(resolve.target.c_str(), name.data()) == 0; - }); - if (desc.format == gfx::Format::DEPTH_STENCIL) { - subpassInfo.depthStencilResolve = getDepthStencilSlot(fgRenderpassInfo.uniqueRasterViewCount, fgRenderpassInfo.resolveCount, hasDS) + 1; - if (resolveIter->mode != gfx::ResolveMode::NONE) { - subpassInfo.depthResolveMode = resolveIter->mode; - } - if (resolveIter->mode1 != gfx::ResolveMode::NONE) { - subpassInfo.stencilResolveMode = resolveIter->mode1; + auto process = [&](auto &colorMap) { + auto [hasDep, hasDS] = checkRasterViews(graphs, rlgVertID, accessNode, pass.rasterViews, colorMap); + hasDep |= checkComputeViews(graphs, rlgVertID, accessNode, pass.computeViews); + hasDep |= checkResolveResource(graphs, rlgVertID, accessNode, pass.resolvePairs, colorMap); + fillRenderPassInfo(colorMap, fgRenderpassInfo, resg); + + auto &subpassInfo = fgRenderpassInfo.rpInfo.subpasses.emplace_back(); + auto &dependencies = fgRenderpassInfo.rpInfo.dependencies; + + // subpass info & subpass dependencies + for (const auto &pair : colorMap) { + const auto &sortKey = pair.first; + const std::string_view name = sortKey.name; + auto resID = vertex(sortKey.name, resg); + const auto &desc = get(ResourceGraph::DescTag{}, resg, resID); + const auto &[ignored, cIndex, isResolveView] = fgRenderpassInfo.viewIndex.at(name.data()); + if (isResolveView) { + auto resolveIter = std::find_if(pass.resolvePairs.begin(), pass.resolvePairs.end(), [&name](const ResolvePair &resolve) { + return strcmp(resolve.target.c_str(), name.data()) == 0; + }); + if (desc.format == gfx::Format::DEPTH_STENCIL) { + subpassInfo.depthStencilResolve = getDepthStencilSlot(fgRenderpassInfo.uniqueRasterViewCount, fgRenderpassInfo.resolveCount, hasDS) + 1; + if (resolveIter->mode != gfx::ResolveMode::NONE) { + subpassInfo.depthResolveMode = resolveIter->mode; + } + if (resolveIter->mode1 != gfx::ResolveMode::NONE) { + subpassInfo.stencilResolveMode = resolveIter->mode1; + } + } else { + if (subpassInfo.resolves.empty()) { + subpassInfo.resolves.resize(pass.rasterViews.size() - hasDS, gfx::INVALID_BINDING); + } + const auto &resolveSrc = resolveIter->source; + const auto &resourceSrcInfo = fgRenderpassInfo.viewIndex.at(resolveSrc); + subpassInfo.resolves[resourceSrcInfo.attachmentIndex] = cIndex; } } else { - if (subpassInfo.resolves.empty()) { - subpassInfo.resolves.resize(pass.rasterViews.size() - hasDS, gfx::INVALID_BINDING); + if (desc.format == gfx::Format::DEPTH_STENCIL) { + auto dsSlot = getDepthStencilSlot(fgRenderpassInfo.uniqueRasterViewCount, fgRenderpassInfo.resolveCount, hasDS); + if (sortKey.accessType != AccessType::WRITE) { + subpassInfo.inputs.emplace_back(dsSlot); + } + if (sortKey.accessType != AccessType::READ) { + subpassInfo.depthStencil = dsSlot; + } + } else { + if (sortKey.accessType != AccessType::WRITE) { + subpassInfo.inputs.emplace_back(cIndex); + } + if (sortKey.accessType != AccessType::READ) { + subpassInfo.colors.emplace_back(cIndex); + } + + if (sortKey.accessType == AccessType::READ_WRITE) { + auto &selfDependency = dependencies.emplace_back(); + selfDependency.srcSubpass = pass.subpassID; + selfDependency.dstSubpass = pass.subpassID; + selfDependency.prevAccesses = pair.second.access.nextAccess; + selfDependency.nextAccesses = pair.second.access.nextAccess; + } } - const auto &resolveSrc = resolveIter->source; - const auto &resourceSrcInfo = fgRenderpassInfo.viewIndex.at(resolveSrc); - subpassInfo.resolves[resourceSrcInfo.attachmentIndex] = cIndex; } - } else { - if (desc.format == gfx::Format::DEPTH_STENCIL) { - auto dsSlot = getDepthStencilSlot(fgRenderpassInfo.uniqueRasterViewCount, fgRenderpassInfo.resolveCount, hasDS); - if (sortKey.accessType != AccessType::WRITE) { - subpassInfo.inputs.emplace_back(dsSlot); - } - if (sortKey.accessType != AccessType::READ) { - subpassInfo.depthStencil = dsSlot; - } - } else { - if (sortKey.accessType != AccessType::WRITE) { - subpassInfo.inputs.emplace_back(cIndex); - } - if (sortKey.accessType != AccessType::READ) { - subpassInfo.colors.emplace_back(cIndex); - } - if (sortKey.accessType == AccessType::READ_WRITE) { - auto &selfDependency = dependencies.emplace_back(); - selfDependency.srcSubpass = pass.subpassID; - selfDependency.dstSubpass = pass.subpassID; - selfDependency.prevAccesses = pair.second.access.nextAccess; - selfDependency.nextAccesses = pair.second.access.nextAccess; + if (hasDep) { + auto &dependency = dependencies.emplace_back(); + auto lastIter = ++rag.resourceAccess[name.data()].rbegin(); + bool isBuffer = desc.dimension == ResourceDimension::BUFFER; + if (accessDependent(lastIter->second.accessFlag, accessNode.resourceStatus.at(name.data()).accessFlag, isBuffer) && lastIter->second.accessFlag != gfx::AccessFlagBit::NONE) { + auto lastVert = lastIter->first; + auto lastPassID = get(ResourceAccessGraph::PassIDTag{}, rag, lastVert); + auto lastPassIndex = INVALID_ID; + if (holds(lastPassID, rg) && (parent(lastPassID, rg) == parentID)) { + const auto *lastPass = get_if(lastPassID, &rg); + lastPassIndex = lastPass->subpassID; + } + + auto &dependency = dependencies.emplace_back(); + dependency.srcSubpass = lastPassIndex; + dependency.dstSubpass = pass.subpassID; + dependency.prevAccesses = lastIter->second.accessFlag; + dependency.nextAccesses = pair.second.access.nextAccess; } } } + }; - if (hasDep) { - auto &dependency = dependencies.emplace_back(); - auto lastIter = ++resourceAccessGraph.resourceAccess[name.data()].rbegin(); - bool isBuffer = desc.dimension == ResourceDimension::BUFFER; - if (accessDependent(lastIter->second.accessFlag, accessNode.resourceStatus.at(name.data()).accessFlag, isBuffer) && lastIter->second.accessFlag != gfx::AccessFlagBit::NONE) { - auto lastVert = lastIter->first; - auto lastPassID = get(ResourceAccessGraph::PassIDTag{}, resourceAccessGraph, lastVert); - auto lastPassIndex = INVALID_ID; - if (holds(lastPassID, renderGraph) && (parent(lastPassID, renderGraph) == parentID)) { - const auto *lastPass = get_if(lastPassID, &renderGraph); - lastPassIndex = lastPass->subpassID; - } + const auto *parentPass = get_if(parentID, &renderGraph); + CC_ASSERT(parentPass); - auto &dependency = dependencies.emplace_back(); - dependency.srcSubpass = lastPassIndex; - dependency.dstSubpass = pass.subpassID; - dependency.prevAccesses = lastIter->second.accessFlag; - dependency.nextAccesses = pair.second.access.nextAccess; - } - } + if (parentPass->subpassGraph.subpasses.size() == 1) { + // for those renderpass which consist of only 1 subpass + AttachmentMap colorMap(resourceAccessGraph.get_allocator()); + process(colorMap); + } else { + AttachmentMap colorMap(resourceAccessGraph.get_allocator()); + process(colorMap); } } @@ -1316,7 +1335,7 @@ void startComputeSubpass(const Graphs &graphs, uint32_t passID, const ComputeSub CC_EXPECTS(static_cast(rlgVertID) == static_cast(vertID)); auto &accessNode = get(ResourceAccessGraph::PassNodeTag{}, resourceAccessGraph, rlgVertID); - AttachmentMap colorMap(resourceAccessGraph.get_allocator()); + AttachmentMap colorMap(resourceAccessGraph.get_allocator()); auto parentID = parent(passID, renderGraph); auto parentRagVertID = resourceAccessGraph.passIndex.at(parentID); @@ -1403,8 +1422,8 @@ void startRaytracePass(const Graphs &graphs, uint32_t passID, const RaytracePass } bool rangeCheck(ResourceNode &status, - const ResourceDesc &/*desc*/, - const PmrString &/*targetName*/, + const ResourceDesc & /*desc*/, + const PmrString & /*targetName*/, uint32_t firstSlice, uint32_t numSlices, uint32_t firstMip, uint32_t mipLevels, uint32_t planeIndex) { @@ -1452,7 +1471,7 @@ uint32_t getPlaneCount(gfx::Format format) { } } -bool moveValidation(const MovePass& pass, ResourceAccessGraph& rag, const ResourceGraph& resourceGraph) { +bool moveValidation(const MovePass &pass, ResourceAccessGraph &rag, const ResourceGraph &resourceGraph) { bool check = true; ccstd::pmr::vector targets(rag.get_allocator()); for (const auto &movePair : pass.movePairs) { @@ -1542,7 +1561,7 @@ gfx::SamplerInfo makePointSamplerInfo() { return gfx::SamplerInfo{gfx::Filter::POINT, gfx::Filter::POINT, gfx::Filter::POINT}; } -SubresourceView makeSubresourceView(const ResourceDesc& srcDesc, const ResourceDesc &targetDesc, const gfx::ResourceRange& range) { +SubresourceView makeSubresourceView(const ResourceDesc &srcDesc, const ResourceDesc &targetDesc, const gfx::ResourceRange &range) { SubresourceView view{}; view.firstArraySlice = range.firstSlice; view.numArraySlices = range.numSlices; @@ -1581,8 +1600,8 @@ void startMovePass(const Graphs &graphs, uint32_t passID, const MovePass &pass) auto &rag = resourceAccessGraph; std::function feedBack = [&]( - const ccstd::pmr::string &source, - ResourceGraph::vertex_descriptor v) { + const ccstd::pmr::string &source, + ResourceGraph::vertex_descriptor v) { rag.resourceIndex[source] = v; if (rag.movedTarget.find(source) != rag.movedTarget.end()) { @@ -1594,7 +1613,7 @@ void startMovePass(const Graphs &graphs, uint32_t passID, const MovePass &pass) feedBack(pair.source, targetResID); } } else { - for(const auto& pair : pass.movePairs) { + for (const auto &pair : pass.movePairs) { CopyPass copyPass(resourceAccessGraph.get_allocator()); copyPass.copyPairs.emplace_back(CopyPair( pair.source, @@ -1653,7 +1672,7 @@ struct DependencyVisitor : boost::dfs_visitor<> { const Graphs &graphs; }; -void subresourceAnalysis(ResourceAccessGraph& rag, ResourceGraph& resg) { +void subresourceAnalysis(ResourceAccessGraph &rag, ResourceGraph &resg) { using RecursiveFuncType = std::function &, const ccstd::pmr::string &)>; RecursiveFuncType addSubres = [&](const PmrFlatMap &subreses, const ccstd::pmr::string &resName) { if (subreses.size() == 1) { @@ -1873,7 +1892,7 @@ void buildBarriers(FrameGraphDispatcher &fgDispatcher) { info.type = barrier.type; gfxBarrier = gfx::Device::getInstance()->getBufferBarrier(info); } else { - const auto& originRange = getOriginRange(barrier.resourceID, barrier.endStatus.range, resourceGraph); + const auto &originRange = getOriginRange(barrier.resourceID, barrier.endStatus.range, resourceGraph); gfx::TextureBarrierInfo info; info.prevAccesses = barrier.beginStatus.accessFlag; info.nextAccesses = barrier.endStatus.accessFlag; diff --git a/scripts/native-pack-tool/source/platforms/openharmony.ts b/scripts/native-pack-tool/source/platforms/openharmony.ts index 45af3334f3a..6dbbad129db 100644 --- a/scripts/native-pack-tool/source/platforms/openharmony.ts +++ b/scripts/native-pack-tool/source/platforms/openharmony.ts @@ -47,8 +47,8 @@ export class OpenHarmonyPackTool extends NativePackTool { // entry/build-profile.json5 const buildCfgFile = ps.join(ohosProjDir, 'entry/build-profile.json5'); await cchelper.replaceInFile([ - { reg: '={DRES_DIR}', text: `=${cchelper.fixPath(this.paths.buildDir!)}` }, - { reg: '={DCOMMON_DIR}', text: `=${cchelper.fixPath(process.env.COMMON_DIR || '')}` }, + { reg: 'DRES_DIR=[^ ]*', text: `DRES_DIR=${cchelper.fixPath(this.paths.buildDir!)}` }, + { reg: 'DCOMMON_DIR=[^ ]*', text: `DCOMMON_DIR=${cchelper.fixPath(process.env.COMMON_DIR || '')}` }, { reg: /"compileSdkVersion": *,/, text: `"compileSdkVersion": ${platformParams.apiLevel},}` }, ], buildCfgFile); @@ -94,6 +94,11 @@ export class OpenHarmonyPackTool extends NativePackTool { configJSON.app.bundleName = platformParams.packageName; outputJSONSync(cfgFile, configJSON, { spaces: 2 }); + const appScopeStringJSONPath = ps.join(ohosProjDir, 'AppScope/resources/base/element/string.json'); + const appScopeStringJSON = fs.readJSONSync(appScopeStringJSONPath); + appScopeStringJSON.string.find((item: any) => item.name === 'app_name').value = this.params.projectName; + outputJSONSync(appScopeStringJSONPath, appScopeStringJSON, { spaces: 2 }); + const stringJSONPath = ps.join(ohosProjDir, 'entry/src/main/resources/base/element/string.json'); const stringJSON = fs.readJSONSync(stringJSONPath); stringJSON.string.find((item: any) => item.name === 'MainAbility_label').value = this.params.projectName;