feat(shaders_lab): DAG pipeline mode with node catalog
- cpp/functions/gfx/dag_types: DagStep, DagNodeDef, DagControl (header-only) - cpp/functions/gfx/dag_catalog: 10 hardcoded nodes (4 gen, 3 op, 3 blend) ported from shader-dag-blends.jsx - cpp/functions/gfx/dag_compile: pipeline → GLSL 330 core with fan-in via source_id - cpp/functions/gfx/dag_uniforms: upload u_params[16] via glUniform4fv - cpp/functions/gfx/dag_panel: ImGui pipeline editor (add/remove/reorder/controls) - main.cpp: Code/DAG mode toggle, per-mode compile path and uniforms - gl_loader: +glUniform4fv - rebuild Windows .exe Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
---
|
||||
name: dag_types
|
||||
lang: cpp
|
||||
domain: gfx
|
||||
version: "1.0.0"
|
||||
algebraic: product
|
||||
definition: |
|
||||
enum class DagKind { Gen, Op, Blend };
|
||||
|
||||
struct DagControl {
|
||||
enum class Kind { Slider, XY, Color };
|
||||
Kind kind;
|
||||
std::string label;
|
||||
std::array<int, 3> param_idx{-1, -1, -1};
|
||||
float min = 0.0f;
|
||||
float max = 1.0f;
|
||||
float step = 0.0f;
|
||||
};
|
||||
|
||||
struct DagNodeDef {
|
||||
std::string name;
|
||||
std::string label;
|
||||
std::string desc;
|
||||
DagKind kind = DagKind::Gen;
|
||||
std::array<std::string, 4> param_names{"", "", "", ""};
|
||||
std::array<float, 4> param_defaults{0, 0, 0, 0};
|
||||
std::vector<DagControl> controls;
|
||||
std::function<std::string(int idx)> body_glsl;
|
||||
};
|
||||
|
||||
struct DagStep {
|
||||
std::string id;
|
||||
std::string name;
|
||||
std::array<float, 4> params{0, 0, 0, 0};
|
||||
std::string source_id;
|
||||
};
|
||||
description: "Tipos del DAG de shaders: DagKind (gen/op/blend), DagControl (descriptor de widget UI), DagNodeDef (entrada del catalogo de nodos con body GLSL), DagStep (paso del pipeline con params y source_id estable ante reorders)."
|
||||
tags: [dag, shader, gfx, pipeline, nodes, types]
|
||||
uses_types: []
|
||||
file_path: "cpp/functions/gfx/dag_types.h"
|
||||
---
|
||||
|
||||
## Notas
|
||||
|
||||
Header-only. DagNodeDef::body_glsl es un callable que recibe el indice del nodo en el pipeline y devuelve el cuerpo GLSL de la funcion (sin llaves). DagStep::source_id es el id estable del paso fuente para blends; sobrevive a reordenamientos del pipeline porque referencia por id, no por indice.
|
||||
Reference in New Issue
Block a user