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.

feat(postfx): the effective sample count is readable, so a row can report it

esengine689715556ef6
diff --git a/desktop b/desktop
index 855dbbdfc..a51eeba6c 160000
--- a/desktop
+++ b/desktop
@@ -1 +1 @@
-Subproject commit 855dbbdfcc2332b299cb582be1f0bbe62c20c11c
+Subproject commit a51eeba6c9596169fbe25f05374d1f268a26f9e0
diff --git a/sdk/etc/index.api.md b/sdk/etc/index.api.md
index 9b591af63..b56e903b6 100644
--- a/sdk/etc/index.api.md
+++ b/sdk/etc/index.api.md
@@ -6270,6 +6270,7 @@ end: () => void
getStack: (camera: Entity) => PostProcessStack | null
init: (width: number, height: number) => boolean
isInitialized: () => boolean
+msaaCapability: () => { effective: number; max: number; }
resize: (width: number, height: number) => void
screenStack: PostProcessStack | null
setBypass: (bypass: boolean) => void
diff --git a/sdk/etc/index.native.api.md b/sdk/etc/index.native.api.md
index 3f98529c8..8aa856ad8 100644
--- a/sdk/etc/index.native.api.md
+++ b/sdk/etc/index.native.api.md
@@ -6453,6 +6453,7 @@ end: () => void
getStack: (camera: Entity) => PostProcessStack | null
init: (width: number, height: number) => boolean
isInitialized: () => boolean
+msaaCapability: () => { effective: number; max: number; }
resize: (width: number, height: number) => void
screenStack: PostProcessStack | null
setBypass: (bypass: boolean) => void
diff --git a/sdk/etc/index.node.api.md b/sdk/etc/index.node.api.md
index 1ac9ea47f..e113086db 100644
--- a/sdk/etc/index.node.api.md
+++ b/sdk/etc/index.node.api.md
@@ -6265,6 +6265,7 @@ end: () => void
getStack: (camera: Entity) => PostProcessStack | null
init: (width: number, height: number) => boolean
isInitialized: () => boolean
+msaaCapability: () => { effective: number; max: number; }
resize: (width: number, height: number) => void
screenStack: PostProcessStack | null
setBypass: (bypass: boolean) => void
diff --git a/sdk/etc/minigame.api.md b/sdk/etc/minigame.api.md
index 2fb2fc4b1..75baf97c7 100644
--- a/sdk/etc/minigame.api.md
+++ b/sdk/etc/minigame.api.md
@@ -6511,6 +6511,7 @@ end: () => void
getStack: (camera: Entity) => PostProcessStack | null
init: (width: number, height: number) => boolean
isInitialized: () => boolean
+msaaCapability: () => { effective: number; max: number; }
resize: (width: number, height: number) => void
screenStack: PostProcessStack | null
setBypass: (bypass: boolean) => void
diff --git a/sdk/etc/wasm.api.md b/sdk/etc/wasm.api.md
index 514116653..b396ab0a0 100644
--- a/sdk/etc/wasm.api.md
+++ b/sdk/etc/wasm.api.md
@@ -322,11 +322,13 @@ postprocess_begin: () => void
postprocess_beginScreenCapture: () => void
postprocess_clearPasses: () => void
postprocess_clearScreenPasses: () => void
+postprocess_effectiveMsaaSamples: (() => number) | undefined
postprocess_end: () => void
postprocess_endScreenCapture: () => void
postprocess_executeScreenPasses: () => void
postprocess_init: (width: number, height: number) => boolean
postprocess_isInitialized: () => boolean
+postprocess_maxMsaaSamples: (() => number) | undefined
postprocess_resize: (width: number, height: number) => void
postprocess_setBypass: (bypass: boolean) => void
postprocess_setMsaaSamples: (samples: number) => void
diff --git a/sdk/etc/wechat.api.md b/sdk/etc/wechat.api.md
index 4f3431acb..7e304f59f 100644
--- a/sdk/etc/wechat.api.md
+++ b/sdk/etc/wechat.api.md
@@ -6272,6 +6272,7 @@ end: () => void
getStack: (camera: Entity) => PostProcessStack | null
init: (width: number, height: number) => boolean
isInitialized: () => boolean
+msaaCapability: () => { effective: number; max: number; }
resize: (width: number, height: number) => void
screenStack: PostProcessStack | null
setBypass: (bypass: boolean) => void
diff --git a/sdk/src/ecs/bridge/nativeEngineApi.generated.ts b/sdk/src/ecs/bridge/nativeEngineApi.generated.ts
index e7c68c460..4b715c76b 100644
--- a/sdk/src/ecs/bridge/nativeEngineApi.generated.ts
+++ b/sdk/src/ecs/bridge/nativeEngineApi.generated.ts
@@ -87,11 +87,13 @@ export interface NativeEngineApi {
postprocess_beginScreenCapture?(): void;
postprocess_clearPasses?(): void;
postprocess_clearScreenPasses?(): void;
+ postprocess_effectiveMsaaSamples?(): number;
postprocess_end?(): void;
postprocess_endScreenCapture?(): void;
postprocess_executeScreenPasses?(): void;
postprocess_init?(width: number, height: number): boolean;
postprocess_isInitialized?(): boolean;
+ postprocess_maxMsaaSamples?(): number;
postprocess_resize?(width: number, height: number): void;
postprocess_setBypass?(bypass: boolean): void;
postprocess_setMsaaSamples?(samples: number): void;
@@ -335,11 +337,13 @@ export function createNativeEngineApi(
bind('postprocess_beginScreenCapture', 'es_postprocess_beginScreenCapture', false);
bind('postprocess_clearPasses', 'es_postprocess_clearPasses', false);
bind('postprocess_clearScreenPasses', 'es_postprocess_clearScreenPasses', false);
+ bind('postprocess_effectiveMsaaSamples', 'es_postprocess_effectiveMsaaSamples', false);
bind('postprocess_end', 'es_postprocess_end', false);
bind('postprocess_endScreenCapture', 'es_postprocess_endScreenCapture', false);
bind('postprocess_executeScreenPasses', 'es_postprocess_executeScreenPasses', false);
bind('postprocess_init', 'es_postprocess_init', false);
bind('postprocess_isInitialized', 'es_postprocess_isInitialized', false);
+ bind('postprocess_maxMsaaSamples', 'es_postprocess_maxMsaaSamples', false);
bind('postprocess_resize', 'es_postprocess_resize', false);
bind('postprocess_setBypass', 'es_postprocess_setBypass', false);
bind('postprocess_setMsaaSamples', 'es_postprocess_setMsaaSamples', false);
diff --git a/sdk/src/postprocess/PostProcessAPI.ts b/sdk/src/postprocess/PostProcessAPI.ts
index 033e05530..13d051cb4 100644
--- a/sdk/src/postprocess/PostProcessAPI.ts
+++ b/sdk/src/postprocess/PostProcessAPI.ts
@@ -270,6 +270,33 @@ export class PostProcessAPI {
}
}
+ /**
+ * What the scene target is ACTUALLY multisampled at, and the most this
+ * device can do. @experimental
+ *
+ * Two numbers because a request and a capability are different facts: asking
+ * for 8 where the backend allows 1 is not a typo, and only saying both tells
+ * those apart. `0` means nothing here can answer.
+ */
+ msaaCapability(): { effective: number; max: number } {
+ try {
+ // Off the module rather than through PostProcessCore, a Required<> of
+ // what a chain cannot run WITHOUT: these two only report on it, and a
+ // host binding neither still has a working chain.
+ const m = getModule() as unknown as {
+ postprocess_effectiveMsaaSamples?(): number;
+ postprocess_maxMsaaSamples?(): number;
+ };
+ return {
+ effective: m.postprocess_effectiveMsaaSamples?.() ?? 0,
+ max: m.postprocess_maxMsaaSamples?.() ?? 0,
+ };
+ } catch (e) {
+ handleWasmError(e, 'PostProcess.msaaCapability');
+ return { effective: 0, max: 0 };
+ }
+ }
+
begin(): void {
try {
getModule().postprocess_begin();
diff --git a/sdk/src/wasm.ts b/sdk/src/wasm.ts
index 7ca5f884f..83ed926c1 100644
--- a/sdk/src/wasm.ts
+++ b/sdk/src/wasm.ts
@@ -401,6 +401,8 @@ export interface ESEngineModule {
postprocess_addPass(name: string, shaderHandle: number): number;
postprocess_setPassScale(name: string, scale: number): void;
postprocess_setMsaaSamples(samples: number): void;
+ postprocess_effectiveMsaaSamples?(): number;
+ postprocess_maxMsaaSamples?(): number;
postprocess_setUniformFloat(passName: string, uniform: string, value: number): void;
postprocess_setPassTexture(passName: string, uniform: string, textureHandle: number): void;
postprocess_setUniformVec4(passName: string, uniform: string, x: number, y: number, z: number, w: number): void;
diff --git a/src/esengine/bindings/PostProcessBindings.cpp b/src/esengine/bindings/PostProcessBindings.cpp
index dec077b08..2b50cb5f5 100644
--- a/src/esengine/bindings/PostProcessBindings.cpp
+++ b/src/esengine/bindings/PostProcessBindings.cpp
@@ -69,6 +69,14 @@ void postprocess_setMsaaSamples(u32 samples) {
if (g_postProcessPipeline) g_postProcessPipeline->setRequestedSamples(samples);
}
+u32 postprocess_effectiveMsaaSamples() {
+ return g_postProcessPipeline ? g_postProcessPipeline->sceneSamples() : 0u;
+}
+
+u32 postprocess_maxMsaaSamples() {
+ return g_device ? g_device->maxSamples() : 0u;
+}
+
void postprocess_setPassScale(const std::string& passName, f32 scale) {
if (g_postProcessPipeline) {
g_postProcessPipeline->setPassScale(passName, scale);
diff --git a/src/esengine/bindings/PostProcessBindings.hpp b/src/esengine/bindings/PostProcessBindings.hpp
index d9d8f37ba..c605c0558 100644
--- a/src/esengine/bindings/PostProcessBindings.hpp
+++ b/src/esengine/bindings/PostProcessBindings.hpp
@@ -15,6 +15,11 @@ u32 postprocess_addPass(const std::string& name, u32 shaderHandle);
/** The project's multisampling request for the scene target; 1 = off. Clamped
* by what the device supports — the device answers capability, not policy. */
void postprocess_setMsaaSamples(u32 samples);
+/// What the scene target is actually multisampled at, and the most this device
+/// can do. Separate because a request and a capability are different facts, and
+/// only saying both tells a typo from a machine. 0 = nothing here can answer.
+u32 postprocess_effectiveMsaaSamples();
+u32 postprocess_maxMsaaSamples();
/** Draw a pass at a fraction of the chain size; the next pass upsamples it. */
void postprocess_setPassScale(const std::string& passName, f32 scale);
void postprocess_setUniformFloat(const std::string& passName,
diff --git a/src/esengine/bindings/WebSDKEntry.cpp b/src/esengine/bindings/WebSDKEntry.cpp
index 35f3e9e40..c74e785a7 100644
--- a/src/esengine/bindings/WebSDKEntry.cpp
+++ b/src/esengine/bindings/WebSDKEntry.cpp
@@ -573,6 +573,8 @@ EMSCRIPTEN_BINDINGS(esengine_renderer) {
emscripten::function("postprocess_addPass", &esengine::postprocess_addPass);
emscripten::function("postprocess_setPassScale", &esengine::postprocess_setPassScale);
emscripten::function("postprocess_setMsaaSamples", &esengine::postprocess_setMsaaSamples);
+ emscripten::function("postprocess_effectiveMsaaSamples", &esengine::postprocess_effectiveMsaaSamples);
+ emscripten::function("postprocess_maxMsaaSamples", &esengine::postprocess_maxMsaaSamples);
emscripten::function("postprocess_setUniformFloat", &esengine::postprocess_setUniformFloat);
emscripten::function("postprocess_setUniformVec4", &esengine::postprocess_setUniformVec4);
emscripten::function("postprocess_setPassTexture", &esengine::postprocess_setPassTexture);
diff --git a/src/esengine/renderer/frame/PostProcessPipeline.hpp b/src/esengine/renderer/frame/PostProcessPipeline.hpp
index 807688eae..eebba5f43 100644
--- a/src/esengine/renderer/frame/PostProcessPipeline.hpp
+++ b/src/esengine/renderer/frame/PostProcessPipeline.hpp
@@ -135,6 +135,12 @@ public:
u32 addPass(const std::string& name, resource::ShaderHandle shader);
/// The project's multisampling request; 1 = off. Clamped by the device.
void setRequestedSamples(u32 samples);
+ /// What the scene target is actually created with: the request after the
+ /// device's ceiling. The two silently differing is how a project ships at 1x
+ /// believing it asked for 8.
+ u32 sceneSamples() const { return scene_samples_; }
+ /// What was asked for, before the ceiling.
+ u32 requestedSamples() const { return requested_samples_; }
/// Draw @p passName at @p scale of the chain size (clamped to (0, 1]).
void setPassScale(const std::string& passName, f32 scale);
diff --git a/tools/check-project-settings.mjs b/tools/check-project-settings.mjs
index 6340e262f..cfb70973e 100644
--- a/tools/check-project-settings.mjs
+++ b/tools/check-project-settings.mjs
@@ -133,10 +133,7 @@ const AUTHORING = {
depthLayers: { ui: 'project.rendering.depthLayers' },
colorSpace: { ui: 'project.rendering.colorSpace' },
outputTransform: { ui: 'project.rendering.outputTransform' },
- msaaSamples: {
- owed: 'parsed, applied to the edit viewport, forwarded to Play and written into every '
- + 'build — and set nowhere but by hand in project.esproject',
- },
+ msaaSamples: { ui: 'project.rendering.msaa' },
renderBackend: { ui: 'project.rendering.backend' },
screenFit: { ui: 'project.display.cameraFit' },
};
@@ -198,7 +195,12 @@ function authoringProblem(field) {
}
if (kind !== 'ui') return `${field} declares an unknown authoring kind "${kind}"`;
const ids = Array.isArray(answer.ui) ? answer.ui : [answer.ui];
- const missing = ids.filter((id) => !settingsSrc.includes(id));
+ // A trailing dot is a PREFIX, for the ids built in a loop (`project.ui.color.
+ // ${role}`); anything else must appear quoted, because a bare substring test
+ // let `project.rendering.msaaX` satisfy a claim about `project.rendering.msaa`.
+ const missing = ids.filter((id) => (id.endsWith('.')
+ ? !settingsSrc.includes(id)
+ : !settingsSrc.includes(`'${id}'`)));
return missing.length
? `${field} claims a settings row (${missing.join(', ')}) that ${SETTINGS} does not register`
: null;