#pragma once
#include <vector>
#include "gfx/dag_types.h"

namespace fn::gfx {

// Renders a small thumbnail per node that has preview_open == true, by binding
// the node's FBO and drawing the DAG shader with u_preview_target = step index.
// Each node's FBO is created lazily and keyed by editor_uid. The active GL
// program must be the one returned by compile_dag_to_glsl(pipeline).
//
// Pass the pipeline used to compile `program` so target indices match.
void dag_previews_render(const std::vector<DagStep>& pipeline,
                         unsigned program,
                         int width = 96, int height = 64);

// Returns the OpenGL texture id for the preview of `editor_uid`, or 0 if
// none exists. Use with ImGui::Image(). Call AFTER dag_previews_render so
// the texture has fresh contents.
unsigned dag_preview_texture(unsigned editor_uid);

// Free all preview FBOs. Call on shutdown.
void dag_previews_destroy();

} // namespace fn::gfx
