b093c898a8
Wave 1 de parallel-fix-issues integrada a master: - 0025: text_editor_cpp_core + file_watcher_cpp_core - 0026: gl_texture_load_cpp_gfx (vendor: stb_image v2.30) Ademas se commitea WIP previo de master que estaba sin commitear (cambios en shaders_lab, dag_*, framework, tokens, kpi_card, gl_loader.md, etc.) para dejar HEAD buildable. Notas: - Algunos deps del gallery (button.cpp, toolbar.cpp, modal_dialog.cpp...) siguen UNTRACKED — gating con FN_BUILD_GALLERY=ON (default OFF) para que master build (sin flag) no los necesite. - Build OK con y sin flag. fn index registra 904 functions. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
39 lines
1.3 KiB
C++
39 lines
1.3 KiB
C++
#include "gfx/dag_uniforms.h"
|
|
#include "gfx/dag_compile.h"
|
|
#include "gfx/dag_catalog.h"
|
|
#include "gfx/gl_loader.h"
|
|
#include <algorithm>
|
|
#include <cstring>
|
|
|
|
namespace fn::gfx {
|
|
|
|
static constexpr int MAX_PARAM_VEC4S = 64;
|
|
|
|
void dag_uniforms_apply(const std::vector<DagStep>& pipeline, unsigned int program) {
|
|
float data[MAX_PARAM_VEC4S * 4];
|
|
std::memset(data, 0, sizeof(data));
|
|
|
|
std::vector<int> base = dag_param_layout(pipeline);
|
|
|
|
for (size_t i = 0; i < pipeline.size(); ++i) {
|
|
const DagStep& step = pipeline[i];
|
|
const DagNodeDef* def = dag_find(step.name);
|
|
if (!def) continue;
|
|
int pc = static_cast<int>(def->param_defaults.size());
|
|
int b = base[i] * 4;
|
|
for (int k = 0; k < pc && b + k < MAX_PARAM_VEC4S * 4; ++k) {
|
|
data[b + k] = (k < static_cast<int>(step.params.size())) ? step.params[static_cast<size_t>(k)] : 0.0f;
|
|
}
|
|
}
|
|
|
|
GLint loc = glGetUniformLocation(program, "u_params");
|
|
if (loc >= 0) glUniform4fv(loc, MAX_PARAM_VEC4S, data);
|
|
|
|
// Default render path: ensure preview branch in the compiled DAG shader is
|
|
// disabled (per-node previews override this transiently in dag_previews_render).
|
|
GLint loc_pt = glGetUniformLocation(program, "u_preview_target");
|
|
if (loc_pt >= 0) glUniform1i(loc_pt, -1);
|
|
}
|
|
|
|
} // namespace fn::gfx
|