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: 9464c9e0c974
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: 3506f49e952d
Choose a head ref
  • 1 commit
  • 2 files changed
  • 1 contributor

Commits on Feb 22, 2020

  1. Copy the full SHA
    3506f49 View commit details
Showing with 18 additions and 15 deletions.
  1. +2 −2 glscopeclient/WaveformArea.cpp
  2. +16 −13 glscopeclient/shaders/waveform-compute.glsl
4 changes: 2 additions & 2 deletions glscopeclient/WaveformArea.cpp
Original file line number Diff line number Diff line change
@@ -113,8 +113,8 @@ WaveformArea::~WaveformArea()
double tavg = m_frameTime / m_frameCount;
LogDebug("Average frame interval: %.3f ms (%.2f FPS, %zu frames)\n",
tavg*1000, 1/tavg, m_frameCount);
LogDebug("Total render time: %.3f ms\n",
m_renderTime * 1000);
LogDebug("Total render time: %.3f ms (average %.3f)\n",
m_renderTime * 1000, m_renderTime * 1000 / m_frameCount);
LogDebug("Cairo underlay : %.3f ms (%.1f %%)\n",
m_underlayTime * 1000, m_underlayTime * 100 / m_renderTime);
LogDebug("Cairo overlay : %.3f ms (%.1f %%)\n",
29 changes: 16 additions & 13 deletions glscopeclient/shaders/waveform-compute.glsl
Original file line number Diff line number Diff line change
@@ -31,9 +31,9 @@ layout(std430, binding=3) buffer index
layout(local_size_x=128, local_size_y=1, local_size_z=1) in;

//Interpolate a Y coordinate
float InterpolateY(vec2 left, vec2 right, float dx_inverse, float x)
float InterpolateY(vec2 left, vec2 right, float slope, float x)
{
return left.y + ( (x - left.x) * dx_inverse ) * (right.y - left.y);
return left.y + ( (x - left.x) * slope );
}

//Maximum height of a single waveform, in pixels.
@@ -66,30 +66,33 @@ void main()
{
//Fetch coordinates of the current and upcoming sample
right = vec2(data[i+1].x, data[i+1].voltage);
float dx_inverse = 1.0 / (right.x - left.x);

//If the current point is right of us, stop
if(left.x > x+1)
break;

//If the upcoming point is still left of us, we're not there yet
if(right.x < x)
{
left = right;
continue;
}

//To start, assume we're drawing the entire segment
float starty = left.y;
float endy = right.y;

//Interpolate if either end is outside our column
float slope = (right.y - left.y) / (right.x - left.x);
if(left.x < x)
starty = InterpolateY(left, right, dx_inverse, x);
starty = InterpolateY(left, right, slope, x);
if(right.x > x+1)
endy = InterpolateY(left, right, dx_inverse, x+1);
endy = InterpolateY(left, right, slope, x+1);

//Sort Y coordinates from min to max
int ymin = int(min(starty, endy));
int ymax = int(max(starty, endy));

//If the current point is right of us, stop
if(left.x > x+1)
break;

//If the upcoming point is still left of us, we're not there yet
if(right.x < x)
continue;

//Push current point down the pipeline
left = right;