Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

fix(render): a present is not an effect, and bypass never meant what it said

yhh526c8373ae2d
diff --git a/sdk/src/render/renderPipeline.ts b/sdk/src/render/renderPipeline.ts
index 31232e484..ea6b8c736 100644
--- a/sdk/src/render/renderPipeline.ts
+++ b/sdk/src/render/renderPipeline.ts
@@ -172,6 +172,10 @@ export class RenderPipeline {
const hasPostProcess = pp !== null && (hasStack || !plan.oneToOne);
if (hasPostProcess) {
+ // A present is not an effect: with no stack nothing else would ever
+ // bring the pipeline up, and an uninitialised one reports itself
+ // disengaged — so the policy would go quietly missing.
+ if (!pp!.isInitialized()) pp!.init(1, 1);
if (hasStack) pp!._applyForCamera(cameraEntity!);
pp!.resize(scene.w, scene.h);
pp!.setOutputViewport(present.x, present.y, present.w, present.h);
diff --git a/sdk/tests/render-present.test.ts b/sdk/tests/render-present.test.ts
index 84e464c9b..930f3ca28 100644
--- a/sdk/tests/render-present.test.ts
+++ b/sdk/tests/render-present.test.ts
@@ -26,6 +26,8 @@ import { RenderResolution } from '../src/camera/presentPlan';
function fakePostProcess(hasStack: boolean) {
return {
getStack: vi.fn().mockReturnValue(hasStack ? {} : null),
+ isInitialized: vi.fn().mockReturnValue(false),
+ init: vi.fn(),
resize: vi.fn(),
setOutputViewport: vi.fn(),
begin: vi.fn(),
@@ -80,6 +82,14 @@ describe('renderCamera — the render size and the present rect', () => {
expect(pp._resetAfterCamera).not.toHaveBeenCalled();
});
+ it('brings the pipeline up itself — with no stack nothing else ever would', () => {
+ // Only a stack initialises it, and an uninitialised pipeline reports
+ // itself disengaged. Without this the policy goes quietly missing on
+ // every project that uses no post-process at all.
+ const pp = run(RenderResolution.Design, /*hasStack=*/false);
+ expect(pp.init).toHaveBeenCalled();
+ });
+
it('draws the scene into the whole render target, not the panel rect', () => {
run(RenderResolution.Design, false);
expect(Renderer.setViewport).toHaveBeenCalledWith(0, 0, expect.any(Number), DESIGN_WORLD_HEIGHT);
diff --git a/src/esengine/renderer/frame/PostProcessPipeline.hpp b/src/esengine/renderer/frame/PostProcessPipeline.hpp
index 6cd3ad564..a27ebfbef 100644
--- a/src/esengine/renderer/frame/PostProcessPipeline.hpp
+++ b/src/esengine/renderer/frame/PostProcessPipeline.hpp
@@ -215,8 +215,12 @@ public:
}
/**
- * @brief Sets bypass mode to skip FBO rendering entirely
- * @param bypass If true, begin()/end() become no-ops
+ * @brief Skip the EFFECTS, not the chain.
+ *
+ * @details It gates the authored passes and nothing else. The linear encode,
+ * the output transform and a scaling present all still engage —
+ * none of them is an effect, they are how the image reaches the
+ * screen, and a camera with no stack still needs them.
*/
void setBypass(bool bypass) { bypass_ = bypass; }
@@ -252,8 +256,6 @@ public:
/**
* @brief Checks if bypass mode is enabled
*/
- bool isBypassed() const { return bypass_; }
-
/**
* @brief Clears all passes
*/