Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions benchmark/src/benchmark_frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ void render_benchmark_frame(
adjusted_reserved_height,
params.adjusted_preview_height,
false, // show_info
ctx.render_config.skip_gl_calls, // skip_gl
ctx.render_config.dark_mode, // dark_mode
&ctx.render_config
};
}();
Expand Down
2 changes: 0 additions & 2 deletions include/vnm_plot/core/algo.h
Original file line number Diff line number Diff line change
Expand Up @@ -374,13 +374,11 @@ std::size_t upper_bound_timestamp(

inline std::size_t choose_lod_level(
const std::vector<std::size_t>& scales,
std::size_t current_level,
double base_pps)
{
if (scales.empty() || !(base_pps > 0.0)) {
return 0;
}
(void)current_level;

constexpr double target_pps = 1.0;
std::size_t best_level = 0;
Expand Down
3 changes: 0 additions & 3 deletions include/vnm_plot/core/asset_loader.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,6 @@ class Asset_loader
// If set, assets will first be searched in this directory.
void set_override_directory(std::string_view path);

// Get the override directory (empty if not set)
[[nodiscard]] std::string_view override_directory() const noexcept;

// Register an embedded asset
// The data must remain valid for the lifetime of the Asset_loader.
void register_embedded(std::string_view name, std::string_view data);
Expand Down
4 changes: 0 additions & 4 deletions include/vnm_plot/core/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ namespace detail {
constexpr float k_v_label_horizontal_padding_px = 6.0f;

// Grid & preview metrics
constexpr float k_grid_line_half_px = 0.7f;
constexpr float k_cell_span_min_factor = 0.1f;
constexpr float k_cell_span_max_factor = 6.0f;

Expand All @@ -28,7 +27,6 @@ constexpr float k_hit_test_px = 1.0f;

// Grid appearance
constexpr float k_grid_line_alpha_base = 0.75f;
constexpr int k_max_grid_levels = 32;

// Value formatting
constexpr int k_value_decimals = 3;
Expand All @@ -50,8 +48,6 @@ constexpr double k_default_font_px = 10.0;
constexpr double k_default_base_label_height_px = 14.0;

// Internal constants
constexpr int k_drawn_x_reserve = 512;
constexpr int k_index_growth_step = 2;
constexpr double k_vbar_width_change_threshold_d = 0.5;
constexpr double k_vbar_min_width_px_d = 1.0;
constexpr int k_rect_initial_quads = 256;
Expand Down
41 changes: 0 additions & 41 deletions include/vnm_plot/core/function_sample.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ struct function_sample_t
y_min(y_min_),
y_max(y_max_)
{}

double timestamp() const { return x; }
};
#pragma pack(pop)

Expand Down Expand Up @@ -76,40 +74,6 @@ class Function_data_source : public Vector_data_source<function_sample_t>
set_data(std::move(samples));
}

// Generate with range (for band/envelope display)
void generate_with_range(
Function fn_value,
Function fn_min,
Function fn_max,
double x_min,
double x_max,
size_t num_samples)
{
if (num_samples < 2) {
num_samples = 2;
}

std::vector<function_sample_t> samples;
samples.reserve(num_samples);

const double step = (x_max - x_min) / static_cast<double>(num_samples - 1);

for (size_t i = 0; i < num_samples; ++i) {
double x = x_min + i * step;
float y = fn_value(x);
float y_lo = fn_min(x);
float y_hi = fn_max(x);

// Handle NaN/Inf
if (!std::isfinite(y)) { y = 0.0f; }
if (!std::isfinite(y_lo)) { y_lo = y; }
if (!std::isfinite(y_hi)) { y_hi = y; }

samples.emplace_back(x, y, y_lo, y_hi);
}

set_data(std::move(samples));
}
};

// -----------------------------------------------------------------------------
Expand Down Expand Up @@ -142,9 +106,4 @@ inline Data_access_policy_typed<function_sample_t> make_function_sample_policy_t
return policy;
}

inline Data_access_policy make_function_sample_policy()
{
return make_function_sample_policy_typed().erase();
}

} // namespace vnm::plot
5 changes: 1 addition & 4 deletions include/vnm_plot/core/layout_calculator.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@
#include <vector>

namespace vnm::plot {
class Profiler;
}

