Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ngscopeclient/scopehal-apps
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 56c99a5bcccf
Choose a base ref
...
head repository: ngscopeclient/scopehal-apps
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 926ada64d1b9
Choose a head ref
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Sep 5, 2020

  1. WaveformArea: no longer stretch digital samples to 2 points. Halves G…

    …PU memory bandwidth/capacity requirement for digital traces and simplifies code.
    azonenberg committed Sep 5, 2020
    Copy the full SHA
    3422ab2 View commit details
  2. Copy the full SHA
    ff35f7e View commit details
  3. WaveformArea: display nicely formatted error and abort if GL init fai…

    …ls, rather than crashing
    azonenberg committed Sep 5, 2020
    Copy the full SHA
    926ada6 View commit details
20 changes: 18 additions & 2 deletions src/glscopeclient/WaveformArea.cpp
Original file line number Diff line number Diff line change
@@ -483,10 +483,26 @@ void WaveformArea::on_realize()
if(!m_isGlewInitialized)
{
GLenum glewResult = glewInit();

string err =
"glscopeclient was unable to initialize GLEW and cannot continue.\n"
"This probably indicates a problem with your graphics card drivers.\n"
"\n"
"GLEW error: ";
err += (const char*)glewGetErrorString(glewResult);

if (glewResult != GLEW_OK)
{
LogError("Error: Failed to initialize GLEW");
return;
Gtk::MessageDialog dlg(
err,
false,
Gtk::MESSAGE_ERROR,
Gtk::BUTTONS_OK,
true
);
dlg.run();

exit(1);
}

m_isGlewInitialized = true;
27 changes: 6 additions & 21 deletions src/glscopeclient/WaveformArea_rendering.cpp
Original file line number Diff line number Diff line change
@@ -64,8 +64,6 @@ void WaveformRenderData::MapBuffers(size_t width)
auto pdat = m_channel.GetData();
if( (pdat == NULL) || ((m_count = pdat->m_offsets.size()) == 0) )
m_count = 1;
if(dynamic_cast<DigitalWaveform*>(pdat) != NULL)
m_count *= 2;
}

m_mappedXBuffer = (int64_t*)m_waveformXBuffer.Map(m_count*sizeof(int64_t), GL_READ_WRITE);
@@ -131,14 +129,6 @@ void WaveformArea::PrepareGeometry(WaveformRenderData* wdata)

//Y axis scaling in shader
float yscale = 1;

//We need to stretch every sample to two samples, one at the very left and one at the very right,
//so interpolation works right.
//TODO: we can probably avoid this by rewriting the compute shader to not interpolate like this
size_t realcount = wdata->m_count;
if(digdat)
realcount /= 2;

if(digdat)
{
float digheight;
@@ -147,27 +137,22 @@ void WaveformArea::PrepareGeometry(WaveformRenderData* wdata)
else
digheight = 20;

//TODO: AVX
//TODO: AVX this conversion
yscale = digheight;
for(size_t j=0; j<realcount; j++)
{
int64_t off = digdat->m_offsets[j];
wdata->m_mappedXBuffer[j*2] = off;
wdata->m_mappedXBuffer[j*2 + 1] = off + digdat->m_durations[j];

wdata->m_mappedYBuffer[j*2] = digdat->m_samples[j];
wdata->m_mappedYBuffer[j*2 + 1] = digdat->m_samples[j];
}
for(size_t j=0; j<wdata->m_count; j++)
wdata->m_mappedYBuffer[j] = digdat->m_samples[j];
}
else
{
yscale = m_pixelsPerVolt;

//Copy the waveform
memcpy(wdata->m_mappedXBuffer, &andat->m_offsets[0], wdata->m_count*sizeof(int64_t));
memcpy(wdata->m_mappedYBuffer, &andat->m_samples[0], wdata->m_count*sizeof(float));
}

//Copy the X axis timestamps, no conversion needed
memcpy(wdata->m_mappedXBuffer, &pdat->m_offsets[0], wdata->m_count*sizeof(int64_t));

double dt = GetTime() - start;
m_prepareTime += dt;
start = GetTime();
7 changes: 6 additions & 1 deletion src/glscopeclient/shaders/waveform-compute.glsl
Original file line number Diff line number Diff line change
@@ -106,7 +106,6 @@ void main()
float endy = right.y;

//Interpolate analog signals if either end is outside our column
//We want digital signals to be nice and square, so don't do this!
if(digital == 0)
{
float slope = (right.y - left.y) / (right.x - left.x);
@@ -116,6 +115,12 @@ void main()
endy = InterpolateY(left, right, slope, gl_GlobalInvocationID.x + 1);
}

//Digital signal - do not interpolate
else
{
//Draw the vertical line exactly one sample wide at edges
}

//Clip to window size
starty = min(starty, MAX_HEIGHT);
endy = min(endy, MAX_HEIGHT);
12 changes: 11 additions & 1 deletion src/glscopeclient/styles/glscopeclient.css
Original file line number Diff line number Diff line change
@@ -33,7 +33,6 @@ actionbar

label,
combobox *,
messagedialog *,
GtkGrid,
GtkGrid:disabled,
box,
@@ -45,6 +44,17 @@ box:disabled
text-shadow: none;
}

/***********************************************************************************************************************
Message dialog
**********************************************************************************************************************/

messagedialog *
{
color: @glscopeclient_text_color;
background-color: @glscopeclient_bg_color;
background-image: none;
}

/***********************************************************************************************************************
Button
**********************************************************************************************************************/