From ec5724493bb9398134553a7354e08497e778a9cb Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Tue, 25 Mar 2014 15:49:42 +0100 Subject: Bug 801: Use allsamples 'brute force' for VBAA (best quality) ; Demos: Reduce text contrast by 1/10th allowing better AA ; GPUUISceneGLListener0A uses proportional window height font size and one label w/ 10pt --- .../shader/curverenderer01-2pass_vbaa-weight.fp | 8 +- .../opengl/shader/curverenderer01-2pass_vbaa.fp | 8 +- ...urverenderer01-pass2-vbaa_allsamples_equal.glsl | 98 ++++++++++++++++++ ...rverenderer01-pass2-vbaa_allsamples_prop01.glsl | 114 +++++++++++++++++++++ ...enderer01-pass2-vbaa_wholeedge_equalweight.glsl | 98 ------------------ ...enderer01-pass2-vbaa_wholeedge_propweight1.glsl | 114 --------------------- 6 files changed, 220 insertions(+), 220 deletions(-) create mode 100644 src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allsamples_equal.glsl create mode 100644 src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allsamples_prop01.glsl delete mode 100644 src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_wholeedge_equalweight.glsl delete mode 100644 src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_wholeedge_propweight1.glsl (limited to 'src/jogl/classes/jogamp') diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa-weight.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa-weight.fp index bc443061e..795215285 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa-weight.fp +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa-weight.fp @@ -28,9 +28,10 @@ void main (void) if( 0 < gcu_TextureSize.z ) { -// Quality: wholeedge > [flipquad,rgss, quincunx] > poles -#include curverenderer01-pass2-vbaa_flipquad3.glsl +// Quality: allsamples > [flipquad,rgss, quincunx] > poles +#include curverenderer01-pass2-vbaa_allsamples_equal.glsl +// #include curverenderer01-pass2-vbaa_flipquad3.glsl // #include curverenderer01-pass2-vbaa_flipquad2.glsl // #include curverenderer01-pass2-vbaa_flipquad.glsl // #include curverenderer01-pass2-vbaa_rgss.glsl @@ -39,8 +40,7 @@ void main (void) // #include curverenderer01-pass2-vbaa_poles_equalweight.glsl // #include curverenderer01-pass2-vbaa_poles_bilin1.glsl // #include curverenderer01-pass2-vbaa_poles_propweight1.glsl -// #include curverenderer01-pass2-vbaa_wholeedge_propweight1.glsl -// #include curverenderer01-pass2-vbaa_wholeedge_equalweight.glsl +// #include curverenderer01-pass2-vbaa_allsamples_prop01.glsl // #include curverenderer01-pass2-vbaa_fxaa3.glsl } else { diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa.fp b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa.fp index 6836b3ee0..e303f5c1b 100644 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa.fp +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-2pass_vbaa.fp @@ -28,9 +28,10 @@ void main (void) if( 0 < gcu_TextureSize.z ) { -// Quality: wholeedge > [flipquad,rgss, quincunx] > poles -#include curverenderer01-pass2-vbaa_flipquad3.glsl +// Quality: allsamples > [flipquad,rgss, quincunx] > poles +#include curverenderer01-pass2-vbaa_allsamples_equal.glsl +// #include curverenderer01-pass2-vbaa_flipquad3.glsl // #include curverenderer01-pass2-vbaa_flipquad2.glsl // #include curverenderer01-pass2-vbaa_flipquad.glsl // #include curverenderer01-pass2-vbaa_rgss.glsl @@ -39,8 +40,7 @@ void main (void) // #include curverenderer01-pass2-vbaa_poles_equalweight.glsl // #include curverenderer01-pass2-vbaa_poles_bilin1.glsl // #include curverenderer01-pass2-vbaa_poles_propweight1.glsl -// #include curverenderer01-pass2-vbaa_wholeedge_propweight1.glsl -// #include curverenderer01-pass2-vbaa_wholeedge_equalweight.glsl +// #include curverenderer01-pass2-vbaa_allsamples_prop01.glsl // #include curverenderer01-pass2-vbaa_fxaa3.glsl } else { diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allsamples_equal.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allsamples_equal.glsl new file mode 100644 index 000000000..068341b25 --- /dev/null +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allsamples_equal.glsl @@ -0,0 +1,98 @@ + // Pass-2: AA on Texture + // Note: gcv_TexCoord is in center of sample pixels. + + const float sampleCount = gcu_TextureSize.z; + const vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size + + // Not only the poles (NW, SW, ..) but the whole edge! + const float sample_weight = 1 / ( sampleCount * sampleCount ); + + // const vec4 tex_weights = vec4(0.075, 0.06, 0.045, 0.025); + + const vec2 texCoord = gcv_TexCoord.st; + + vec4 t; + + // SampleCount 2 -> 4x + t = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -0.5)))*sample_weight; // NW + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 0.5)))*sample_weight; // SW + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 0.5)))*sample_weight; // SE + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -0.5)))*sample_weight; // NE + if( sampleCount > 2 ) { + // SampleCount 4 -> +12x = 16p + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -1.5)))*sample_weight; // NW -> SW Edge + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -0.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 0.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 1.5)))*sample_weight; // SW -> SE Edge + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 1.5)))*sample_weight; // + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 1.5)))*sample_weight; // + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 1.5)))*sample_weight; // SE -> NE Edge + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 0.5)))*sample_weight; // + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -0.5)))*sample_weight; // + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -1.5)))*sample_weight; // NE -> NW Edge + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -1.5)))*sample_weight; // + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -1.5)))*sample_weight; // NW - 1 (closed) + + if( sampleCount > 4 ) { + // SampleCount 6 -> +20x = 36p + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -2.5)))*sample_weight; // NW -> SW Edge + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -1.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -0.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 0.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 1.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 2.5)))*sample_weight; // SW -> SE Edge + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 2.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 2.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 2.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 2.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 2.5)))*sample_weight; // SE -> NE Edge + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 1.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 0.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -0.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -1.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -2.5)))*sample_weight; // NE -> NW Edge + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -2.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -2.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -2.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -2.5)))*sample_weight; // NW - 1 (closed) + if( sampleCount > 6 ) { + // SampleCount 8 -> +28x = 64p + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -3.5)))*sample_weight; // NW -> SW Edge + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -2.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -1.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -0.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 0.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 1.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 2.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 3.5)))*sample_weight; // SW -> SE Edge + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 3.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 3.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 3.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 3.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 3.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 3.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 3.5)))*sample_weight; // SE -> NE Edge + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 2.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 1.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 0.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -0.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -1.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -2.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -3.5)))*sample_weight; // NE -> NW Edge + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -3.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -3.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -3.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -3.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -3.5)))*sample_weight; + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -3.5)))*sample_weight; // NW - 1 (closed) + } + } + } + #if 0 + if(t.w == 0.0){ + discard; // discard freezes NV tegra2 compiler + } + #endif + + color = t.rgb; + alpha = gcu_Alpha * t.a; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allsamples_prop01.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allsamples_prop01.glsl new file mode 100644 index 000000000..76227eba3 --- /dev/null +++ b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_allsamples_prop01.glsl @@ -0,0 +1,114 @@ + // Pass-2: AA on Texture + // Note: gcv_TexCoord is in center of sample pixels. + + const float sampleCount = gcu_TextureSize.z; + const vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size + + // Not only the poles (NW, SW, ..) but the whole edge! + const float pixelCount = sampleCount * sampleCount; + + // sampleCount [0, 1, 3, 5, 7] are undefined! + const float layerCount = ( sampleCount / 2.0 ); + + // sum of all integer [layerCount .. 1] -> Gauss + const float denom = ( layerCount / 2.0 ) * ( layerCount + 1.0 ); + + const vec2 texCoord = gcv_TexCoord.st; + + vec4 t = vec4(0); + + // Layer-1: SampleCount 2 -> 4x + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -0.5))); // NW + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 0.5))); // SW + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 0.5))); // SE + t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -0.5))); // NE + + t *= (layerCount - 0.0) / ( denom * 4.0 ); // weight layer 1 + + if( sampleCount > 2 ) { + // Layer-2: SampleCount 4 -> +12x = 16p + vec4 tn = vec4(0); + tn = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -1.5))); // NW -> SW Edge + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -0.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 0.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 1.5))); // SW -> SE Edge + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 1.5))); // + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 1.5))); // + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 1.5))); // SE -> NE Edge + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 0.5))); // + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -0.5))); // + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -1.5))); // NE -> NW Edge + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -1.5))); // + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -1.5))); // NW - 1 (closed) + + t += tn * (layerCount - 1) / ( denom * 12.0 ); // weight layer 2 + + if( sampleCount > 4 ) { + // Layer-3: SampleCount 6 -> +20x = 36p + tn = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -2.5))); // NW -> SW Edge + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -1.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -0.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 0.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 1.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 2.5))); // SW -> SE Edge + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 2.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 2.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 2.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 2.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 2.5))); // SE -> NE Edge + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 1.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 0.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -0.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -1.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -2.5))); // NE -> NW Edge + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -2.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -2.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -2.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -2.5))); // NW - 1 (closed) + + t += tn * (layerCount - 2) / ( denom * 20.0 ); // weight layer 3 + + if( sampleCount > 6 ) { + // Layer-4: SampleCount 8 -> +28x = 64p + tn = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -3.5))); // NW -> SW Edge + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -2.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -1.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -0.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 0.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 1.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 2.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 3.5))); // SW -> SE Edge + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 3.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 3.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 3.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 3.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 3.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 3.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 3.5))); // SE -> NE Edge + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 2.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 1.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 0.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -0.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -1.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -2.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -3.5))); // NE -> NW Edge + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -3.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -3.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -3.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -3.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -3.5))); + tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -3.5))); // NW - 1 (closed) + + t += tn * (layerCount - 3) / ( denom * 28.0 ); // weight layer 4 + } + } + } + + #if 0 + if(t.w == 0.0){ + discard; // discard freezes NV tegra2 compiler + } + #endif + + color = t.rgb; + alpha = gcu_Alpha * t.a; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_wholeedge_equalweight.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_wholeedge_equalweight.glsl deleted file mode 100644 index 3c787b46e..000000000 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_wholeedge_equalweight.glsl +++ /dev/null @@ -1,98 +0,0 @@ - // Pass-2: AA on Texture - // Note: gcv_TexCoord is in center of sample pixels. - - const float sampleCount = gcu_TextureSize.z; - const vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size - - // Not only the poles (NW, SW, ..) but the whole edge! - const float sample_weight = 1 / ( sampleCount * sampleCount ); - - // const vec4 tex_weights = vec4(0.075, 0.06, 0.045, 0.025); - - const vec2 texCoord = gcv_TexCoord.st; - - vec4 t = vec4(0); - - // SampleCount 2 -> 4x - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -0.5)))*sample_weight; // NW - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 0.5)))*sample_weight; // SW - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 0.5)))*sample_weight; // SE - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -0.5)))*sample_weight; // NE - if( sampleCount > 2 ) { - // SampleCount 4 -> +12x = 16p - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -1.5)))*sample_weight; // NW -> SW Edge - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -0.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 0.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 1.5)))*sample_weight; // SW -> SE Edge - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 1.5)))*sample_weight; // - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 1.5)))*sample_weight; // - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 1.5)))*sample_weight; // SE -> NE Edge - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 0.5)))*sample_weight; // - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -0.5)))*sample_weight; // - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -1.5)))*sample_weight; // NE -> NW Edge - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -1.5)))*sample_weight; // - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -1.5)))*sample_weight; // NW - 1 (closed) - - if( sampleCount > 4 ) { - // SampleCount 6 -> +20x = 36p - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -2.5)))*sample_weight; // NW -> SW Edge - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -1.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -0.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 0.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 1.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 2.5)))*sample_weight; // SW -> SE Edge - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 2.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 2.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 2.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 2.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 2.5)))*sample_weight; // SE -> NE Edge - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 1.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 0.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -0.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -1.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -2.5)))*sample_weight; // NE -> NW Edge - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -2.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -2.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -2.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -2.5)))*sample_weight; // NW - 1 (closed) - if( sampleCount > 6 ) { - // SampleCount 8 -> +28x = 64p - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -3.5)))*sample_weight; // NW -> SW Edge - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -2.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -1.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -0.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 0.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 1.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 2.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 3.5)))*sample_weight; // SW -> SE Edge - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 3.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 3.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 3.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 3.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 3.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 3.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 3.5)))*sample_weight; // SE -> NE Edge - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 2.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 1.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 0.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -0.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -1.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -2.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -3.5)))*sample_weight; // NE -> NW Edge - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -3.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -3.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -3.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -3.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -3.5)))*sample_weight; - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -3.5)))*sample_weight; // NW - 1 (closed) - } - } - } - #if 0 - if(t.w == 0.0){ - discard; // discard freezes NV tegra2 compiler - } - #endif - - color = t.rgb; - alpha = gcu_Alpha * t.a; diff --git a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_wholeedge_propweight1.glsl b/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_wholeedge_propweight1.glsl deleted file mode 100644 index 76227eba3..000000000 --- a/src/jogl/classes/jogamp/graph/curve/opengl/shader/curverenderer01-pass2-vbaa_wholeedge_propweight1.glsl +++ /dev/null @@ -1,114 +0,0 @@ - // Pass-2: AA on Texture - // Note: gcv_TexCoord is in center of sample pixels. - - const float sampleCount = gcu_TextureSize.z; - const vec2 psize = 1.0 / gcu_TextureSize.xy; // pixel size - - // Not only the poles (NW, SW, ..) but the whole edge! - const float pixelCount = sampleCount * sampleCount; - - // sampleCount [0, 1, 3, 5, 7] are undefined! - const float layerCount = ( sampleCount / 2.0 ); - - // sum of all integer [layerCount .. 1] -> Gauss - const float denom = ( layerCount / 2.0 ) * ( layerCount + 1.0 ); - - const vec2 texCoord = gcv_TexCoord.st; - - vec4 t = vec4(0); - - // Layer-1: SampleCount 2 -> 4x - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -0.5))); // NW - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 0.5))); // SW - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 0.5))); // SE - t += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -0.5))); // NE - - t *= (layerCount - 0.0) / ( denom * 4.0 ); // weight layer 1 - - if( sampleCount > 2 ) { - // Layer-2: SampleCount 4 -> +12x = 16p - vec4 tn = vec4(0); - tn = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -1.5))); // NW -> SW Edge - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -0.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 0.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 1.5))); // SW -> SE Edge - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 1.5))); // - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 1.5))); // - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 1.5))); // SE -> NE Edge - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 0.5))); // - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -0.5))); // - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -1.5))); // NE -> NW Edge - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -1.5))); // - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -1.5))); // NW - 1 (closed) - - t += tn * (layerCount - 1) / ( denom * 12.0 ); // weight layer 2 - - if( sampleCount > 4 ) { - // Layer-3: SampleCount 6 -> +20x = 36p - tn = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -2.5))); // NW -> SW Edge - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -1.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -0.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 0.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 1.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 2.5))); // SW -> SE Edge - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 2.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 2.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 2.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 2.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 2.5))); // SE -> NE Edge - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 1.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 0.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -0.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -1.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -2.5))); // NE -> NW Edge - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -2.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -2.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -2.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -2.5))); // NW - 1 (closed) - - t += tn * (layerCount - 2) / ( denom * 20.0 ); // weight layer 3 - - if( sampleCount > 6 ) { - // Layer-4: SampleCount 8 -> +28x = 64p - tn = texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -3.5))); // NW -> SW Edge - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -2.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -1.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, -0.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 0.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 1.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 2.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-3.5, 3.5))); // SW -> SE Edge - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, 3.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, 3.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, 3.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, 3.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, 3.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, 3.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 3.5))); // SE -> NE Edge - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 2.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 1.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, 0.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -0.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -1.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -2.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 3.5, -3.5))); // NE -> NW Edge - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 2.5, -3.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 1.5, -3.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2( 0.5, -3.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-0.5, -3.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-1.5, -3.5))); - tn += texture2D(gcu_TextureUnit, texCoord + psize*(vec2(-2.5, -3.5))); // NW - 1 (closed) - - t += tn * (layerCount - 3) / ( denom * 28.0 ); // weight layer 4 - } - } - } - - #if 0 - if(t.w == 0.0){ - discard; // discard freezes NV tegra2 compiler - } - #endif - - color = t.rgb; - alpha = gcu_Alpha * t.a; -- cgit v1.2.3