namespace vnm::plot {
class Profiler;

// -----------------------------------------------------------------------------
// Layout Calculator
Expand Down Expand Up @@ -78,7 +76,6 @@ class Layout_calculator
int vertical_seed_index = -1;
double vertical_seed_step = 0.0;
double vertical_finest_step = 0.0;
double horizontal_finest_step = 0.0;
int horizontal_seed_index = -1;
double horizontal_seed_step = 0.0;
};
Expand Down
26 changes: 9 additions & 17 deletions include/vnm_plot/core/range_cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,29 +81,21 @@ bool validate_range_cache_impl(
inline bool validate_range_cache_sequences(
const std::map<int, std::shared_ptr<const series_data_t>>& series_map,
std::unordered_map<int, series_minmax_cache_t>& cache_map,
Auto_v_range_mode auto_mode)
Auto_v_range_mode auto_mode,
bool preview = false)
{
return validate_range_cache_impl(series_map, cache_map, auto_mode,
[](const series_data_t& s)
[preview](const series_data_t& s)
-> std::pair<Data_source*, const Data_access_policy*> {
if (preview) {
if (s.preview_matches_main()) return {nullptr, nullptr};
Data_source* src = s.preview_source();
if (!src) return {nullptr, nullptr};
return {src, &s.preview_access()};
}
if (!s.data_source) return {nullptr, nullptr};
return {s.data_source.get(), &s.access};
});
}

inline bool validate_preview_range_cache_sequences(
const std::map<int, std::shared_ptr<const series_data_t>>& series_map,
std::unordered_map<int, series_minmax_cache_t>& cache_map,
Auto_v_range_mode auto_mode)
{
return validate_range_cache_impl(series_map, cache_map, auto_mode,
[](const series_data_t& s)
-> std::pair<Data_source*, const Data_access_policy*> {
if (s.preview_matches_main()) return {nullptr, nullptr};
Data_source* src = s.preview_source();
if (!src) return {nullptr, nullptr};
return {src, &s.preview_access()};
});
}

} // namespace vnm::plot
10 changes: 0 additions & 10 deletions include/vnm_plot/core/series_renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#include "gl_program.h"
#include "types.h"

#include <atomic>
#include <cstddef>
#include <cstdint>
#include <limits>
Expand Down Expand Up @@ -45,14 +44,6 @@ class Series_renderer
const std::map<int, std::shared_ptr<const series_data_t>>& series);

private:
struct metrics_t
{
std::atomic<uint64_t> bytes_uploaded{0};
std::atomic<uint64_t> bytes_allocated{0};
std::atomic<uint64_t> vbo_reallocations{0};
std::atomic<uint64_t> snapshot_failures{0};
};

struct vbo_view_state_t
{
GLuint id = UINT_MAX;
Expand Down Expand Up @@ -157,7 +148,6 @@ class Series_renderer
std::unique_ptr<series_pipe_t> m_pipe_area;
std::unique_ptr<series_pipe_t> m_pipe_colormap;

metrics_t m_metrics;
uint64_t m_frame_id = 0; // Monotonic frame counter for snapshot caching

std::shared_ptr<GL_program> get_or_load_shader(
Expand Down
30 changes: 2 additions & 28 deletions include/vnm_plot/core/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,6 @@ struct Size_2i
{
return width == other.width && height == other.height;
}

[[nodiscard]] constexpr bool operator!=(const Size_2i& other) const noexcept
{
return !(*this == other);
}
};

// -----------------------------------------------------------------------------
Expand Down Expand Up @@ -466,18 +461,6 @@ struct series_data_t
return access;
}

void set_preview_source(std::shared_ptr<Data_source> source)
{
ensure_preview_config();
preview_config->data_source.set(std::move(source));
}

void set_preview_source_ref(Data_source& source)
{
ensure_preview_config();
preview_config->data_source.set_ref(source);
}

// Preview style (falls back to main when unset).
Display_style effective_preview_style() const
{
Expand All @@ -502,13 +485,6 @@ struct series_data_t
&& effective_preview_style() == style;
}

private:
void ensure_preview_config()
{
if (!preview_config) {
preview_config = preview_config_t{};
}
}
};

// -----------------------------------------------------------------------------
Expand Down Expand Up @@ -591,10 +567,6 @@ struct layout_cache_key_t
font_metrics_key == other.font_metrics_key;
}

[[nodiscard]] bool operator!=(const layout_cache_key_t& other) const noexcept
{
return !(*this == other);
}
};

class Layout_cache
Expand Down Expand Up @@ -653,6 +625,8 @@ struct frame_context_t
double adjusted_preview_height = 0.0;

bool show_info = false;
bool skip_gl = false;
bool dark_mode = false;

const Plot_config* config = nullptr;
};
Expand Down
Loading