refactor: centralize fullscreen graph policy

Amp-Thread-ID: https://ampcode.com/threads/T-019f9d91-77c1-7206-a60f-ed6554ce92ab

Co-authored-by: Heaust Azure <heaust.azure@gmail.com>
This commit is contained in:
Amp
2026-07-28 13:45:10 +00:00
co-authored by heaust
parent edc7c8ef29
commit 67cf3a6555
11 changed files with 272 additions and 133 deletions
+2 -2
View File
@@ -172,7 +172,7 @@ export function adaptFxNodeSnapshot(raw, revision = 1) {
if (
!exactKeys(n, nodeKeys) ||
n.known !== true ||
n.typeVersion !== 1 ||
n.typeVersion !== descriptor.version ||
typeof n.muted !== "boolean" ||
typeof n.collapsed !== "boolean" ||
typeof n.label !== "string" ||
@@ -340,7 +340,7 @@ export function adaptFxNodeSnapshot(raw, revision = 1) {
value: {
id: n.id,
state: n.muted ? "muted" : "enabled",
executor: { key: n.typeId, version: 1 },
executor: { key: n.typeId, version: descriptor.version },
parameters,
inputs: {},
},
+15 -2
View File
@@ -25,6 +25,7 @@ const texture = {
};
export const semanticCatalog = Object.freeze({
mesh: {
version: 1,
execution: "source",
inputs: {},
outputs: {
@@ -39,6 +40,7 @@ export const semanticCatalog = Object.freeze({
parameters: {},
},
texture: {
version: 1,
execution: "source",
inputs: {},
outputs: { texture: o("texture") },
@@ -60,6 +62,7 @@ export const semanticCatalog = Object.freeze({
},
},
frustum_cull: {
version: 1,
execution: "compute",
inputs: {
mesh: i("mesh_data"),
@@ -74,6 +77,7 @@ export const semanticCatalog = Object.freeze({
parameters: { cameraSelection: "active" },
},
mesh_query: {
version: 1,
execution: "compute",
inputs: {
mesh: i("mesh_data"),
@@ -87,12 +91,14 @@ export const semanticCatalog = Object.freeze({
},
},
pipeline_registry: {
version: 1,
execution: "cpu_preparation",
inputs: { pipelineIndices: i("pipeline_index_stream") },
outputs: { activation: o("pipeline_activation") },
parameters: {},
},
pipeline: {
version: 1,
execution: "render",
inputs: {
mesh: i("mesh_data"),
@@ -105,6 +111,7 @@ export const semanticCatalog = Object.freeze({
parameters: { pipeline: "gltf_standard", depthCompare: "less_equal", depthWriteEnabled: true, clearDepth: 1, clearColor: [0.015, 0.02, 0.03, 1] },
},
fullscreen_copy: {
version: 1,
execution: "render",
inputs: {
source: i("texture"),
@@ -114,6 +121,7 @@ export const semanticCatalog = Object.freeze({
parameters: {},
},
tone_map: {
version: 1,
execution: "render",
inputs: {
source: i("texture"),
@@ -123,6 +131,7 @@ export const semanticCatalog = Object.freeze({
parameters: { exposure: 1 },
},
bloom_extract: {
version: 1,
execution: "render",
inputs: {
source: i("texture"),
@@ -132,6 +141,7 @@ export const semanticCatalog = Object.freeze({
parameters: { threshold: 1, knee: 0.5 },
},
bloom_blur: {
version: 1,
execution: "render",
inputs: {
source: i("texture"),
@@ -141,6 +151,7 @@ export const semanticCatalog = Object.freeze({
parameters: { direction: [1, 0], radius: 1 },
},
bloom_composite: {
version: 1,
execution: "render",
inputs: {
source: i("texture"),
@@ -151,6 +162,7 @@ export const semanticCatalog = Object.freeze({
parameters: { intensity: 1 },
},
luminance_edge: {
version: 1,
execution: "render",
inputs: {
source: i("texture"),
@@ -160,6 +172,7 @@ export const semanticCatalog = Object.freeze({
parameters: { strength: 2 },
},
frame_out: {
version: 1,
execution: "frame",
inputs: { color: i("texture") },
outputs: {},
@@ -390,7 +403,7 @@ export const nodeDefinitions = Object.fromEntries(
return [
key,
{
version: 1,
version: c.version,
title: key.replaceAll("_", " "),
behavior: "standard",
style: c.execution,
@@ -427,7 +440,7 @@ export const descriptors = Object.fromEntries(
Object.entries(semanticCatalog).map(([key, c]) => [
key,
{
version: 1,
version: c.version,
inputs: c.inputs,
outputs: c.outputs,
parameters: c.parameters,
+3 -1
View File
@@ -1,6 +1,8 @@
import { descriptors } from "./catalog.js";
const input = (node, socket) => ({ node, socket });
const node = (id, key, parameters = {}, inputs = {}) => ({
id, state: "enabled", executor: { key, version: 1 }, parameters, inputs,
id, state: "enabled", executor: { key, version: descriptors[key].version }, parameters, inputs,
});
const texture = (format, scale = 1) => ({
texture: {