Files
fn_registry/cpp/functions/gfx/dag_uniforms.cpp
T
egutierrez 5d83c11169 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>
2026-04-24 21:15:21 +02:00

28 lines
819 B
C++

#include "gfx/dag_uniforms.h"
#include "gfx/gl_loader.h"
#include <algorithm>
#include <cstring>
namespace fn::gfx {
static constexpr int MAX_NODES = 16;
void dag_uniforms_apply(const std::vector<DagStep>& pipeline, unsigned int program) {
float data[MAX_NODES * 4];
std::memset(data, 0, sizeof(data));
const int n = static_cast<int>(std::min(pipeline.size(), static_cast<size_t>(MAX_NODES)));
for (int i = 0; i < n; ++i) {
const auto& step = pipeline[static_cast<size_t>(i)];
data[i * 4 + 0] = step.params[0];
data[i * 4 + 1] = step.params[1];
data[i * 4 + 2] = step.params[2];
data[i * 4 + 3] = step.params[3];
}
GLint loc = glGetUniformLocation(program, "u_params");
if (loc >= 0) glUniform4fv(loc, MAX_NODES, data);
}
} // namespace fn::gfx