From 20a2a7f06c9288dba742cd7fb335ad246a6d7f12 Mon Sep 17 00:00:00 2001 From: jk20012001 Date: Mon, 12 Jun 2023 15:18:22 +0800 Subject: [PATCH 01/28] fix shader compatible for old version (#15407) --- editor/assets/chunks/common/common-define.chunk | 6 ++++++ editor/assets/chunks/common/math/number.chunk | 17 ++++------------- editor/assets/effects/advanced/hair.effect | 8 ++++---- editor/assets/effects/pipeline/ssss-blur.effect | 1 + 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/editor/assets/chunks/common/common-define.chunk b/editor/assets/chunks/common/common-define.chunk index db65a1fed8..8308d4fa69 100644 --- a/editor/assets/chunks/common/common-define.chunk +++ b/editor/assets/chunks/common/common-define.chunk @@ -31,6 +31,12 @@ #pragma define clip(value) if(value < 0.0) discard; #pragma define lerp(value1, value2, value2Multiplier) mix(value1, value2, value2Multiplier) +float saturate(float value) { return clamp(value, 0.0, 1.0); } +vec2 saturate(vec2 value) { return clamp(value, vec2(0.0), vec2(1.0)); } +vec3 saturate(vec3 value) { return clamp(value, vec3(0.0), vec3(1.0)); } +vec4 saturate(vec4 value) { return clamp(value, vec4(0.0), vec4(1.0)); } + + // runtime constants #pragma define-meta CC_DEVICE_SUPPORT_FLOAT_TEXTURE default(1) #pragma define-meta CC_DEVICE_MAX_FRAGMENT_UNIFORM_VECTORS default(1024) diff --git a/editor/assets/chunks/common/math/number.chunk b/editor/assets/chunks/common/math/number.chunk index 5dd6f2ba7b..cec08efffa 100644 --- a/editor/assets/chunks/common/math/number.chunk +++ b/editor/assets/chunks/common/math/number.chunk @@ -39,19 +39,10 @@ bool isinfs(vec4 val) { vec4 round(vec4 value) { return vec4(round(value.x), round(value.y), round(value.z), round(value.w)); } #endif -float rsqrt(float value) { - return 1.0 / sqrt(value); -} -vec2 rsqrt(vec2 value) { return vec2(rsqrt(value.x), rsqrt(value.y)); } -vec3 rsqrt(vec3 value) { return vec3(rsqrt(value.x), rsqrt(value.y), rsqrt(value.z)); } -vec4 rsqrt(vec4 value) { return vec4(rsqrt(value.x), rsqrt(value.y), rsqrt(value.z), rsqrt(value.w)); } - -float saturate(float value) { - return min(max(value, 0.0), 1.0); -} -vec2 saturate(vec2 value) { return vec2(saturate(value.x), saturate(value.y)); } -vec3 saturate(vec3 value) { return vec3(saturate(value.x), saturate(value.y), saturate(value.z)); } -vec4 saturate(vec4 value) { return vec4(saturate(value.x), saturate(value.y), saturate(value.z), saturate(value.w)); } +float rsqrt(float value) { return 1.0 / sqrt(value); } +vec2 rsqrt(vec2 value) { return vec2(1.0) / sqrt(value); } +vec3 rsqrt(vec3 value) { return vec3(1.0) / sqrt(value); } +vec4 rsqrt(vec4 value) { return vec4(1.0) / sqrt(value); } // random number diff --git a/editor/assets/effects/advanced/hair.effect b/editor/assets/effects/advanced/hair.effect index e7eb72881c..40688eb6f4 100644 --- a/editor/assets/effects/advanced/hair.effect +++ b/editor/assets/effects/advanced/hair.effect @@ -46,7 +46,7 @@ CCEffect %{ - switch: USE_TRANSPARENCY_PASS_BACK vert: standard-vs frag: standard-fs - properties: *props + propertyIndex: 0 rasterizerState: cullMode: Front depthStencilState: @@ -64,7 +64,7 @@ CCEffect %{ - switch: USE_TRANSPARENCY_PASS_FRONT vert: standard-vs frag: standard-fs - properties: *props + propertyIndex: 0 rasterizerState: cullMode: Back depthStencilState: @@ -100,7 +100,7 @@ CCEffect %{ - switch: USE_TRANSPARENCY_PASS_BACK vert: standard-vs frag: standard-fs - properties: *props + propertyIndex: 0 rasterizerState: cullMode: Front depthStencilState: @@ -118,7 +118,7 @@ CCEffect %{ - switch: USE_TRANSPARENCY_PASS_FRONT vert: standard-vs frag: standard-fs - properties: *props + propertyIndex: 0 rasterizerState: cullMode: Back depthStencilState: diff --git a/editor/assets/effects/pipeline/ssss-blur.effect b/editor/assets/effects/pipeline/ssss-blur.effect index bfba110f79..4d57aaf895 100644 --- a/editor/assets/effects/pipeline/ssss-blur.effect +++ b/editor/assets/effects/pipeline/ssss-blur.effect @@ -52,6 +52,7 @@ CCProgram copy-fs %{ CCProgram ssssBlur %{ precision highp float; + #include #include #include #include From 997491be8f6b16dfa4bd1d8874120833d44eb661 Mon Sep 17 00:00:00 2001 From: troublemaker52025 Date: Mon, 12 Jun 2023 17:52:11 +0800 Subject: [PATCH 02/28] fix csm with custom pipeline (#15409) --- .../pipeline/custom/NativeRenderGraph.cpp | 19 ++++++++++--------- .../pipeline/custom/NativeSceneCulling.cpp | 4 ++-- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/native/cocos/renderer/pipeline/custom/NativeRenderGraph.cpp b/native/cocos/renderer/pipeline/custom/NativeRenderGraph.cpp index 93ea8d8e72..b850b5cfd0 100644 --- a/native/cocos/renderer/pipeline/custom/NativeRenderGraph.cpp +++ b/native/cocos/renderer/pipeline/custom/NativeRenderGraph.cpp @@ -1033,8 +1033,8 @@ void setShadowUBOLightView( const auto &mainLight = dynamic_cast(light); if (shadowInfo.isEnabled() && mainLight.isShadowEnabled()) { if (shadowInfo.getType() == scene::ShadowType::SHADOW_MAP) { - float near = 0.1; - float far = 0; + float near = 0.1F; + float far = 0.0F; Mat4 matShadowView; Mat4 matShadowProj; Mat4 matShadowViewProj; @@ -1048,11 +1048,11 @@ void setShadowUBOLightView( far = mainLight.getShadowFar(); levelCount = static_cast(0); } else { - near = 0.1; + near = 0.1F; far = csmLayers.getSpecialLayer()->getShadowCameraFar(); levelCount = scene::CSMLevel::LEVEL_1; } - vec4ShadowInfo.set(0.0F, packing, mainLight.getShadowNormalBias(), 0); + vec4ShadowInfo.set(static_cast(scene::LightType::DIRECTIONAL), packing, mainLight.getShadowNormalBias(), 0); setVec4Impl(data, layoutGraph, "cc_shadowLPNNInfo", vec4ShadowInfo); } else { const auto &layer = *csmLayers.getLayers()[level]; @@ -1081,7 +1081,7 @@ void setShadowUBOLightView( vec4ShadowInfo.set(near, far, 0, 1.0F - mainLight.getShadowSaturation()); setVec4Impl(data, layoutGraph, "cc_shadowNFLSInfo", vec4ShadowInfo); vec4ShadowInfo.set( - 0.0F, + static_cast(scene::LightType::DIRECTIONAL), packing, mainLight.getShadowNormalBias(), static_cast(levelCount)); @@ -1120,7 +1120,7 @@ void setShadowUBOLightView( spotLight.getShadowBias()); setVec4Impl(data, layoutGraph, "cc_shadowWHPBInfo", shadowWHPBInfos); - const Vec4 shadowLPNNInfos(1.0F, packing, spotLight.getShadowNormalBias(), 0.0F); + const Vec4 shadowLPNNInfos(static_cast(scene::LightType::SPOT), packing, spotLight.getShadowNormalBias(), 0.0F); setVec4Impl(data, layoutGraph, "cc_shadowLPNNInfo", shadowLPNNInfos); } break; @@ -1186,7 +1186,7 @@ void setShadowUBOView( setMat4Impl(data, layoutGraph, "cc_matLightViewProj", matShadowViewProj); vec4ShadowInfo.set(near, far, 0, 1.0F - mainLight.getShadowSaturation()); setVec4Impl(data, layoutGraph, "cc_shadowNFLSInfo", vec4ShadowInfo); - vec4ShadowInfo.set(0.0F, packing, mainLight.getShadowNormalBias(), 0); + vec4ShadowInfo.set(static_cast(scene::LightType::DIRECTIONAL), packing, mainLight.getShadowNormalBias(), 0); setVec4Impl(data, layoutGraph, "cc_shadowLPNNInfo", vec4ShadowInfo); } else { { // CSM @@ -1239,7 +1239,8 @@ void setShadowUBOView( vec4ShadowInfo.set(0, 0, 0, 1.0F - mainLight.getShadowSaturation()); setVec4Impl(data, layoutGraph, "cc_shadowNFLSInfo", vec4ShadowInfo); vec4ShadowInfo.set( - 0.0F, packing, + static_cast(scene::LightType::DIRECTIONAL), + packing, mainLight.getShadowNormalBias(), static_cast(mainLight.getCSMLevel())); setVec4Impl(data, layoutGraph, "cc_shadowLPNNInfo", vec4ShadowInfo); @@ -1672,7 +1673,7 @@ void NativeComputePassBuilder::addTexture( gfx::ShaderStageFlagBit::NONE, renderGraph->get_allocator()}); if (sampler) { - auto iter = layoutGraph->attributeIndex.find(std::string_view{slotName}); + const auto iter = layoutGraph->attributeIndex.find(std::string_view{slotName}); if (iter != layoutGraph->attributeIndex.end()) { auto &data = get(RenderGraph::DataTag{}, *renderGraph, nodeID); data.samplers[iter->second.value] = sampler; diff --git a/native/cocos/renderer/pipeline/custom/NativeSceneCulling.cpp b/native/cocos/renderer/pipeline/custom/NativeSceneCulling.cpp index b65e3f31a7..faa14472d2 100644 --- a/native/cocos/renderer/pipeline/custom/NativeSceneCulling.cpp +++ b/native/cocos/renderer/pipeline/custom/NativeSceneCulling.cpp @@ -262,9 +262,9 @@ void SceneCulling::batchCulling(const pipeline::PipelineSceneData& pplSceneData) const auto& csmLevel = mainLight->getCSMLevel(); const geometry::Frustum* frustum = nullptr; if (mainLight->isShadowFixedArea() || csmLevel == scene::CSMLevel::LEVEL_1) { - frustum = &csmLayers.getSpecialLayer()->getLightViewFrustum(); + frustum = &csmLayers.getSpecialLayer()->getValidFrustum(); } else { - frustum = &csmLayers.getLayers()[level]->getLightViewFrustum(); + frustum = &csmLayers.getLayers()[level]->getValidFrustum(); } sceneCulling( skyboxModelToSkip, From ea58020d3f481ee48eae92427c453c0cbbc4d34e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leslie=20Leigh=20=28=E6=9D=8E=E7=9A=84=E5=BA=8F=29?= Date: Mon, 12 Jun 2023 18:31:21 +0800 Subject: [PATCH 03/28] Fix clip frame events are not fired in animation graph (#15405) * Support clip frame events in animation graph * Opt * Opt --- cocos/animation/animation-clip.ts | 12 ++++++++++++ .../animation/marionette/motion/animation-blend.ts | 8 ++++++++ cocos/animation/marionette/motion/clip-motion.ts | 14 ++++++++++++++ cocos/animation/marionette/motion/motion.ts | 2 ++ .../marionette/state-machine/state-machine-eval.ts | 1 + 5 files changed, 37 insertions(+) diff --git a/cocos/animation/animation-clip.ts b/cocos/animation/animation-clip.ts index a40293ef47..518ce7396e 100644 --- a/cocos/animation/animation-clip.ts +++ b/cocos/animation/animation-clip.ts @@ -1529,7 +1529,19 @@ class EventEvaluator { } } + public reset () { + this._lastFrameIndex = -1; + this._lastIterations = 0.0; + this._lastDirection = 0; + this._ignoreIndex = InvalidIndex; + this._sampled = false; + } + public sample (ratio: number, direction: number, iterations: number) { + if (this._eventGroups.length === 0) { + return; + } + const length = this._eventGroups.length; let eventIndex = getEventGroupIndexAtRatio(ratio, this._ratios); if (eventIndex < 0) { diff --git a/cocos/animation/marionette/motion/animation-blend.ts b/cocos/animation/marionette/motion/animation-blend.ts index c7d99d41bf..64ddfcc39e 100644 --- a/cocos/animation/marionette/motion/animation-blend.ts +++ b/cocos/animation/marionette/motion/animation-blend.ts @@ -212,6 +212,14 @@ class AnimationBlendPort implements MotionPort { return this._host.__evaluatePort(this, progress, context); } + public reenter () { + const { childPorts } = this; + const nChildPorts = childPorts.length; + for (let iChild = 0; iChild < nChildPorts; ++iChild) { + childPorts[iChild]?.reenter(); + } + } + private _host: AnimationBlendEval; } diff --git a/cocos/animation/marionette/motion/clip-motion.ts b/cocos/animation/marionette/motion/clip-motion.ts index 7b0eb746ba..33a749ab36 100644 --- a/cocos/animation/marionette/motion/clip-motion.ts +++ b/cocos/animation/marionette/motion/clip-motion.ts @@ -149,6 +149,9 @@ class ClipMotionEval implements MotionEval { const pose = clipEval.evaluate(clipTime, context); + // Sample frame events. + this._frameEventEval?.sample(wrapInfo.ratio, wrapInfo.direction, wrapInfo.iterations); + // Evaluate embedded players. this._clipEmbeddedPlayerEval?.evaluate(clipTime, Math.trunc(wrapInfo.iterations)); @@ -163,6 +166,10 @@ class ClipMotionEval implements MotionEval { } } + public reenter () { + this._frameEventEval?.reset(); + } + /** * Preserved here for clip overriding. */ @@ -173,12 +180,14 @@ class ClipMotionEval implements MotionEval { private declare _clip: AnimationClip; private declare _clipEval: AnimationClipAGEvaluation; private _clipEmbeddedPlayerEval: ReturnType | null = null; + private _frameEventEval: ReturnType | null = null; private _wrapInfo = new WrappedInfo(); private _duration = 0.0; private _ignoreEmbeddedPlayers: boolean; private _setClip (clip: AnimationClip, context: AnimationGraphBindingContext) { this._clipEval?.destroy(); + this._frameEventEval = null; if (this._clipEmbeddedPlayerEval) { this._clipEmbeddedPlayerEval.destroy(); this._clipEmbeddedPlayerEval = null; @@ -189,6 +198,7 @@ class ClipMotionEval implements MotionEval { ? 0.0 : clip.duration / clip.speed; // TODO, a test for `clip.speed === 0` is required! this._clipEval = createAnimationAGEvaluation(clip, context); + this._frameEventEval = clip.createEventEvaluator(context.origin); if (!this._ignoreEmbeddedPlayers && clip.containsAnyEmbeddedPlayer()) { this._clipEmbeddedPlayerEval = clip.createEmbeddedPlayerEvaluator(context.origin); } @@ -204,5 +214,9 @@ class ClipMotionPort implements MotionPort { return this._eval[evaluatePortTag](progress, context); } + public reenter () { + this._eval.reenter(); + } + private _eval: ClipMotionEval; } diff --git a/cocos/animation/marionette/motion/motion.ts b/cocos/animation/marionette/motion/motion.ts index f8d7871868..d4481dd0e2 100644 --- a/cocos/animation/marionette/motion/motion.ts +++ b/cocos/animation/marionette/motion/motion.ts @@ -84,4 +84,6 @@ export abstract class Motion extends EditorExtendable { export interface MotionPort { evaluate(progress: number, context: AnimationGraphEvaluationContext): Pose; + + reenter(): void; } diff --git a/cocos/animation/marionette/state-machine/state-machine-eval.ts b/cocos/animation/marionette/state-machine/state-machine-eval.ts index f4eae03bff..39d3e891ce 100644 --- a/cocos/animation/marionette/state-machine/state-machine-eval.ts +++ b/cocos/animation/marionette/state-machine/state-machine-eval.ts @@ -1345,6 +1345,7 @@ class VMSMInternalState extends EventifiedStateEval { public reenter (initialTimeNormalized: number) { this._progress = initialTimeNormalized; + this._port?.reenter(); } public getStatus () { From 2f9041d94b9057a789e080964769af87a8b677a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leslie=20Leigh=20=28=E6=9D=8E=E7=9A=84=E5=BA=8F=29?= Date: Tue, 13 Jun 2023 13:53:17 +0800 Subject: [PATCH 04/28] PoseGraph: more detailed stash visit editor API (#15401) --- .../src/marionette/pose-graph-editor-api.ts | 17 ++++++++++---- .../src/marionette/visit/visit-pose-node.ts | 22 +++++++++++-------- 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/editor/src/marionette/pose-graph-editor-api.ts b/editor/src/marionette/pose-graph-editor-api.ts index 7a4a9845bf..8cfc435457 100644 --- a/editor/src/marionette/pose-graph-editor-api.ts +++ b/editor/src/marionette/pose-graph-editor-api.ts @@ -10,7 +10,7 @@ import { PureValueNode } from "../../../cocos/animation/marionette/pose-graph/pu import { assertIsTrue, editorExtrasTag } from "../../../exports/base"; import { PoseNodeUseStashedPose } from '../../../cocos/animation/marionette/pose-graph/pose-nodes/use-stashed-pose'; import { PoseGraphStash, StateMachine } from "../../../cocos/animation/marionette/animation-graph"; -import { visitPoseNodeInLayer } from "./visit/visit-pose-node"; +import { PoseNodeLocation, visitPoseNodeInLayer } from "./visit/visit-pose-node"; import { PoseGraph } from '../../../cocos/animation/marionette/pose-graph/pose-graph'; import { PoseNodeStateMachine } from "../../../cocos/animation/marionette/pose-graph/pose-nodes/state-machine"; @@ -304,13 +304,22 @@ export function stashPoseGraph( }; } -interface StashReference { +export interface StashReference { + location: PoseNodeLocation; + + alterReference(newStashName: string): void; } export function* visitStashReferences(layer: Layer, stashId: string): Generator { - for (const poseNode of visitPoseNodeInLayer(layer)) { + for (const poseNodeLocation of visitPoseNodeInLayer(layer)) { + const [poseNode] = poseNodeLocation; if (poseNode instanceof PoseNodeUseStashedPose && poseNode.stashName === stashId) { - yield poseNode; + yield { + location: poseNodeLocation, + alterReference(newStashName: string) { + poseNode.stashName = newStashName; + }, + }; } } } diff --git a/editor/src/marionette/visit/visit-pose-node.ts b/editor/src/marionette/visit/visit-pose-node.ts index 7bab9497b9..2faf44a480 100644 --- a/editor/src/marionette/visit/visit-pose-node.ts +++ b/editor/src/marionette/visit/visit-pose-node.ts @@ -1,30 +1,34 @@ -import { Layer, ProceduralPoseState, StateMachine } from "../../../../cocos/animation/marionette/animation-graph"; +import { Layer, PoseGraphStash, ProceduralPoseState, StateMachine } from "../../../../cocos/animation/marionette/animation-graph"; import { PoseNodeStateMachine } from '../../../../cocos/animation/marionette/pose-graph/pose-nodes/state-machine'; import { PoseGraph } from "../../../../cocos/animation/marionette/pose-graph/pose-graph"; import { PoseNode } from "../../../../cocos/animation/marionette/pose-graph/pose-node"; -export function* visitPoseNodeInLayer(layer: Layer): Generator { - yield* visitPoseNodesInStateMachine(layer.stateMachine); +export type PoseNodeLocationRoot = [string | '']; + +export type PoseNodeLocation = [node: PoseNode, graph: PoseGraph, ...root: PoseNodeLocationRoot]; + +export function* visitPoseNodeInLayer(layer: Layer): Generator { + yield* visitPoseNodesInStateMachine(layer.stateMachine, ['']); for (const [stashId, stash] of layer.stashes()) { - yield* visitPoseNodeInPoseGraph(stash.graph); + yield* visitPoseNodeInPoseGraph(stash.graph, [stashId]); } } -export function* visitPoseNodeInPoseGraph(poseGraph: PoseGraph): Generator { +export function* visitPoseNodeInPoseGraph(poseGraph: PoseGraph, root: PoseNodeLocationRoot): Generator { for (const node of poseGraph.nodes()) { if (node instanceof PoseNode) { - yield node; + yield [node, poseGraph, ...root]; } if (node instanceof PoseNodeStateMachine) { - yield* visitPoseNodesInStateMachine(node.stateMachine); + yield* visitPoseNodesInStateMachine(node.stateMachine, [...root]); } } } -export function* visitPoseNodesInStateMachine(stateMachine: StateMachine) { +export function* visitPoseNodesInStateMachine(stateMachine: StateMachine, root: PoseNodeLocationRoot) { for (const state of stateMachine.states()) { if (state instanceof ProceduralPoseState) { - yield* visitPoseNodeInPoseGraph(state.graph); + yield* visitPoseNodeInPoseGraph(state.graph, [...root]); } } } From de60531d1bd7b8f55119c782c696a29a17af629f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leslie=20Leigh=20=28=E6=9D=8E=E7=9A=84=E5=BA=8F=29?= Date: Tue, 13 Jun 2023 15:04:50 +0800 Subject: [PATCH 05/28] Clear unused logs (#15419) --- .eslintrc.yaml | 2 +- .../box2d/platform/physics-contact-listener.ts | 11 ----------- cocos/scene-graph/node-event-processor.ts | 1 - cocos/spine/lib/instantiated.ts | 3 --- 4 files changed, 1 insertion(+), 16 deletions(-) diff --git a/.eslintrc.yaml b/.eslintrc.yaml index bb227c333e..121172a178 100644 --- a/.eslintrc.yaml +++ b/.eslintrc.yaml @@ -76,7 +76,7 @@ rules: lines-between-class-members: off # be more lenient on member declarations max-classes-per-file: off # helper classes are common max-len: [warn, 150] # more lenient on max length per line - no-console: off # this is just too much work, cc.warn is still too much pain to use + no-console: error # prefer the uniform logging methods no-plusplus: off # allow increment/decrement operators no-continue: off # allow unlabeled continues no-mixed-operators: off # this is just cumbersome diff --git a/cocos/physics-2d/box2d/platform/physics-contact-listener.ts b/cocos/physics-2d/box2d/platform/physics-contact-listener.ts index 55a6f57348..7512b36610 100644 --- a/cocos/physics-2d/box2d/platform/physics-contact-listener.ts +++ b/cocos/physics-2d/box2d/platform/physics-contact-listener.ts @@ -56,16 +56,12 @@ export class PhysicsContactListener extends b2.ContactListener { if (PhysicsContactListener._contactMap.has(key)) { const retContact = PhysicsContactListener._contactMap.get(key)!; retContact.ref++; - //console.log(' collision++', key, 'current ref is:', retContact.ref); if (retContact.status === Contact2DType.END_CONTACT) { retContact.status = Contact2DType.STAY_CONTACT; - //console.log(' set as stay'); } else if (retContact.status !== Contact2DType.STAY_CONTACT) { retContact.status = Contact2DType.BEGIN_CONTACT; - //console.log(' set as enter'); } } else { - //console.log(' new collision', key, 'current ref is:', 1); const retCollision = new PhysicsContact(contact); PhysicsContactListener._contactMap.set(key, retCollision); retCollision.status = Contact2DType.BEGIN_CONTACT; @@ -79,9 +75,7 @@ export class PhysicsContactListener extends b2.ContactListener { assert(retContact); retContact.ref--; - //console.log(' collision--', key, 'current ref is:', retCollision.ref); if (retContact.ref <= 0) { - //console.log(' set as exit'); retContact.status = Contact2DType.END_CONTACT; } } @@ -94,18 +88,13 @@ export class PhysicsContactListener extends b2.ContactListener { public finalizeContactEvent () { PhysicsContactListener._contactMap.forEach((contact: PhysicsContact, key: string) => { - //console.log('forEach', key, collision); - // emit collision event if (!contact.disabled || contact.status === Contact2DType.BEGIN_CONTACT) { //BEGIN_CONTACT always emits if (contact.status === Contact2DType.END_CONTACT) { - //console.log(' report end collision', key, 'current ref is:', contact.ref); this.emit(Contact2DType.END_CONTACT, contact); } else if (contact.status === Contact2DType.BEGIN_CONTACT) { - //console.log(' report enter collision', key, 'current ref is:', contact.ref); this.emit(Contact2DType.BEGIN_CONTACT, contact); } else if (contact.status === Contact2DType.STAY_CONTACT) { - //console.log(' report stay collision', key, 'current ref is:', contact.ref); this.emit(Contact2DType.STAY_CONTACT, contact); } } diff --git a/cocos/scene-graph/node-event-processor.ts b/cocos/scene-graph/node-event-processor.ts index 61f215e175..bdfa3b2ba4 100644 --- a/cocos/scene-graph/node-event-processor.ts +++ b/cocos/scene-graph/node-event-processor.ts @@ -648,7 +648,6 @@ export class NodeEventProcessor { } event.getLocation(pos); - //console.log('pos: ' + pos); if (node._uiProps.uiTransformComp.hitTest(pos, event.windowId)) { event.type = NodeEventType.TOUCH_END; diff --git a/cocos/spine/lib/instantiated.ts b/cocos/spine/lib/instantiated.ts index 4c215cff72..ac6bffa5bc 100644 --- a/cocos/spine/lib/instantiated.ts +++ b/cocos/spine/lib/instantiated.ts @@ -44,7 +44,6 @@ const wasmInstance: SpineWasm.instance = {} as any; const registerList: any[] = []; /////////////////////////////////////////////////////////////////////////////////////////////////// function initWasm (wasmUrl) { - console.log('[Spine]: Using wasm libs.'); // eslint-disable-next-line @typescript-eslint/no-unsafe-return return wasmFactory({ instantiateWasm (importObject: WebAssembly.Imports, @@ -62,7 +61,6 @@ function initWasm (wasmUrl) { } function initAsm (resolve) { - console.log('[Spine]: Using asmjs libs.'); const wasmMemory: any = {}; wasmMemory.buffer = new ArrayBuffer(MEMORYSIZE); const module = { @@ -77,7 +75,6 @@ function initAsm (resolve) { } export function waitForSpineWasmInstantiation () { - console.log('[spine] waitForSpineWasmInstantiation'); return new Promise((resolve) => { const errorReport = (msg: any) => { console.error(msg); }; if (WASM_SUPPORT_MODE === WebAssemblySupportMode.MAYBE_SUPPORT) { From 9f294ddaa3637b52b104141ede5643b63a769b63 Mon Sep 17 00:00:00 2001 From: Yiwen <15225434259xue@gmail.com> Date: Tue, 13 Jun 2023 18:35:21 +0800 Subject: [PATCH 06/28] Update constraint comments (#15422) * [fix] add boundary to avoid physx assert error (#15321) * update comments for physics constraint components --- .../constraints/configurable-constraint.ts | 22 +++++++++++++++++++ .../constraints/fixed-constraint.ts | 6 +++++ .../constraints/hinge-constraint.ts | 15 +++++++++++++ .../constraints/point-to-point-constraint.ts | 6 +++++ 4 files changed, 49 insertions(+) diff --git a/cocos/physics/framework/components/constraints/configurable-constraint.ts b/cocos/physics/framework/components/constraints/configurable-constraint.ts index e239336a23..a43b967b8d 100644 --- a/cocos/physics/framework/components/constraints/configurable-constraint.ts +++ b/cocos/physics/framework/components/constraints/configurable-constraint.ts @@ -39,6 +39,10 @@ import { Vec3, CCFloat, CCBoolean } from '../../../../core'; import { EConstraintType, EConstraintMode, EDriverMode } from '../../physics-enum'; import { IConfigurableConstraint } from '../../../spec/i-physics-constraint'; +/** + * @en The linear limit settings of the configurable constraint. + * @zh 可配置约束的线性限制设置。 + */ @ccclass('cc.LinearLimitSettings') export class LinearLimitSettings { @type(EConstraintMode) @@ -190,6 +194,10 @@ export class LinearLimitSettings { } } +/** + * @en The angular limit settings of the configurable constraint. + * @zh 可配置约束的角度限制设置。 + */ @ccclass('cc.AngularLimitSettings') export class AngularLimitSettings { @type(EConstraintMode) @@ -409,6 +417,10 @@ export class AngularLimitSettings { } } +/** + * @en The linear driver settings of the configurable constraint. + * @zh 可配置约束的线性驱动器设置。 + */ @ccclass('cc.LinearDriverSettings') export class LinearDriverSettings { @type(EDriverMode) @@ -511,6 +523,10 @@ export class LinearDriverSettings { } } +/** + * @en The angular driver settings of the configurable constraint. + * @zh 可配置约束的角度驱动器设置。 + */ @ccclass('cc.AngularDriverSettings') export class AngularDriverSettings { @type(EDriverMode) @@ -613,6 +629,12 @@ export class AngularDriverSettings { } } +/** + * @en The configurable constraint component. + * The configurable constraint provides all the functionality of other constraints, and provides comprehensive configurable options. + * @zh 可配置约束组件。 + * 可配置约束提供了其他约束的所有功能支持,提供了全面的可配置选项。 + */ @ccclass('cc.ConfigurableConstraint') @help('i18n:cc.ConfigurableConstraint') @menu('Physics/ConfigurableConstraint(beta)') diff --git a/cocos/physics/framework/components/constraints/fixed-constraint.ts b/cocos/physics/framework/components/constraints/fixed-constraint.ts index cd09e164ba..653735d759 100644 --- a/cocos/physics/framework/components/constraints/fixed-constraint.ts +++ b/cocos/physics/framework/components/constraints/fixed-constraint.ts @@ -37,6 +37,12 @@ import { CCFloat, IVec3Like, Vec3 } from '../../../../core'; import { EConstraintType } from '../../physics-enum'; import { IFixedConstraint } from '../../../spec/i-physics-constraint'; +/** + * @en The fixed constraint. + * It locks the relative position and rotation between two rigid bodies. + * @zh 固定关节。 + * 固定关节会锁定两个刚体间的相对位置和相对旋转。 + */ @ccclass('cc.FixedConstraint') @help('i18n:cc.FixedConstraint') @menu('Physics/FixedConstraint(beta)') diff --git a/cocos/physics/framework/components/constraints/hinge-constraint.ts b/cocos/physics/framework/components/constraints/hinge-constraint.ts index e50beac6f1..ffd283834d 100644 --- a/cocos/physics/framework/components/constraints/hinge-constraint.ts +++ b/cocos/physics/framework/components/constraints/hinge-constraint.ts @@ -37,6 +37,10 @@ import { Vec3, CCFloat, CCBoolean } from '../../../../core'; import { EConstraintType } from '../../physics-enum'; import { IHingeConstraint } from '../../../spec/i-physics-constraint'; +/** + * @en The hinge constraint limitation data. + * @zh 铰链约束的限制数据。 + */ @ccclass('cc.HingeLimitData') export class HingeLimitData { @serializable @@ -96,6 +100,10 @@ export class HingeLimitData { } } +/** + * @en The hinge constraint motor data. + * @zh 铰链约束的马达数据。 + */ @ccclass('cc.HingeMotorData') export class HingeMotorData { @serializable @@ -155,6 +163,13 @@ export class HingeMotorData { } } +/** + * @en Hinge constraint. + * It keeps the local rotation axes of two rigid bodies aligned, + * and locks the relative motion along the rotation axis. + * @zh 铰链约束。 + * 它保持两个刚体的本地旋转轴对齐,并锁定沿旋转轴的相对运动。 + */ @ccclass('cc.HingeConstraint') @help('i18n:cc.HingeConstraint') @menu('Physics/HingeConstraint(beta)') diff --git a/cocos/physics/framework/components/constraints/point-to-point-constraint.ts b/cocos/physics/framework/components/constraints/point-to-point-constraint.ts index 2064640940..dfd6f3c03d 100644 --- a/cocos/physics/framework/components/constraints/point-to-point-constraint.ts +++ b/cocos/physics/framework/components/constraints/point-to-point-constraint.ts @@ -36,6 +36,12 @@ import { Vec3, IVec3Like } from '../../../../core'; import { EConstraintType } from '../../physics-enum'; import { IPointToPointConstraint } from '../../../spec/i-physics-constraint'; +/** + * @en The point to point constraint. + * It locks the relative position of the pivots between two rigid bodies. + * @zh 点对点约束。 + * 点对点约束会锁定两个刚体间的连接点的相对位置。 + */ @ccclass('cc.PointToPointConstraint') @help('i18n:cc.PointToPointConstraint') @menu('Physics/PointToPointConstraint(beta)') From 36fbed88a01e089e37883fd1fff891cb86798b03 Mon Sep 17 00:00:00 2001 From: GengineJS <476393671@qq.com> Date: Wed, 14 Jun 2023 10:05:35 +0800 Subject: [PATCH 07/28] [Delete]Remove post-processing configuration items (#15413) --- cocos/core/platform/macro.ts | 20 ------------------- cocos/rendering/custom/define.ts | 3 --- .../deferred/deferred-pipeline-scene-data.ts | 3 --- 3 files changed, 26 deletions(-) diff --git a/cocos/core/platform/macro.ts b/cocos/core/platform/macro.ts index a9756215a2..c27506d7dd 100644 --- a/cocos/core/platform/macro.ts +++ b/cocos/core/platform/macro.ts @@ -985,15 +985,6 @@ interface Macro { */ ENABLE_WEBGL_ANTIALIAS: boolean; - /** - * @en - * Used to set FXAA post-processing anti-aliasing, the default value is false. - * @zh - * 用于开启 FXAA 后处理抗锯齿, 默认值为 false。 - * @default false - */ - ENABLE_ANTIALIAS_FXAA: boolean; - /** * @en * Used to set float output, the default value is false. @@ -1003,15 +994,6 @@ interface Macro { */ ENABLE_FLOAT_OUTPUT: boolean; - /** - * @en - * Used to set bloom, the default value is false. - * @zh - * 用于开启 bloom, 默认值为 false。 - * @default false - */ - ENABLE_BLOOM: boolean; - /** * @en * Whether to clear the original image cache after uploaded a texture to GPU. @@ -1116,9 +1098,7 @@ const macro: Macro = { TOUCH_TIMEOUT: 5000, ENABLE_TRANSPARENT_CANVAS: false, ENABLE_WEBGL_ANTIALIAS: true, - ENABLE_ANTIALIAS_FXAA: false, ENABLE_FLOAT_OUTPUT: false, - ENABLE_BLOOM: false, CLEANUP_IMAGE_CACHE: false, ENABLE_MULTI_TOUCH: true, MAX_LABEL_CANVAS_POOL_SIZE: 20, diff --git a/cocos/rendering/custom/define.ts b/cocos/rendering/custom/define.ts index 28e4eca2bc..daa4049ad2 100644 --- a/cocos/rendering/custom/define.ts +++ b/cocos/rendering/custom/define.ts @@ -456,9 +456,6 @@ export class PostInfo { private _init () { this.postMaterial = new Material(); this.postMaterial.name = 'builtin-post-process-material'; - if (macro.ENABLE_ANTIALIAS_FXAA) { - this.antiAliasing = AntiAliasing.FXAA; - } this.postMaterial.initialize({ effectName: 'pipeline/post-process', defines: { diff --git a/cocos/rendering/deferred/deferred-pipeline-scene-data.ts b/cocos/rendering/deferred/deferred-pipeline-scene-data.ts index 0c995b6b19..ad5db83006 100644 --- a/cocos/rendering/deferred/deferred-pipeline-scene-data.ts +++ b/cocos/rendering/deferred/deferred-pipeline-scene-data.ts @@ -141,9 +141,6 @@ export class DeferredPipelineSceneData extends PipelineSceneData { const postMat = new Material(); postMat._uuid = 'builtin-post-process-material'; - if (macro.ENABLE_ANTIALIAS_FXAA) { - this._antiAliasing = AntiAliasing.FXAA; - } postMat.initialize({ effectName: 'pipeline/post-process', defines: { From fc1ca3557e25576f4b693e7c7f11bf6d0aac9720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leslie=20Leigh=20=28=E6=9D=8E=E7=9A=84=E5=BA=8F=29?= Date: Wed, 14 Jun 2023 10:20:01 +0800 Subject: [PATCH 08/28] Marionette/PoseGraph: update i18n (#15420) --- editor/i18n/en/animation.js | 2 +- editor/i18n/zh/animation.js | 40 ++++++++++++++++++------------------- editor/i18n/zh/assets.js | 8 ++++---- 3 files changed, 25 insertions(+), 25 deletions(-) diff --git a/editor/i18n/en/animation.js b/editor/i18n/en/animation.js index a9bd0f3526..dd309d217e 100644 --- a/editor/i18n/en/animation.js +++ b/editor/i18n/en/animation.js @@ -24,7 +24,7 @@ module.exports = { }, 'PoseNodeUseStashedPose': { displayName: 'Use Stashed Pose', - title: 'Use Stashed Pose {stashName}', + title: 'Use Stash {stashName}', }, 'PoseNodeStateMachine': { displayName: 'State Machine', diff --git a/editor/i18n/zh/animation.js b/editor/i18n/zh/animation.js index 8b66ff6a48..08fe607315 100644 --- a/editor/i18n/zh/animation.js +++ b/editor/i18n/zh/animation.js @@ -4,7 +4,7 @@ module.exports = { animation_graph: { pose_graph_node_sub_categories: { - pose_nodes: '姿势结点', + pose_nodes: '姿态结点', pose_nodes_blend: '混合', pose_nodes_ik: '反向动力学', pose_nodes_choose: '选择', @@ -20,17 +20,17 @@ module.exports = { 'cc': { 'animation': { 'PoseGraphOutputNode': { - displayName: '输出姿势', + displayName: '输出姿态', }, 'PoseNodeUseStashedPose': { - displayName: '使用暂存的姿势', - title: '使用暂存的姿势 {stashName}', + displayName: '使用暂存', + title: '使用暂存 {stashName}', }, 'PoseNodeStateMachine': { displayName: '状态机', inputs: { 'emptyStatePose': { - displayName: '空状态姿势', + displayName: '空状态姿态', }, }, }, @@ -100,20 +100,20 @@ module.exports = { displayName: '按占比混合', inputs: { 'poses': { - displayName: '姿势 {elementIndex}', + displayName: '姿态 {elementIndex}', }, 'proportions': { - displayName: '姿势 {elementIndex} 占比', + displayName: '姿态 {elementIndex} 占比', }, }, }, 'PoseNodeBlendTwoPoseBase': { inputs: { 'pose0': { - displayName: '姿势 1', + displayName: '姿态 1', }, 'pose1': { - displayName: '姿势 2', + displayName: '姿态 2', }, 'ratio': { displayName: '比例', @@ -121,7 +121,7 @@ module.exports = { }, }, 'PoseNodeBlendTwoPose': { - displayName: '混合双姿势', + displayName: '混合双姿态', inputs: { __extends__: 'classes.cc.animation.PoseNodeBlendTwoPoseBase.inputs', }, @@ -133,13 +133,13 @@ module.exports = { }, }, 'PoseNodeAdditivelyBlend': { - displayName: '加性混合', + displayName: '叠加混合', inputs: { 'basePose': { - displayName: '基础姿势', + displayName: '基础姿态', }, 'additivePose': { - displayName: '累加姿势', + displayName: '叠加姿态', }, 'ratio': { displayName: '比例', @@ -150,16 +150,16 @@ module.exports = { displayName: '按布尔选择', inputs: { 'truePose': { - displayName: '为真时姿势', + displayName: '为真时姿态', }, 'falsePose': { - displayName: '为假时姿势', + displayName: '为假时姿态', }, 'trueFadeInDuration': { - displayName: '为真时姿势淡入时长', + displayName: '为真时姿态淡入时长', }, 'falseFadeInDuration': { - displayName: '为假时姿势淡入时长', + displayName: '为假时姿态淡入时长', }, 'choice': { displayName: '选择', @@ -170,10 +170,10 @@ module.exports = { displayName: '按索引选择', inputs: { poses: { - displayName: '姿势 {elementIndex}', + displayName: '姿态 {elementIndex}', }, fadeInDurations: { - displayName: '姿势 {elementIndex} 淡入时长', + displayName: '姿态 {elementIndex} 淡入时长', }, 'choice': { displayName: '选择', @@ -183,7 +183,7 @@ module.exports = { 'PoseNodeModifyPoseBase': { inputs: { 'pose': { - displayName: '姿势', + displayName: '姿态', }, }, }, diff --git a/editor/i18n/zh/assets.js b/editor/i18n/zh/assets.js index f4d354857d..80f563243d 100644 --- a/editor/i18n/zh/assets.js +++ b/editor/i18n/zh/assets.js @@ -428,14 +428,14 @@ module.exports = { }, animationSetting: { additive: { - header: '加性动画导入设置', + header: '叠加动画导入设置', enabled: { - label: '导入为加性', - tooltip: '勾选后,该动画将被导入为加性动画。', + label: '导入为叠加动画', + tooltip: '勾选后,该动画将被导入为叠加动画。', }, refClip: { label: '参考剪辑', - tooltip: '若设置,将参考该动画第 0 帧的姿势计算加性动画;否则,则将参考第动画本身第 0 帧的姿势进行计算。', + tooltip: '若设置,将参考该动画第 0 帧的姿态计算叠加动画;否则,则将参考第动画本身第 0 帧的姿态进行计算。', }, }, }, From 75e6d428ad94e2dec69d1133aaece915fecfc755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A2=81=E7=82=9C=E6=B5=B7?= <35713518+dogodo-cc@users.noreply.github.com> Date: Wed, 14 Jun 2023 10:59:59 +0800 Subject: [PATCH 09/28] fix: inspector/texture: fault-tolerant for parse atlas (#15414) * fix: inspector/texture: fault-tolerant for parse atlas * feat: if parentAssetList is not Array, hide the tip * feat: delete hyphhyphen --- editor/inspector/assets/texture/texture.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/editor/inspector/assets/texture/texture.js b/editor/inspector/assets/texture/texture.js index b639b60c80..57dc1318f1 100644 --- a/editor/inspector/assets/texture/texture.js +++ b/editor/inspector/assets/texture/texture.js @@ -590,6 +590,10 @@ const Elements = { }, async update() { try { + if (!Array.isArray(this.parentAssetList)) { + this.$.filterDifferent.style.display = 'none'; + return; + } const parentPath = this.parentAssetList[0].path.replace(/\/[^/]+$/, '/*'); let assets = await Editor.Message.request( 'asset-db', @@ -637,7 +641,7 @@ const Elements = { } } catch (error) { this.$.filterDifferent.style.display = 'none'; - console.error(error); + console.warn('parse atlas file error:', error); } }, }, From 23326432c582f416cd1c1826c67e1296dd2eb655 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leslie=20Leigh=20=28=E6=9D=8E=E7=9A=84=E5=BA=8F=29?= Date: Wed, 14 Jun 2023 11:09:10 +0800 Subject: [PATCH 10/28] Adjust code order to eliminate warning (#15418) --- .../pose-graph/pose-nodes/modify-pose-base.ts | 102 +++++++++--------- 1 file changed, 51 insertions(+), 51 deletions(-) diff --git a/cocos/animation/marionette/pose-graph/pose-nodes/modify-pose-base.ts b/cocos/animation/marionette/pose-graph/pose-nodes/modify-pose-base.ts index c5dde074ad..a3c0afa426 100644 --- a/cocos/animation/marionette/pose-graph/pose-nodes/modify-pose-base.ts +++ b/cocos/animation/marionette/pose-graph/pose-nodes/modify-pose-base.ts @@ -10,57 +10,6 @@ import { PoseGraphType } from '../foundation/type-system'; import { assertIsTrue, CachedArray, Pool } from '../../../../core'; import { Transform } from '../../../core/transform'; -@ccclass(`${CLASS_NAME_PREFIX_ANIM}PoseNodeModifyPoseBase`) -@poseGraphNodeHide() -export abstract class PoseNodeModifyPoseBase extends PoseNode { - @serializable - @input({ type: PoseGraphType.POSE }) - public pose: PoseNode | null = null; - - public settle (context: AnimationGraphSettleContext) { - this.pose?.settle(context); - this._spaceFlagTable = new PoseTransformSpaceFlagTable(context.transformCount); - } - - public reenter () { - this.pose?.reenter(); - } - - public bind (context: AnimationGraphBindingContext): void { - this.pose?.bind(context); - } - - protected doUpdate (context: AnimationGraphUpdateContext) { - this.pose?.update(context); - } - - protected doEvaluate (context: AnimationGraphEvaluationContext): Pose { - const poseTransformSpaceRequirement = this.getPoseTransformSpaceRequirement(); - const inputPose = this.pose?.evaluate(context, poseTransformSpaceRequirement) - ?? PoseNode.evaluateDefaultPose(context, poseTransformSpaceRequirement); - - const { _modificationQueue: modificationQueue } = this; - assertIsTrue(modificationQueue.length === 0); - this.modifyPose(context, inputPose, modificationQueue); - - applyTransformModificationQueue(context, inputPose, modificationQueue, this._spaceFlagTable); - modificationQueue.clear(); - - return inputPose; - } - - protected abstract getPoseTransformSpaceRequirement(): PoseTransformSpaceRequirement; - - protected abstract modifyPose( - context: AnimationGraphEvaluationContext, - pose: Pose, - transformModificationQueue: TransformModificationQueue, - ): void; - - private _modificationQueue = new TransformModificationQueue(); - private _spaceFlagTable = new PoseTransformSpaceFlagTable(0); -} - class TransformModification { public transformIndex = -1; public transform = new Transform(); @@ -249,3 +198,54 @@ function applyTransformModificationQueue ( } } } + +@ccclass(`${CLASS_NAME_PREFIX_ANIM}PoseNodeModifyPoseBase`) +@poseGraphNodeHide() +export abstract class PoseNodeModifyPoseBase extends PoseNode { + @serializable + @input({ type: PoseGraphType.POSE }) + public pose: PoseNode | null = null; + + public settle (context: AnimationGraphSettleContext) { + this.pose?.settle(context); + this._spaceFlagTable = new PoseTransformSpaceFlagTable(context.transformCount); + } + + public reenter () { + this.pose?.reenter(); + } + + public bind (context: AnimationGraphBindingContext): void { + this.pose?.bind(context); + } + + protected doUpdate (context: AnimationGraphUpdateContext) { + this.pose?.update(context); + } + + protected doEvaluate (context: AnimationGraphEvaluationContext): Pose { + const poseTransformSpaceRequirement = this.getPoseTransformSpaceRequirement(); + const inputPose = this.pose?.evaluate(context, poseTransformSpaceRequirement) + ?? PoseNode.evaluateDefaultPose(context, poseTransformSpaceRequirement); + + const { _modificationQueue: modificationQueue } = this; + assertIsTrue(modificationQueue.length === 0); + this.modifyPose(context, inputPose, modificationQueue); + + applyTransformModificationQueue(context, inputPose, modificationQueue, this._spaceFlagTable); + modificationQueue.clear(); + + return inputPose; + } + + protected abstract getPoseTransformSpaceRequirement(): PoseTransformSpaceRequirement; + + protected abstract modifyPose( + context: AnimationGraphEvaluationContext, + pose: Pose, + transformModificationQueue: TransformModificationQueue, + ): void; + + private _modificationQueue = new TransformModificationQueue(); + private _spaceFlagTable = new PoseTransformSpaceFlagTable(0); +} From bca35b2636c96e27b219fa0989d15ea8d43f11fe Mon Sep 17 00:00:00 2001 From: qiuguohua Date: Wed, 14 Jun 2023 11:33:15 +0800 Subject: [PATCH 11/28] Update Harmonyos third-party library. (#15429) --- native/external-config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native/external-config.json b/native/external-config.json index abae35e1d1..79278ebdc3 100644 --- a/native/external-config.json +++ b/native/external-config.json @@ -3,6 +3,6 @@ "type": "github", "owner": "cocos-creator", "name": "engine-native-external", - "checkout": "v3.8.0-4" + "checkout": "v3.8.0-5" } } \ No newline at end of file From 67352fcec6058c660173394cd218670a1dbff157 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=9F=E6=88=98?= <40414978+PatriceJiang@users.noreply.github.com> Date: Wed, 14 Jun 2023 15:45:49 +0800 Subject: [PATCH 12/28] add validation for cMakeConfig values (#15432) --- scripts/native-pack-tool/source/base/default.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/native-pack-tool/source/base/default.ts b/scripts/native-pack-tool/source/base/default.ts index 893e5659ba..bdbb75ecf9 100644 --- a/scripts/native-pack-tool/source/base/default.ts +++ b/scripts/native-pack-tool/source/base/default.ts @@ -449,7 +449,11 @@ export abstract class NativePackTool { } }); Object.keys(config).forEach((key: string) => { - content += config[key] + '\n'; + if(typeof config[key] !== 'string') { + console.error(`cMakeConfig.${key} is not a string, "${config[key]}"`); + } else { + content += config[key] + '\n'; + } }); console.debug(`generateCMakeConfig, ${JSON.stringify(config)}`); await fs.outputFile(file, content); From 98cdeb784b5b0a2ff0d522bc3833b1ace4a3c9f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leslie=20Leigh=20=28=E6=9D=8E=E7=9A=84=E5=BA=8F=29?= Date: Wed, 14 Jun 2023 18:04:45 +0800 Subject: [PATCH 13/28] PoseGraph: fix PoseNodeApplyTransform i18n (#15400) --- editor/i18n/en/animation.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editor/i18n/en/animation.js b/editor/i18n/en/animation.js index dd309d217e..7d5f7e4543 100644 --- a/editor/i18n/en/animation.js +++ b/editor/i18n/en/animation.js @@ -213,7 +213,7 @@ module.exports = { 'rotation': { displayName: 'Rotation', }, - 'intensity': { + 'intensityValue': { displayName: 'Intensity', }, }, From 9935f8ba513fb16be66fea0edb11de41a348da7b Mon Sep 17 00:00:00 2001 From: changhua <39176194+changhua0118@users.noreply.github.com> Date: Wed, 14 Jun 2023 18:37:30 +0800 Subject: [PATCH 14/28] update change image type (#15439) --- editor/inspector/assets/image.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/editor/inspector/assets/image.js b/editor/inspector/assets/image.js index 2ed8894ec0..2dc8329f6e 100644 --- a/editor/inspector/assets/image.js +++ b/editor/inspector/assets/image.js @@ -203,6 +203,10 @@ const Elements = { }; exports.methods = { + apply() { + // if the image type changes between sprite-frame + this.spriteFrameChange = this.checkSpriteFrameChange(this.originImageType, this.meta.userData.type); + }, updatePanel() { this.setPanel(this.$.panelSection, this.meta.userData.type); @@ -370,15 +374,14 @@ exports.update = function(assetList, metaList) { this.asset = assetList[0]; this.meta = metaList[0]; - if (this.originMetaList && !this.asset.readonly) { - // if the image type changes between sprite-frame - const spriteFrameChange = this.checkSpriteFrameChange(this.originMetaList[0].userData.type, this.meta.userData.type); - this.handleTypeChange(spriteFrameChange, this.meta.userData.type); + if (this.spriteFrameChange && this.originMetaList && !this.asset.readonly) { + this.handleTypeChange(this.spriteFrameChange, this.meta.userData.type); // same as panel handle if (this.meta.userData.type === 'sprite-frame') { - this.handleTypeChange(spriteFrameChange, 'texture'); + this.handleTypeChange(this.spriteFrameChange, 'texture'); } } + this.originImageType = this.meta.userData.type; // change originMetaList this.originMetaList = JSON.parse(JSON.stringify(this.metaList)); From f736b87db8a9fd2ec9b32403cacab3b18ecbe79d Mon Sep 17 00:00:00 2001 From: dogeFu <609075410@qq.com> Date: Wed, 14 Jun 2023 18:41:19 +0800 Subject: [PATCH 15/28] =?UTF-8?q?feat=EF=BC=9Aadd=20clear=20method=20for?= =?UTF-8?q?=20AnimationGraphPartialPreviewer=20(#15441)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat : add clearVariables method for AnimationGraphPartialPreviewer * clear motionRecords too --- editor/src/marionette/preview.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/editor/src/marionette/preview.ts b/editor/src/marionette/preview.ts index f946ecdd70..42566e88fc 100644 --- a/editor/src/marionette/preview.ts +++ b/editor/src/marionette/preview.ts @@ -27,6 +27,11 @@ class AnimationGraphPartialPreviewer { this._dummyAnimationController.node.destroy(); } + public clear() { + this._varInstances = {}; + this._motionRecords = []; + } + public evaluate() { const { _evaluationContext: evaluationContext } = this; const pose = this.doEvaluate(evaluationContext); From 820826939d130253689da92c1c1ed4f4031b5552 Mon Sep 17 00:00:00 2001 From: hyde zhou Date: Fri, 16 Jun 2023 09:56:57 +0800 Subject: [PATCH 16/28] V3.8.0 pipeline (#15428) --- cocos/rendering/custom/compiler.ts | 4 +- cocos/rendering/custom/define.ts | 289 +++--------------- cocos/rendering/custom/executor.ts | 5 +- cocos/rendering/custom/pipeline.ts | 22 +- cocos/rendering/custom/render-graph.ts | 74 ++++- cocos/rendering/custom/types.ts | 134 +------- cocos/rendering/custom/web-pipeline.ts | 37 +-- .../post-process/utils/pass-context.ts | 6 +- .../pipeline/custom/NativePipelineTypes.h | 11 - .../pipeline/custom/NativeProgramLibrary.cpp | 2 +- .../pipeline/custom/NativeRenderGraph.cpp | 202 ++++++------ .../pipeline/custom/RenderCommonFwd.h | 25 -- .../pipeline/custom/RenderCommonJsb.cpp | 201 ------------ .../pipeline/custom/RenderCommonJsb.h | 15 - .../pipeline/custom/RenderCommonNames.h | 3 - .../custom/RenderCommonSerialization.h | 60 ---- .../pipeline/custom/RenderCommonTypes.cpp | 88 ------ .../pipeline/custom/RenderCommonTypes.h | 141 --------- .../renderer/pipeline/custom/RenderGraphFwd.h | 18 ++ .../pipeline/custom/RenderGraphTypes.cpp | 88 ++++++ .../pipeline/custom/RenderGraphTypes.h | 136 +++++++++ .../pipeline/custom/RenderInterfaceTypes.h | 20 -- 22 files changed, 467 insertions(+), 1114 deletions(-) diff --git a/cocos/rendering/custom/compiler.ts b/cocos/rendering/custom/compiler.ts index d2ba1512fd..bf20c0a218 100644 --- a/cocos/rendering/custom/compiler.ts +++ b/cocos/rendering/custom/compiler.ts @@ -29,9 +29,9 @@ import { DefaultVisitor, depthFirstSearch, ReferenceGraphView } from './graph'; import { LayoutGraphData } from './layout-graph'; import { BasicPipeline } from './pipeline'; import { Blit, ClearView, ComputePass, ComputeSubpass, CopyPass, Dispatch, FormatView, ManagedBuffer, ManagedResource, ManagedTexture, MovePass, - RasterPass, RasterSubpass, RaytracePass, RenderGraph, RenderGraphVisitor, + RasterPass, RasterSubpass, RaytracePass, RenderGraph, RenderGraphVisitor, RasterView, ComputeView, RenderQueue, RenderSwapchain, ResolvePass, ResourceGraph, ResourceGraphVisitor, SceneData, SubresourceView } from './render-graph'; -import { AccessType, RasterView, ComputeView, ResourceResidency, SceneFlags } from './types'; +import { AccessType, ResourceResidency, SceneFlags } from './types'; let hashCode = 0; diff --git a/cocos/rendering/custom/define.ts b/cocos/rendering/custom/define.ts index daa4049ad2..a17e0c5c6e 100644 --- a/cocos/rendering/custom/define.ts +++ b/cocos/rendering/custom/define.ts @@ -32,8 +32,8 @@ import { import { supportsR32FloatTexture, supportsRGBA16HalfFloatTexture } from '../define'; import { BasicPipeline, Pipeline } from './pipeline'; import { - AccessType, AttachmentType, ComputeView, CopyPair, LightInfo, - QueueHint, RasterView, ResourceResidency, SceneFlags, UpdateFrequency, UploadPair, + AccessType, AttachmentType, CopyPair, LightInfo, + QueueHint, ResourceResidency, SceneFlags, UpdateFrequency, UploadPair, } from './types'; import { Vec2, Vec3, Vec4, macro, geometry, toRadian, cclegacy, assert, nextPow2 } from '../../core'; import { ImageAsset, Material, Texture2D } from '../../asset/assets'; @@ -43,7 +43,6 @@ import { RenderData } from './render-graph'; import { WebPipeline } from './web-pipeline'; import { DescriptorSetData } from './layout-graph'; import { AABB } from '../../core/geometry'; -import { MeshRenderer } from '../../3d'; import { DebugViewCompositeType, DebugViewSingleType } from '../debug-view'; const _rangedDirLightBoundingBox = new AABB(0.0, 0.0, 0.0, 0.5, 0.5, 0.5); @@ -934,141 +933,6 @@ export function buildUIPass (camera: Camera, } } -export function buildNativeForwardPass (camera: Camera, ppl: BasicPipeline) { - const cameraID = getCameraUniqueID(camera); - const cameraName = `Camera${cameraID}`; - const area = getRenderArea(camera, camera.window.width, camera.window.height); - const width = area.width; - const height = area.height; - - // Resources - const forwardPassRTName = `dsForwardPassColor${cameraName}`; - const forwardPassDSName = `dsForwardPassDS${cameraName}`; - if (!ppl.containsResource(forwardPassRTName)) { - ppl.addRenderTexture(forwardPassRTName, Format.BGRA8, width, height, camera.window); - ppl.addDepthStencil(forwardPassDSName, Format.DEPTH_STENCIL, width, height, ResourceResidency.MANAGED); - } - - ppl.updateRenderWindow(forwardPassRTName, camera.window); - ppl.updateDepthStencil(forwardPassDSName, width, height); - // Passes - const forwardPass = ppl.addRenderPass(width, height, 'default'); - forwardPass.name = `CameraForwardPass${cameraID}`; - forwardPass.setViewport(new Viewport(area.x, area.y, width, height)); - - const cameraRenderTargetLoadOp = getLoadOpOfClearFlag(camera.clearFlag, AttachmentType.RENDER_TARGET); - const cameraDepthStencilLoadOp = getLoadOpOfClearFlag(camera.clearFlag, AttachmentType.DEPTH_STENCIL); - - forwardPass.addRasterView(forwardPassRTName, - new RasterView('_', - AccessType.WRITE, AttachmentType.RENDER_TARGET, - cameraRenderTargetLoadOp, - StoreOp.STORE, - getClearFlags(AttachmentType.RENDER_TARGET, camera.clearFlag, cameraRenderTargetLoadOp), - new Color(camera.clearColor.x, camera.clearColor.y, camera.clearColor.z, camera.clearColor.w))); - forwardPass.addRasterView(forwardPassDSName, - new RasterView('_', - AccessType.WRITE, AttachmentType.DEPTH_STENCIL, - cameraDepthStencilLoadOp, - StoreOp.STORE, - getClearFlags(AttachmentType.DEPTH_STENCIL, camera.clearFlag, cameraDepthStencilLoadOp), - new Color(camera.clearDepth, camera.clearStencil, 0, 0))); - - forwardPass - .addQueue(QueueHint.RENDER_OPAQUE) - .addSceneOfCamera(camera, new LightInfo(), - SceneFlags.OPAQUE_OBJECT - | SceneFlags.PLANAR_SHADOW - | SceneFlags.CUTOUT_OBJECT - | SceneFlags.DEFAULT_LIGHTING - | SceneFlags.DRAW_INSTANCING); - forwardPass - .addQueue(QueueHint.RENDER_TRANSPARENT) - .addSceneOfCamera(camera, new LightInfo(), - SceneFlags.TRANSPARENT_OBJECT - | SceneFlags.GEOMETRY); - forwardPass - .addQueue(QueueHint.RENDER_TRANSPARENT) - .addSceneOfCamera(camera, new LightInfo(), - SceneFlags.UI); - forwardPass.showStatistics = true; -} - -export function buildNativeDeferredPipeline (camera: Camera, ppl: BasicPipeline) { - const cameraID = getCameraUniqueID(camera); - const area = getRenderArea(camera, camera.window.width, camera.window.height); - const width = area.width; - const height = area.height; - if (!ppl.containsResource('Albedo')) { - // GBuffers - ppl.addRenderTarget('Albedo', Format.RGBA16F, width, height, ResourceResidency.MANAGED); - ppl.addRenderTarget('Normal', Format.RGBA16F, width, height, ResourceResidency.MANAGED); - ppl.addRenderTarget('Emissive', Format.RGBA16F, width, height, ResourceResidency.MANAGED); - ppl.addDepthStencil('DepthStencil', Format.DEPTH_STENCIL, width, height, ResourceResidency.MANAGED); - // Lighting - ppl.addRenderTexture('Color', Format.BGRA8, width, height, camera.window); - } - if (!lightingInfo) { - lightingInfo = new LightingInfo(); - } - // GeometryPass - { - const gBufferPass = ppl.addRenderPass(width, height, 'default'); - gBufferPass.name = 'GeometryPass'; - gBufferPass.setViewport(new Viewport(area.x, area.y, area.width, area.height)); - - gBufferPass.addRasterView('Albedo', new RasterView('_', - AccessType.WRITE, AttachmentType.RENDER_TARGET, - LoadOp.CLEAR, StoreOp.STORE, ClearFlagBit.COLOR)); - gBufferPass.addRasterView('Normal', new RasterView('_', - AccessType.WRITE, AttachmentType.RENDER_TARGET, - LoadOp.CLEAR, StoreOp.STORE, ClearFlagBit.COLOR)); - gBufferPass.addRasterView('Emissive', new RasterView('_', - AccessType.WRITE, AttachmentType.RENDER_TARGET, - LoadOp.CLEAR, StoreOp.STORE, ClearFlagBit.COLOR)); - gBufferPass.addRasterView('DepthStencil', new RasterView('_', - AccessType.WRITE, AttachmentType.DEPTH_STENCIL, - LoadOp.CLEAR, StoreOp.STORE, - ClearFlagBit.DEPTH_STENCIL, - new Color(1, 0, 0, 0))); - gBufferPass - .addQueue(QueueHint.RENDER_OPAQUE) - .addSceneOfCamera(camera, new LightInfo(), SceneFlags.OPAQUE_OBJECT | SceneFlags.CUTOUT_OBJECT); - } - // LightingPass - { - const lightingPass = ppl.addRenderPass(width, height, 'default'); - lightingPass.name = 'LightingPass'; - lightingPass.setViewport(new Viewport(area.x, area.y, width, height)); - - const lightingClearColor = new Color(0, 0, 0, 0); - if (camera.clearFlag & ClearFlagBit.COLOR) { - lightingClearColor.x = camera.clearColor.x; - lightingClearColor.y = camera.clearColor.y; - lightingClearColor.z = camera.clearColor.z; - } - lightingClearColor.w = 1; - lightingPass.addRasterView('Color', new RasterView('_', - AccessType.WRITE, AttachmentType.RENDER_TARGET, - LoadOp.CLEAR, StoreOp.STORE, - camera.clearFlag, - lightingClearColor)); - - lightingPass.addComputeView('Albedo', new ComputeView('gbuffer_albedoMap')); - lightingPass.addComputeView('Normal', new ComputeView('gbuffer_normalMap')); - lightingPass.addComputeView('Emissive', new ComputeView('gbuffer_emissiveMap')); - lightingPass.addComputeView('DepthStencil', new ComputeView('depth_stencil')); - - lightingPass.addQueue(QueueHint.RENDER_TRANSPARENT).addCameraQuad( - camera, lightingInfo.deferredLightingMaterial, 0, - SceneFlags.VOLUMETRIC_LIGHTING, - ); - lightingPass.addQueue(QueueHint.RENDER_TRANSPARENT).addSceneOfCamera(camera, - new LightInfo(), - SceneFlags.TRANSPARENT_OBJECT | SceneFlags.PLANAR_SHADOW | SceneFlags.GEOMETRY); - } -} - export function updateCameraUBO (setter: any, camera: Readonly, ppl: Readonly) { const pipeline = cclegacy.director.root.pipeline; const sceneData = ppl.pipelineSceneData; @@ -1482,18 +1346,10 @@ function _buildSSSSBlurPass (camera: Camera, sampler.minFilter = Filter.POINT; sampler.magFilter = Filter.POINT; sampler.mipFilter = Filter.NONE; - const computeView = new ComputeView(); - computeView.name = 'depthRaw'; - copyInputDSPass.addComputeView(inputDS, computeView); + copyInputDSPass.addTexture(inputDS, 'depthRaw'); } - const copyInputDSPassView = new RasterView('_', - AccessType.WRITE, - AttachmentType.RENDER_TARGET, - LoadOp.CLEAR, - StoreOp.STORE, - camera.clearFlag, - new Color(1.0, 0.0, 0.0, 0.0)); - copyInputDSPass.addRasterView(ssssBlurDSName, copyInputDSPassView); + copyInputDSPass.addRenderTarget(ssssBlurDSName, + LoadOp.CLEAR, StoreOp.STORE, new Color(1.0, 0.0, 0.0, 0.0)); copyInputDSPass.addQueue(QueueHint.RENDER_OPAQUE | QueueHint.RENDER_TRANSPARENT).addCameraQuad( camera, ssssBlurData.ssssBlurMaterial, COPY_INPUT_DS_PASS_INDEX, SceneFlags.NONE, @@ -1509,9 +1365,7 @@ function _buildSSSSBlurPass (camera: Camera, sampler.minFilter = Filter.POINT; sampler.magFilter = Filter.POINT; sampler.mipFilter = Filter.NONE; - const computeView = new ComputeView(); - computeView.name = 'colorTex'; - ssssblurXPass.addComputeView(inputRT, computeView); + ssssblurXPass.addTexture(inputRT, 'colorTex'); } if (ppl.containsResource(ssssBlurDSName)) { const verId = webPipeline.resourceGraph.vertex(ssssBlurDSName); @@ -1519,26 +1373,11 @@ function _buildSSSSBlurPass (camera: Camera, sampler.minFilter = Filter.POINT; sampler.magFilter = Filter.POINT; sampler.mipFilter = Filter.NONE; - const computeView = new ComputeView(); - computeView.name = 'depthTex'; - ssssblurXPass.addComputeView(ssssBlurDSName, computeView); + ssssblurXPass.addTexture(ssssBlurDSName, 'depthTex'); } - const ssssBlurXPassRTView = new RasterView('_', - AccessType.WRITE, - AttachmentType.RENDER_TARGET, - LoadOp.CLEAR, - StoreOp.STORE, - camera.clearFlag, - ssssBlurClearColor); - ssssblurXPass.addRasterView(ssssBlurRTName, ssssBlurXPassRTView); - const ssssBlurXPassDSView = new RasterView('_', - AccessType.WRITE, - AttachmentType.DEPTH_STENCIL, - LoadOp.LOAD, - StoreOp.STORE, - camera.clearFlag, - new Color(camera.clearDepth, camera.clearStencil, 0.0, 0.0)); - ssssblurXPass.addRasterView(inputDS, ssssBlurXPassDSView); + ssssblurXPass.addRenderTarget(ssssBlurRTName, LoadOp.CLEAR, StoreOp.STORE, ssssBlurClearColor); + ssssblurXPass.addDepthStencil(inputDS, LoadOp.LOAD, StoreOp.STORE, + camera.clearDepth, camera.clearStencil, camera.clearFlag); ssssBlurData.ssssBlurMaterial.setProperty('blurInfo', new Vec4(ssssBlurData.ssssFov, ssssBlurData.ssssWidth, ssssBlurData.boundingBox, ssssBlurData.ssssScale), SSSS_BLUR_X_PASS_INDEX); ssssBlurData.ssssBlurMaterial.setProperty('kernel', ssssBlurData.kernel, SSSS_BLUR_X_PASS_INDEX); @@ -1557,9 +1396,7 @@ function _buildSSSSBlurPass (camera: Camera, sampler.minFilter = Filter.POINT; sampler.magFilter = Filter.POINT; sampler.mipFilter = Filter.NONE; - const computeView = new ComputeView(); - computeView.name = 'colorTex'; - ssssblurYPass.addComputeView(ssssBlurRTName, computeView); + ssssblurYPass.addTexture(ssssBlurRTName, 'colorTex'); } if (ppl.containsResource(ssssBlurDSName)) { const verId = webPipeline.resourceGraph.vertex(ssssBlurDSName); @@ -1567,26 +1404,11 @@ function _buildSSSSBlurPass (camera: Camera, sampler.minFilter = Filter.POINT; sampler.magFilter = Filter.POINT; sampler.mipFilter = Filter.NONE; - const computeView = new ComputeView(); - computeView.name = 'depthTex'; - ssssblurYPass.addComputeView(ssssBlurDSName, computeView); + ssssblurYPass.addTexture(ssssBlurDSName, 'depthTex'); } - const ssssBlurYPassView = new RasterView('_', - AccessType.WRITE, - AttachmentType.RENDER_TARGET, - LoadOp.LOAD, - StoreOp.STORE, - camera.clearFlag, - ssssBlurClearColor); - ssssblurYPass.addRasterView(inputRT, ssssBlurYPassView); - const ssssBlurYPassDSView = new RasterView('_', - AccessType.WRITE, - AttachmentType.DEPTH_STENCIL, - LoadOp.LOAD, - StoreOp.STORE, - camera.clearFlag, - new Color(camera.clearDepth, camera.clearStencil, 0.0, 0.0)); - ssssblurYPass.addRasterView(inputDS, ssssBlurYPassDSView); + ssssblurYPass.addRenderTarget(inputRT, LoadOp.LOAD, StoreOp.STORE, ssssBlurClearColor); + ssssblurYPass.addDepthStencil(inputDS, LoadOp.LOAD, StoreOp.STORE, + camera.clearDepth, camera.clearStencil, camera.clearFlag); ssssBlurData.ssssBlurMaterial.setProperty('blurInfo', new Vec4(ssssBlurData.ssssFov, ssssBlurData.ssssWidth, ssssBlurData.boundingBox, ssssBlurData.ssssScale), SSSS_BLUR_Y_PASS_INDEX); ssssBlurData.ssssBlurMaterial.setProperty('kernel', ssssBlurData.kernel, SSSS_BLUR_Y_PASS_INDEX); @@ -1648,24 +1470,15 @@ export function buildToneMappingPass (camera: Camera, toneMappingPass.name = `CameraToneMappingPass${cameraID}`; toneMappingPass.setViewport(new Viewport(area.x, area.y, area.width, area.height)); if (ppl.containsResource(inputRT)) { - const computeView = new ComputeView(); - computeView.name = 'u_texSampler'; - toneMappingPass.addComputeView(inputRT, computeView); + toneMappingPass.addTexture(inputRT, 'u_texSampler'); } - const toneMappingPassView = new RasterView('_', - AccessType.WRITE, AttachmentType.RENDER_TARGET, + toneMappingPass.addRenderTarget(toneMappingPassRTName, getLoadOpOfClearFlag(camera.clearFlag, AttachmentType.RENDER_TARGET), - StoreOp.STORE, - camera.clearFlag, - toneMappingClearColor); - const toneMappingPassDSView = new RasterView('_', - AccessType.WRITE, AttachmentType.DEPTH_STENCIL, + StoreOp.STORE, toneMappingClearColor); + toneMappingPass.addDepthStencil(toneMappingPassDS, getLoadOpOfClearFlag(camera.clearFlag, AttachmentType.DEPTH_STENCIL), StoreOp.STORE, - camera.clearFlag, - new Color(camera.clearDepth, camera.clearStencil, 0, 0)); - toneMappingPass.addRasterView(toneMappingPassRTName, toneMappingPassView); - toneMappingPass.addRasterView(toneMappingPassDS, toneMappingPassDSView); + camera.clearDepth, camera.clearStencil, camera.clearFlag); toneMappingPass.addQueue(QueueHint.NONE).addFullscreenQuad( toneMappingInfo.toneMappingMaterial, 0, SceneFlags.NONE, ); @@ -1704,22 +1517,12 @@ export function buildTransparencyPass (camera: Camera, alphaPass.addTexture(spotShadowName, 'cc_spotShadowMap'); } } - const alphaPassView = new RasterView('_', - AccessType.WRITE, - AttachmentType.RENDER_TARGET, - LoadOp.LOAD, - StoreOp.STORE, - camera.clearFlag, + alphaPass.addRenderTarget(inputRT, + LoadOp.LOAD, StoreOp.STORE, new Color(camera.clearDepth, camera.clearStencil, 0, 0)); - const alphaPassDSView = new RasterView('_', - AccessType.WRITE, - AttachmentType.DEPTH_STENCIL, - LoadOp.LOAD, - StoreOp.STORE, - camera.clearFlag, - new Color(camera.clearDepth, camera.clearStencil, 0, 0)); - alphaPass.addRasterView(inputRT, alphaPassView); - alphaPass.addRasterView(inputDS, alphaPassDSView); + alphaPass.addDepthStencil(inputDS, + LoadOp.LOAD, StoreOp.STORE, + camera.clearDepth, camera.clearStencil, camera.clearFlag); alphaPass .addQueue(QueueHint.RENDER_TRANSPARENT) .addSceneOfCamera(camera, new LightInfo(), SceneFlags.TRANSPARENT_OBJECT | SceneFlags.GEOMETRY); @@ -1745,32 +1548,20 @@ function _buildSpecularPass (camera: Camera, specalurPass.setViewport(new Viewport(area.x, area.y, width, height)); for (const dirShadowName of cameraInfo.mainLightShadowNames) { if (ppl.containsResource(dirShadowName)) { - const computeView = new ComputeView('cc_shadowMap'); - specalurPass.addComputeView(dirShadowName, computeView); + specalurPass.addTexture(dirShadowName, 'cc_shadowMap'); } } for (const spotShadowName of cameraInfo.spotLightShadowNames) { if (ppl.containsResource(spotShadowName)) { - const computeView = new ComputeView('cc_spotShadowMap'); - specalurPass.addComputeView(spotShadowName, computeView); + specalurPass.addTexture(spotShadowName, 'cc_spotShadowMap'); } } - const passView = new RasterView('_', - AccessType.WRITE, - AttachmentType.RENDER_TARGET, - LoadOp.LOAD, - StoreOp.STORE, - camera.clearFlag, + specalurPass.addRenderTarget(inputRT, + LoadOp.LOAD, StoreOp.STORE, new Color(camera.clearColor.x, camera.clearColor.y, camera.clearColor.z, camera.clearColor.w)); - const passDSView = new RasterView('_', - AccessType.WRITE, - AttachmentType.DEPTH_STENCIL, - LoadOp.LOAD, - StoreOp.STORE, - camera.clearFlag, - new Color(camera.clearDepth, camera.clearStencil, 0, 0)); - specalurPass.addRasterView(inputRT, passView); - specalurPass.addRasterView(inputDS, passDSView); + specalurPass.addDepthStencil(inputDS, + LoadOp.LOAD, StoreOp.STORE, + camera.clearDepth, camera.clearStencil, camera.clearFlag); specalurPass .addQueue(QueueHint.RENDER_OPAQUE, 'default') .addSceneOfCamera(camera, new LightInfo(), @@ -1974,9 +1765,7 @@ function _buildHBAOPass (camera: Camera, sampler.minFilter = sampler.magFilter = Filter.POINT; sampler.mipFilter = Filter.NONE; sampler.addressU = sampler.addressV = Address.CLAMP; - const computeView = new ComputeView(); - computeView.name = 'DepthTex'; - hbaoPass.addComputeView(inputDS, computeView); + hbaoPass.addTexture(inputDS, 'DepthTex'); } hbaoPass.addRenderTarget( hbaoRTName, @@ -2037,9 +1826,7 @@ function _buildHBAOBlurPass (camera: Camera, sampler.minFilter = sampler.magFilter = Filter.POINT; sampler.mipFilter = Filter.NONE; sampler.addressU = sampler.addressV = Address.CLAMP; - const computeView = new ComputeView(); - computeView.name = 'DepthTex'; - blurPass.addComputeView(inputDS, computeView); + blurPass.addTexture(inputDS, 'DepthTex'); } if (ppl.containsResource(inputRTName)) { const webPipeline = (ppl as WebPipeline); @@ -2048,9 +1835,7 @@ function _buildHBAOBlurPass (camera: Camera, sampler.minFilter = sampler.magFilter = Filter.LINEAR; sampler.mipFilter = Filter.NONE; sampler.addressU = sampler.addressV = Address.CLAMP; - const computeView = new ComputeView(); - computeView.name = 'AOTexNearest'; - blurPass.addComputeView(inputRTName, computeView); + blurPass.addTexture(inputRTName, 'AOTexNearest'); } blurPass.addRenderTarget( outputRTName, @@ -2101,9 +1886,7 @@ function _buildHBAOCombinedPass (camera: Camera, sampler.minFilter = sampler.magFilter = Filter.LINEAR; sampler.mipFilter = Filter.NONE; sampler.addressU = sampler.addressV = Address.CLAMP; - const computeView = new ComputeView(); - computeView.name = 'AOTexNearest'; - hbaoPass.addComputeView(inputRTName, computeView); + hbaoPass.addTexture(inputRTName, 'AOTexNearest'); } hbaoPass.addRenderTarget( diff --git a/cocos/rendering/custom/executor.ts b/cocos/rendering/custom/executor.ts index a65da10f86..15a3084e76 100644 --- a/cocos/rendering/custom/executor.ts +++ b/cocos/rendering/custom/executor.ts @@ -49,12 +49,11 @@ import { DescriptorSetData, LayoutGraphData, PipelineLayoutData, RenderPhaseData import { BasicPipeline, SceneVisitor } from './pipeline'; import { Blit, ClearView, ComputePass, ComputeSubpass, CopyPass, Dispatch, FormatView, ManagedBuffer, ManagedResource, ManagedTexture, MovePass, RasterPass, RasterSubpass, RaytracePass, RenderData, RenderGraph, RenderGraphVisitor, RenderQueue, RenderSwapchain, ResolvePass, ResourceDesc, - ResourceGraph, ResourceGraphVisitor, ResourceTraits, SceneData, SubresourceView } from './render-graph'; -import { AttachmentType, ComputeView, QueueHint, RasterView, ResourceDimension, ResourceFlags, ResourceResidency, SceneFlags, UpdateFrequency } from './types'; + ResourceGraph, ResourceGraphVisitor, ResourceTraits, SceneData, SubresourceView, ComputeView, RasterView } from './render-graph'; +import { AttachmentType, QueueHint, ResourceDimension, ResourceFlags, ResourceResidency, SceneFlags, UpdateFrequency } from './types'; import { PipelineUBO } from '../pipeline-ubo'; import { RenderInfo, RenderObject, WebSceneTask, WebSceneTransversal } from './web-scene'; import { WebSceneVisitor } from './web-scene-visitor'; -import { stringify } from './utils'; import { RenderAdditiveLightQueue } from '../render-additive-light-queue'; import { RenderShadowMapBatchedQueue } from '../render-shadow-map-batched-queue'; import { PlanarShadowQueue } from '../planar-shadow-queue'; diff --git a/cocos/rendering/custom/pipeline.ts b/cocos/rendering/custom/pipeline.ts index 5b55811c14..a705a5c139 100644 --- a/cocos/rendering/custom/pipeline.ts +++ b/cocos/rendering/custom/pipeline.ts @@ -36,7 +36,7 @@ import { GlobalDSManager } from '../global-descriptor-set-manager'; import { Mat4, Quat, Vec2, Vec4 } from '../../core/math'; import { MacroRecord } from '../../render-scene/core/pass-utils'; import { PipelineSceneData } from '../pipeline-scene-data'; -import { AccessType, ComputeView, CopyPair, LightInfo, MovePair, QueueHint, RasterView, ResolvePair, ResourceResidency, SceneFlags, TaskType, UpdateFrequency, UploadPair } from './types'; +import { AccessType, CopyPair, LightInfo, MovePair, QueueHint, ResolvePair, ResourceResidency, SceneFlags, TaskType, UpdateFrequency, UploadPair } from './types'; import { RenderWindow } from '../../render-scene/core/render-window'; import { Model } from '../../render-scene/scene'; @@ -157,14 +157,6 @@ export interface BasicRenderPassBuilder extends Setter { slotName: string, sampler?: Sampler | null, plane?: number): void; - /** - * @deprecated method will be removed in 3.9.0 - */ - addRasterView (name: string, view: RasterView): void; - /** - * @deprecated method will be removed in 3.9.0 - */ - addComputeView (name: string, view: ComputeView): void; addQueue (hint?: QueueHint, phaseName?: string): RenderQueueBuilder; setViewport (viewport: Viewport): void; setVersion (name: string, version: number): void; @@ -264,10 +256,6 @@ export interface RenderSubpassBuilder extends Setter { name: string, accessType: AccessType, slotName: string): void; - /** - * @deprecated method will be removed in 3.9.0 - */ - addComputeView (name: string, view: ComputeView): void; setViewport (viewport: Viewport): void; addQueue (hint?: QueueHint, phaseName?: string): RenderQueueBuilder; showStatistics: boolean; @@ -310,10 +298,6 @@ export interface ComputeSubpassBuilder extends Setter { name: string, accessType: AccessType, slotName: string): void; - /** - * @deprecated method will be removed in 3.9.0 - */ - addComputeView (name: string, view: ComputeView): void; addQueue (phaseName?: string): ComputeQueueBuilder; /** * @beta function signature might change @@ -361,10 +345,6 @@ export interface ComputePassBuilder extends Setter { accessType: AccessType, slotName: string): void; addMaterialTexture (resourceName: string, flags?: ShaderStageFlagBit): void; - /** - * @deprecated method will be removed in 3.9.0 - */ - addComputeView (name: string, view: ComputeView): void; addQueue (phaseName?: string): ComputeQueueBuilder; /** * @beta function signature might change diff --git a/cocos/rendering/custom/render-graph.ts b/cocos/rendering/custom/render-graph.ts index 40cac35bb0..3051497dc3 100644 --- a/cocos/rendering/custom/render-graph.ts +++ b/cocos/rendering/custom/render-graph.ts @@ -31,11 +31,81 @@ import { AdjI, AdjacencyGraph, BidirectionalGraph, ComponentGraph, ED, InEI, MutableGraph, MutableReferenceGraph, NamedGraph, OutE, OutEI, PolymorphicGraph, PropertyGraph, PropertyMap, ReferenceGraph, UuidGraph, VertexListGraph, directional, parallel, reindexEdgeList, traversal } from './graph'; import { Material } from '../../asset/assets'; import { Camera } from '../../render-scene/scene/camera'; -import { AccessFlagBit, Buffer, ClearFlagBit, Color, Format, Framebuffer, RenderPass, SampleCount, Sampler, SamplerInfo, ShaderStageFlagBit, Swapchain, Texture, TextureFlagBit, Viewport } from '../../gfx'; -import { ComputeView, CopyPair, LightInfo, MovePair, QueueHint, RasterView, ResolvePair, ResourceDimension, ResourceFlags, ResourceResidency, SceneFlags, UploadPair } from './types'; +import { AccessFlagBit, Buffer, ClearFlagBit, Color, Format, Framebuffer, LoadOp, RenderPass, SampleCount, Sampler, SamplerInfo, ShaderStageFlagBit, StoreOp, Swapchain, Texture, TextureFlagBit, Viewport } from '../../gfx'; +import { AccessType, AttachmentType, ClearValueType, CopyPair, LightInfo, MovePair, QueueHint, ResolvePair, ResourceDimension, ResourceFlags, ResourceResidency, SceneFlags, UploadPair } from './types'; import { RenderScene } from '../../render-scene/core/render-scene'; import { RenderWindow } from '../../render-scene/core/render-window'; +export class ClearValue { + constructor (x = 0, y = 0, z = 0, w = 0) { + this.x = x; + this.y = y; + this.z = z; + this.w = w; + } + x: number; + y: number; + z: number; + w: number; +} + +export class RasterView { + constructor ( + slotName = '', + accessType: AccessType = AccessType.WRITE, + attachmentType: AttachmentType = AttachmentType.RENDER_TARGET, + loadOp: LoadOp = LoadOp.LOAD, + storeOp: StoreOp = StoreOp.STORE, + clearFlags: ClearFlagBit = ClearFlagBit.ALL, + clearColor: Color = new Color(), + shaderStageFlags: ShaderStageFlagBit = ShaderStageFlagBit.NONE, + ) { + this.slotName = slotName; + this.accessType = accessType; + this.attachmentType = attachmentType; + this.loadOp = loadOp; + this.storeOp = storeOp; + this.clearFlags = clearFlags; + this.clearColor = clearColor; + this.shaderStageFlags = shaderStageFlags; + } + slotName: string; + slotName1 = ''; + accessType: AccessType; + attachmentType: AttachmentType; + loadOp: LoadOp; + storeOp: StoreOp; + clearFlags: ClearFlagBit; + readonly clearColor: Color; + slotID = 0; + shaderStageFlags: ShaderStageFlagBit; +} + +export class ComputeView { + constructor ( + name = '', + accessType: AccessType = AccessType.READ, + clearFlags: ClearFlagBit = ClearFlagBit.NONE, + clearValueType: ClearValueType = ClearValueType.NONE, + clearValue: ClearValue = new ClearValue(), + shaderStageFlags: ShaderStageFlagBit = ShaderStageFlagBit.NONE, + ) { + this.name = name; + this.accessType = accessType; + this.clearFlags = clearFlags; + this.clearValueType = clearValueType; + this.clearValue = clearValue; + this.shaderStageFlags = shaderStageFlags; + } + name: string; + accessType: AccessType; + plane = 0; + clearFlags: ClearFlagBit; + clearValueType: ClearValueType; + readonly clearValue: ClearValue; + shaderStageFlags: ShaderStageFlagBit; +} + export class ResourceDesc { dimension: ResourceDimension = ResourceDimension.BUFFER; alignment = 0; diff --git a/cocos/rendering/custom/types.ts b/cocos/rendering/custom/types.ts index 74348dd2ee..096b847abe 100644 --- a/cocos/rendering/custom/types.ts +++ b/cocos/rendering/custom/types.ts @@ -28,10 +28,10 @@ * ========================= !DO NOT CHANGE THE FOLLOWING SECTION MANUALLY! ========================= */ /* eslint-disable max-len */ -import { ClearFlagBit, Color, LoadOp, ResolveMode, ShaderStageFlagBit, StoreOp, Type, UniformBlock } from '../../gfx'; +import { ResolveMode, ShaderStageFlagBit, Type, UniformBlock } from '../../gfx'; import { Light } from '../../render-scene/scene'; import { OutputArchive, InputArchive } from './archive'; -import { saveColor, loadColor, saveUniformBlock, loadUniformBlock } from './serialization'; +import { saveUniformBlock, loadUniformBlock } from './serialization'; export enum UpdateFrequency { PER_INSTANCE, @@ -262,38 +262,6 @@ export function getAccessTypeName (e: AccessType): string { } } -export class RasterView { - constructor ( - slotName = '', - accessType: AccessType = AccessType.WRITE, - attachmentType: AttachmentType = AttachmentType.RENDER_TARGET, - loadOp: LoadOp = LoadOp.LOAD, - storeOp: StoreOp = StoreOp.STORE, - clearFlags: ClearFlagBit = ClearFlagBit.ALL, - clearColor: Color = new Color(), - shaderStageFlags: ShaderStageFlagBit = ShaderStageFlagBit.NONE, - ) { - this.slotName = slotName; - this.accessType = accessType; - this.attachmentType = attachmentType; - this.loadOp = loadOp; - this.storeOp = storeOp; - this.clearFlags = clearFlags; - this.clearColor = clearColor; - this.shaderStageFlags = shaderStageFlags; - } - slotName: string; - slotName1 = ''; - accessType: AccessType; - attachmentType: AttachmentType; - loadOp: LoadOp; - storeOp: StoreOp; - clearFlags: ClearFlagBit; - readonly clearColor: Color; - slotID = 0; - shaderStageFlags: ShaderStageFlagBit; -} - export enum ClearValueType { NONE, FLOAT_TYPE, @@ -313,44 +281,6 @@ export function getClearValueTypeName (e: ClearValueType): string { } } -export class ClearValue { - constructor (x = 0, y = 0, z = 0, w = 0) { - this.x = x; - this.y = y; - this.z = z; - this.w = w; - } - x: number; - y: number; - z: number; - w: number; -} - -export class ComputeView { - constructor ( - name = '', - accessType: AccessType = AccessType.READ, - clearFlags: ClearFlagBit = ClearFlagBit.NONE, - clearValueType: ClearValueType = ClearValueType.NONE, - clearValue: ClearValue = new ClearValue(), - shaderStageFlags: ShaderStageFlagBit = ShaderStageFlagBit.NONE, - ) { - this.name = name; - this.accessType = accessType; - this.clearFlags = clearFlags; - this.clearValueType = clearValueType; - this.clearValue = clearValue; - this.shaderStageFlags = shaderStageFlags; - } - name: string; - accessType: AccessType; - plane = 0; - clearFlags: ClearFlagBit; - clearValueType: ClearValueType; - readonly clearValue: ClearValue; - shaderStageFlags: ShaderStageFlagBit; -} - export class LightInfo { constructor (light: Light | null = null, level = 0) { this.light = light; @@ -566,66 +496,6 @@ export class PipelineStatistics { numInstancingUniformBlocks = 0; } -export function saveRasterView (ar: OutputArchive, v: RasterView) { - ar.writeString(v.slotName); - ar.writeString(v.slotName1); - ar.writeNumber(v.accessType); - ar.writeNumber(v.attachmentType); - ar.writeNumber(v.loadOp); - ar.writeNumber(v.storeOp); - ar.writeNumber(v.clearFlags); - saveColor(ar, v.clearColor); - ar.writeNumber(v.slotID); - ar.writeNumber(v.shaderStageFlags); -} - -export function loadRasterView (ar: InputArchive, v: RasterView) { - v.slotName = ar.readString(); - v.slotName1 = ar.readString(); - v.accessType = ar.readNumber(); - v.attachmentType = ar.readNumber(); - v.loadOp = ar.readNumber(); - v.storeOp = ar.readNumber(); - v.clearFlags = ar.readNumber(); - loadColor(ar, v.clearColor); - v.slotID = ar.readNumber(); - v.shaderStageFlags = ar.readNumber(); -} - -export function saveClearValue (ar: OutputArchive, v: ClearValue) { - ar.writeNumber(v.x); - ar.writeNumber(v.y); - ar.writeNumber(v.z); - ar.writeNumber(v.w); -} - -export function loadClearValue (ar: InputArchive, v: ClearValue) { - v.x = ar.readNumber(); - v.y = ar.readNumber(); - v.z = ar.readNumber(); - v.w = ar.readNumber(); -} - -export function saveComputeView (ar: OutputArchive, v: ComputeView) { - ar.writeString(v.name); - ar.writeNumber(v.accessType); - ar.writeNumber(v.plane); - ar.writeNumber(v.clearFlags); - ar.writeNumber(v.clearValueType); - saveClearValue(ar, v.clearValue); - ar.writeNumber(v.shaderStageFlags); -} - -export function loadComputeView (ar: InputArchive, v: ComputeView) { - v.name = ar.readString(); - v.accessType = ar.readNumber(); - v.plane = ar.readNumber(); - v.clearFlags = ar.readNumber(); - v.clearValueType = ar.readNumber(); - loadClearValue(ar, v.clearValue); - v.shaderStageFlags = ar.readNumber(); -} - export function saveLightInfo (ar: OutputArchive, v: LightInfo) { // skip, v.light: Light ar.writeNumber(v.level); diff --git a/cocos/rendering/custom/web-pipeline.ts b/cocos/rendering/custom/web-pipeline.ts index eacb55b0c3..58c24a9a5b 100644 --- a/cocos/rendering/custom/web-pipeline.ts +++ b/cocos/rendering/custom/web-pipeline.ts @@ -27,8 +27,8 @@ import { systemInfo } from 'pal/system-info'; import { DEBUG } from 'internal:constants'; import { Color, Buffer, DescriptorSetLayout, Device, Feature, Format, FormatFeatureBit, Sampler, Swapchain, Texture, ClearFlagBit, DescriptorSet, deviceManager, Viewport, API, CommandBuffer, Type, SamplerInfo, Filter, Address, DescriptorSetInfo, LoadOp, StoreOp, ShaderStageFlagBit, BufferInfo, TextureInfo } from '../../gfx'; import { Mat4, Quat, toRadian, Vec2, Vec3, Vec4, assert, macro, cclegacy } from '../../core'; -import { AccessType, AttachmentType, ComputeView, CopyPair, LightInfo, LightingMode, MovePair, QueueHint, RasterView, ResolvePair, ResourceDimension, ResourceFlags, ResourceResidency, SceneFlags, UpdateFrequency } from './types'; -import { Blit, ClearView, ComputePass, CopyPass, Dispatch, ManagedBuffer, ManagedResource, MovePass, RasterPass, RasterSubpass, RenderData, RenderGraph, RenderGraphComponent, RenderGraphValue, RenderQueue, RenderSwapchain, ResourceDesc, ResourceGraph, ResourceGraphValue, ResourceStates, ResourceTraits, SceneData, Subpass } from './render-graph'; +import { AccessType, AttachmentType, CopyPair, LightInfo, LightingMode, MovePair, QueueHint, ResolvePair, ResourceDimension, ResourceFlags, ResourceResidency, SceneFlags, UpdateFrequency } from './types'; +import { ComputeView, RasterView, Blit, ClearView, ComputePass, CopyPass, Dispatch, ManagedBuffer, ManagedResource, MovePass, RasterPass, RasterSubpass, RenderData, RenderGraph, RenderGraphComponent, RenderGraphValue, RenderQueue, RenderSwapchain, ResourceDesc, ResourceGraph, ResourceGraphValue, ResourceStates, ResourceTraits, SceneData, Subpass } from './render-graph'; import { ComputePassBuilder, ComputeQueueBuilder, ComputeSubpassBuilder, BasicPipeline, PipelineBuilder, RenderPassBuilder, RenderQueueBuilder, RenderSubpassBuilder, PipelineType, BasicRenderPassBuilder, PipelineCapabilities } from './pipeline'; import { PipelineSceneData } from '../pipeline-scene-data'; import { Model, Camera, ShadowType, CSMLevel, DirectionalLight, SpotLight, PCFType, Shadows } from '../../render-scene/scene'; @@ -932,12 +932,6 @@ export class WebRenderSubpassBuilder extends WebSetter implements RenderSubpassB addStorageImage (name: string, accessType: AccessType, slotName: string): void { throw new Error('Method not implemented.'); } - addRasterView (name: string, view: RasterView): void { - throw new Error('Method not implemented.'); - } - addComputeView (name: string, view: ComputeView): void { - throw new Error('Method not implemented.'); - } setViewport (viewport: Viewport): void { throw new Error('Method not implemented.'); } @@ -986,23 +980,6 @@ export class WebRenderPassBuilder extends WebSetter implements BasicRenderPassBu setCustomShaderStages (name: string, stageFlags: ShaderStageFlagBit): void { throw new Error('Method not implemented.'); } - addRasterView (name: string, view: RasterView) { - this._pass.rasterViews.set(name, view); - } - addComputeView (name: string, view: ComputeView) { - if (DEBUG) { - assert(view.name); - assert(name && this._resourceGraph.contains(name)); - const descriptorName = view.name; - const descriptorID = this._layoutGraph.attributeIndex.get(descriptorName); - assert(descriptorID !== undefined); - } - if (this._pass.computeViews.has(name)) { - this._pass.computeViews.get(name)?.push(view); - } else { - this._pass.computeViews.set(name, [view]); - } - } setArrayBuffer (name: string, arrayBuffer: ArrayBuffer): void { throw new Error('Method not implemented.'); } @@ -1216,16 +1193,6 @@ export class WebComputePassBuilder extends WebSetter implements ComputePassBuild addMaterialTexture (resourceName: string, flags?: ShaderStageFlagBit | undefined): void { throw new Error('Method not implemented.'); } - addComputeView (name: string, view: ComputeView) { - if (DEBUG) { - assert(name && this._resourceGraph.contains(name)); - } - if (this._pass.computeViews.has(name)) { - this._pass.computeViews.get(name)?.push(view); - } else { - this._pass.computeViews.set(name, [view]); - } - } addQueue (layoutName = 'default') { if (DEBUG) { const layoutId = this._layoutGraph.locateChild(this._layoutID, layoutName); diff --git a/cocos/rendering/post-process/utils/pass-context.ts b/cocos/rendering/post-process/utils/pass-context.ts index 51ca319978..a2797270f4 100644 --- a/cocos/rendering/post-process/utils/pass-context.ts +++ b/cocos/rendering/post-process/utils/pass-context.ts @@ -1,6 +1,6 @@ import { EDITOR } from 'internal:constants'; -import { AccessType, AttachmentType, ComputeView, QueueHint, RasterView, ResourceResidency, SceneFlags } from '../../custom/types'; +import { QueueHint, ResourceResidency, SceneFlags } from '../../custom/types'; import { ClearFlagBit, Color, Format, LoadOp, Rect, StoreOp, Viewport } from '../../../gfx'; import { Pipeline, RenderPassBuilder } from '../../custom/pipeline'; import { Camera } from '../../../render-scene/scene'; @@ -164,9 +164,7 @@ export class PassContext { } setPassInput (inputName: string, shaderName: string) { if (this.ppl!.containsResource(inputName)) { - const computeView = new ComputeView(); - computeView.name = shaderName; - this.pass!.addComputeView(inputName, computeView); + this.pass!.addTexture(inputName, shaderName); } return this; } diff --git a/native/cocos/renderer/pipeline/custom/NativePipelineTypes.h b/native/cocos/renderer/pipeline/custom/NativePipelineTypes.h index 75c10abf82..b60700a6e0 100644 --- a/native/cocos/renderer/pipeline/custom/NativePipelineTypes.h +++ b/native/cocos/renderer/pipeline/custom/NativePipelineTypes.h @@ -107,7 +107,6 @@ public: void addTexture(const ccstd::string &name, const ccstd::string &slotName, gfx::Sampler *sampler, uint32_t plane) /*implements*/; void addStorageBuffer(const ccstd::string &name, AccessType accessType, const ccstd::string &slotName) /*implements*/; void addStorageImage(const ccstd::string &name, AccessType accessType, const ccstd::string &slotName) /*implements*/; - void addComputeView(const ccstd::string &name, const ComputeView &view) /*implements*/; void setViewport(const gfx::Viewport &viewport) /*implements*/; RenderQueueBuilder *addQueue(QueueHint hint, const ccstd::string &phaseName) /*implements*/; bool getShowStatistics() const /*implements*/; @@ -242,9 +241,6 @@ public: void addStorageImage(const ccstd::string &name, AccessType accessType, const ccstd::string &slotName) override { NativeRenderSubpassBuilderImpl::addStorageImage(name, accessType, slotName); } - void addComputeView(const ccstd::string &name, const ComputeView &view) override { - NativeRenderSubpassBuilderImpl::addComputeView(name, view); - } void setViewport(const gfx::Viewport &viewport) override { NativeRenderSubpassBuilderImpl::setViewport(viewport); } @@ -329,9 +325,6 @@ public: void addStorageImage(const ccstd::string &name, AccessType accessType, const ccstd::string &slotName) override { NativeRenderSubpassBuilderImpl::addStorageImage(name, accessType, slotName); } - void addComputeView(const ccstd::string &name, const ComputeView &view) override { - NativeRenderSubpassBuilderImpl::addComputeView(name, view); - } void setViewport(const gfx::Viewport &viewport) override { NativeRenderSubpassBuilderImpl::setViewport(viewport); } @@ -408,7 +401,6 @@ public: void addTexture(const ccstd::string &name, const ccstd::string &slotName, gfx::Sampler *sampler, uint32_t plane) override; void addStorageBuffer(const ccstd::string &name, AccessType accessType, const ccstd::string &slotName) override; void addStorageImage(const ccstd::string &name, AccessType accessType, const ccstd::string &slotName) override; - void addComputeView(const ccstd::string &name, const ComputeView &view) override; ComputeQueueBuilder *addQueue(const ccstd::string &phaseName) override; void setCustomShaderStages(const ccstd::string &name, gfx::ShaderStageFlagBit stageFlags) override; }; @@ -468,8 +460,6 @@ public: void addRenderTarget(const ccstd::string &name, gfx::LoadOp loadOp, gfx::StoreOp storeOp, const gfx::Color &color) override; void addDepthStencil(const ccstd::string &name, gfx::LoadOp loadOp, gfx::StoreOp storeOp, float depth, uint8_t stencil, gfx::ClearFlagBit clearFlags) override; void addTexture(const ccstd::string &name, const ccstd::string &slotName, gfx::Sampler *sampler, uint32_t plane) override; - void addRasterView(const ccstd::string &name, const RasterView &view) override; - void addComputeView(const ccstd::string &name, const ComputeView &view) override; RenderQueueBuilder *addQueue(QueueHint hint, const ccstd::string &phaseName) override; void setViewport(const gfx::Viewport &viewport) override; void setVersion(const ccstd::string &name, uint64_t version) override; @@ -596,7 +586,6 @@ public: void addStorageBuffer(const ccstd::string &name, AccessType accessType, const ccstd::string &slotName) override; void addStorageImage(const ccstd::string &name, AccessType accessType, const ccstd::string &slotName) override; void addMaterialTexture(const ccstd::string &resourceName, gfx::ShaderStageFlagBit flags) override; - void addComputeView(const ccstd::string &name, const ComputeView &view) override; ComputeQueueBuilder *addQueue(const ccstd::string &phaseName) override; void setCustomShaderStages(const ccstd::string &name, gfx::ShaderStageFlagBit stageFlags) override; }; diff --git a/native/cocos/renderer/pipeline/custom/NativeProgramLibrary.cpp b/native/cocos/renderer/pipeline/custom/NativeProgramLibrary.cpp index 0392477569..1e45cad430 100644 --- a/native/cocos/renderer/pipeline/custom/NativeProgramLibrary.cpp +++ b/native/cocos/renderer/pipeline/custom/NativeProgramLibrary.cpp @@ -1265,7 +1265,7 @@ void NativeProgramLibrary::addEffect(const EffectAsset *effectAssetIn) { const auto &srcShaderInfo = *pShaderInfo; CC_ENSURES(subpassOrPassID != INVALID_ID && phaseID != INVALID_ID); const auto &passLayout = get(LayoutGraphData::LayoutTag{}, lg, subpassOrPassID); - const auto &phaseLayout = get(LayoutGraphData::LayoutTag{}, lg, subpassOrPassID); + const auto &phaseLayout = get(LayoutGraphData::LayoutTag{}, lg, phaseID); // programs auto iter = this->phases.find(phaseID); diff --git a/native/cocos/renderer/pipeline/custom/NativeRenderGraph.cpp b/native/cocos/renderer/pipeline/custom/NativeRenderGraph.cpp index b850b5cfd0..97bc3089a2 100644 --- a/native/cocos/renderer/pipeline/custom/NativeRenderGraph.cpp +++ b/native/cocos/renderer/pipeline/custom/NativeRenderGraph.cpp @@ -466,11 +466,105 @@ void NativeRenderPassBuilder::addDepthStencil( stencil); } +namespace { + +void addComputeView(NativeRenderPassBuilder &builder, const ccstd::string &name, const ComputeView &view) { + CC_EXPECTS(!name.empty()); + CC_EXPECTS(!view.name.empty()); + auto &pass = get(RasterPassTag{}, builder.nodeID, *builder.renderGraph); + auto iter = pass.computeViews.find(name.c_str()); + if (iter == pass.computeViews.end()) { + bool added = false; + std::tie(iter, added) = pass.computeViews.emplace( + std::piecewise_construct, + std::forward_as_tuple(name.c_str()), + std::forward_as_tuple()); + CC_ENSURES(added); + } + iter->second.emplace_back(view); +} + +void addComputeView(NativeComputePassBuilder &builder, const ccstd::string &name, const ComputeView &view) { + CC_EXPECTS(!name.empty()); + CC_EXPECTS(!view.name.empty()); + auto &pass = get(ComputeTag{}, builder.nodeID, *builder.renderGraph); + auto iter = pass.computeViews.find(name.c_str()); + if (iter == pass.computeViews.end()) { + bool added = false; + std::tie(iter, added) = pass.computeViews.emplace( + std::piecewise_construct, + std::forward_as_tuple(name.c_str()), + std::forward_as_tuple()); + CC_ENSURES(added); + } + iter->second.emplace_back(view); +} + +template +void addComputeViewImpl( + const ccstd::string &name, const ComputeView &view, + RenderGraph::vertex_descriptor subpassID, + RenderGraph &renderGraph) { + CC_EXPECTS(!name.empty()); + CC_EXPECTS(!view.name.empty()); + auto &subpass = get(Tag{}, subpassID, renderGraph); + const auto passID = parent(subpassID, renderGraph); + CC_EXPECTS(passID != RenderGraph::null_vertex()); + CC_EXPECTS(holds(passID, renderGraph)); + auto &pass = get(RasterPassTag{}, passID, renderGraph); + CC_EXPECTS(subpass.subpassID < num_vertices(pass.subpassGraph)); + auto &subpassData = get(SubpassGraph::SubpassTag{}, pass.subpassGraph, subpass.subpassID); + CC_EXPECTS(subpass.computeViews.size() == subpassData.computeViews.size()); + { + auto iter = subpassData.computeViews.find(name.c_str()); + if (iter == subpassData.computeViews.end()) { + bool added = false; + std::tie(iter, added) = subpassData.computeViews.emplace( + std::piecewise_construct, + std::forward_as_tuple(name.c_str()), + std::forward_as_tuple()); + CC_ENSURES(added); + } + iter->second.emplace_back(view); + } + { + auto iter = subpass.computeViews.find(name.c_str()); + if (iter == subpass.computeViews.end()) { + bool added = false; + std::tie(iter, added) = subpass.computeViews.emplace( + std::piecewise_construct, + std::forward_as_tuple(name.c_str()), + std::forward_as_tuple()); + CC_ENSURES(added); + } + iter->second.emplace_back(view); + } + CC_ENSURES(subpass.computeViews.size() == subpassData.computeViews.size()); + CC_ENSURES(subpass.computeViews.find(std::string_view{name}) != subpass.computeViews.end()); + CC_ENSURES(subpassData.computeViews.find(std::string_view{name}) != subpassData.computeViews.end()); + CC_ENSURES(subpass.computeViews.find(std::string_view{name})->second.size() == + subpassData.computeViews.find(std::string_view{name})->second.size()); +} + +void addComputeView( + NativeRenderSubpassBuilderImpl &builder, + const ccstd::string &name, const ComputeView &view) { + addComputeViewImpl(name, view, builder.nodeID, *builder.renderGraph); +} + +void addComputeView( + NativeComputeSubpassBuilder &builder, const ccstd::string &name, const ComputeView &view) { + addComputeViewImpl(name, view, builder.nodeID, *builder.renderGraph); +} + +} // namespace + // NOLINTNEXTLINE(bugprone-easily-swappable-parameters) void NativeRenderPassBuilder::addTexture( const ccstd::string &name, const ccstd::string &slotName, gfx::Sampler *sampler, uint32_t plane) { addComputeView( + *this, name, ComputeView{ ccstd::pmr::string(slotName, renderGraph->get_allocator()), @@ -493,6 +587,7 @@ void NativeRenderPassBuilder::addTexture( void NativeRenderPassBuilder::addStorageBuffer( const ccstd::string &name, AccessType accessType, const ccstd::string &slotName) { addComputeView( + *this, name, ComputeView{ ccstd::pmr::string(slotName, renderGraph->get_allocator()), @@ -507,6 +602,7 @@ void NativeRenderPassBuilder::addStorageBuffer( void NativeRenderPassBuilder::addStorageImage( const ccstd::string &name, AccessType accessType, const ccstd::string &slotName) { addComputeView( + *this, name, ComputeView{ ccstd::pmr::string(slotName, renderGraph->get_allocator()), @@ -544,33 +640,6 @@ void NativeRenderPassBuilder::setCustomShaderStages( } } -void NativeRenderPassBuilder::addRasterView(const ccstd::string &name, const RasterView &view) { - auto &pass = get(RasterPassTag{}, nodeID, *renderGraph); - auto slotID = static_cast(pass.rasterViews.size()); - auto res = pass.rasterViews.emplace( - std::piecewise_construct, - std::forward_as_tuple(name.c_str()), - std::forward_as_tuple(view)); - CC_ENSURES(res.second); - res.first->second.slotID = slotID; -} - -void NativeRenderPassBuilder::addComputeView(const ccstd::string &name, const ComputeView &view) { - CC_EXPECTS(!name.empty()); - CC_EXPECTS(!view.name.empty()); - auto &pass = get(RasterPassTag{}, nodeID, *renderGraph); - auto iter = pass.computeViews.find(name.c_str()); - if (iter == pass.computeViews.end()) { - bool added = false; - std::tie(iter, added) = pass.computeViews.emplace( - std::piecewise_construct, - std::forward_as_tuple(name.c_str()), - std::forward_as_tuple()); - CC_ENSURES(added); - } - iter->second.emplace_back(view); -} - bool NativeRenderPassBuilder::getShowStatistics() const { const auto &pass = get(RasterPassTag{}, nodeID, *renderGraph); return pass.showStatistics; @@ -652,52 +721,6 @@ void addRasterViewImpl( CC_ENSURES(subpass.rasterViews.size() == subpassData.rasterViews.size()); } -template -void addComputeViewImpl( - const ccstd::string &name, const ComputeView &view, - RenderGraph::vertex_descriptor subpassID, - RenderGraph &renderGraph) { - CC_EXPECTS(!name.empty()); - CC_EXPECTS(!view.name.empty()); - auto &subpass = get(Tag{}, subpassID, renderGraph); - const auto passID = parent(subpassID, renderGraph); - CC_EXPECTS(passID != RenderGraph::null_vertex()); - CC_EXPECTS(holds(passID, renderGraph)); - auto &pass = get(RasterPassTag{}, passID, renderGraph); - CC_EXPECTS(subpass.subpassID < num_vertices(pass.subpassGraph)); - auto &subpassData = get(SubpassGraph::SubpassTag{}, pass.subpassGraph, subpass.subpassID); - CC_EXPECTS(subpass.computeViews.size() == subpassData.computeViews.size()); - { - auto iter = subpassData.computeViews.find(name.c_str()); - if (iter == subpassData.computeViews.end()) { - bool added = false; - std::tie(iter, added) = subpassData.computeViews.emplace( - std::piecewise_construct, - std::forward_as_tuple(name.c_str()), - std::forward_as_tuple()); - CC_ENSURES(added); - } - iter->second.emplace_back(view); - } - { - auto iter = subpass.computeViews.find(name.c_str()); - if (iter == subpass.computeViews.end()) { - bool added = false; - std::tie(iter, added) = subpass.computeViews.emplace( - std::piecewise_construct, - std::forward_as_tuple(name.c_str()), - std::forward_as_tuple()); - CC_ENSURES(added); - } - iter->second.emplace_back(view); - } - CC_ENSURES(subpass.computeViews.size() == subpassData.computeViews.size()); - CC_ENSURES(subpass.computeViews.find(std::string_view{name}) != subpass.computeViews.end()); - CC_ENSURES(subpassData.computeViews.find(std::string_view{name}) != subpassData.computeViews.end()); - CC_ENSURES(subpass.computeViews.find(std::string_view{name})->second.size() == - subpassData.computeViews.find(std::string_view{name})->second.size()); -} - } // namespace void NativeRenderSubpassBuilderImpl::addRenderTarget( @@ -746,6 +769,7 @@ void NativeRenderSubpassBuilderImpl::addTexture( const ccstd::string &name, const ccstd::string &slotName, gfx::Sampler *sampler, uint32_t plane) { addComputeView( + *this, name, ComputeView{ ccstd::pmr::string(slotName, renderGraph->get_allocator()), @@ -768,6 +792,7 @@ void NativeRenderSubpassBuilderImpl::addTexture( void NativeRenderSubpassBuilderImpl::addStorageBuffer( const ccstd::string &name, AccessType accessType, const ccstd::string &slotName) { addComputeView( + *this, name, ComputeView{ ccstd::pmr::string(slotName, renderGraph->get_allocator()), @@ -782,6 +807,7 @@ void NativeRenderSubpassBuilderImpl::addStorageBuffer( void NativeRenderSubpassBuilderImpl::addStorageImage( const ccstd::string &name, AccessType accessType, const ccstd::string &slotName) { addComputeView( + *this, name, ComputeView{ ccstd::pmr::string(slotName, renderGraph->get_allocator()), @@ -848,10 +874,6 @@ void NativeRenderSubpassBuilderImpl::setCustomShaderStages( setSubpassResourceShaderStages(*renderGraph, nodeID, name, stageFlags); } -void NativeRenderSubpassBuilderImpl::addComputeView(const ccstd::string &name, const ComputeView &view) { - addComputeViewImpl(name, view, nodeID, *renderGraph); -} - void NativeRenderSubpassBuilderImpl::setViewport(const gfx::Viewport &viewport) { auto &subpass = get(RasterSubpassTag{}, nodeID, *renderGraph); subpass.viewport = viewport; @@ -937,6 +959,7 @@ void NativeComputeSubpassBuilder::addTexture( const ccstd::string &name, const ccstd::string &slotName, gfx::Sampler *sampler, uint32_t plane) { addComputeView( + *this, name, ComputeView{ ccstd::pmr::string(slotName, renderGraph->get_allocator()), @@ -959,6 +982,7 @@ void NativeComputeSubpassBuilder::addTexture( void NativeComputeSubpassBuilder::addStorageBuffer( const ccstd::string &name, AccessType accessType, const ccstd::string &slotName) { addComputeView( + *this, name, ComputeView{ ccstd::pmr::string(slotName, renderGraph->get_allocator()), @@ -973,6 +997,7 @@ void NativeComputeSubpassBuilder::addStorageBuffer( void NativeComputeSubpassBuilder::addStorageImage( const ccstd::string &name, AccessType accessType, const ccstd::string &slotName) { addComputeView( + *this, name, ComputeView{ ccstd::pmr::string(slotName, renderGraph->get_allocator()), @@ -989,10 +1014,6 @@ void NativeComputeSubpassBuilder::setCustomShaderStages( setSubpassResourceShaderStages(*renderGraph, nodeID, name, stageFlags); } -void NativeComputeSubpassBuilder::addComputeView(const ccstd::string &name, const ComputeView &view) { - addComputeViewImpl(name, view, nodeID, *renderGraph); -} - ComputeQueueBuilder *NativeComputeSubpassBuilder::addQueue(const ccstd::string &phaseName) { CC_EXPECTS(!phaseName.empty()); CC_EXPECTS(layoutID != LayoutGraphData::null_vertex()); @@ -1662,6 +1683,7 @@ void NativeComputePassBuilder::addTexture( const ccstd::string &name, const ccstd::string &slotName, gfx::Sampler *sampler, uint32_t plane) { addComputeView( + *this, name, ComputeView{ ccstd::pmr::string(slotName, renderGraph->get_allocator()), @@ -1684,6 +1706,7 @@ void NativeComputePassBuilder::addTexture( void NativeComputePassBuilder::addStorageBuffer( const ccstd::string &name, AccessType accessType, const ccstd::string &slotName) { addComputeView( + *this, name, ComputeView{ ccstd::pmr::string(slotName, renderGraph->get_allocator()), @@ -1698,6 +1721,7 @@ void NativeComputePassBuilder::addStorageBuffer( void NativeComputePassBuilder::addStorageImage( const ccstd::string &name, AccessType accessType, const ccstd::string &slotName) { addComputeView( + *this, name, ComputeView{ ccstd::pmr::string(slotName, renderGraph->get_allocator()), @@ -1728,22 +1752,6 @@ void NativeComputePassBuilder::setCustomShaderStages( } } -void NativeComputePassBuilder::addComputeView(const ccstd::string &name, const ComputeView &view) { - CC_EXPECTS(!name.empty()); - CC_EXPECTS(!view.name.empty()); - auto &pass = get(ComputeTag{}, nodeID, *renderGraph); - auto iter = pass.computeViews.find(name.c_str()); - if (iter == pass.computeViews.end()) { - bool added = false; - std::tie(iter, added) = pass.computeViews.emplace( - std::piecewise_construct, - std::forward_as_tuple(name.c_str()), - std::forward_as_tuple()); - CC_ENSURES(added); - } - iter->second.emplace_back(view); -} - ComputeQueueBuilder *NativeComputePassBuilder::addQueue(const ccstd::string &phaseName) { CC_EXPECTS(!phaseName.empty()); CC_EXPECTS(layoutID != LayoutGraphData::null_vertex()); diff --git a/native/cocos/renderer/pipeline/custom/RenderCommonFwd.h b/native/cocos/renderer/pipeline/custom/RenderCommonFwd.h index 0aff9daaf2..8f54ad52ca 100644 --- a/native/cocos/renderer/pipeline/custom/RenderCommonFwd.h +++ b/native/cocos/renderer/pipeline/custom/RenderCommonFwd.h @@ -29,7 +29,6 @@ */ // clang-format off #pragma once -#include "cocos/base/std/hash/hash.h" #include "cocos/base/std/variant.h" #include "cocos/renderer/gfx-base/GFXDef-common.h" @@ -62,13 +61,8 @@ enum class SceneFlags : uint32_t; enum class LightingMode : uint32_t; enum class AttachmentType; enum class AccessType; - -struct RasterView; - enum class ClearValueType; -struct ClearValue; -struct ComputeView; struct LightInfo; enum class DescriptorTypeOrder; @@ -90,23 +84,4 @@ struct PipelineStatistics; } // namespace cc -namespace ccstd { - -template <> -struct hash { - hash_t operator()(const cc::render::RasterView& val) const noexcept; -}; - -template <> -struct hash { - hash_t operator()(const cc::render::ClearValue& val) const noexcept; -}; - -template <> -struct hash { - hash_t operator()(const cc::render::ComputeView& val) const noexcept; -}; - -} // namespace ccstd - // clang-format on diff --git a/native/cocos/renderer/pipeline/custom/RenderCommonJsb.cpp b/native/cocos/renderer/pipeline/custom/RenderCommonJsb.cpp index e342b27250..9bb23563b0 100644 --- a/native/cocos/renderer/pipeline/custom/RenderCommonJsb.cpp +++ b/native/cocos/renderer/pipeline/custom/RenderCommonJsb.cpp @@ -34,93 +34,6 @@ #include "cocos/renderer/pipeline/custom/RenderCommonTypes.h" #include "cocos/renderer/pipeline/custom/details/JsbConversion.h" -bool nativevalue_to_se(const cc::render::RasterView &from, se::Value &to, se::Object *ctx) { // NOLINT - se::HandleObject obj(se::Object::createPlainObject()); - se::Value tmp; - - nativevalue_to_se(from.slotName, tmp, ctx); - obj->setProperty("slotName", tmp); - - nativevalue_to_se(from.slotName1, tmp, ctx); - obj->setProperty("slotName1", tmp); - - nativevalue_to_se(from.accessType, tmp, ctx); - obj->setProperty("accessType", tmp); - - nativevalue_to_se(from.attachmentType, tmp, ctx); - obj->setProperty("attachmentType", tmp); - - nativevalue_to_se(from.loadOp, tmp, ctx); - obj->setProperty("loadOp", tmp); - - nativevalue_to_se(from.storeOp, tmp, ctx); - obj->setProperty("storeOp", tmp); - - nativevalue_to_se(from.clearFlags, tmp, ctx); - obj->setProperty("clearFlags", tmp); - - nativevalue_to_se(from.clearColor, tmp, ctx); - obj->setProperty("clearColor", tmp); - - nativevalue_to_se(from.slotID, tmp, ctx); - obj->setProperty("slotID", tmp); - - nativevalue_to_se(from.shaderStageFlags, tmp, ctx); - obj->setProperty("shaderStageFlags", tmp); - - to.setObject(obj); - return true; -} - -bool nativevalue_to_se(const cc::render::ClearValue &from, se::Value &to, se::Object *ctx) { // NOLINT - se::HandleObject obj(se::Object::createPlainObject()); - se::Value tmp; - - nativevalue_to_se(from.x, tmp, ctx); - obj->setProperty("x", tmp); - - nativevalue_to_se(from.y, tmp, ctx); - obj->setProperty("y", tmp); - - nativevalue_to_se(from.z, tmp, ctx); - obj->setProperty("z", tmp); - - nativevalue_to_se(from.w, tmp, ctx); - obj->setProperty("w", tmp); - - to.setObject(obj); - return true; -} - -bool nativevalue_to_se(const cc::render::ComputeView &from, se::Value &to, se::Object *ctx) { // NOLINT - se::HandleObject obj(se::Object::createPlainObject()); - se::Value tmp; - - nativevalue_to_se(from.name, tmp, ctx); - obj->setProperty("name", tmp); - - nativevalue_to_se(from.accessType, tmp, ctx); - obj->setProperty("accessType", tmp); - - nativevalue_to_se(from.plane, tmp, ctx); - obj->setProperty("plane", tmp); - - nativevalue_to_se(from.clearFlags, tmp, ctx); - obj->setProperty("clearFlags", tmp); - - nativevalue_to_se(from.clearValueType, tmp, ctx); - obj->setProperty("clearValueType", tmp); - - nativevalue_to_se(from.clearValue, tmp, ctx); - obj->setProperty("clearValue", tmp); - - nativevalue_to_se(from.shaderStageFlags, tmp, ctx); - obj->setProperty("shaderStageFlags", tmp); - - to.setObject(obj); - return true; -} - bool nativevalue_to_se(const cc::render::LightInfo &from, se::Value &to, se::Object *ctx) { // NOLINT se::HandleObject obj(se::Object::createPlainObject()); se::Value tmp; @@ -314,120 +227,6 @@ bool nativevalue_to_se(const cc::render::MovePair &from, se::Value &to, se::Obje return true; } -template <> -bool sevalue_to_native(const se::Value &from, cc::render::RasterView *to, se::Object *ctx) { // NOLINT - SE_PRECONDITION2(from.isObject(), false, " Convert parameter to RasterView failed !"); - - auto *obj = const_cast(from.toObject()); - bool ok = true; - se::Value field; - obj->getProperty("slotName", &field, true); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->slotName), ctx); - } - obj->getProperty("slotName1", &field, true); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->slotName1), ctx); - } - obj->getProperty("accessType", &field, true); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->accessType), ctx); - } - obj->getProperty("attachmentType", &field, true); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->attachmentType), ctx); - } - obj->getProperty("loadOp", &field, true); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->loadOp), ctx); - } - obj->getProperty("storeOp", &field, true); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->storeOp), ctx); - } - obj->getProperty("clearFlags", &field, true); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->clearFlags), ctx); - } - obj->getProperty("clearColor", &field, true); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->clearColor), ctx); - } - obj->getProperty("slotID", &field, true); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->slotID), ctx); - } - obj->getProperty("shaderStageFlags", &field, true); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->shaderStageFlags), ctx); - } - return ok; -} - -template <> -bool sevalue_to_native(const se::Value &from, cc::render::ClearValue *to, se::Object *ctx) { // NOLINT - SE_PRECONDITION2(from.isObject(), false, " Convert parameter to ClearValue failed !"); - - auto *obj = const_cast(from.toObject()); - bool ok = true; - se::Value field; - obj->getProperty("x", &field, true); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->x), ctx); - } - obj->getProperty("y", &field, true); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->y), ctx); - } - obj->getProperty("z", &field, true); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->z), ctx); - } - obj->getProperty("w", &field, true); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->w), ctx); - } - return ok; -} - -template <> -bool sevalue_to_native(const se::Value &from, cc::render::ComputeView *to, se::Object *ctx) { // NOLINT - SE_PRECONDITION2(from.isObject(), false, " Convert parameter to ComputeView failed !"); - - auto *obj = const_cast(from.toObject()); - bool ok = true; - se::Value field; - obj->getProperty("name", &field, true); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->name), ctx); - } - obj->getProperty("accessType", &field, true); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->accessType), ctx); - } - obj->getProperty("plane", &field, true); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->plane), ctx); - } - obj->getProperty("clearFlags", &field, true); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->clearFlags), ctx); - } - obj->getProperty("clearValueType", &field, true); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->clearValueType), ctx); - } - obj->getProperty("clearValue", &field, true); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->clearValue), ctx); - } - obj->getProperty("shaderStageFlags", &field, true); - if(!field.isNullOrUndefined()) { - ok &= sevalue_to_native(field, &(to->shaderStageFlags), ctx); - } - return ok; -} - template <> bool sevalue_to_native(const se::Value &from, cc::render::LightInfo *to, se::Object *ctx) { // NOLINT SE_PRECONDITION2(from.isObject(), false, " Convert parameter to LightInfo failed !"); diff --git a/native/cocos/renderer/pipeline/custom/RenderCommonJsb.h b/native/cocos/renderer/pipeline/custom/RenderCommonJsb.h index 66c2aa3188..56b478fb56 100644 --- a/native/cocos/renderer/pipeline/custom/RenderCommonJsb.h +++ b/native/cocos/renderer/pipeline/custom/RenderCommonJsb.h @@ -32,12 +32,6 @@ #include "cocos/bindings/manual/jsb_conversions.h" #include "cocos/renderer/pipeline/custom/RenderCommonFwd.h" -bool nativevalue_to_se(const cc::render::RasterView &from, se::Value &to, se::Object *ctx); // NOLINT - -bool nativevalue_to_se(const cc::render::ClearValue &from, se::Value &to, se::Object *ctx); // NOLINT - -bool nativevalue_to_se(const cc::render::ComputeView &from, se::Value &to, se::Object *ctx); // NOLINT - bool nativevalue_to_se(const cc::render::LightInfo &from, se::Value &to, se::Object *ctx); // NOLINT bool nativevalue_to_se(const cc::render::Descriptor &from, se::Value &to, se::Object *ctx); // NOLINT @@ -55,15 +49,6 @@ bool nativevalue_to_se(const cc::render::UploadPair &from, se::Value &to, se::Ob bool nativevalue_to_se(const cc::render::MovePair &from, se::Value &to, se::Object *ctx); // NOLINT // if function overload is used, android build fails -template <> -bool sevalue_to_native(const se::Value &from, cc::render::RasterView *to, se::Object *ctx); // NOLINT - -template <> -bool sevalue_to_native(const se::Value &from, cc::render::ClearValue *to, se::Object *ctx); // NOLINT - -template <> -bool sevalue_to_native(const se::Value &from, cc::render::ComputeView *to, se::Object *ctx); // NOLINT - template <> bool sevalue_to_native(const se::Value &from, cc::render::LightInfo *to, se::Object *ctx); // NOLINT diff --git a/native/cocos/renderer/pipeline/custom/RenderCommonNames.h b/native/cocos/renderer/pipeline/custom/RenderCommonNames.h index d192cbd550..51a3144420 100644 --- a/native/cocos/renderer/pipeline/custom/RenderCommonNames.h +++ b/native/cocos/renderer/pipeline/custom/RenderCommonNames.h @@ -125,7 +125,6 @@ inline const char* getName(AccessType e) noexcept { } return ""; } -inline const char* getName(const RasterView& /*v*/) noexcept { return "RasterView"; } inline const char* getName(ClearValueType e) noexcept { switch (e) { case ClearValueType::NONE: return "NONE"; @@ -134,8 +133,6 @@ inline const char* getName(ClearValueType e) noexcept { } return ""; } -inline const char* getName(const ClearValue& /*v*/) noexcept { return "ClearValue"; } -inline const char* getName(const ComputeView& /*v*/) noexcept { return "ComputeView"; } inline const char* getName(const LightInfo& /*v*/) noexcept { return "LightInfo"; } inline const char* getName(DescriptorTypeOrder e) noexcept { switch (e) { diff --git a/native/cocos/renderer/pipeline/custom/RenderCommonSerialization.h b/native/cocos/renderer/pipeline/custom/RenderCommonSerialization.h index d4b56222b3..49fa456c4c 100644 --- a/native/cocos/renderer/pipeline/custom/RenderCommonSerialization.h +++ b/native/cocos/renderer/pipeline/custom/RenderCommonSerialization.h @@ -37,66 +37,6 @@ namespace cc { namespace render { -inline void save(OutputArchive& ar, const RasterView& v) { - save(ar, v.slotName); - save(ar, v.slotName1); - save(ar, v.accessType); - save(ar, v.attachmentType); - save(ar, v.loadOp); - save(ar, v.storeOp); - save(ar, v.clearFlags); - save(ar, v.clearColor); - save(ar, v.slotID); - save(ar, v.shaderStageFlags); -} - -inline void load(InputArchive& ar, RasterView& v) { - load(ar, v.slotName); - load(ar, v.slotName1); - load(ar, v.accessType); - load(ar, v.attachmentType); - load(ar, v.loadOp); - load(ar, v.storeOp); - load(ar, v.clearFlags); - load(ar, v.clearColor); - load(ar, v.slotID); - load(ar, v.shaderStageFlags); -} - -inline void save(OutputArchive& ar, const ClearValue& v) { - save(ar, v.x); - save(ar, v.y); - save(ar, v.z); - save(ar, v.w); -} - -inline void load(InputArchive& ar, ClearValue& v) { - load(ar, v.x); - load(ar, v.y); - load(ar, v.z); - load(ar, v.w); -} - -inline void save(OutputArchive& ar, const ComputeView& v) { - save(ar, v.name); - save(ar, v.accessType); - save(ar, v.plane); - save(ar, v.clearFlags); - save(ar, v.clearValueType); - save(ar, v.clearValue); - save(ar, v.shaderStageFlags); -} - -inline void load(InputArchive& ar, ComputeView& v) { - load(ar, v.name); - load(ar, v.accessType); - load(ar, v.plane); - load(ar, v.clearFlags); - load(ar, v.clearValueType); - load(ar, v.clearValue); - load(ar, v.shaderStageFlags); -} - inline void save(OutputArchive& ar, const LightInfo& v) { // skip, light: IntrusivePtr save(ar, v.level); diff --git a/native/cocos/renderer/pipeline/custom/RenderCommonTypes.cpp b/native/cocos/renderer/pipeline/custom/RenderCommonTypes.cpp index 6246f7a86a..1f556cf105 100644 --- a/native/cocos/renderer/pipeline/custom/RenderCommonTypes.cpp +++ b/native/cocos/renderer/pipeline/custom/RenderCommonTypes.cpp @@ -34,94 +34,6 @@ namespace cc { namespace render { -RasterView::RasterView(const allocator_type& alloc) noexcept -: slotName(alloc), - slotName1(alloc) {} - -RasterView::RasterView(ccstd::pmr::string slotNameIn, AccessType accessTypeIn, AttachmentType attachmentTypeIn, gfx::LoadOp loadOpIn, gfx::StoreOp storeOpIn, gfx::ClearFlagBit clearFlagsIn, gfx::Color clearColorIn, gfx::ShaderStageFlagBit shaderStageFlagsIn, const allocator_type& alloc) noexcept // NOLINT -: slotName(std::move(slotNameIn), alloc), - slotName1(alloc), - accessType(accessTypeIn), - attachmentType(attachmentTypeIn), - loadOp(loadOpIn), - storeOp(storeOpIn), - clearFlags(clearFlagsIn), - clearColor(clearColorIn), - shaderStageFlags(shaderStageFlagsIn) {} - -RasterView::RasterView(ccstd::pmr::string slotNameIn, ccstd::pmr::string slotName1In, AccessType accessTypeIn, AttachmentType attachmentTypeIn, gfx::LoadOp loadOpIn, gfx::StoreOp storeOpIn, gfx::ClearFlagBit clearFlagsIn, gfx::Color clearColorIn, gfx::ShaderStageFlagBit shaderStageFlagsIn, const allocator_type& alloc) noexcept // NOLINT -: slotName(std::move(slotNameIn), alloc), - slotName1(std::move(slotName1In), alloc), - accessType(accessTypeIn), - attachmentType(attachmentTypeIn), - loadOp(loadOpIn), - storeOp(storeOpIn), - clearFlags(clearFlagsIn), - clearColor(clearColorIn), - shaderStageFlags(shaderStageFlagsIn) {} - -RasterView::RasterView(RasterView&& rhs, const allocator_type& alloc) -: slotName(std::move(rhs.slotName), alloc), - slotName1(std::move(rhs.slotName1), alloc), - accessType(rhs.accessType), - attachmentType(rhs.attachmentType), - loadOp(rhs.loadOp), - storeOp(rhs.storeOp), - clearFlags(rhs.clearFlags), - clearColor(rhs.clearColor), - slotID(rhs.slotID), - shaderStageFlags(rhs.shaderStageFlags) {} - -RasterView::RasterView(RasterView const& rhs, const allocator_type& alloc) -: slotName(rhs.slotName, alloc), - slotName1(rhs.slotName1, alloc), - accessType(rhs.accessType), - attachmentType(rhs.attachmentType), - loadOp(rhs.loadOp), - storeOp(rhs.storeOp), - clearFlags(rhs.clearFlags), - clearColor(rhs.clearColor), - slotID(rhs.slotID), - shaderStageFlags(rhs.shaderStageFlags) {} - -ComputeView::ComputeView(const allocator_type& alloc) noexcept -: name(alloc) {} - -ComputeView::ComputeView(ccstd::pmr::string nameIn, AccessType accessTypeIn, gfx::ClearFlagBit clearFlagsIn, ClearValueType clearValueTypeIn, ClearValue clearValueIn, gfx::ShaderStageFlagBit shaderStageFlagsIn, const allocator_type& alloc) noexcept -: name(std::move(nameIn), alloc), - accessType(accessTypeIn), - clearFlags(clearFlagsIn), - clearValueType(clearValueTypeIn), - clearValue(clearValueIn), - shaderStageFlags(shaderStageFlagsIn) {} - -ComputeView::ComputeView(ccstd::pmr::string nameIn, AccessType accessTypeIn, uint32_t planeIn, gfx::ClearFlagBit clearFlagsIn, ClearValueType clearValueTypeIn, ClearValue clearValueIn, gfx::ShaderStageFlagBit shaderStageFlagsIn, const allocator_type& alloc) noexcept -: name(std::move(nameIn), alloc), - accessType(accessTypeIn), - plane(planeIn), - clearFlags(clearFlagsIn), - clearValueType(clearValueTypeIn), - clearValue(clearValueIn), - shaderStageFlags(shaderStageFlagsIn) {} - -ComputeView::ComputeView(ComputeView&& rhs, const allocator_type& alloc) -: name(std::move(rhs.name), alloc), - accessType(rhs.accessType), - plane(rhs.plane), - clearFlags(rhs.clearFlags), - clearValueType(rhs.clearValueType), - clearValue(rhs.clearValue), - shaderStageFlags(rhs.shaderStageFlags) {} - -ComputeView::ComputeView(ComputeView const& rhs, const allocator_type& alloc) -: name(rhs.name, alloc), - accessType(rhs.accessType), - plane(rhs.plane), - clearFlags(rhs.clearFlags), - clearValueType(rhs.clearValueType), - clearValue(rhs.clearValue), - shaderStageFlags(rhs.shaderStageFlags) {} - ResolvePair::ResolvePair(const allocator_type& alloc) noexcept : source(alloc), target(alloc) {} diff --git a/native/cocos/renderer/pipeline/custom/RenderCommonTypes.h b/native/cocos/renderer/pipeline/custom/RenderCommonTypes.h index 5f7279d6aa..ce9584a0c7 100644 --- a/native/cocos/renderer/pipeline/custom/RenderCommonTypes.h +++ b/native/cocos/renderer/pipeline/custom/RenderCommonTypes.h @@ -32,7 +32,6 @@ #include "cocos/base/Ptr.h" #include "cocos/base/std/container/map.h" #include "cocos/base/std/container/string.h" -#include "cocos/base/std/hash/hash.h" #include "cocos/renderer/gfx-base/GFXDef-common.h" #include "cocos/renderer/pipeline/custom/RenderCommonFwd.h" #include "cocos/scene/Light.h" @@ -197,115 +196,12 @@ enum class AccessType { WRITE, }; -struct RasterView { - using allocator_type = boost::container::pmr::polymorphic_allocator; - allocator_type get_allocator() const noexcept { // NOLINT - return {slotName.get_allocator().resource()}; - } - - RasterView(const allocator_type& alloc = boost::container::pmr::get_default_resource()) noexcept; // NOLINT - RasterView(ccstd::pmr::string slotNameIn, AccessType accessTypeIn, AttachmentType attachmentTypeIn, gfx::LoadOp loadOpIn, gfx::StoreOp storeOpIn, gfx::ClearFlagBit clearFlagsIn, gfx::Color clearColorIn, gfx::ShaderStageFlagBit shaderStageFlagsIn, const allocator_type& alloc = boost::container::pmr::get_default_resource()) noexcept; - RasterView(ccstd::pmr::string slotNameIn, ccstd::pmr::string slotName1In, AccessType accessTypeIn, AttachmentType attachmentTypeIn, gfx::LoadOp loadOpIn, gfx::StoreOp storeOpIn, gfx::ClearFlagBit clearFlagsIn, gfx::Color clearColorIn, gfx::ShaderStageFlagBit shaderStageFlagsIn, const allocator_type& alloc = boost::container::pmr::get_default_resource()) noexcept; - RasterView(RasterView&& rhs, const allocator_type& alloc); - RasterView(RasterView const& rhs, const allocator_type& alloc); - - RasterView(RasterView&& rhs) noexcept = default; - RasterView(RasterView const& rhs) = delete; - RasterView& operator=(RasterView&& rhs) = default; - RasterView& operator=(RasterView const& rhs) = default; - - ccstd::pmr::string slotName; - ccstd::pmr::string slotName1; - AccessType accessType{AccessType::WRITE}; - AttachmentType attachmentType{AttachmentType::RENDER_TARGET}; - gfx::LoadOp loadOp{gfx::LoadOp::LOAD}; - gfx::StoreOp storeOp{gfx::StoreOp::STORE}; - gfx::ClearFlagBit clearFlags{gfx::ClearFlagBit::ALL}; - gfx::Color clearColor; - uint32_t slotID{0}; - gfx::ShaderStageFlagBit shaderStageFlags{gfx::ShaderStageFlagBit::NONE}; -}; - -inline bool operator==(const RasterView& lhs, const RasterView& rhs) noexcept { - return std::forward_as_tuple(lhs.slotName, lhs.slotName1, lhs.accessType, lhs.attachmentType, lhs.loadOp, lhs.storeOp, lhs.clearFlags, lhs.shaderStageFlags) == - std::forward_as_tuple(rhs.slotName, rhs.slotName1, rhs.accessType, rhs.attachmentType, rhs.loadOp, rhs.storeOp, rhs.clearFlags, rhs.shaderStageFlags); -} - -inline bool operator!=(const RasterView& lhs, const RasterView& rhs) noexcept { - return !(lhs == rhs); -} - enum class ClearValueType { NONE, FLOAT_TYPE, INT_TYPE, }; -struct ClearValue { - ClearValue() = default; - ClearValue(double xIn, double yIn, double zIn, double wIn) noexcept // NOLINT - : x(xIn), - y(yIn), - z(zIn), - w(wIn) {} - - double x{0}; - double y{0}; - double z{0}; - double w{0}; -}; - -inline bool operator==(const ClearValue& lhs, const ClearValue& rhs) noexcept { - return std::forward_as_tuple(lhs.x, lhs.y, lhs.z, lhs.w) == - std::forward_as_tuple(rhs.x, rhs.y, rhs.z, rhs.w); -} - -inline bool operator!=(const ClearValue& lhs, const ClearValue& rhs) noexcept { - return !(lhs == rhs); -} - -struct ComputeView { - using allocator_type = boost::container::pmr::polymorphic_allocator; - allocator_type get_allocator() const noexcept { // NOLINT - return {name.get_allocator().resource()}; - } - - ComputeView(const allocator_type& alloc = boost::container::pmr::get_default_resource()) noexcept; // NOLINT - ComputeView(ccstd::pmr::string nameIn, AccessType accessTypeIn, gfx::ClearFlagBit clearFlagsIn, ClearValueType clearValueTypeIn, ClearValue clearValueIn, gfx::ShaderStageFlagBit shaderStageFlagsIn, const allocator_type& alloc = boost::container::pmr::get_default_resource()) noexcept; - ComputeView(ccstd::pmr::string nameIn, AccessType accessTypeIn, uint32_t planeIn, gfx::ClearFlagBit clearFlagsIn, ClearValueType clearValueTypeIn, ClearValue clearValueIn, gfx::ShaderStageFlagBit shaderStageFlagsIn, const allocator_type& alloc = boost::container::pmr::get_default_resource()) noexcept; - ComputeView(ComputeView&& rhs, const allocator_type& alloc); - ComputeView(ComputeView const& rhs, const allocator_type& alloc); - - ComputeView(ComputeView&& rhs) noexcept = default; - ComputeView(ComputeView const& rhs) = delete; - ComputeView& operator=(ComputeView&& rhs) = default; - ComputeView& operator=(ComputeView const& rhs) = default; - - bool isRead() const { - return accessType != AccessType::WRITE; - } - bool isWrite() const { - return accessType != AccessType::READ; - } - - ccstd::pmr::string name; - AccessType accessType{AccessType::READ}; - uint32_t plane{0}; - gfx::ClearFlagBit clearFlags{gfx::ClearFlagBit::NONE}; - ClearValueType clearValueType{ClearValueType::NONE}; - ClearValue clearValue; - gfx::ShaderStageFlagBit shaderStageFlags{gfx::ShaderStageFlagBit::NONE}; -}; - -inline bool operator==(const ComputeView& lhs, const ComputeView& rhs) noexcept { - return std::forward_as_tuple(lhs.name, lhs.accessType, lhs.plane, lhs.clearFlags, lhs.clearValueType, lhs.shaderStageFlags) == - std::forward_as_tuple(rhs.name, rhs.accessType, rhs.plane, rhs.clearFlags, rhs.clearValueType, rhs.shaderStageFlags); -} - -inline bool operator!=(const ComputeView& lhs, const ComputeView& rhs) noexcept { - return !(lhs == rhs); -} - struct LightInfo { LightInfo() = default; LightInfo(IntrusivePtr lightIn, uint32_t levelIn) noexcept @@ -521,41 +417,4 @@ struct PipelineStatistics { } // namespace cc -namespace ccstd { - -inline hash_t hash::operator()(const cc::render::RasterView& val) const noexcept { - hash_t seed = 0; - hash_combine(seed, val.slotName); - hash_combine(seed, val.slotName1); - hash_combine(seed, val.accessType); - hash_combine(seed, val.attachmentType); - hash_combine(seed, val.loadOp); - hash_combine(seed, val.storeOp); - hash_combine(seed, val.clearFlags); - hash_combine(seed, val.shaderStageFlags); - return seed; -} - -inline hash_t hash::operator()(const cc::render::ClearValue& val) const noexcept { - hash_t seed = 0; - hash_combine(seed, val.x); - hash_combine(seed, val.y); - hash_combine(seed, val.z); - hash_combine(seed, val.w); - return seed; -} - -inline hash_t hash::operator()(const cc::render::ComputeView& val) const noexcept { - hash_t seed = 0; - hash_combine(seed, val.name); - hash_combine(seed, val.accessType); - hash_combine(seed, val.plane); - hash_combine(seed, val.clearFlags); - hash_combine(seed, val.clearValueType); - hash_combine(seed, val.shaderStageFlags); - return seed; -} - -} // namespace ccstd - // clang-format on diff --git a/native/cocos/renderer/pipeline/custom/RenderGraphFwd.h b/native/cocos/renderer/pipeline/custom/RenderGraphFwd.h index 95483b4ad7..0ec6698a93 100644 --- a/native/cocos/renderer/pipeline/custom/RenderGraphFwd.h +++ b/native/cocos/renderer/pipeline/custom/RenderGraphFwd.h @@ -38,6 +38,9 @@ namespace cc { namespace render { +struct ClearValue; +struct RasterView; +struct ComputeView; struct ResourceDesc; struct ResourceTraits; struct RenderSwapchain; @@ -89,6 +92,21 @@ struct RenderGraph; namespace ccstd { +template <> +struct hash { + hash_t operator()(const cc::render::ClearValue& val) const noexcept; +}; + +template <> +struct hash { + hash_t operator()(const cc::render::RasterView& val) const noexcept; +}; + +template <> +struct hash { + hash_t operator()(const cc::render::ComputeView& val) const noexcept; +}; + template <> struct hash { hash_t operator()(const cc::render::Subpass& val) const noexcept; diff --git a/native/cocos/renderer/pipeline/custom/RenderGraphTypes.cpp b/native/cocos/renderer/pipeline/custom/RenderGraphTypes.cpp index 0a7970dc99..0d6236eb38 100644 --- a/native/cocos/renderer/pipeline/custom/RenderGraphTypes.cpp +++ b/native/cocos/renderer/pipeline/custom/RenderGraphTypes.cpp @@ -34,6 +34,94 @@ namespace cc { namespace render { +RasterView::RasterView(const allocator_type& alloc) noexcept +: slotName(alloc), + slotName1(alloc) {} + +RasterView::RasterView(ccstd::pmr::string slotNameIn, AccessType accessTypeIn, AttachmentType attachmentTypeIn, gfx::LoadOp loadOpIn, gfx::StoreOp storeOpIn, gfx::ClearFlagBit clearFlagsIn, gfx::Color clearColorIn, gfx::ShaderStageFlagBit shaderStageFlagsIn, const allocator_type& alloc) noexcept // NOLINT +: slotName(std::move(slotNameIn), alloc), + slotName1(alloc), + accessType(accessTypeIn), + attachmentType(attachmentTypeIn), + loadOp(loadOpIn), + storeOp(storeOpIn), + clearFlags(clearFlagsIn), + clearColor(clearColorIn), + shaderStageFlags(shaderStageFlagsIn) {} + +RasterView::RasterView(ccstd::pmr::string slotNameIn, ccstd::pmr::string slotName1In, AccessType accessTypeIn, AttachmentType attachmentTypeIn, gfx::LoadOp loadOpIn, gfx::StoreOp storeOpIn, gfx::ClearFlagBit clearFlagsIn, gfx::Color clearColorIn, gfx::ShaderStageFlagBit shaderStageFlagsIn, const allocator_type& alloc) noexcept // NOLINT +: slotName(std::move(slotNameIn), alloc), + slotName1(std::move(slotName1In), alloc), + accessType(accessTypeIn), + attachmentType(attachmentTypeIn), + loadOp(loadOpIn), + storeOp(storeOpIn), + clearFlags(clearFlagsIn), + clearColor(clearColorIn), + shaderStageFlags(shaderStageFlagsIn) {} + +RasterView::RasterView(RasterView&& rhs, const allocator_type& alloc) +: slotName(std::move(rhs.slotName), alloc), + slotName1(std::move(rhs.slotName1), alloc), + accessType(rhs.accessType), + attachmentType(rhs.attachmentType), + loadOp(rhs.loadOp), + storeOp(rhs.storeOp), + clearFlags(rhs.clearFlags), + clearColor(rhs.clearColor), + slotID(rhs.slotID), + shaderStageFlags(rhs.shaderStageFlags) {} + +RasterView::RasterView(RasterView const& rhs, const allocator_type& alloc) +: slotName(rhs.slotName, alloc), + slotName1(rhs.slotName1, alloc), + accessType(rhs.accessType), + attachmentType(rhs.attachmentType), + loadOp(rhs.loadOp), + storeOp(rhs.storeOp), + clearFlags(rhs.clearFlags), + clearColor(rhs.clearColor), + slotID(rhs.slotID), + shaderStageFlags(rhs.shaderStageFlags) {} + +ComputeView::ComputeView(const allocator_type& alloc) noexcept +: name(alloc) {} + +ComputeView::ComputeView(ccstd::pmr::string nameIn, AccessType accessTypeIn, gfx::ClearFlagBit clearFlagsIn, ClearValueType clearValueTypeIn, ClearValue clearValueIn, gfx::ShaderStageFlagBit shaderStageFlagsIn, const allocator_type& alloc) noexcept +: name(std::move(nameIn), alloc), + accessType(accessTypeIn), + clearFlags(clearFlagsIn), + clearValueType(clearValueTypeIn), + clearValue(clearValueIn), + shaderStageFlags(shaderStageFlagsIn) {} + +ComputeView::ComputeView(ccstd::pmr::string nameIn, AccessType accessTypeIn, uint32_t planeIn, gfx::ClearFlagBit clearFlagsIn, ClearValueType clearValueTypeIn, ClearValue clearValueIn, gfx::ShaderStageFlagBit shaderStageFlagsIn, const allocator_type& alloc) noexcept +: name(std::move(nameIn), alloc), + accessType(accessTypeIn), + plane(planeIn), + clearFlags(clearFlagsIn), + clearValueType(clearValueTypeIn), + clearValue(clearValueIn), + shaderStageFlags(shaderStageFlagsIn) {} + +ComputeView::ComputeView(ComputeView&& rhs, const allocator_type& alloc) +: name(std::move(rhs.name), alloc), + accessType(rhs.accessType), + plane(rhs.plane), + clearFlags(rhs.clearFlags), + clearValueType(rhs.clearValueType), + clearValue(rhs.clearValue), + shaderStageFlags(rhs.shaderStageFlags) {} + +ComputeView::ComputeView(ComputeView const& rhs, const allocator_type& alloc) +: name(rhs.name, alloc), + accessType(rhs.accessType), + plane(rhs.plane), + clearFlags(rhs.clearFlags), + clearValueType(rhs.clearValueType), + clearValue(rhs.clearValue), + shaderStageFlags(rhs.shaderStageFlags) {} + Subpass::Subpass(const allocator_type& alloc) noexcept : rasterViews(alloc), computeViews(alloc) {} diff --git a/native/cocos/renderer/pipeline/custom/RenderGraphTypes.h b/native/cocos/renderer/pipeline/custom/RenderGraphTypes.h index cb5c0baeb2..d0f7e0aa9f 100644 --- a/native/cocos/renderer/pipeline/custom/RenderGraphTypes.h +++ b/native/cocos/renderer/pipeline/custom/RenderGraphTypes.h @@ -55,6 +55,109 @@ namespace cc { namespace render { +struct ClearValue { + ClearValue() = default; + ClearValue(double xIn, double yIn, double zIn, double wIn) noexcept // NOLINT + : x(xIn), + y(yIn), + z(zIn), + w(wIn) {} + + double x{0}; + double y{0}; + double z{0}; + double w{0}; +}; + +inline bool operator==(const ClearValue& lhs, const ClearValue& rhs) noexcept { + return std::forward_as_tuple(lhs.x, lhs.y, lhs.z, lhs.w) == + std::forward_as_tuple(rhs.x, rhs.y, rhs.z, rhs.w); +} + +inline bool operator!=(const ClearValue& lhs, const ClearValue& rhs) noexcept { + return !(lhs == rhs); +} + +struct RasterView { + using allocator_type = boost::container::pmr::polymorphic_allocator; + allocator_type get_allocator() const noexcept { // NOLINT + return {slotName.get_allocator().resource()}; + } + + RasterView(const allocator_type& alloc = boost::container::pmr::get_default_resource()) noexcept; // NOLINT + RasterView(ccstd::pmr::string slotNameIn, AccessType accessTypeIn, AttachmentType attachmentTypeIn, gfx::LoadOp loadOpIn, gfx::StoreOp storeOpIn, gfx::ClearFlagBit clearFlagsIn, gfx::Color clearColorIn, gfx::ShaderStageFlagBit shaderStageFlagsIn, const allocator_type& alloc = boost::container::pmr::get_default_resource()) noexcept; + RasterView(ccstd::pmr::string slotNameIn, ccstd::pmr::string slotName1In, AccessType accessTypeIn, AttachmentType attachmentTypeIn, gfx::LoadOp loadOpIn, gfx::StoreOp storeOpIn, gfx::ClearFlagBit clearFlagsIn, gfx::Color clearColorIn, gfx::ShaderStageFlagBit shaderStageFlagsIn, const allocator_type& alloc = boost::container::pmr::get_default_resource()) noexcept; + RasterView(RasterView&& rhs, const allocator_type& alloc); + RasterView(RasterView const& rhs, const allocator_type& alloc); + + RasterView(RasterView&& rhs) noexcept = default; + RasterView(RasterView const& rhs) = delete; + RasterView& operator=(RasterView&& rhs) = default; + RasterView& operator=(RasterView const& rhs) = default; + + ccstd::pmr::string slotName; + ccstd::pmr::string slotName1; + AccessType accessType{AccessType::WRITE}; + AttachmentType attachmentType{AttachmentType::RENDER_TARGET}; + gfx::LoadOp loadOp{gfx::LoadOp::LOAD}; + gfx::StoreOp storeOp{gfx::StoreOp::STORE}; + gfx::ClearFlagBit clearFlags{gfx::ClearFlagBit::ALL}; + gfx::Color clearColor; + uint32_t slotID{0}; + gfx::ShaderStageFlagBit shaderStageFlags{gfx::ShaderStageFlagBit::NONE}; +}; + +inline bool operator==(const RasterView& lhs, const RasterView& rhs) noexcept { + return std::forward_as_tuple(lhs.slotName, lhs.slotName1, lhs.accessType, lhs.attachmentType, lhs.loadOp, lhs.storeOp, lhs.clearFlags, lhs.shaderStageFlags) == + std::forward_as_tuple(rhs.slotName, rhs.slotName1, rhs.accessType, rhs.attachmentType, rhs.loadOp, rhs.storeOp, rhs.clearFlags, rhs.shaderStageFlags); +} + +inline bool operator!=(const RasterView& lhs, const RasterView& rhs) noexcept { + return !(lhs == rhs); +} + +struct ComputeView { + using allocator_type = boost::container::pmr::polymorphic_allocator; + allocator_type get_allocator() const noexcept { // NOLINT + return {name.get_allocator().resource()}; + } + + ComputeView(const allocator_type& alloc = boost::container::pmr::get_default_resource()) noexcept; // NOLINT + ComputeView(ccstd::pmr::string nameIn, AccessType accessTypeIn, gfx::ClearFlagBit clearFlagsIn, ClearValueType clearValueTypeIn, ClearValue clearValueIn, gfx::ShaderStageFlagBit shaderStageFlagsIn, const allocator_type& alloc = boost::container::pmr::get_default_resource()) noexcept; + ComputeView(ccstd::pmr::string nameIn, AccessType accessTypeIn, uint32_t planeIn, gfx::ClearFlagBit clearFlagsIn, ClearValueType clearValueTypeIn, ClearValue clearValueIn, gfx::ShaderStageFlagBit shaderStageFlagsIn, const allocator_type& alloc = boost::container::pmr::get_default_resource()) noexcept; + ComputeView(ComputeView&& rhs, const allocator_type& alloc); + ComputeView(ComputeView const& rhs, const allocator_type& alloc); + + ComputeView(ComputeView&& rhs) noexcept = default; + ComputeView(ComputeView const& rhs) = delete; + ComputeView& operator=(ComputeView&& rhs) = default; + ComputeView& operator=(ComputeView const& rhs) = default; + + bool isRead() const { + return accessType != AccessType::WRITE; + } + bool isWrite() const { + return accessType != AccessType::READ; + } + + ccstd::pmr::string name; + AccessType accessType{AccessType::READ}; + uint32_t plane{0}; + gfx::ClearFlagBit clearFlags{gfx::ClearFlagBit::NONE}; + ClearValueType clearValueType{ClearValueType::NONE}; + ClearValue clearValue; + gfx::ShaderStageFlagBit shaderStageFlags{gfx::ShaderStageFlagBit::NONE}; +}; + +inline bool operator==(const ComputeView& lhs, const ComputeView& rhs) noexcept { + return std::forward_as_tuple(lhs.name, lhs.accessType, lhs.plane, lhs.clearFlags, lhs.clearValueType, lhs.shaderStageFlags) == + std::forward_as_tuple(rhs.name, rhs.accessType, rhs.plane, rhs.clearFlags, rhs.clearValueType, rhs.shaderStageFlags); +} + +inline bool operator!=(const ComputeView& lhs, const ComputeView& rhs) noexcept { + return !(lhs == rhs); +} + struct ResourceDesc { ResourceDimension dimension{ResourceDimension::BUFFER}; uint32_t alignment{0}; @@ -1028,6 +1131,39 @@ struct RenderGraph { namespace ccstd { +inline hash_t hash::operator()(const cc::render::ClearValue& val) const noexcept { + hash_t seed = 0; + hash_combine(seed, val.x); + hash_combine(seed, val.y); + hash_combine(seed, val.z); + hash_combine(seed, val.w); + return seed; +} + +inline hash_t hash::operator()(const cc::render::RasterView& val) const noexcept { + hash_t seed = 0; + hash_combine(seed, val.slotName); + hash_combine(seed, val.slotName1); + hash_combine(seed, val.accessType); + hash_combine(seed, val.attachmentType); + hash_combine(seed, val.loadOp); + hash_combine(seed, val.storeOp); + hash_combine(seed, val.clearFlags); + hash_combine(seed, val.shaderStageFlags); + return seed; +} + +inline hash_t hash::operator()(const cc::render::ComputeView& val) const noexcept { + hash_t seed = 0; + hash_combine(seed, val.name); + hash_combine(seed, val.accessType); + hash_combine(seed, val.plane); + hash_combine(seed, val.clearFlags); + hash_combine(seed, val.clearValueType); + hash_combine(seed, val.shaderStageFlags); + return seed; +} + inline hash_t hash::operator()(const cc::render::Subpass& val) const noexcept { hash_t seed = 0; hash_combine(seed, val.rasterViews); diff --git a/native/cocos/renderer/pipeline/custom/RenderInterfaceTypes.h b/native/cocos/renderer/pipeline/custom/RenderInterfaceTypes.h index cde05b114d..0c404938bb 100644 --- a/native/cocos/renderer/pipeline/custom/RenderInterfaceTypes.h +++ b/native/cocos/renderer/pipeline/custom/RenderInterfaceTypes.h @@ -228,14 +228,6 @@ public: virtual void addRenderTarget(const ccstd::string &name, gfx::LoadOp loadOp, gfx::StoreOp storeOp, const gfx::Color &color) = 0; virtual void addDepthStencil(const ccstd::string &name, gfx::LoadOp loadOp, gfx::StoreOp storeOp, float depth, uint8_t stencil, gfx::ClearFlagBit clearFlags) = 0; virtual void addTexture(const ccstd::string &name, const ccstd::string &slotName, gfx::Sampler *sampler, uint32_t plane) = 0; - /** - * @deprecated method will be removed in 3.9.0 - */ - virtual void addRasterView(const ccstd::string &name, const RasterView &view) = 0; - /** - * @deprecated method will be removed in 3.9.0 - */ - virtual void addComputeView(const ccstd::string &name, const ComputeView &view) = 0; virtual RenderQueueBuilder *addQueue(QueueHint hint, const ccstd::string &phaseName) = 0; virtual void setViewport(const gfx::Viewport &viewport) = 0; virtual void setVersion(const ccstd::string &name, uint64_t version) = 0; @@ -335,10 +327,6 @@ public: virtual void addTexture(const ccstd::string &name, const ccstd::string &slotName, gfx::Sampler *sampler, uint32_t plane) = 0; virtual void addStorageBuffer(const ccstd::string &name, AccessType accessType, const ccstd::string &slotName) = 0; virtual void addStorageImage(const ccstd::string &name, AccessType accessType, const ccstd::string &slotName) = 0; - /** - * @deprecated method will be removed in 3.9.0 - */ - virtual void addComputeView(const ccstd::string &name, const ComputeView &view) = 0; virtual void setViewport(const gfx::Viewport &viewport) = 0; virtual RenderQueueBuilder *addQueue(QueueHint hint, const ccstd::string &phaseName) = 0; virtual bool getShowStatistics() const = 0; @@ -429,10 +417,6 @@ public: virtual void addTexture(const ccstd::string &name, const ccstd::string &slotName, gfx::Sampler *sampler, uint32_t plane) = 0; virtual void addStorageBuffer(const ccstd::string &name, AccessType accessType, const ccstd::string &slotName) = 0; virtual void addStorageImage(const ccstd::string &name, AccessType accessType, const ccstd::string &slotName) = 0; - /** - * @deprecated method will be removed in 3.9.0 - */ - virtual void addComputeView(const ccstd::string &name, const ComputeView &view) = 0; virtual ComputeQueueBuilder *addQueue(const ccstd::string &phaseName) = 0; /** * @beta function signature might change @@ -482,10 +466,6 @@ public: virtual void addStorageBuffer(const ccstd::string &name, AccessType accessType, const ccstd::string &slotName) = 0; virtual void addStorageImage(const ccstd::string &name, AccessType accessType, const ccstd::string &slotName) = 0; virtual void addMaterialTexture(const ccstd::string &resourceName, gfx::ShaderStageFlagBit flags) = 0; - /** - * @deprecated method will be removed in 3.9.0 - */ - virtual void addComputeView(const ccstd::string &name, const ComputeView &view) = 0; virtual ComputeQueueBuilder *addQueue(const ccstd::string &phaseName) = 0; /** * @beta function signature might change From 6f412705ff190d78647230095861111c23906731 Mon Sep 17 00:00:00 2001 From: Jiujiang Liu <37231523+moshuying@users.noreply.github.com> Date: Fri, 16 Jun 2023 14:29:35 +0800 Subject: [PATCH 17/28] revert preview change (#15450) --- editor/inspector/assets/fbx/preview.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/editor/inspector/assets/fbx/preview.js b/editor/inspector/assets/fbx/preview.js index 7158a19a64..b2c11213ff 100644 --- a/editor/inspector/assets/fbx/preview.js +++ b/editor/inspector/assets/fbx/preview.js @@ -666,16 +666,16 @@ exports.methods = { addAssetChangeListener(add = true) { if (!add && this.hasListenAssetsChange) { - Editor.Message.__protected__.removeBroadcastListener('scene:asset-applied', this.onAssetChangeBind); + Editor.Message.__protected__.removeBroadcastListener('asset-db:asset-change', this.onAssetChangeBind); this.hasListenAssetsChange = false; return; } - Editor.Message.__protected__.addBroadcastListener('scene:asset-applied', this.onAssetChangeBind); + Editor.Message.__protected__.addBroadcastListener('asset-db:asset-change', this.onAssetChangeBind); this.hasListenAssetsChange = true; }, - async onAssetChange(uuids) { - if (uuids.includes(this.asset.uuid)) { + async onAssetChange(uuid) { + if (this.asset.uuid === uuid) { // Update the animation dump when the parent assets changes this.meta = await Editor.Message.request('asset-db', 'query-asset-meta', this.asset.uuid); const clipInfo = animation.methods.getCurClipInfo.call(this); @@ -684,7 +684,7 @@ exports.methods = { }, }; -exports.ready = function() { +exports.ready = function () { this.gridWidth = 0; this.gridTableWith = 0; this.activeTab = 'animation'; @@ -726,7 +726,7 @@ exports.ready = function() { this.eventEditor.ready.call(this); }; -exports.update = async function(assetList, metaList) { +exports.update = async function (assetList, metaList) { this.assetList = assetList; this.metaList = metaList; this.isMultiple = this.assetList.length > 1; @@ -757,7 +757,7 @@ exports.update = async function(assetList, metaList) { this.refreshPreview(); }; -exports.close = function() { +exports.close = function () { for (const prop in Elements) { const element = Elements[prop]; if (element.close) { From c37e0880c1b3dec2c111a8406e664bf85aae75d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leslie=20Leigh=20=28=E6=9D=8E=E7=9A=84=E5=BA=8F=29?= Date: Fri, 16 Jun 2023 16:33:35 +0800 Subject: [PATCH 18/28] AnimationGraph: renaming variable should consider PVNodeGetVariable (#15460) --- editor/src/marionette/variable-binding.ts | 30 +++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/editor/src/marionette/variable-binding.ts b/editor/src/marionette/variable-binding.ts index 74df2a7ec3..26a142c400 100644 --- a/editor/src/marionette/variable-binding.ts +++ b/editor/src/marionette/variable-binding.ts @@ -10,9 +10,14 @@ import { MotionState, SubStateMachine, VariableType, + ProceduralPoseState, } from '../../../cocos/animation/marionette/asset-creation'; +import { PoseNodeStateMachine } from '../../../cocos/animation/marionette/pose-graph/pose-nodes/state-machine'; import { TCBindingValueType } from '../../../cocos/animation/marionette/state-machine/condition/binding/binding'; import { TCVariableBinding } from '../../../cocos/animation/marionette/state-machine/condition/binding/variable-binding'; +import { PVNodeGetVariableBase } from '../../../cocos/animation/marionette/pose-graph/pure-value-nodes/get-variable'; +import { PoseGraphType } from '../../../cocos/animation/marionette/pose-graph/foundation/type-system'; +import { assertIsTrue } from '../../../exports/base'; export interface VariableBindingView { /** @@ -111,7 +116,32 @@ export function* viewVariableBindings(animationGraph: AnimationGraph): Generator } } else if (state instanceof SubStateMachine) { yield* visitStateMachine(state.stateMachine); + } else if (state instanceof ProceduralPoseState) { + for (const node of state.graph.nodes()) { + if (node instanceof PoseNodeStateMachine) { + yield* visitStateMachine(node.stateMachine); + } else if (node instanceof PVNodeGetVariableBase) { + const outputType = node.getOutputType(0); + assertIsTrue(outputType !== PoseGraphType.POSE); + yield createVariableBindingView( + node, + 'variableName', + poseGraphTypeToAcceptableVariableType(outputType), + ); + } + } } } } } + +function poseGraphTypeToAcceptableVariableType(poseGraphType: Exclude) { + switch (poseGraphType) { + default: throw new Error(`Unhandled pose graph type ${PoseGraphType[poseGraphType]}`); + case PoseGraphType.FLOAT: return VariableType.FLOAT; + case PoseGraphType.INTEGER: return VariableType.INTEGER; + case PoseGraphType.BOOLEAN: return VariableType.BOOLEAN; + case PoseGraphType.VEC3: return VariableType.VEC3_experimental; + case PoseGraphType.QUAT: return VariableType.QUAT_experimental; + } +} From 075c970c0ef44ab9b00b0336e0562776c193aa03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=84=E6=A3=AE=E6=96=8C?= Date: Fri, 16 Jun 2023 16:55:16 +0800 Subject: [PATCH 19/28] optimize asset and node interface in inspector (#15459) * optimize inspector padding interface * clear somewhere ui-prop ui-section margin-top * optimize asset and node interface in inspector * adjust asset.css --- editor/inspector/assets/animation-mask.js | 5 +-- editor/inspector/assets/asterisk.js | 1 - editor/inspector/assets/effect-header.js | 1 - editor/inspector/assets/effect.js | 9 +++-- editor/inspector/assets/erp-texture-cube.js | 6 ++-- editor/inspector/assets/fbx/animation.js | 6 +++- editor/inspector/assets/fbx/fbx.js | 3 ++ editor/inspector/assets/fbx/index.js | 7 ++-- editor/inspector/assets/fbx/material.js | 3 ++ editor/inspector/assets/fbx/model.js | 3 ++ editor/inspector/assets/fbx/preview.js | 5 +++ editor/inspector/assets/image.js | 6 ++-- editor/inspector/assets/material-header.js | 4 +-- editor/inspector/assets/material.js | 7 ++++ editor/inspector/assets/mesh-preview.js | 5 ++- editor/inspector/assets/physics-material.js | 10 ++++-- editor/inspector/assets/prefab.js | 6 ++++ editor/inspector/assets/render-pipeline.js | 8 +++-- editor/inspector/assets/skeleton-preview.js | 2 +- editor/inspector/assets/sprite-frame.js | 5 +++ editor/inspector/assets/texture/texture.js | 1 + editor/inspector/assets/typescript.js | 1 - editor/inspector/assets/video-clip.js | 4 +-- .../inspector/components/particle-system.js | 24 ++++++------- editor/inspector/contributions/asset.css | 24 ++++++------- editor/inspector/contributions/asset.js | 34 ++++++++++++++----- editor/inspector/contributions/node.css | 11 +++--- editor/inspector/contributions/node.js | 8 +++-- editor/inspector/utils/prop.js | 7 +++- 29 files changed, 144 insertions(+), 72 deletions(-) diff --git a/editor/inspector/assets/animation-mask.js b/editor/inspector/assets/animation-mask.js index 17bad1664d..3180d1e315 100644 --- a/editor/inspector/assets/animation-mask.js +++ b/editor/inspector/assets/animation-mask.js @@ -43,7 +43,8 @@ exports.style = /* css */` } .asset-animation-mask > .header { - margin-top: 10px; + margin-top: 8px; + margin-right: 4px; display: flex; } @@ -286,7 +287,7 @@ exports.ready = function() { ], listeners: { async confirm(detail) { - if (!detail) return; + if (!detail) { return; } const info = await Editor.Message.request('asset-db', 'query-asset-info', detail.value); if (!info || !info.redirect || info.redirect.type !== 'cc.Prefab') { console.error(Editor.I18n.t('ENGINE.assets.animationMask.illegalFbx') + ` {asset(${detail.value})}`); diff --git a/editor/inspector/assets/asterisk.js b/editor/inspector/assets/asterisk.js index 5a86d07e73..fc2c872bf5 100644 --- a/editor/inspector/assets/asterisk.js +++ b/editor/inspector/assets/asterisk.js @@ -18,7 +18,6 @@ exports.style = /* css */` flex: 1; display: flex; flex-direction: column; - margin-top: 4px; /* it is necessary */ height: 0px; } diff --git a/editor/inspector/assets/effect-header.js b/editor/inspector/assets/effect-header.js index e242b2a095..1c3b9c0f10 100644 --- a/editor/inspector/assets/effect-header.js +++ b/editor/inspector/assets/effect-header.js @@ -18,7 +18,6 @@ exports.style = /* css */` flex: 1; display: flex; flex-direction: column; - margin-top: 4px; margin-bottom: 4px; /* it is necessary */ height: 0px; diff --git a/editor/inspector/assets/effect.js b/editor/inspector/assets/effect.js index b991493c9c..234e7166ea 100644 --- a/editor/inspector/assets/effect.js +++ b/editor/inspector/assets/effect.js @@ -26,7 +26,9 @@ exports.template = /* html */` `; exports.style = /* css */` - .asset-effect { } + .asset-effect { + padding-right: 4px; + } .asset-effect[multiple-invalid] > *:not(.multiple-warn-tip) { display: none!important; @@ -57,12 +59,13 @@ exports.style = /* css */` color: var(--color-info-contrast-important); } .asset-effect > .codes .tabs { - margin: 4px auto; - text-align: center; + margin: 4px auto 6px auto; } .asset-effect > .codes .tabs > .tab { padding: 0; width: 110px; + height: 20px; + box-sizing: border-box; text-align: center; cursor: pointer; display: inline-block; diff --git a/editor/inspector/assets/erp-texture-cube.js b/editor/inspector/assets/erp-texture-cube.js index b530ea8fb6..dd632112cb 100644 --- a/editor/inspector/assets/erp-texture-cube.js +++ b/editor/inspector/assets/erp-texture-cube.js @@ -60,13 +60,13 @@ exports.template = /* html */ ` `; exports.style = /* css */` -.asset-erp-texture-cube ui-prop{ - margin-top: 4px; +.asset-erp-texture-cube ui-prop{ + margin-right: 4px; } .asset-erp-texture-cube #filterAdvancedSection, .asset-erp-texture-cube #wrapAdvancedSection, .asset-erp-texture-cube #generateMipmapsSection { - margin-left: 1.2em; + margin-left: 1em; display: none; } `; diff --git a/editor/inspector/assets/fbx/animation.js b/editor/inspector/assets/fbx/animation.js index a15029f9d0..9693331cf5 100644 --- a/editor/inspector/assets/fbx/animation.js +++ b/editor/inspector/assets/fbx/animation.js @@ -78,7 +78,7 @@ exports.template = /* html */` Speed - + @@ -97,6 +97,10 @@ exports.template = /* html */` `; exports.style = /* css */` +.container { + padding: 4px; +} + .container[multiple-invalid] > *:not(.multiple-warn-tip) { display: none!important; } diff --git a/editor/inspector/assets/fbx/fbx.js b/editor/inspector/assets/fbx/fbx.js index b0435e3add..ab3e90081e 100644 --- a/editor/inspector/assets/fbx/fbx.js +++ b/editor/inspector/assets/fbx/fbx.js @@ -41,6 +41,9 @@ exports.template = /* html */` `; exports.style = /* css */` +ui-prop { margin-right: 4px; } +ui-section.config { margin-right: 0; } + .warn-words { color: var(--color-warn-fill); } diff --git a/editor/inspector/assets/fbx/index.js b/editor/inspector/assets/fbx/index.js index 7ef62675ee..5df8c24e25 100644 --- a/editor/inspector/assets/fbx/index.js +++ b/editor/inspector/assets/fbx/index.js @@ -21,8 +21,10 @@ exports.style = /* css */` } .asset-fbx > .header { - padding-top: 8px; - padding-bottom: 8px; + padding: 8px 4px; +} +.asset-fbx > .header > .tabs { + height: 24px; } `; @@ -67,6 +69,7 @@ const Elements = { panel.tabs.forEach((tab) => { const button = document.createElement('ui-button'); + button.setAttribute('size', 'medium'); panel.$.tabs.appendChild(button); const label = document.createElement('ui-label'); diff --git a/editor/inspector/assets/fbx/material.js b/editor/inspector/assets/fbx/material.js index 550c4cb2b1..9b90e08d33 100644 --- a/editor/inspector/assets/fbx/material.js +++ b/editor/inspector/assets/fbx/material.js @@ -27,6 +27,9 @@ exports.template = /* html */` `; exports.style = /* css */` +ui-prop { margin-right: 4px; } +ui-section.config { margin-right: 0; } + .images { margin: 4px 0; } diff --git a/editor/inspector/assets/fbx/model.js b/editor/inspector/assets/fbx/model.js index 8ab722a8c4..f7f240b34c 100644 --- a/editor/inspector/assets/fbx/model.js +++ b/editor/inspector/assets/fbx/model.js @@ -141,6 +141,9 @@ exports.template = /* html */` `; exports.style = /* css */` +ui-prop { margin-right: 4px; } +ui-section.config { margin-right: 0; } + .warn-words { color: var(--color-warn-fill); } diff --git a/editor/inspector/assets/fbx/preview.js b/editor/inspector/assets/fbx/preview.js index b2c11213ff..08e0fcb382 100644 --- a/editor/inspector/assets/fbx/preview.js +++ b/editor/inspector/assets/fbx/preview.js @@ -76,6 +76,10 @@ exports.style = /* css*/` min-height: 200px; border-top: 1px solid var(--color-normal-border); } +.preview-container > .animation-info { + padding-right: 4px; +} + .preview[hoving] > .preview-container { outline: 2px solid var(--color-focus-fill-weaker); outline-offset: -1px; @@ -86,6 +90,7 @@ exports.style = /* css*/` } .preview-container > .model-info { display: none; + padding: 2px 4px; } .preview-container > .model-info > ui-label { margin-right: 6px; diff --git a/editor/inspector/assets/image.js b/editor/inspector/assets/image.js index 2dc8329f6e..401a58ab48 100644 --- a/editor/inspector/assets/image.js +++ b/editor/inspector/assets/image.js @@ -26,11 +26,11 @@ exports.template = /* html */` - + -