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: 2a4fb3ef799a
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: 8d6cbcdd425f
Choose a head ref
  • 1 commit
  • 1 file changed
  • 1 contributor

Commits on Sep 5, 2020

  1. Copy the full SHA
    8d6cbcd View commit details
Showing with 12 additions and 18 deletions.
  1. +12 −18 src/glscopeclient/WaveformArea_rendering.cpp
30 changes: 12 additions & 18 deletions src/glscopeclient/WaveformArea_rendering.cpp
Original file line number Diff line number Diff line change
@@ -115,10 +115,8 @@ void WaveformArea::PrepareGeometry(WaveformRenderData* wdata)
return;
}

float xscale = pdat->m_timescale * m_group->m_pixelsPerXUnit;

//Zero voltage level
//TODO: properly calculate decoder positions once RenderDecodeOverlays() isn't doing that anymore
//TODO: properly calculate overlay positions once RenderDecodeOverlays() isn't doing that anymore
float ybase = m_height/2;
if(digdat)
{
@@ -131,15 +129,12 @@ void WaveformArea::PrepareGeometry(WaveformRenderData* wdata)
ybase = m_height - (m_overlayPositions[wdata->m_channel] + 10);
}

float yoff = channel->GetOffset();

//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
//TODO: only add extra samples if the left and right values are not the same?
size_t realcount = wdata->m_count;
if(digdat)
realcount /= 2;
@@ -181,13 +176,12 @@ void WaveformArea::PrepareGeometry(WaveformRenderData* wdata)
//This is necessary since samples may be sparse and have arbitrary spacing between them, so we can't
//trivially map sample indexes to X pixel coordinates.
//TODO: can we parallelize this? move to a compute shader?
float xoff = pdat->m_triggerPhase * m_group->m_pixelsPerXUnit;
for(int j=0; j<m_width; j++)
{
wdata->m_mappedIndexBuffer[j] = BinarySearchForGequal(
wdata->m_mappedXBuffer,
wdata->m_count,
(j /*- pdat->m_triggerPhase*/ + m_group->m_xAxisOffset) / pdat->m_timescale);
(j + m_group->m_xAxisOffset) / pdat->m_timescale);
}

dt = GetTime() - start;
@@ -201,16 +195,16 @@ void WaveformArea::PrepareGeometry(WaveformRenderData* wdata)
//Config stuff
//TODO: we should be able to only update this stuff if we pan/zoom, without redoing the waveform data itself
wdata->m_mappedConfigBuffer64[0] = -m_group->m_xAxisOffset / pdat->m_timescale; //innerXoff
wdata->m_mappedConfigBuffer[2] = m_height; //windowHeight
wdata->m_mappedConfigBuffer[3] = m_plotRight; //windowWidth
wdata->m_mappedConfigBuffer[4] = wdata->m_count; //depth
wdata->m_mappedFloatConfigBuffer[5] = alpha_scaled; //alpha
wdata->m_mappedConfigBuffer[6] = digdat ? 1 : 0; //digital
wdata->m_mappedFloatConfigBuffer[7] = xoff; //xoff
wdata->m_mappedFloatConfigBuffer[8] = xscale; //xscale
wdata->m_mappedFloatConfigBuffer[9] = ybase; //ybase
wdata->m_mappedFloatConfigBuffer[10] = yscale; //yscale
wdata->m_mappedFloatConfigBuffer[11] = yoff; //yoff
wdata->m_mappedConfigBuffer[2] = m_height; //windowHeight
wdata->m_mappedConfigBuffer[3] = m_plotRight; //windowWidth
wdata->m_mappedConfigBuffer[4] = wdata->m_count; //depth
wdata->m_mappedFloatConfigBuffer[5] = alpha_scaled; //alpha
wdata->m_mappedConfigBuffer[6] = digdat ? 1 : 0; //digital
wdata->m_mappedFloatConfigBuffer[7] = pdat->m_triggerPhase * m_group->m_pixelsPerXUnit; //xoff
wdata->m_mappedFloatConfigBuffer[8] = pdat->m_timescale * m_group->m_pixelsPerXUnit; //xscale
wdata->m_mappedFloatConfigBuffer[9] = ybase; //ybase
wdata->m_mappedFloatConfigBuffer[10] = yscale; //yscale
wdata->m_mappedFloatConfigBuffer[11] = channel->GetOffset(); //yoff

//Done
wdata->m_geometryOK = true;