ngscopeclient v0.2.2
Loading...
Searching...
No Matches
DensityFunctionWaveform.h
Go to the documentation of this file.
1/***********************************************************************************************************************
2* *
3* libscopehal *
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
38#ifndef DensityFunctionWaveform_h
39#define DensityFunctionWaveform_h
40
41#include "Waveform.h"
42
51{
52public:
53
54 DensityFunctionWaveform(size_t width, size_t height);
56
57 //not copyable or assignable
59 DensityFunctionWaveform& operator=(const DensityFunctionWaveform&) =delete;
60
61 //nothing to do if not gpu accelerated
62 virtual void Rename([[maybe_unused]] const std::string& name = "") override
63 {}
64
66 float* GetData()
67 {
68 m_outdata.PrepareForCpuAccess();
69 return m_outdata.GetCpuPointer();
70 }
71
75
77 size_t GetHeight()
78 { return m_height; }
79
81 size_t GetWidth()
82 { return m_width; }
83
84 //Unused virtual methods from WaveformBase that we have to override
85 virtual void clear() override
86 {}
87
88 virtual void Resize([[maybe_unused]] size_t unused) override
89 {}
90
91 virtual void Reserve([[maybe_unused]] size_t unused) override
92 {}
93
94 virtual void PrepareForCpuAccess() override
95 { m_outdata.PrepareForCpuAccess(); }
96
97 virtual void PrepareForGpuAccess() override
98 { m_outdata.PrepareForGpuAccess();}
99
100 virtual void PrepareForCpuAccessNonblocking(vk::raii::CommandBuffer& cmdBuf) override
101 { m_outdata.PrepareForCpuAccessNonblocking(cmdBuf);}
102
103 virtual void PrepareForGpuAccessNonblocking(vk::raii::CommandBuffer& cmdBuf) override
104 { m_outdata.PrepareForGpuAccessNonblocking(false, cmdBuf);}
105
106 virtual void MarkSamplesModifiedFromCpu() override
107 { m_outdata.MarkModifiedFromCpu(); }
108
109 virtual void MarkSamplesModifiedFromGpu() override
110 { m_outdata.MarkModifiedFromGpu(); }
111
112 virtual void MarkModifiedFromCpu() override
113 { m_outdata.MarkModifiedFromCpu(); }
114
115 virtual void MarkModifiedFromGpu() override
116 { m_outdata.MarkModifiedFromGpu(); }
117
118 //we have no linear sample buffer so return 0
119 virtual size_t size() const override
120 { return 0; }
121
122 virtual size_t capacity() const override
123 { return 0; }
124
125 virtual size_t GetMemoryBytes() const override
126 { return m_outdata.GetMemoryBytes(); }
127
128protected:
129
131 size_t m_width;
132
134 size_t m_height;
135
138};
139
140#endif
Declaration of WaveformBase, SparseWaveformBase, UniformWaveformBase.
Definition AcceleratorBuffer.h:204
size_t GetMemoryBytes() const
Returns the total size of the buffer (wherever it is), in bytes.
Definition AcceleratorBuffer.h:582
T * GetCpuPointer()
Gets a pointer to the CPU-side buffer.
Definition AcceleratorBuffer.h:659
Base class for waveforms such as eye patterns, spectrograms, and waterfalls which are conceptually a ...
Definition DensityFunctionWaveform.h:51
virtual void PrepareForCpuAccessNonblocking(vk::raii::CommandBuffer &cmdBuf) override
Indicates that this waveform is going to be used by the CPU in the near future.
Definition DensityFunctionWaveform.h:100
AcceleratorBuffer< float > & GetOutData()
Returns a reference to the output data buffer object.
Definition DensityFunctionWaveform.h:73
virtual void PrepareForGpuAccess() override
Indicates that this waveform is going to be used by the GPU in the near future.
Definition DensityFunctionWaveform.h:97
virtual void clear() override
Remove all samples from this waveform.
Definition DensityFunctionWaveform.h:85
virtual void PrepareForCpuAccess() override
Indicates that this waveform is going to be used by the CPU in the near future.
Definition DensityFunctionWaveform.h:94
virtual size_t capacity() const override
Returns the number of samples allocated in this waveform.
Definition DensityFunctionWaveform.h:122
size_t m_width
Buffer width, in pixels.
Definition DensityFunctionWaveform.h:131
virtual void PrepareForGpuAccessNonblocking(vk::raii::CommandBuffer &cmdBuf) override
Indicates that this waveform is going to be used by the GPU in the near future.
Definition DensityFunctionWaveform.h:103
virtual void MarkSamplesModifiedFromCpu() override
Indicates that this waveform's sample data has been modified on the CPU and the GPU-side copy is no l...
Definition DensityFunctionWaveform.h:106
virtual void Resize(size_t unused) override
Reallocates buffers so the waveform contains the specified number of samples.
Definition DensityFunctionWaveform.h:88
virtual size_t GetMemoryBytes() const override
Gets the amount of memory consumed by the waveform (may be CPU, GPU, or mirrored)
Definition DensityFunctionWaveform.h:125
virtual void MarkModifiedFromCpu() override
Indicates that this waveform's sample data and timestamps have been modified on the CPU and the GPU-s...
Definition DensityFunctionWaveform.h:112
float * GetData()
Returns a pointer to the CPU-side sample data buffer.
Definition DensityFunctionWaveform.h:66
size_t m_height
Buffer height, in pixels.
Definition DensityFunctionWaveform.h:134
virtual void Reserve(size_t unused) override
Preallocates buffers without changing the usable size of the waveform.
Definition DensityFunctionWaveform.h:91
virtual void MarkSamplesModifiedFromGpu() override
Indicates that this waveform's sample data has been modified on the GPU and the CPU-side copy is no l...
Definition DensityFunctionWaveform.h:109
AcceleratorBuffer< float > m_outdata
Pixel buffer.
Definition DensityFunctionWaveform.h:137
virtual size_t size() const override
Returns the number of samples in this waveform.
Definition DensityFunctionWaveform.h:119
virtual void MarkModifiedFromGpu() override
Indicates that this waveform's sample data and timestamps have been modified on the GPU and the CPU-s...
Definition DensityFunctionWaveform.h:115
size_t GetWidth()
Returns the width of the bitmap in pixels.
Definition DensityFunctionWaveform.h:81
size_t GetHeight()
Returns the height of the bitmap in pixels.
Definition DensityFunctionWaveform.h:77
virtual void Rename(const std::string &name="") override
Assigns a human readable name to the waveform for debug purposes.
Definition DensityFunctionWaveform.h:62
Base class for all Waveform specializations.
Definition Waveform.h:59