ngscopeclient 0.1-dev+51fbda87c
WaveformArea.h
Go to the documentation of this file.
1/***********************************************************************************************************************
2* *
3* ngscopeclient *
4* *
5* Copyright (c) 2012-2024 Andrew D. Zonenberg *
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:
48 WaveformToneMapArgs(ImVec4 channelColor, uint32_t w, uint32_t h)
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:
66 EyeToneMapArgs(uint32_t w, uint32_t h)
67 : m_width(w)
68 , m_height(h)
69 {}
70
71 uint32_t m_width;
72 uint32_t m_height;
73};
74
76{
77public:
78 ConstellationToneMapArgs(uint32_t w, uint32_t h)
79 : m_width(w)
80 , m_height(h)
81 {}
82
83 uint32_t m_width;
84 uint32_t m_height;
85};
86
88{
89public:
90 WaterfallToneMapArgs(uint32_t w, uint32_t h, uint32_t outwidth, uint32_t outheight, uint32_t o, float x)
91 : m_width(w)
92 , m_height(h)
93 , m_outwidth(outwidth)
94 , m_outheight(outheight)
95 , m_offsetSamples(o)
96 , m_xscale(x)
97 {}
98
99 uint32_t m_width;
100 uint32_t m_height;
101 uint32_t m_outwidth;
102 uint32_t m_outheight;
103 uint32_t m_offsetSamples;
104 float m_xscale;
105};
106
108{
109public:
110 SpectrogramToneMapArgs(uint32_t w, uint32_t h, uint32_t outwidth, uint32_t outheight, uint32_t xo,
111 float x, int32_t yo, float y)
112 : m_width(w)
113 , m_height(h)
114 , m_outwidth(outwidth)
115 , m_outheight(outheight)
116 , m_xoff(xo)
117 , m_xscale(x)
118 , m_yoff(yo)
119 , m_yscale(y)
120 {}
121
122 uint32_t m_width;
123 uint32_t m_height;
124 uint32_t m_outwidth;
125 uint32_t m_outheight;
126 uint32_t m_xoff;
127 float m_xscale;
128 int32_t m_yoff;
129 float m_yscale;
130};
131
133{
134 int64_t innerXoff;
135 uint32_t windowHeight;
136 uint32_t windowWidth;
137 uint32_t memDepth;
138 uint32_t offset_samples;
139 float alpha;
140 float xoff;
141 float xscale;
142 float ybase;
143 float yscale;
144 float yoff;
145 float persistScale;
146};
147
154{
156 int64_t m_labelXpos;
157
160
162 int64_t m_peakXpos;
163
166
169
172
181
183 float m_fwhm;
184};
185
190{
191public:
192 DisplayedChannel(StreamDescriptor stream, Session& session);
193
195
196 YAML::Node Serialize(IDTable& table) const;
197
198 std::string GetName()
199 { return m_stream.GetName(); }
200
201 StreamDescriptor GetStream()
202 { return m_stream; }
203
204 std::shared_ptr<Texture> GetTexture()
205 { return m_texture; }
206
207 void SetTexture(std::shared_ptr<Texture> tex)
208 { m_texture = tex; }
209
210 void PrepareToRasterize(size_t x, size_t y);
211
212 bool UpdateSize(ImVec2 newSize, MainWindow* top);
213
214 AcceleratorBuffer<float>& GetRasterizedWaveform()
215 { return m_rasterizedWaveform; }
216
221 { return m_rasterizedX; }
222
227 { return m_rasterizedY; }
228
232 __attribute__((noinline))
233 std::shared_ptr<ComputePipeline> GetUniformAnalogPipeline()
234 {
235 if(m_uniformAnalogComputePipeline == nullptr)
236 {
237 std::string base = "shaders/waveform-compute.";
238 std::string suffix;
239 if(ZeroHoldFlagSet())
240 suffix += ".zerohold";
242 suffix += ".int64";
243 m_uniformAnalogComputePipeline = std::make_shared<ComputePipeline>(
244 base + "analog" + suffix + ".dense.spv", 2, sizeof(ConfigPushConstants));
245 }
246
248 }
249
253 __attribute__((noinline))
254 std::shared_ptr<ComputePipeline> GetHistogramPipeline()
255 {
256 if(m_histogramComputePipeline == nullptr)
257 {
258 std::string base = "shaders/waveform-compute.";
259 std::string suffix;
261 suffix += ".int64";
262 m_histogramComputePipeline = std::make_shared<ComputePipeline>(
263 base + "histogram" + suffix + ".dense.spv", 2, sizeof(ConfigPushConstants));
264 }
265
267 }
268
272 __attribute__((noinline))
273 std::shared_ptr<ComputePipeline> GetSparseAnalogPipeline()
274 {
275 if(m_sparseAnalogComputePipeline == nullptr)
276 {
277 std::string base = "shaders/waveform-compute.";
278 std::string suffix;
279 int durationSSBOs = 0;
280 if(ZeroHoldFlagSet())
281 {
282 suffix += ".zerohold";
283 durationSSBOs++;
284 }
286 suffix += ".int64";
287 m_sparseAnalogComputePipeline = std::make_shared<ComputePipeline>(
288 base + "analog" + suffix + ".spv", durationSSBOs + 4, sizeof(ConfigPushConstants));
289 }
290
292 }
293
297 __attribute__((noinline))
298 std::shared_ptr<ComputePipeline> GetUniformDigitalPipeline()
299 {
301 {
302 std::string base = "shaders/waveform-compute.";
303 std::string suffix;
305 suffix += ".int64";
306 m_uniformDigitalComputePipeline = std::make_shared<ComputePipeline>(
307 base + "digital" + suffix + ".dense.spv", 2, sizeof(ConfigPushConstants));
308 }
309
311 }
312
316 __attribute__((noinline))
317 std::shared_ptr<ComputePipeline> GetSparseDigitalPipeline()
318 {
319 if(m_sparseDigitalComputePipeline == nullptr)
320 {
321 std::string base = "shaders/waveform-compute.";
322 std::string suffix;
323 int durationSSBOs = 0; //TODO: support gaps
325 suffix += ".int64";
326 m_sparseDigitalComputePipeline = std::make_shared<ComputePipeline>(
327 base + "digital" + suffix + ".spv", durationSSBOs + 4, sizeof(ConfigPushConstants));
328 }
329
331 }
332
333 std::shared_ptr<ComputePipeline> GetToneMapPipeline()
334 { return m_toneMapPipe; }
335
336 bool ZeroHoldFlagSet()
337 {
338 return m_stream.GetFlags() & Stream::STREAM_DO_NOT_INTERPOLATE;
339 // TODO: Allow this to be overridden by a configuration option in the WaveformArea
340 }
341
342 bool IsDensePacked()
343 {
344 auto data = m_stream.GetData();
345 if(dynamic_cast<UniformWaveformBase*>(data) != nullptr)
346 return true;
347 else
348 return false;
349 }
350
351 bool ShouldFillUnder()
352 { return m_stream.GetFlags() & Stream::STREAM_FILL_UNDER; }
353
354 bool ZeroHoldCursorBehaviour()
355 {
356 return ZeroHoldFlagSet();
357 }
358
359 bool ShouldMapDurations()
360 {
361 return ZeroHoldFlagSet() && !IsDensePacked();
362 // Do not need durations if dense because each duration is "1"
363 }
364
365 bool IsPersistenceEnabled()
366 { return m_persistenceEnabled; }
367
368 void SetPersistenceEnabled(bool b)
369 { m_persistenceEnabled = b; }
370
371 AcceleratorBuffer<uint32_t>& GetIndexBuffer()
372 { return m_indexBuffer; }
373
374 void SetYButtonPos(float y)
375 { m_yButtonPos = y; }
376
377 float GetYButtonPos()
378 { return m_yButtonPos; }
379
381 std::vector<PeakLabel> m_peakLabels;
382
383 std::string m_colorRamp;
384
385protected:
386 StreamDescriptor m_stream;
387
390
393
396
399
402
404 std::shared_ptr<Texture> m_texture;
405
407 size_t m_cachedX;
408
410 size_t m_cachedY;
411
414
416 std::shared_ptr<ComputePipeline> m_toneMapPipe;
417
419 std::shared_ptr<ComputePipeline> m_uniformAnalogComputePipeline;
420
422 std::shared_ptr<ComputePipeline> m_histogramComputePipeline;
423
425 std::shared_ptr<ComputePipeline> m_sparseAnalogComputePipeline;
426
428 std::shared_ptr<ComputePipeline> m_uniformDigitalComputePipeline;
429
431 std::shared_ptr<ComputePipeline> m_sparseDigitalComputePipeline;
432
435
436 std::unique_ptr<vk::raii::CommandPool> m_utilCmdPool;
437 std::unique_ptr<vk::raii::CommandBuffer> m_utilCmdBuffer;
438};
439
446{
447public:
448 WaveformArea(StreamDescriptor stream, std::shared_ptr<WaveformGroup> group, MainWindow* parent);
449 virtual ~WaveformArea();
450
451 bool Render(int iArea, int numAreas, ImVec2 clientArea);
453 vk::raii::CommandBuffer& cmdbuf,
454 std::vector<std::shared_ptr<DisplayedChannel> >& channels,
455 bool clearPersistence);
457 void ToneMapAllWaveforms(vk::raii::CommandBuffer& cmdbuf);
458
459 size_t GetStreamCount()
460 { return m_displayedChannels.size(); }
461
462 StreamDescriptor GetStream(size_t i)
463 { return m_displayedChannels[i]->GetStream(); }
464
465 std::shared_ptr<DisplayedChannel> GetDisplayedChannel(size_t i)
466 { return m_displayedChannels[i]; }
467
469
470 void AddStream(StreamDescriptor desc, bool persistence = false, const std::string& ramp = "eye-gradient-viridis");
471
473
474 void RemoveStream(size_t i);
475
476 void ClearPersistence();
478
481
485 std::shared_ptr<WaveformGroup> GetGroup()
486 { return m_group; }
487
489
490protected:
491 void ChannelButton(std::shared_ptr<DisplayedChannel> chan, size_t index);
492 void RenderBackgroundGradient(ImVec2 start, ImVec2 size);
493 void RenderGrid(ImVec2 start, ImVec2 size, std::map<float, float>& gridmap, float& vbot, float& vtop);
494 void RenderYAxis(ImVec2 size, std::map<float, float>& gridmap, float vbot, float vtop);
495 void RenderTriggerLevelArrows(ImVec2 start, ImVec2 size);
496 void RenderBERLevelArrows(ImVec2 start, ImVec2 size);
497 void RenderCursors(ImVec2 start, ImVec2 size);
498 void RenderBERSamplingPoint(ImVec2 start, ImVec2 size);
499 void CheckForScaleMismatch(ImVec2 start, ImVec2 size);
500 void RenderEyePatternTooltip(ImVec2 start, ImVec2 size);
501 void RenderWaveforms(ImVec2 start, ImVec2 size);
502 void RenderAnalogWaveform(std::shared_ptr<DisplayedChannel> channel, ImVec2 start, ImVec2 size);
503 void RenderEyeWaveform(std::shared_ptr<DisplayedChannel> channel, ImVec2 start, ImVec2 size);
504 void RenderConstellationWaveform(std::shared_ptr<DisplayedChannel> channel, ImVec2 start, ImVec2 size);
505 void RenderWaterfallWaveform(std::shared_ptr<DisplayedChannel> channel, ImVec2 start, ImVec2 size);
506 void RenderSpectrogramWaveform(std::shared_ptr<DisplayedChannel> channel, ImVec2 start, ImVec2 size);
507 void RenderSpectrumPeaks(ImDrawList* list, std::shared_ptr<DisplayedChannel> channel);
508 void RenderDigitalWaveform(std::shared_ptr<DisplayedChannel> channel, ImVec2 start, ImVec2 size);
509 void RenderProtocolWaveform(std::shared_ptr<DisplayedChannel> channel, ImVec2 start, ImVec2 size);
510 void RenderComplexSignal(
511 ImDrawList* list,
512 int visleft, int visright,
513 float xstart, float xend, float xoff,
514 float ybot, float ymid, float ytop,
515 std::string str,
516 ImU32 color);
517 void MakePathSignalBody(ImDrawList* list, float xstart, float xend, float ybot, float ymid, float ytop);
518 void ToneMapAnalogOrDigitalWaveform(std::shared_ptr<DisplayedChannel> channel, vk::raii::CommandBuffer& cmdbuf);
519 void ToneMapEyeWaveform(std::shared_ptr<DisplayedChannel> channel, vk::raii::CommandBuffer& cmdbuf);
520 void ToneMapConstellationWaveform(std::shared_ptr<DisplayedChannel> channel, vk::raii::CommandBuffer& cmdbuf);
521 void ToneMapWaterfallWaveform(std::shared_ptr<DisplayedChannel> channel, vk::raii::CommandBuffer& cmdbuf);
522 void ToneMapSpectrogramWaveform(std::shared_ptr<DisplayedChannel> channel, vk::raii::CommandBuffer& cmdbuf);
523 void RasterizeAnalogOrDigitalWaveform(
524 std::shared_ptr<DisplayedChannel> channel,
525 vk::raii::CommandBuffer& cmdbuf,
526 bool clearPersistence);
527 void PlotContextMenu();
528
530 ImDrawList* list,
531 ImVec2 center,
532 StreamDescriptor ourStream,
533 StreamDescriptor theirStream);
534
535 void DragDropOverlays(ImVec2 start, ImVec2 size, int iArea, int numAreas);
536 void CenterLeftDropArea(ImVec2 start, ImVec2 size);
537 void CenterRightDropArea(ImVec2 start, ImVec2 size);
538 void EdgeDropArea(const std::string& name, ImVec2 start, ImVec2 size, ImGuiDir splitDir);
539
540 void FilterMenu(std::shared_ptr<DisplayedChannel> chan);
541 void FilterSubmenu(std::shared_ptr<DisplayedChannel> chan, const std::string& name, Filter::Category cat);
542
543 float PixelsToYAxisUnits(float pix);
544 float YAxisUnitsToPixels(float volt);
545 float YAxisUnitsToYPosition(float volt);
546 float YPositionToYAxisUnits(float y);
547 float PickStepSize(float volts_per_half_span, int min_steps = 2, int max_steps = 5);
548
549public:
555
562 { return m_mouseOverButton; }
563
564protected:
566 float m_width;
567
569 float m_height;
570
573
575 float m_ymid;
576
579
582
585 {
586 DRAG_STATE_NONE,
587 DRAG_STATE_CHANNEL,
588 DRAG_STATE_CHANNEL_LAST,
589 DRAG_STATE_Y_AXIS,
590 DRAG_STATE_TRIGGER_LEVEL,
591 DRAG_STATE_TRIGGER_SECONDARY_LEVEL,
592 DRAG_STATE_BER_LEVEL,
593 DRAG_STATE_BER_BOTH,
594 DRAG_STATE_PEAK_MARKER
595 } m_dragState;
596
599
600 void OnMouseWheelPlotArea(float delta, float delta_h);
601 void OnMouseWheelYAxis(float delta);
602 void OnMouseUp();
603 void OnDragUpdate();
604
610 std::vector<std::shared_ptr<DisplayedChannel>> m_displayedChannels;
611
613 std::shared_ptr<WaveformGroup> m_group;
614
617
620
623
626
629
632
635
638
640 std::vector<std::shared_ptr<DisplayedChannel> > m_channelsToRemove;
641
644
646 std::atomic<bool> m_clearPersistence;
647
650
653
656
657 ImVec2 ClosestPointOnLineSegment(ImVec2 lineA, ImVec2 lineB, ImVec2 pt);
658
661};
662
663typedef std::pair<WaveformArea*, size_t> DragDescriptor;
664
665#endif
666
667
Declaration of Marker.
Declaration of TextureManager.
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:190
std::shared_ptr< ComputePipeline > m_sparseAnalogComputePipeline
Compute pipeline for rendering sparse analog waveforms.
Definition: WaveformArea.h:425
size_t GetRasterizedY()
Return the Y axis size of the rasterized waveform.
Definition: WaveformArea.h:226
bool UpdateSize(ImVec2 newSize, MainWindow *top)
Handles a change in size of the displayed waveform.
Definition: WaveformArea.cpp:141
std::shared_ptr< ComputePipeline > m_histogramComputePipeline
Compute pipeline for rendering histogram waveforms.
Definition: WaveformArea.h:422
size_t m_rasterizedX
X axis size of rasterized waveform.
Definition: WaveformArea.h:398
Session & m_session
Parent session object.
Definition: WaveformArea.h:389
size_t GetRasterizedX()
Return the X axis size of the rasterized waveform.
Definition: WaveformArea.h:220
void PrepareToRasterize(size_t x, size_t y)
Prepares to rasterize the waveform at the specified resolution.
Definition: WaveformArea.cpp:290
bool m_persistenceEnabled
Persistence enable flag.
Definition: WaveformArea.h:413
__attribute__((noinline)) std
Gets the pipeline for drawing uniform analog waveforms, creating it if necessary.
Definition: WaveformArea.h:232
float m_yButtonPos
Y axis position of our button within the view.
Definition: WaveformArea.h:434
std::vector< PeakLabel > m_peakLabels
Active labels for peaks associated with the current waveform.
Definition: WaveformArea.h:381
size_t m_cachedX
X axis size of the texture as of last UpdateSize() call.
Definition: WaveformArea.h:407
std::shared_ptr< ComputePipeline > m_sparseDigitalComputePipeline
Compute pipeline for rendering sparse digital waveforms.
Definition: WaveformArea.h:431
std::shared_ptr< ComputePipeline > m_toneMapPipe
Compute pipeline for tone mapping fp32 images to RGBA.
Definition: WaveformArea.h:416
std::shared_ptr< ComputePipeline > m_uniformAnalogComputePipeline
Compute pipeline for rendering uniform analog waveforms.
Definition: WaveformArea.h:419
AcceleratorBuffer< float > m_rasterizedWaveform
Buffer storing our rasterized waveform, prior to tone mapping.
Definition: WaveformArea.h:392
size_t m_cachedY
Y axis size of the texture as of last UpdateSize() call.
Definition: WaveformArea.h:410
size_t m_rasterizedY
Y axis size of rasterized waveform.
Definition: WaveformArea.h:401
YAML::Node Serialize(IDTable &table) const
Serializes the configuration for this channel.
Definition: WaveformArea.cpp:316
AcceleratorBuffer< uint32_t > m_indexBuffer
Buffer for X axis indexes (only used for sparse waveforms)
Definition: WaveformArea.h:395
std::shared_ptr< Texture > m_texture
The texture storing our final rendered waveform.
Definition: WaveformArea.h:404
std::shared_ptr< ComputePipeline > m_uniformDigitalComputePipeline
Compute pipeline for rendering uniform digital waveforms.
Definition: WaveformArea.h:428
Definition: WaveformArea.h:64
Category
Category the filter should be displayed under in the GUI.
Definition: Filter.h:108
Bidirectional table mapping integer IDs in scopesession files to object pointers.
Definition: IDTable.h:49
Top level application window.
Definition: MainWindow.h:115
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:95
Definition: WaveformArea.h:108
Descriptor for a single stream coming off a channel.
Definition: StreamDescriptor.h:46
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:337
A unit of measurement, plus conversion to pretty-printed output.
Definition: Unit.h:57
Definition: WaveformArea.h:88
A WaveformArea is a plot that displays one or more OscilloscopeChannel's worth of data.
Definition: WaveformArea.h:446
void ToneMapSpectrogramWaveform(std::shared_ptr< DisplayedChannel > channel, vk::raii::CommandBuffer &cmdbuf)
Tone maps a spectrogram waveform by converting the internal fp32 buffer to RGBA and cropping/scaling.
Definition: WaveformArea.cpp:2046
PeakLabel * m_dragPeakLabel
Peak label being dragged, if any.
Definition: WaveformArea.h:652
bool Render(int iArea, int numAreas, ImVec2 clientArea)
Renders a waveform area.
Definition: WaveformArea.cpp:574
void ToneMapAllWaveforms(vk::raii::CommandBuffer &cmdbuf)
Tone map our waveforms.
Definition: WaveformArea.cpp:1682
void RenderConstellationWaveform(std::shared_ptr< DisplayedChannel > channel, ImVec2 start, ImVec2 size)
Renders a single constellation diagram.
Definition: WaveformArea.cpp:1003
std::vector< std::shared_ptr< DisplayedChannel > > m_channelsToRemove
Channels we're in the process of removing.
Definition: WaveformArea.h:640
int64_t m_xAxisPosDuringDrag
Current X axis position during drag.
Definition: WaveformArea.h:631
void CheckForScaleMismatch(ImVec2 start, ImVec2 size)
Look for mismatched vertical scales and display warning message.
Definition: WaveformArea.cpp:2665
void DragDropOverlays(ImVec2 start, ImVec2 size, int iArea, int numAreas)
Drag-and-drop overlay areas.
Definition: WaveformArea.cpp:2947
MainWindow * m_parent
Top level window object containing us.
Definition: WaveformArea.h:616
void EdgeDropArea(const std::string &name, ImVec2 start, ImVec2 size, ImGuiDir splitDir)
Drop area for edge of the plot.
Definition: WaveformArea.cpp:2996
bool m_mouseOverBERTarget
True if mouse is over the BER sampling location.
Definition: WaveformArea.h:625
void OnMouseWheelYAxis(float delta)
Handles a mouse wheel scroll step on the Y axis.
Definition: WaveformArea.cpp:3895
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:3617
StreamDescriptor GetFirstAnalogStream()
Returns the first analog stream displayed in this area.
Definition: WaveformArea.cpp:398
void RenderWaterfallWaveform(std::shared_ptr< DisplayedChannel > channel, ImVec2 start, ImVec2 size)
Renders a single waterfall.
Definition: WaveformArea.cpp:877
void RenderDigitalWaveform(std::shared_ptr< DisplayedChannel > channel, ImVec2 start, ImVec2 size)
Renders a single digital waveform.
Definition: WaveformArea.cpp:1367
void DrawDropRangeMismatchMessage(ImDrawList *list, ImVec2 center, StreamDescriptor ourStream, StreamDescriptor theirStream)
Display a warning message about mismatched vertical scale.
Definition: WaveformArea.cpp:3329
void RenderTriggerLevelArrows(ImVec2 start, ImVec2 size)
Arrows pointing to trigger levels.
Definition: WaveformArea.cpp:2759
bool IsChannelBeingDragged()
Returns true if a channel is currently being dragged.
Definition: WaveformArea.cpp:553
std::vector< std::shared_ptr< DisplayedChannel > > m_displayedChannels
The channels currently living within this WaveformArea.
Definition: WaveformArea.h:610
StreamDescriptor GetFirstDensityFunctionStream()
Returns the first density plot displayed in this area.
Definition: WaveformArea.cpp:474
void OnMouseWheelPlotArea(float delta, float delta_h)
Handles a mouse wheel scroll step on the plot area.
Definition: WaveformArea.cpp:3871
void AddStream(StreamDescriptor desc, bool persistence=false, const std::string &ramp="eye-gradient-viridis")
Adds a new stream to this plot.
Definition: WaveformArea.cpp:367
Trigger * m_triggerDuringDrag
The trigger we're configuring.
Definition: WaveformArea.h:634
void ClearPersistenceOfChannel(OscilloscopeChannel *chan)
Clear persistence iff we are displaying the specified channel.
Definition: WaveformArea.cpp:3684
void RenderYAxis(ImVec2 size, std::map< float, float > &gridmap, float vbot, float vtop)
Renders the Y axis scale.
Definition: WaveformArea.cpp:2381
StreamDescriptor GetFirstConstellationStream()
Returns the first constellation diagram displayed in this area.
Definition: WaveformArea.cpp:457
void RenderEyeWaveform(std::shared_ptr< DisplayedChannel > channel, ImVec2 start, ImVec2 size)
Renders a single eye pattern.
Definition: WaveformArea.cpp:929
StreamDescriptor GetFirstAnalogOrDensityStream()
Returns the first analog, spectrogram or eye pattern stream displayed in this area.
Definition: WaveformArea.cpp:417
void ChannelButton(std::shared_ptr< DisplayedChannel > chan, size_t index)
Handles a button for a channel.
Definition: WaveformArea.cpp:3389
void ToneMapConstellationWaveform(std::shared_ptr< DisplayedChannel > channel, vk::raii::CommandBuffer &cmdbuf)
Tone maps a constellation waveform by converting the internal fp32 buffer to RGBA.
Definition: WaveformArea.cpp:2176
void RenderProtocolWaveform(std::shared_ptr< DisplayedChannel > channel, ImVec2 start, ImVec2 size)
Renders a single protocol waveform (assume it's sparse)
Definition: WaveformArea.cpp:1399
void CenterRightDropArea(ImVec2 start, ImVec2 size)
Drop area for the middle of the plot.
Definition: WaveformArea.cpp:3241
void PlotContextMenu()
Run the context menu for the main plot area.
Definition: WaveformArea.cpp:711
StreamDescriptor GetFirstEyeStream()
Returns the first eye pattern displayed in this area.
Definition: WaveformArea.cpp:440
std::shared_ptr< WaveformGroup > m_group
Waveform group containing us.
Definition: WaveformArea.h:613
bool m_mouseOverTriggerArrow
True if mouse is over a trigger level arrow.
Definition: WaveformArea.h:622
void CenterLeftDropArea(ImVec2 start, ImVec2 size)
Drop area for the middle of the plot.
Definition: WaveformArea.cpp:3129
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:1054
void RenderEyePatternTooltip(ImVec2 start, ImVec2 size)
Draw the tooltip on an eye pattern.
Definition: WaveformArea.cpp:2608
float m_pixelsPerYAxisUnit
Cached Y axis scale.
Definition: WaveformArea.h:578
std::shared_ptr< WaveformGroup > GetGroup()
Gets the WaveformGroup for this area.
Definition: WaveformArea.h:485
bool IsCompatible(StreamDescriptor desc)
Checks if this area is compatible with a provided stream.
Definition: WaveformArea.cpp:3946
float m_yAxisOffset
Cached Y axis offset.
Definition: WaveformArea.h:572
void RenderGrid(ImVec2 start, ImVec2 size, std::map< float, float > &gridmap, float &vbot, float &vtop)
Renders grid lines.
Definition: WaveformArea.cpp:2265
BERTInputChannel * m_bertChannelDuringDrag
The BERT channel we're configuring.
Definition: WaveformArea.h:637
void RenderWaveformTextures(vk::raii::CommandBuffer &cmdbuf, std::vector< std::shared_ptr< DisplayedChannel > > &channels, bool clearPersistence)
Runs the rendering shader on all of our waveforms.
Definition: WaveformArea.cpp:1738
bool IsStreamBeingDisplayed(StreamDescriptor target)
Checks if this area is currently displaying a provided stream.
Definition: WaveformArea.cpp:4001
TimePoint GetWaveformTimestamp()
Gets the timestamp of our current waveform (if we have one)
Definition: WaveformArea.cpp:3931
ImVec2 m_dragPeakAnchorOffset
Offset, in pixels, from mouse to anchor point of peak being dragged.
Definition: WaveformArea.h:655
void ToneMapWaterfallWaveform(std::shared_ptr< DisplayedChannel > channel, vk::raii::CommandBuffer &cmdbuf)
Tone maps a density function waveform by converting the internal fp32 buffer to RGBA and cropping/sca...
Definition: WaveformArea.cpp:1983
float m_channelButtonHeight
Height of a channel button.
Definition: WaveformArea.h:649
int64_t m_lastRightClickOffset
X axis position of the mouse at the most recent right click.
Definition: WaveformArea.h:643
StreamDescriptor GetChannelBeingDragged()
Returns the channel being dragged, if one exists.
Definition: WaveformArea.cpp:561
Unit m_yAxisUnit
Cached Y axis unit.
Definition: WaveformArea.h:581
double m_tLastMouseMove
Time of last mouse movement.
Definition: WaveformArea.h:619
void ToneMapAnalogOrDigitalWaveform(std::shared_ptr< DisplayedChannel > channel, vk::raii::CommandBuffer &cmdbuf)
Tone maps an analog or digital waveform by converting the internal fp32 buffer to RGBA.
Definition: WaveformArea.cpp:1936
DragState
Drag and drop of UI elements.
Definition: WaveformArea.h:585
void RenderBERLevelArrows(ImVec2 start, ImVec2 size)
Arrows pointing to BERT sampling level.
Definition: WaveformArea.cpp:2873
float m_triggerLevelDuringDrag
Current trigger level, if dragging.
Definition: WaveformArea.h:628
void RenderBERSamplingPoint(ImVec2 start, ImVec2 size)
Sampling point for BER.
Definition: WaveformArea.cpp:2538
void RenderSpectrumPeaks(ImDrawList *list, std::shared_ptr< DisplayedChannel > channel)
Draw peaks from a FFT or similar waveform.
Definition: WaveformArea.cpp:1077
bool IsMouseOverButtonAtEndOfRender()
Returns true if the mouse is over a button, rather than the plot area.
Definition: WaveformArea.h:561
StreamDescriptor m_dragStream
The stream currently being dragged (invalid if m_dragState != DRAG_STATE_CHANNEL)
Definition: WaveformArea.h:598
float m_width
Cached plot width (excluding Y axis)
Definition: WaveformArea.h:566
float m_ymid
Cached midpoint of the plot.
Definition: WaveformArea.h:575
void RenderSpectrogramWaveform(std::shared_ptr< DisplayedChannel > channel, ImVec2 start, ImVec2 size)
Renders a single spectrogram (same as waterfall for now)
Definition: WaveformArea.cpp:903
void RenderCursors(ImVec2 start, ImVec2 size)
Cursors and related stuff.
Definition: WaveformArea.cpp:2506
void ReferenceWaveformTextures()
Marks all of our waveform textures as being used this frame.
Definition: WaveformArea.cpp:495
void RenderWaveforms(ImVec2 start, ImVec2 size)
Renders our waveforms.
Definition: WaveformArea.cpp:782
void RenderBackgroundGradient(ImVec2 start, ImVec2 size)
Renders the background of the main plot area.
Definition: WaveformArea.cpp:2235
bool m_mouseOverButton
True if the mouse cursor is over a channel button.
Definition: WaveformArea.h:660
void RemoveStream(size_t i)
Removes the stream at a specified index.
Definition: WaveformArea.cpp:378
std::atomic< bool > m_clearPersistence
True if clearing persistence next render.
Definition: WaveformArea.h:646
void RenderAnalogWaveform(std::shared_ptr< DisplayedChannel > channel, ImVec2 start, ImVec2 size)
Renders a single analog waveform.
Definition: WaveformArea.cpp:850
float m_height
Cached plot height.
Definition: WaveformArea.h:569
void ToneMapEyeWaveform(std::shared_ptr< DisplayedChannel > channel, vk::raii::CommandBuffer &cmdbuf)
Tone maps an eye waveform by converting the internal fp32 buffer to RGBA.
Definition: WaveformArea.cpp:2119
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:133
State for a single peak label.
Definition: WaveformArea.h:154
int m_peakAlpha
Alpha decay. Decays by a small amount per frame after the peak disappears.
Definition: WaveformArea.h:180
float m_labelYpos
Y axis position of the label's centroid.
Definition: WaveformArea.h:159
int64_t m_labelXpos
X axis position of the label's centroid.
Definition: WaveformArea.h:156
float m_fwhm
Calculated FWHM of the peak.
Definition: WaveformArea.h:183
int64_t m_labelXsize
X axis size of the label (for collision detection)
Definition: WaveformArea.h:168
int64_t m_peakXpos
X axis position of the peak last refresh.
Definition: WaveformArea.h:162
int64_t m_labelYsize
Y axis size of the label (for collision detection)
Definition: WaveformArea.h:171
float m_peakYpos
Y axis position of the peak last refresh.
Definition: WaveformArea.h:165