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.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix(postprocess): the output curve's number is worked out once
esenginefe3fa706a6f8
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex a9558969a..a81600872 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -110,6 +110,14 @@ published separately; it ships inside the editor.multi-tileset layer, whose singular field is still carried for older scenes,and the particle curves that only one game has authored.+- **The output curve's number is worked out in one place.** `OutputTransform` is+ a string union at the API and a number at the wasm boundary, and the+ translation — `'aces' ? 1 : 0` — was written at both call sites. A third curve+ would have reached one of them and been read as `none` by the other. Found by+ sweeping for fields whose meaning is spelled in a comment over a bare `number`;+ the only other two hits document the DOM's own button numbering, which is a+ foreign convention and belongs in prose.+- **"Tested" now means named in a test's CODE, and three mirrors of one enum aregone.** The evidence behind every stability promise counted any identifierappearing anywhere in a test file — a comment, a `describe()` title. Measured,diff --git a/sdk/src/app/app.ts b/sdk/src/app/app.tsindex 4257e8a5e..65c16c213 100644--- a/sdk/src/app/app.ts+++ b/sdk/src/app/app.ts@@ -15,7 +15,7 @@ import type { AotManifest } from '../ecs/aot/AotSystems';import type { AotRuntime } from '../ecs/aot/AotRuntime';import { EventRegistry, eventNamed, type EventDef } from '../ecs/event';import type { ESEngineModule, CppRegistry } from '../wasm';-import type { OutputTransform } from '../postprocess';+import { outputTransformCode, type OutputTransform } from '../postprocess';import type { BridgeConnectOptions } from '../ecs/bridge/BuiltinBridge';import { UICameraInfo } from '../ui/core/ui-camera-info';import { inputPlugin, Input } from '../input/input';@@ -1685,7 +1685,7 @@ export function createWebApp(module: ESEngineModule, options?: WebAppOptions): A// After the renderer, not with the colour space above it: the post-process// pipeline is created by the renderer, and a curve declared before it exists// reaches nothing.- module.postprocess_setOutputTransform?.(options?.outputTransform === 'aces' ? 1 : 0);+ module.postprocess_setOutputTransform?.(outputTransformCode(options?.outputTransform));app.addPlugin(corePlugin);app.setPipeline(new RenderPipeline());diff --git a/sdk/src/postprocess.ts b/sdk/src/postprocess.tsindex b60ab0c68..bbd799634 100644--- a/sdk/src/postprocess.ts+++ b/sdk/src/postprocess.ts@@ -4,6 +4,7 @@ export {PostProcess,PostProcessAPI,PostProcessStack,+ outputTransformCode,type OutputTransform,postProcessEffects,initPostProcessAPI,diff --git a/sdk/src/postprocess/PostProcessAPI.ts b/sdk/src/postprocess/PostProcessAPI.tsindex 1320938dc..57be24c7b 100644--- a/sdk/src/postprocess/PostProcessAPI.ts+++ b/sdk/src/postprocess/PostProcessAPI.ts@@ -139,6 +139,15 @@ export function syncStackToWasm(stack: PostProcessStack, force = false): void {*/export type OutputTransform = 'none' | 'aces';+/**+ * The curve's number at the wasm boundary. Here and not at each call: the+ * translation was written twice, and a third curve would have reached one of+ * them and been silently read as `none` by the other.+ */+export function outputTransformCode(transform: OutputTransform | undefined): number {+ return transform === 'aces' ? 1 : 0;+}+export class PostProcessAPI {readonly state = new PostProcessState();@@ -237,7 +246,7 @@ export class PostProcessAPI {*/setOutputTransform(transform: OutputTransform): void {try {- getModule().postprocess_setOutputTransform(transform === 'aces' ? 1 : 0);+ getModule().postprocess_setOutputTransform(outputTransformCode(transform));} catch (e) {handleWasmError(e, 'PostProcess.setOutputTransform');}diff --git a/sdk/src/postprocess/index.ts b/sdk/src/postprocess/index.tsindex 7a86935d6..6bdd7db19 100644--- a/sdk/src/postprocess/index.ts+++ b/sdk/src/postprocess/index.ts@@ -3,6 +3,7 @@export { PostProcessStack } from './PostProcessStack';export type { PassConfig } from './PostProcessStack';export { PostProcess, PostProcessAPI, initPostProcessAPI, shutdownPostProcessAPI, syncStackToWasm } from './PostProcessAPI';+export { outputTransformCode } from './PostProcessAPI';export type { OutputTransform } from './PostProcessAPI';export { postProcessEffects } from './postProcessEffects';export { POSTPROCESS_VERTEX } from './shaders';