ngscopeclient v0.2.2
Loading...
Searching...
No Matches
WaveformArea.h
Go to the documentation of this file.
1/***********************************************************************************************************************
2* *
3* ngscopeclient *
4* *
5* Copyright (c) 2012-2026 Andrew D. Zonenberg and contributors *
6* All rights reserved. *
7* *
8* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
9* following conditions are met: *
10* *
11* * Redistributions of source code must retain the above copyright notice, this list of conditions, and the *
12* following disclaimer. *
13* *
14* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the *
15* following disclaimer in the documentation and/or other materials provided with the distribution. *
16* *
17* * Neither the name of the author nor the names of any contributors may be used to endorse or promote products *
18* derived from this software without specific prior written permission. *
19* *
20* THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
21* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL *
22* THE AUTHORS BE HELD LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
23* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR *
24* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
25* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
26* POSSIBILITY OF SUCH DAMAGE. *
27* *
28***********************************************************************************************************************/
29
35#ifndef WaveformArea_h
36#define WaveformArea_h
37
38class WaveformArea;
39class WaveformGroup;
40class MainWindow;
41
42#include "TextureManager.h"
43#include "Marker.h"
44
46{
47public:
49 : m_red(channelColor.x)
50 , m_green(channelColor.y)
51 , m_blue(channelColor.z)
52 , m_width(w)
53 , m_height(h)
54 {}
55
56 float m_red;
57 float m_green;
58 float m_blue;
59 uint32_t m_width;
60 uint32_t m_height;
61};
62
64{
65public:
67 : m_width(w)
68 , m_height(h)
69 {}
70
71 uint32_t m_width;
72 uint32_t m_height;
73};
74
76{
77public:
79 : m_width(w)
80 , m_height(h)
81 {}
82
83 uint32_t m_width;
84 uint32_t m_height;
85};
86
88{
89public:
92 : m_width(w)
93 , m_height(h)
94 , m_outwidth(outwidth)
95 , m_outheight(outheight)
96 , m_offsetSamples(o)
97 , m_writeRow(p)
98 , m_xscale(x)
99 {}
100
101 uint32_t m_width;
102 uint32_t m_height;
103 uint32_t m_outwidth;
104 uint32_t m_outheight;
105 uint32_t m_offsetSamples;
106 uint32_t m_writeRow;
107 float m_xscale;
108};
109
111{
112public:
114 float x, int32_t yo, float y)
115 : m_width(w)
116 , m_height(h)
117 , m_outwidth(outwidth)
118 , m_outheight(outheight)
119 , m_xoff(xo)
120 , m_xscale(x)
121 , m_yoff(yo)
122 , m_yscale(y)
123 {}
124
125 uint32_t m_width;
126 uint32_t m_height;
127 uint32_t m_outwidth;
128 uint32_t m_outheight;
129 uint32_t m_xoff;
130 float m_xscale;
131 int32_t m_yoff;
132 float m_yscale;
133};
134
136{
137 int64_t innerXoff;
138 uint32_t windowHeight;
139 uint32_t windowWidth;
140 uint32_t memDepth;
141 uint32_t offset_samples;
142 float alpha;
143 float xoff;
144 float xscale;
145 float ybase;
146 float yscale;
147 float yoff;
148 float persistScale;
149};
150
152{
153public:
154 int64_t offset_samples;
155 float xscale;
156 uint32_t len;
157 uint32_t w;
158};
159
199
204{
205public:
207 virtual ~DisplayedChannel();
208
209 YAML::Node Serialize(IDTable& table) const;
210
211 std::string GetName()
212 { return m_sourceStream.GetName(); }
213
214 StreamDescriptor GetStream()
215 { return m_sourceStream; }
216
217 std::shared_ptr<Texture> GetTexture()
218 { return m_texture; }
219
220 void SetTexture(std::shared_ptr<Texture> tex)
221 { m_texture = tex; }
222
223 void PrepareToRasterize(size_t x, size_t y);
224
226
227 AcceleratorBuffer<float>& GetRasterizedWaveform()
228 { return m_rasterizedWaveform; }
229
234 { return m_rasterizedX; }
235
240 { return m_rasterizedY; }
241
246 std::shared_ptr<ComputePipeline> GetUniformAnalogPipeline()
247 {
248 if(m_uniformAnalogComputePipeline == nullptr)
249 {
250 std::string base = "shaders/waveform-compute.";
251 std::string suffix;
252 if(ZeroHoldFlagSet())
253 suffix += ".zerohold";
255 suffix += ".int64";
256 m_uniformAnalogComputePipeline = std::make_shared<ComputePipeline>(
257 base + "analog" + suffix + ".dense.spv", 2, sizeof(ConfigPushConstants));
258 }
259
261 }
262
267 std::shared_ptr<ComputePipeline> GetHistogramPipeline()
268 {
269 if(m_histogramComputePipeline == nullptr)
270 {
271 std::string base = "shaders/waveform-compute.";
272 std::string suffix;
274 suffix += ".int64";
275 m_histogramComputePipeline = std::make_shared<ComputePipeline>(
276 base + "histogram" + suffix + ".dense.spv", 2, sizeof(ConfigPushConstants));
277 }
278
280 }
281
286 std::shared_ptr<ComputePipeline> GetSparseAnalogPipeline()
287 {
288 if(m_sparseAnalogComputePipeline == nullptr)
289 {
290 std::string base = "shaders/waveform-compute.";
291 std::string suffix;
292 int durationSSBOs = 0;
293 if(ZeroHoldFlagSet())
294 {
295 suffix += ".zerohold";
297 }
299 suffix += ".int64";
300 m_sparseAnalogComputePipeline = std::make_shared<ComputePipeline>(
301 base + "analog" + suffix + ".spv", durationSSBOs + 4, sizeof(ConfigPushConstants));
302 }
303
305 }
306
311 std::shared_ptr<ComputePipeline> GetUniformDigitalPipeline()
312 {
314 {
315 std::string base = "shaders/waveform-compute.";
316 std::string suffix;
318 suffix += ".int64";
319 m_uniformDigitalComputePipeline = std::make_shared<ComputePipeline>(
320 base + "digital" + suffix + ".dense.spv", 2, sizeof(ConfigPushConstants));
321 }
322
324 }
325
330 std::shared_ptr<ComputePipeline> GetSparseDigitalPipeline()
331 {
332 if(m_sparseDigitalComputePipeline == nullptr)
333 {
334 std::string base = "shaders/waveform-compute.";
335 std::string suffix;
336 int durationSSBOs = 0; //TODO: support gaps
338 suffix += ".int64";
339 m_sparseDigitalComputePipeline = std::make_shared<ComputePipeline>(
340 base + "digital" + suffix + ".spv", durationSSBOs + 4, sizeof(ConfigPushConstants));
341 }
342
344 }
345
346 std::shared_ptr<ComputePipeline> GetToneMapPipeline()
347 { return m_toneMapPipe; }
348
349 std::shared_ptr<ComputePipeline> GetIndexSearchPipeline()
351
352 bool ZeroHoldFlagSet()
353 {
354 return m_sourceStream.GetFlags() & Stream::STREAM_DO_NOT_INTERPOLATE;
355 // TODO: Allow this to be overridden by a configuration option in the WaveformArea
356 }
357
358 bool IsDensePacked()
359 {
360 auto data = m_sourceStream.GetData();
361 if(dynamic_cast<UniformWaveformBase*>(data) != nullptr)
362 return true;
363 else
364 return false;
365 }
366
367 bool ShouldFillUnder()
368 { return m_sourceStream.GetFlags() & Stream::STREAM_FILL_UNDER; }
369
370 bool ZeroHoldCursorBehaviour()
371 {
372 return ZeroHoldFlagSet();
373 }
374
375 bool ShouldMapDurations()
376 {
377 return ZeroHoldFlagSet() && !IsDensePacked();
378 // Do not need durations if dense because each duration is "1"
379 }
380
381 bool IsPersistenceEnabled()
382 { return m_persistenceEnabled; }
383
384 void SetPersistenceEnabled(bool b)
386
387 AcceleratorBuffer<uint32_t>& GetIndexBuffer()
388 { return m_indexBuffer; }
389
390 void SetYButtonPos(float y)
391 { m_yButtonPos = y; }
392
393 float GetYButtonPos()
394 { return m_yButtonPos; }
395
397 std::vector<PeakLabel> m_peakLabels;
398
399 std::string m_colorRamp;
400
401protected:
402
405
408
411
414
417
419 std::shared_ptr<Texture> m_texture;
420
422 size_t m_cachedX;
423
425 size_t m_cachedY;
426
429
431 std::shared_ptr<ComputePipeline> m_toneMapPipe;
432
434 std::shared_ptr<ComputePipeline> m_uniformAnalogComputePipeline;
435
437 std::shared_ptr<ComputePipeline> m_histogramComputePipeline;
438
440 std::shared_ptr<ComputePipeline> m_sparseAnalogComputePipeline;
441
443 std::shared_ptr<ComputePipeline> m_uniformDigitalComputePipeline;
444
446 std::shared_ptr<ComputePipeline> m_sparseDigitalComputePipeline;
447
449 std::shared_ptr<ComputePipeline> m_indexSearchComputePipeline;
450
453
454 std::unique_ptr<vk::raii::CommandPool> m_utilCmdPool;
455 std::unique_ptr<vk::raii::CommandBuffer> m_utilCmdBuffer;
456};
457
463class WaveformArea : public SinkNode
464{
465public:
466 WaveformArea(StreamDescriptor stream, std::shared_ptr<WaveformGroup> group, MainWindow* parent);
467 virtual ~WaveformArea();
468
469 bool Render(int iArea, int numAreas, ImVec2 clientArea);
471 vk::raii::CommandBuffer& cmdbuf,
472 std::vector<std::shared_ptr<InputDescriptor> >& channels,
473 bool clearPersistence);
475 void ToneMapAllWaveforms(vk::raii::CommandBuffer& cmdbuf, std::vector<vk::ImageMemoryBarrier>& barriers);
476
477 size_t GetStreamCount()
478 { return m_inputs.size(); }
479
480 StreamDescriptor GetStream(size_t i)
481 {
482 auto s = GetDisplayedChannel(i);
483 if(s)
484 return s->GetStream();
485 else
486 return nullptr; //should never happen
487 }
488
489 std::shared_ptr<DisplayedChannel> GetDisplayedChannel(size_t i)
490 { return std::dynamic_pointer_cast<DisplayedChannel>(m_inputs[i]); }
491
493
494 void AddStream(StreamDescriptor desc, bool persistence = false, const std::string& ramp = "eye-gradient-viridis");
495 void AddStream(StreamDescriptor desc, size_t position, bool persistence = false, const std::string& ramp = "eye-gradient-viridis");
496
498
500
501 virtual void RemoveStream(size_t i) override;
502
503 void ClearPersistence();
505
508
509 void AutofitVertical();
510
514 std::shared_ptr<WaveformGroup> GetGroup()
515 { return m_group; }
516
518
519 void SerializeConfiguration(YAML::Node& node);
520 virtual YAML::Node SerializeConfiguration(IDTable& table) override;
521 void LoadConfiguration(YAML::Node& node);
522
523 bool IsMouseOverYCursor(int iCursor, bool ignoreCursorsPlacedThisFrame);
524
525 bool IsMouseOverAnyYCursor(bool ignoreCursorsPlacedThisFrame)
526 {
527 return IsMouseOverYCursor(0, ignoreCursorsPlacedThisFrame) ||
528 IsMouseOverYCursor(1, ignoreCursorsPlacedThisFrame);
529 }
530
531protected:
533
534 virtual void CreateInput(const std::string& name) override;
535 virtual std::shared_ptr<DisplayedChannel> CreateInput(StreamDescriptor stream, Session& session);
536
537 void ChannelButton(std::shared_ptr<DisplayedChannel> chan, size_t index);
538 void RenderBackgroundGradient(ImVec2 start, ImVec2 size);
539 void RenderGrid(ImVec2 start, ImVec2 size, std::map<float, float>& gridmap, float& vbot, float& vtop);
540 void RenderYAxis(ImVec2 size, std::map<float, float>& gridmap, float vbot, float vtop);
541 void RenderTriggerLevelArrows(ImVec2 start, ImVec2 size);
542 void RenderBERLevelArrows(ImVec2 start, ImVec2 size);
543 void RenderCursors(ImVec2 start, ImVec2 size);
544 void RenderYAxisCursors(ImVec2 pos, ImVec2 size, float yAxisWidth);
545 void RenderBERSamplingPoint(ImVec2 start, ImVec2 size);
546 void CheckForScaleMismatch(ImVec2 start, ImVec2 size);
547 void RenderEyePatternTooltip(ImVec2 start, ImVec2 size);
548 void RenderWaveforms(ImVec2 start, ImVec2 size);
549 void RenderAnalogWaveform(std::shared_ptr<DisplayedChannel> channel, ImVec2 start, ImVec2 size);
550 void RenderEyeWaveform(std::shared_ptr<DisplayedChannel> channel, ImVec2 start, ImVec2 size);
551 void RenderConstellationWaveform(std::shared_ptr<DisplayedChannel> channel, ImVec2 start, ImVec2 size);
552 void RenderWaterfallWaveform(std::shared_ptr<DisplayedChannel> channel, ImVec2 start, ImVec2 size);
553 void RenderSpectrogramWaveform(std::shared_ptr<DisplayedChannel> channel, ImVec2 start, ImVec2 size);
554 void RenderSpectrumPeaks(ImDrawList* list, std::shared_ptr<DisplayedChannel> channel);
555 void RenderDigitalWaveform(std::shared_ptr<DisplayedChannel> channel, ImVec2 start, ImVec2 size);
556 void RenderProtocolWaveform(std::shared_ptr<DisplayedChannel> channel, ImVec2 start, ImVec2 size);
557 void RenderDigitalBusWaveform(std::shared_ptr<DisplayedChannel> channel, ImVec2 start, ImVec2 size);
558
559 template<class T>
560 void RenderUniformDigitalBusWaveform(std::shared_ptr<DisplayedChannel> channel, T* data, ImVec2 start, ImVec2 size);
561
562 void RenderComplexSignal(
564 int visleft, int visright,
565 float xstart, float xend, float xoff,
566 float ybot, float ymid, float ytop,
567 std::string str,
568 ImU32 color);
569 void MakePathSignalBody(ImDrawList* list, float xstart, float xend, float ybot, float ymid, float ytop);
571 std::shared_ptr<DisplayedChannel> channel,
572 vk::raii::CommandBuffer& cmdbuf,
573 std::vector<vk::ImageMemoryBarrier>& barriers);
575 std::shared_ptr<DisplayedChannel> channel,
576 vk::raii::CommandBuffer& cmdbuf,
577 std::vector<vk::ImageMemoryBarrier>& barriers);
579 std::shared_ptr<DisplayedChannel> channel,
580 vk::raii::CommandBuffer& cmdbuf,
581 std::vector<vk::ImageMemoryBarrier>& barriers);
583 std::shared_ptr<DisplayedChannel> channel,
584 vk::raii::CommandBuffer& cmdbuf,
585 std::vector<vk::ImageMemoryBarrier>& barriers);
587 std::shared_ptr<DisplayedChannel> channel,
588 vk::raii::CommandBuffer& cmdbuf,
589 std::vector<vk::ImageMemoryBarrier>& barriers);
590 void RasterizeAnalogOrDigitalWaveform(
591 std::shared_ptr<DisplayedChannel> channel,
592 vk::raii::CommandBuffer& cmdbuf,
593 bool clearPersistence);
594 void PlotContextMenu();
595
601
602 void DrawDropScalarMessage(ImDrawList* list, ImVec2 center);
603
604 void DragDropOverlays(ImVec2 start, ImVec2 size, int iArea, int numAreas);
606 bool EdgeDropArea(const std::string& name, ImVec2 start, ImVec2 size, ImGuiDir splitDir);
607 void CenterDropArea(ImVec2 start, ImVec2 size);
608
609 void FilterMenu(std::shared_ptr<DisplayedChannel> chan);
610 void FilterSubmenu(std::shared_ptr<DisplayedChannel> chan, const std::string& name, Filter::Category cat);
611
612 float PixelsToYAxisUnits(float pix);
613 float YAxisUnitsToPixels(float volt);
614 float YAxisUnitsToYPosition(float volt);
615 float YPositionToYAxisUnits(float y);
616 float PickStepSize(float volts_per_half_span, int min_steps = 2, int max_steps = 5);
617
618public:
624
625 Unit GetYAxisUnit()
626 { return m_yAxisUnit; }
627
635
636protected:
638 float m_width;
639
641 float m_height;
642
645
647 float m_ymid;
648
651
654
657 {
658 DRAG_STATE_NONE,
659 DRAG_STATE_CHANNEL,
660 DRAG_STATE_CHANNEL_LAST,
661 DRAG_STATE_Y_AXIS,
662 DRAG_STATE_TRIGGER_LEVEL,
663 DRAG_STATE_TRIGGER_SECONDARY_LEVEL,
664 DRAG_STATE_BER_LEVEL,
665 DRAG_STATE_BER_BOTH,
666 DRAG_STATE_PEAK_MARKER,
667 DRAG_STATE_Y_CURSOR0,
668 DRAG_STATE_Y_CURSOR1
669 } m_dragState;
670
673
674 void OnMouseWheelPlotArea(float delta, float delta_h);
675 void OnMouseWheelYAxis(float delta);
676 void OnMouseUp();
677 void OnDragUpdate();
678
680 std::shared_ptr<WaveformGroup> m_group;
681
684
687
690
693
696
699
702
705
707 std::vector<std::shared_ptr<InputDescriptor> > m_channelsToRemove;
708
711
713 std::atomic<bool> m_clearPersistence;
714
717
720
723
725
728
731 {
732 Y_CURSOR_NONE,
733 Y_CURSOR_SINGLE,
734 Y_CURSOR_DUAL
735 };
736
739
742
743 void DoCursor(int iCursor, DragState state);
744
747};
748
749typedef std::pair<WaveformArea*, size_t> DragDescriptor;
750
751#endif
752
753
Declaration of Marker.
Declaration of TextureManager.
Definition AcceleratorBuffer.h:204
A pattern checker channel of a BERT.
Definition BERTInputChannel.h:51
Definition WaveformArea.h:76
Context data for a single channel being displayed within a WaveformArea.
Definition WaveformArea.h:204
std::shared_ptr< ComputePipeline > m_sparseAnalogComputePipeline
Compute pipeline for rendering sparse analog waveforms.
Definition WaveformArea.h:440
size_t GetRasterizedY()
Return the Y axis size of the rasterized waveform.
Definition WaveformArea.h:239
bool UpdateSize(ImVec2 newSize, MainWindow *top)
Handles a change in size of the displayed waveform.
Definition WaveformArea.cpp:164
std::shared_ptr< ComputePipeline > m_histogramComputePipeline
Compute pipeline for rendering histogram waveforms.
Definition WaveformArea.h:437
size_t m_rasterizedX
X axis size of rasterized waveform.
Definition WaveformArea.h:413
Session & m_session
Parent session object.
Definition WaveformArea.h:404
std::shared_ptr< ComputePipeline > m_indexSearchComputePipeline
Compute pipeline for index searching.
Definition WaveformArea.h:449
size_t GetRasterizedX()
Return the X axis size of the rasterized waveform.
Definition WaveformArea.h:233
void PrepareToRasterize(size_t x, size_t y)
Prepares to rasterize the waveform at the specified resolution.
Definition WaveformArea.cpp:318
bool m_persistenceEnabled
Persistence enable flag.
Definition WaveformArea.h:428
__attribute__((noinline)) std
Gets the pipeline for drawing uniform analog waveforms, creating it if necessary.
Definition WaveformArea.h:245
float m_yButtonPos
Y axis position of our button within the view.
Definition WaveformArea.h:452
std::vector< PeakLabel > m_peakLabels
Active labels for peaks associated with the current waveform.
Definition WaveformArea.h:397
size_t m_cachedX
X axis size of the texture as of last UpdateSize() call.
Definition WaveformArea.h:422
std::shared_ptr< ComputePipeline > m_sparseDigitalComputePipeline
Compute pipeline for rendering sparse digital waveforms.
Definition WaveformArea.h:446
std::shared_ptr< ComputePipeline > m_toneMapPipe
Compute pipeline for tone mapping fp32 images to RGBA.
Definition WaveformArea.h:431
std::shared_ptr< ComputePipeline > m_uniformAnalogComputePipeline
Compute pipeline for rendering uniform analog waveforms.
Definition WaveformArea.h:434
AcceleratorBuffer< float > m_rasterizedWaveform
Buffer storing our rasterized waveform, prior to tone mapping.
Definition WaveformArea.h:407
size_t m_cachedY
Y axis size of the texture as of last UpdateSize() call.
Definition WaveformArea.h:425
size_t m_rasterizedY
Y axis size of rasterized waveform.
Definition WaveformArea.h:416
YAML::Node Serialize(IDTable &table) const
Serializes the configuration for this channel.
Definition WaveformArea.cpp:345
AcceleratorBuffer< uint32_t > m_indexBuffer
Buffer for X axis indexes (only used for sparse waveforms)
Definition WaveformArea.h:410
std::shared_ptr< Texture > m_texture
The texture storing our final rendered waveform.
Definition WaveformArea.h:419
std::shared_ptr< ComputePipeline > m_uniformDigitalComputePipeline
Compute pipeline for rendering uniform digital waveforms.
Definition WaveformArea.h:443
Definition WaveformArea.h:64
Category
Category the filter should be displayed under in the GUI.
Definition Filter.h:118
std::vector< std::shared_ptr< InputDescriptor > > m_inputs
Input ports.
Definition FlowGraphNode.h:247
Bidirectional table mapping integer IDs in scopesession files to object pointers.
Definition IDTable.h:49
Definition WaveformArea.h:152
StreamDescriptor m_sourceStream
The stream, if any, connected to this input port.
Definition StreamDescriptor.h:145
Top level application window.
Definition MainWindow.h:168
Definition ngscopeclient.h:83
A single channel on an oscilloscope.
Definition OscilloscopeChannel.h:49
A Session stores all of the instrument configuration and other state the user has open.
Definition Session.h:126
A sink node is a node in the filter graph that has no outputs.
Definition SinkNode.h:45
Definition WaveformArea.h:111
Descriptor for a single stream coming off a channel.
Definition StreamDescriptor.h:47
A timestamp, measured in seconds + femtoseconds.
Definition Marker.h:42
Abstract base class for oscilloscope / logic analyzer trigger inputs.
Definition Trigger.h:46
Base class for waveforms with data sampled at uniform intervals.
Definition Waveform.h:376
A unit of measurement, plus conversion to pretty-printed output.
Definition Unit.h:59
Definition WaveformArea.h:88
A WaveformArea is a plot that displays one or more OscilloscopeChannel's worth of data.
Definition WaveformArea.h:464
float m_yAxisCursorPositions[2]
Position of the Y axis cursor(s)
Definition WaveformArea.h:741
PeakLabel * m_dragPeakLabel
Peak label being dragged, if any.
Definition WaveformArea.h:719
bool Render(int iArea, int numAreas, ImVec2 clientArea)
Renders a waveform area.
Definition WaveformArea.cpp:763
void RenderConstellationWaveform(std::shared_ptr< DisplayedChannel > channel, ImVec2 start, ImVec2 size)
Renders a single constellation diagram.
Definition WaveformArea.cpp:1439
int64_t m_xAxisPosDuringDrag
Current X axis position during drag.
Definition WaveformArea.h:698
void CheckForScaleMismatch(ImVec2 start, ImVec2 size)
Look for mismatched vertical scales and display warning message.
Definition WaveformArea.cpp:3332
void DragDropOverlays(ImVec2 start, ImVec2 size, int iArea, int numAreas)
Drag-and-drop overlay areas.
Definition WaveformArea.cpp:3606
void RenderYAxisCursors(ImVec2 pos, ImVec2 size, float yAxisWidth)
Render horizontal cursors over the plot.
Definition WaveformArea.cpp:928
MainWindow * m_parent
Top level window object containing us.
Definition WaveformArea.h:683
bool m_mouseOverBERTarget
True if mouse is over the BER sampling location.
Definition WaveformArea.h:692
bool IsShowing(StreamDescriptor desc)
Checks if provided stream descriptor is already present in this waveform area.
Definition WaveformArea.cpp:4911
void OnMouseWheelYAxis(float delta)
Handles a mouse wheel scroll step on the Y axis.
Definition WaveformArea.cpp:4799
void FilterSubmenu(std::shared_ptr< DisplayedChannel > chan, const std::string &name, Filter::Category cat)
Run the submenu for a single filter category.
Definition WaveformArea.cpp:4503
StreamDescriptor GetFirstAnalogStream()
Returns the first analog stream displayed in this area.
Definition WaveformArea.cpp:584
void RenderWaterfallWaveform(std::shared_ptr< DisplayedChannel > channel, ImVec2 start, ImVec2 size)
Renders a single waterfall.
Definition WaveformArea.cpp:1309
void RenderDigitalWaveform(std::shared_ptr< DisplayedChannel > channel, ImVec2 start, ImVec2 size)
Renders a single digital waveform.
Definition WaveformArea.cpp:1804
void DrawDropRangeMismatchMessage(ImDrawList *list, ImVec2 center, StreamDescriptor ourStream, StreamDescriptor theirStream)
Display a warning message about mismatched vertical scale.
Definition WaveformArea.cpp:4187
void RenderTriggerLevelArrows(ImVec2 start, ImVec2 size)
Arrows pointing to trigger levels.
Definition WaveformArea.cpp:3418
bool IsChannelBeingDragged()
Returns true if a channel is currently being dragged.
Definition WaveformArea.cpp:742
StreamDescriptor GetFirstDensityFunctionStream()
Returns the first density plot displayed in this area.
Definition WaveformArea.cpp:660
void OnMouseWheelPlotArea(float delta, float delta_h)
Handles a mouse wheel scroll step on the plot area.
Definition WaveformArea.cpp:4757
bool CenterRightDropArea(ImVec2 start, ImVec2 size, ImGuiDir direction)
Drop area for the middle of the plot.
Definition WaveformArea.cpp:3994
void DoCursor(int iCursor, DragState state)
Run interaction processing for dragging a Y axis cursor.
Definition WaveformArea.cpp:1095
Trigger * m_triggerDuringDrag
The trigger we're configuring.
Definition WaveformArea.h:701
void ClearPersistenceOfChannel(OscilloscopeChannel *chan)
Clear persistence iff we are displaying the specified channel.
Definition WaveformArea.cpp:4570
void RenderYAxis(ImVec2 size, std::map< float, float > &gridmap, float vbot, float vtop)
Renders the Y axis scale.
Definition WaveformArea.cpp:3018
StreamDescriptor GetFirstConstellationStream()
Returns the first constellation diagram displayed in this area.
Definition WaveformArea.cpp:643
void ToneMapAllWaveforms(vk::raii::CommandBuffer &cmdbuf, std::vector< vk::ImageMemoryBarrier > &barriers)
Tone map our waveforms.
Definition WaveformArea.cpp:2283
YAxisCursorMode m_yAxisCursorMode
Currently selected state of the Y axis cursor(s)
Definition WaveformArea.h:738
void RenderEyeWaveform(std::shared_ptr< DisplayedChannel > channel, ImVec2 start, ImVec2 size)
Renders a single eye pattern.
Definition WaveformArea.cpp:1361
StreamDescriptor GetFirstAnalogOrDensityStream()
Returns the first analog, spectrogram or eye pattern stream displayed in this area.
Definition WaveformArea.cpp:603
void ChannelButton(std::shared_ptr< DisplayedChannel > chan, size_t index)
Handles a button for a channel.
Definition WaveformArea.cpp:4241
void RenderProtocolWaveform(std::shared_ptr< DisplayedChannel > channel, ImVec2 start, ImVec2 size)
Renders a single protocol waveform (assume it's sparse)
Definition WaveformArea.cpp:1836
void CenterDropArea(ImVec2 start, ImVec2 size)
Main drop area used to drop a stream in this waveform area at a given position.
Definition WaveformArea.cpp:3830
void PlotContextMenu()
Run the context menu for the main plot area.
Definition WaveformArea.cpp:1126
StreamDescriptor GetFirstEyeStream()
Returns the first eye pattern displayed in this area.
Definition WaveformArea.cpp:626
std::shared_ptr< WaveformGroup > m_group
Waveform group containing us.
Definition WaveformArea.h:680
bool m_mouseOverTriggerArrow
True if mouse is over a trigger level arrow.
Definition WaveformArea.h:689
void ToneMapWaterfallWaveform(std::shared_ptr< DisplayedChannel > channel, vk::raii::CommandBuffer &cmdbuf, std::vector< vk::ImageMemoryBarrier > &barriers)
Tone maps a waterfall waveform by converting the internal fp32 buffer to RGBA and cropping/scaling.
Definition WaveformArea.cpp:2632
ImVec2 ClosestPointOnLineSegment(ImVec2 lineA, ImVec2 lineB, ImVec2 pt)
Computes the closest point on a line segment (given the endpoints) to a given point.
Definition WaveformArea.cpp:1490
void RenderEyePatternTooltip(ImVec2 start, ImVec2 size)
Draw the tooltip on an eye pattern.
Definition WaveformArea.cpp:3256
void RenderDigitalBusWaveform(std::shared_ptr< DisplayedChannel > channel, ImVec2 start, ImVec2 size)
Renders a single digital vector waveform.
Definition WaveformArea.cpp:1947
YAxisCursorMode
Horizontal cursor configuration.
Definition WaveformArea.h:731
float m_pixelsPerYAxisUnit
Cached Y axis scale.
Definition WaveformArea.h:650
void RenderWaveformTextures(vk::raii::CommandBuffer &cmdbuf, std::vector< std::shared_ptr< InputDescriptor > > &channels, bool clearPersistence)
Runs the rendering shader on all of our waveforms.
Definition WaveformArea.cpp:2341
std::shared_ptr< WaveformGroup > GetGroup()
Gets the WaveformGroup for this area.
Definition WaveformArea.h:514
bool IsCompatible(StreamDescriptor desc)
Checks if this area is compatible with a provided stream.
Definition WaveformArea.cpp:4855
void OnStreamAdded(StreamDescriptor desc)
When a stream is added, autoscale it.
Definition WaveformArea.cpp:511
void ToneMapAnalogOrDigitalWaveform(std::shared_ptr< DisplayedChannel > channel, vk::raii::CommandBuffer &cmdbuf, std::vector< vk::ImageMemoryBarrier > &barriers)
Tone maps an analog or digital waveform by converting the internal fp32 buffer to RGBA.
Definition WaveformArea.cpp:2588
void ToneMapEyeWaveform(std::shared_ptr< DisplayedChannel > channel, vk::raii::CommandBuffer &cmdbuf, std::vector< vk::ImageMemoryBarrier > &barriers)
Tone maps an eye waveform by converting the internal fp32 buffer to RGBA.
Definition WaveformArea.cpp:2762
float m_yAxisOffset
Cached Y axis offset.
Definition WaveformArea.h:644
void RenderGrid(ImVec2 start, ImVec2 size, std::map< float, float > &gridmap, float &vbot, float &vtop)
Renders grid lines.
Definition WaveformArea.cpp:2902
BERTInputChannel * m_bertChannelDuringDrag
The BERT channel we're configuring.
Definition WaveformArea.h:704
bool m_cursorPlacedThisFrame
True if the Y axis cursors were just placed in the current frame.
Definition WaveformArea.h:746
bool IsStreamBeingDisplayed(StreamDescriptor target)
Checks if this area is currently displaying a provided stream.
Definition WaveformArea.cpp:4924
TimePoint GetWaveformTimestamp()
Gets the timestamp of our current waveform (if we have one)
Definition WaveformArea.cpp:4840
ImVec2 m_dragPeakAnchorOffset
Offset, in pixels, from mouse to anchor point of peak being dragged.
Definition WaveformArea.h:722
float m_channelButtonHeight
Height of a channel button.
Definition WaveformArea.h:716
int64_t m_lastRightClickOffset
X axis position of the mouse at the most recent right click.
Definition WaveformArea.h:710
StreamDescriptor GetChannelBeingDragged()
Returns the channel being dragged, if one exists.
Definition WaveformArea.cpp:750
Unit m_yAxisUnit
Cached Y axis unit.
Definition WaveformArea.h:653
double m_tLastMouseMove
Time of last mouse movement.
Definition WaveformArea.h:686
DragState
Drag and drop of UI elements.
Definition WaveformArea.h:657
void RenderBERLevelArrows(ImVec2 start, ImVec2 size)
Arrows pointing to BERT sampling level.
Definition WaveformArea.cpp:3532
float m_triggerLevelDuringDrag
Current trigger level, if dragging.
Definition WaveformArea.h:695
bool EdgeDropArea(const std::string &name, ImVec2 start, ImVec2 size, ImGuiDir splitDir)
Drop area for edge of the plot.
Definition WaveformArea.cpp:3680
void RenderBERSamplingPoint(ImVec2 start, ImVec2 size)
Sampling point for BER.
Definition WaveformArea.cpp:3185
void RenderSpectrumPeaks(ImDrawList *list, std::shared_ptr< DisplayedChannel > channel)
Draw peaks from a FFT or similar waveform.
Definition WaveformArea.cpp:1513
bool IsMouseOverButtonAtEndOfRender()
Returns true if the mouse is over a button, rather than the plot area.
Definition WaveformArea.h:633
StreamDescriptor m_dragStream
The stream currently being dragged (invalid if m_dragState != DRAG_STATE_CHANNEL)
Definition WaveformArea.h:672
void ToneMapSpectrogramWaveform(std::shared_ptr< DisplayedChannel > channel, vk::raii::CommandBuffer &cmdbuf, std::vector< vk::ImageMemoryBarrier > &barriers)
Tone maps a spectrogram waveform by converting the internal fp32 buffer to RGBA and cropping/scaling.
Definition WaveformArea.cpp:2692
float m_width
Cached plot width (excluding Y axis)
Definition WaveformArea.h:638
float m_ymid
Cached midpoint of the plot.
Definition WaveformArea.h:647
virtual void RemoveStream(size_t i) override
Removes the stream at a specified index.
Definition WaveformArea.cpp:558
virtual void CreateInput(const std::string &name) override
Gets the digital bus waveform attached to the specified input.
void RenderSpectrogramWaveform(std::shared_ptr< DisplayedChannel > channel, ImVec2 start, ImVec2 size)
Renders a single spectrogram (same as waterfall for now)
Definition WaveformArea.cpp:1335
void RenderCursors(ImVec2 start, ImVec2 size)
Cursors and related stuff.
Definition WaveformArea.cpp:3153
void ReferenceWaveformTextures()
Marks all of our waveform textures as being used this frame.
Definition WaveformArea.cpp:681
void RenderWaveforms(ImVec2 start, ImVec2 size)
Renders our waveforms.
Definition WaveformArea.cpp:1204
void RenderBackgroundGradient(ImVec2 start, ImVec2 size)
Renders the background of the main plot area.
Definition WaveformArea.cpp:2872
void ToneMapConstellationWaveform(std::shared_ptr< DisplayedChannel > channel, vk::raii::CommandBuffer &cmdbuf, std::vector< vk::ImageMemoryBarrier > &barriers)
Tone maps a constellation waveform by converting the internal fp32 buffer to RGBA.
Definition WaveformArea.cpp:2816
bool m_mouseOverButton
True if the mouse cursor is over a channel button.
Definition WaveformArea.h:727
std::atomic< bool > m_clearPersistence
True if clearing persistence next render.
Definition WaveformArea.h:713
void RenderAnalogWaveform(std::shared_ptr< DisplayedChannel > channel, ImVec2 start, ImVec2 size)
Renders a single analog waveform.
Definition WaveformArea.cpp:1282
std::vector< std::shared_ptr< InputDescriptor > > m_channelsToRemove
Channels we're in the process of removing.
Definition WaveformArea.h:707
float m_height
Cached plot height.
Definition WaveformArea.h:641
A WaveformGroup is a container for one or more WaveformArea's.
Definition WaveformGroup.h:44
Definition WaveformArea.h:46
bool g_hasShaderInt64
Indicates whether the int64 type is available for use in shaders and SSBOs.
Definition VulkanInit.cpp:171
Definition WaveformArea.h:136
State for a single peak label.
Definition WaveformArea.h:168
int m_peakAlpha
Alpha decay. Decays by a small amount per frame after the peak disappears.
Definition WaveformArea.h:194
float m_labelYpos
Y axis position of the label's centroid.
Definition WaveformArea.h:173
int64_t m_labelXpos
X axis position of the label's centroid.
Definition WaveformArea.h:170
float m_fwhm
Calculated FWHM of the peak.
Definition WaveformArea.h:197
int64_t m_labelXsize
X axis size of the label (for collision detection)
Definition WaveformArea.h:182
int64_t m_peakXpos
X axis position of the peak last refresh.
Definition WaveformArea.h:176
int64_t m_labelYsize
Y axis size of the label (for collision detection)
Definition WaveformArea.h:185
float m_peakYpos
Y axis position of the peak last refresh.
Definition WaveformArea.h:179