mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
use native root.pipeline (#10467)
This commit is contained in:
+7
-24
@@ -4,7 +4,6 @@ import { Batcher2D } from '../2d/renderer/batcher-2d';
|
||||
import legacyCC from '../../predefine';
|
||||
import { DataPoolManager } from '../3d/skeletal-animation/data-pool-manager';
|
||||
import { Device } from './gfx';
|
||||
import { createCustomPipeline } from './pipeline/custom';
|
||||
|
||||
declare const nr: any;
|
||||
declare const jsb: any;
|
||||
@@ -44,14 +43,6 @@ Object.defineProperty(rootProto, 'dataPoolManager', {
|
||||
},
|
||||
});
|
||||
|
||||
Object.defineProperty(rootProto, 'pipeline', {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
get () {
|
||||
return this._pipeline;
|
||||
}
|
||||
});
|
||||
|
||||
Object.defineProperty(rootProto, 'pipelineEvent', {
|
||||
configurable: true,
|
||||
enumerable: true,
|
||||
@@ -76,10 +67,7 @@ rootProto._ctor = function (device: Device) {
|
||||
this._modelPools = new Map();
|
||||
this._lightPools = new Map();
|
||||
this._batcher = null;
|
||||
this._pipeline = null;
|
||||
this._pipelineEvent = new DummyPipelineEvent();
|
||||
this._classicPipeline = null;
|
||||
this._customPipeline = null;
|
||||
this._registerListeners();
|
||||
};
|
||||
|
||||
@@ -176,19 +164,14 @@ rootProto.frameMove = function (deltaTime: number) {
|
||||
|
||||
const oldSetPipeline = rootProto.setRenderPipeline;
|
||||
rootProto.setRenderPipeline = function (pipeline) {
|
||||
if (!pipeline) {
|
||||
// pipeline should not be created in C++, ._ctor need to be triggered
|
||||
pipeline = new nr.ForwardPipeline();
|
||||
pipeline.init();
|
||||
}
|
||||
|
||||
if (this.usesCustomPipeline()) {
|
||||
this._customPipeline = createCustomPipeline();
|
||||
this._pipeline = this._customPipeline;
|
||||
return oldSetPipeline.call(this, null);
|
||||
} else {
|
||||
this._classicPipeline = pipeline;
|
||||
this._pipeline = this._classicPipeline;
|
||||
if (!pipeline) {
|
||||
// pipeline should not be created in C++, ._ctor need to be triggered
|
||||
pipeline = new nr.ForwardPipeline();
|
||||
pipeline.init();
|
||||
}
|
||||
return oldSetPipeline.call(this, pipeline);
|
||||
}
|
||||
|
||||
return oldSetPipeline.call(this, pipeline);
|
||||
}
|
||||
|
||||
@@ -9901,7 +9901,7 @@ static bool js_scene_Root_getPipeline(se::State& s) // NOLINT(readability-identi
|
||||
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 0);
|
||||
return false;
|
||||
}
|
||||
SE_BIND_FUNC(js_scene_Root_getPipeline)
|
||||
SE_BIND_FUNC_AS_PROP_GET(js_scene_Root_getPipeline)
|
||||
|
||||
static bool js_scene_Root_getScenes(se::State& s) // NOLINT(readability-identifier-naming)
|
||||
{
|
||||
@@ -10227,6 +10227,7 @@ bool js_register_scene_Root(se::Object* obj) // NOLINT(readability-identifier-na
|
||||
cls->defineProperty("fps", _SE(js_scene_Root_getFps_asGetter), nullptr);
|
||||
cls->defineProperty("fixedFPS", _SE(js_scene_Root_getFixedFPS_asGetter), _SE(js_scene_Root_setFixedFPS_asSetter));
|
||||
cls->defineProperty("useDeferredPipeline", _SE(js_scene_Root_isUsingDeferredPipeline_asGetter), nullptr);
|
||||
cls->defineProperty("pipeline", _SE(js_scene_Root_getPipeline_asGetter), nullptr);
|
||||
cls->defineFunction("activeWindow", _SE(js_scene_Root_activeWindow));
|
||||
cls->defineFunction("createCamera", _SE(js_scene_Root_createCamera));
|
||||
cls->defineFunction("createScene", _SE(js_scene_Root_createScene));
|
||||
@@ -10241,7 +10242,6 @@ bool js_register_scene_Root(se::Object* obj) // NOLINT(readability-identifier-na
|
||||
cls->defineFunction("frameMove", _SE(js_scene_Root_frameMove));
|
||||
cls->defineFunction("getBatcher2D", _SE(js_scene_Root_getBatcher2D));
|
||||
cls->defineFunction("getEventProcessor", _SE(js_scene_Root_getEventProcessor));
|
||||
cls->defineFunction("getPipeline", _SE(js_scene_Root_getPipeline));
|
||||
cls->defineFunction("_initialize", _SE(js_scene_Root_initialize));
|
||||
cls->defineFunction("onGlobalPipelineStateChanged", _SE(js_scene_Root_onGlobalPipelineStateChanged));
|
||||
cls->defineFunction("resetCumulativeTime", _SE(js_scene_Root_resetCumulativeTime));
|
||||
|
||||
@@ -426,7 +426,6 @@ SE_DECLARE_FUNC(js_scene_Root_destroyWindows);
|
||||
SE_DECLARE_FUNC(js_scene_Root_frameMove);
|
||||
SE_DECLARE_FUNC(js_scene_Root_getBatcher2D);
|
||||
SE_DECLARE_FUNC(js_scene_Root_getEventProcessor);
|
||||
SE_DECLARE_FUNC(js_scene_Root_getPipeline);
|
||||
SE_DECLARE_FUNC(js_scene_Root_initialize);
|
||||
SE_DECLARE_FUNC(js_scene_Root_onGlobalPipelineStateChanged);
|
||||
SE_DECLARE_FUNC(js_scene_Root_resetCumulativeTime);
|
||||
|
||||
@@ -92,7 +92,7 @@ rename_functions = Root::[initialize=_initialize],
|
||||
Scene::[load=_load activate=_activate],
|
||||
Pass::[initPassFromTarget=_initPassFromTarget]
|
||||
|
||||
getter_setter = Root::[device:_device mainWindow curWindow tempWindow windows scenes cumulativeTime frameTime frameCount fps fixedFPS useDeferredPipeline/isUsingDeferredPipeline],
|
||||
getter_setter = Root::[device:_device mainWindow curWindow tempWindow windows scenes cumulativeTime frameTime frameCount fps fixedFPS useDeferredPipeline/isUsingDeferredPipeline pipeline],
|
||||
RenderWindow::[width height framebuffer cameras swapchain],
|
||||
Pass::[root device shaderInfo localSetLayout program properties defines passIndex propertyIndex dynamics rootBufferDirty/isRootBufferDirty _rootBufferDirty/isRootBufferDirty/_setRootBufferDirty priority primitive stage phase rasterizerState depthStencilState blendState dynamicStates batchingScheme descriptorSet hash/getHashForJS pipelineLayout],
|
||||
PassInstance::[parent],
|
||||
|
||||
Reference in New Issue
Block a user