diff --git a/common/dialogs/panel_common_settings_base.cpp b/common/dialogs/panel_common_settings_base.cpp index 6fcaa2df8e..1dd8fc509c 100644 --- a/common/dialogs/panel_common_settings_base.cpp +++ b/common/dialogs/panel_common_settings_base.cpp @@ -74,7 +74,7 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind antialiasingLabel->Wrap( -1 ); gbSizer1->Add( antialiasingLabel, wxGBPosition( 4, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); - wxString m_antialiasingChoices[] = { _("No Antialiasing"), _("Fast Antialiasing"), _("Balanced Antialiasing"), _("High Quality Antialiasing") }; + wxString m_antialiasingChoices[] = { _("No Antialiasing"), _("Fast Antialiasing"), _("High Quality Antialiasing") }; int m_antialiasingNChoices = sizeof( m_antialiasingChoices ) / sizeof( wxString ); m_antialiasing = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_antialiasingNChoices, m_antialiasingChoices, 0 ); m_antialiasing->SetSelection( 0 ); @@ -84,7 +84,7 @@ PANEL_COMMON_SETTINGS_BASE::PANEL_COMMON_SETTINGS_BASE( wxWindow* parent, wxWind m_antialiasingFallbackLabel->Wrap( -1 ); gbSizer1->Add( m_antialiasingFallbackLabel, wxGBPosition( 6, 0 ), wxGBSpan( 1, 1 ), wxALIGN_CENTER_VERTICAL, 5 ); - wxString m_antialiasingFallbackChoices[] = { _("No Antialiasing"), _("Fast Antialiasing"), _("Balanced Antialiasing"), _("High Quality Antialiasing") }; + wxString m_antialiasingFallbackChoices[] = { _("No Antialiasing"), _("Fast Antialiasing"), _("High Quality Antialiasing") }; int m_antialiasingFallbackNChoices = sizeof( m_antialiasingFallbackChoices ) / sizeof( wxString ); m_antialiasingFallback = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_antialiasingFallbackNChoices, m_antialiasingFallbackChoices, 0 ); m_antialiasingFallback->SetSelection( 0 ); diff --git a/common/dialogs/panel_common_settings_base.fbp b/common/dialogs/panel_common_settings_base.fbp index 5aeba9e677..913a9f6a2e 100644 --- a/common/dialogs/panel_common_settings_base.fbp +++ b/common/dialogs/panel_common_settings_base.fbp @@ -696,7 +696,7 @@ 1 0 - "No Antialiasing" "Fast Antialiasing" "Balanced Antialiasing" "High Quality Antialiasing" + "No Antialiasing" "Fast Antialiasing" "High Quality Antialiasing" 1 1 @@ -827,7 +827,7 @@ 1 0 - "No Antialiasing" "Fast Antialiasing" "Balanced Antialiasing" "High Quality Antialiasing" + "No Antialiasing" "Fast Antialiasing" "High Quality Antialiasing" 1 1 diff --git a/common/gal/cairo/cairo_compositor.cpp b/common/gal/cairo/cairo_compositor.cpp index 40d8f224f9..bc1b0155e0 100644 --- a/common/gal/cairo/cairo_compositor.cpp +++ b/common/gal/cairo/cairo_compositor.cpp @@ -66,7 +66,6 @@ void CAIRO_COMPOSITOR::SetAntialiasingMode( CAIRO_ANTIALIASING_MODE aMode ) { case CAIRO_ANTIALIASING_MODE::FAST: m_currentAntialiasingMode = CAIRO_ANTIALIAS_FAST; break; case CAIRO_ANTIALIASING_MODE::GOOD: m_currentAntialiasingMode = CAIRO_ANTIALIAS_GOOD; break; - case CAIRO_ANTIALIASING_MODE::BEST: m_currentAntialiasingMode = CAIRO_ANTIALIAS_BEST; break; default: m_currentAntialiasingMode = CAIRO_ANTIALIAS_NONE; } diff --git a/common/gal/opengl/antialiasing.cpp b/common/gal/opengl/antialiasing.cpp index b85fbe6e86..06019c7e01 100644 --- a/common/gal/opengl/antialiasing.cpp +++ b/common/gal/opengl/antialiasing.cpp @@ -127,44 +127,16 @@ void draw_fullscreen_primitive() // ANTIALIASING_SUPERSAMPLING // ========================= -ANTIALIASING_SUPERSAMPLING::ANTIALIASING_SUPERSAMPLING( OPENGL_COMPOSITOR* aCompositor, - SUPERSAMPLING_MODE aMode ) : +ANTIALIASING_SUPERSAMPLING::ANTIALIASING_SUPERSAMPLING( OPENGL_COMPOSITOR* aCompositor ) : compositor( aCompositor ), - mode( aMode ), ssaaMainBuffer( 0 ), areBuffersCreated( false ), areShadersCreated( false ) + ssaaMainBuffer( 0 ), areBuffersCreated( false ), areShadersCreated( false ) { } bool ANTIALIASING_SUPERSAMPLING::Init() { - if( mode == SUPERSAMPLING_MODE::X4 && !areShadersCreated ) - { - x4_shader = std::make_unique(); - x4_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_VERTEX, - BUILTIN_SHADERS::ssaa_x4_vertex_shader ); - x4_shader->LoadShaderFromStrings( KIGFX::SHADER_TYPE_FRAGMENT, - BUILTIN_SHADERS::ssaa_x4_fragment_shader ); - x4_shader->Link(); - checkGlError( "linking supersampling x4 shader", __FILE__, __LINE__ ); - - GLint source_parameter = x4_shader->AddParameter( "source" ); - checkGlError( "getting pass 1 colorTex", __FILE__, __LINE__ ); - - x4_shader->Use(); - checkGlError( "using pass 1 shader", __FILE__, __LINE__ ); - x4_shader->SetParameter( source_parameter, 0 ); - checkGlError( "setting colorTex uniform", __FILE__, __LINE__ ); - x4_shader->Deactivate(); - checkGlError( "deactivating pass 2 shader", __FILE__, __LINE__ ); - - areShadersCreated = true; - } - - if( areShadersCreated && mode != SUPERSAMPLING_MODE::X4 ) - { - x4_shader.reset(); - areShadersCreated = false; - } + areShadersCreated = false; if( !areBuffersCreated ) { @@ -181,8 +153,7 @@ bool ANTIALIASING_SUPERSAMPLING::Init() VECTOR2U ANTIALIASING_SUPERSAMPLING::GetInternalBufferSize() { - unsigned int factor = ( mode == SUPERSAMPLING_MODE::X2 ) ? 2 : 4; - return compositor->GetScreenSize() * factor; + return compositor->GetScreenSize() * 2; } @@ -207,19 +178,7 @@ void ANTIALIASING_SUPERSAMPLING::Present() glBindTexture( GL_TEXTURE_2D, compositor->GetBufferTexture( ssaaMainBuffer ) ); compositor->SetBuffer( OPENGL_COMPOSITOR::DIRECT_RENDERING ); - if( mode == SUPERSAMPLING_MODE::X4 ) - { - x4_shader->Use(); - checkGlError( "activating supersampling x4 shader", __FILE__, __LINE__ ); - } - draw_fullscreen_primitive(); - - if( mode == SUPERSAMPLING_MODE::X4 ) - { - x4_shader->Deactivate(); - checkGlError( "deactivating supersampling x4 shader", __FILE__, __LINE__ ); - } } @@ -238,10 +197,9 @@ unsigned int ANTIALIASING_SUPERSAMPLING::CreateBuffer() // ANTIALIASING_SMAA // =============================== -ANTIALIASING_SMAA::ANTIALIASING_SMAA( OPENGL_COMPOSITOR* aCompositor, SMAA_QUALITY aQuality ) : +ANTIALIASING_SMAA::ANTIALIASING_SMAA( OPENGL_COMPOSITOR* aCompositor ) : areBuffersInitialized( false ), shadersLoaded( false ), - quality( aQuality ), compositor( aCompositor ) { smaaBaseBuffer = 0; @@ -303,27 +261,14 @@ void ANTIALIASING_SMAA::loadShaders() std::string quality_string; const char* edge_detect_shader; - if( quality == SMAA_QUALITY::CONSERVATIVE ) - { - // trades imperfect AA of shallow angles for a near artifact-free reproduction of fine features - // jaggies are smoothed over max 5px (original step + 2px in both directions) - quality_string = "#define SMAA_THRESHOLD 0.1\n" - "#define SMAA_MAX_SEARCH_STEPS 1\n" - "#define SMAA_MAX_SEARCH_STEPS_DIAG 2\n" - "#define SMAA_DISABLE_CORNER_DETECTION\n"; - edge_detect_shader = BUILTIN_SHADERS::smaa_pass_1_fragment_shader_luma; - } - else - { - // jaggies are smoothed over max 17px (original step + 8px in both directions) - quality_string = "#define SMAA_THRESHOLD 0.05\n" - "#define SMAA_MAX_SEARCH_STEPS 4\n" - "#define SMAA_MAX_SEARCH_STEPS_DIAG 4\n" - "#define SMAA_LOCAL_CONTRAST_ADAPTATION_FACTOR 1.5\n" - "#define SMAA_CORNER_ROUNDING 10\n"; - edge_detect_shader = BUILTIN_SHADERS::smaa_pass_1_fragment_shader_color; - } - + // trades imperfect AA of shallow angles for a near artifact-free reproduction of fine features + // jaggies are smoothed over max 5px (original step + 2px in both directions) + quality_string = "#define SMAA_THRESHOLD 0.005\n" + "#define SMAA_MAX_SEARCH_STEPS 1\n" + "#define SMAA_MAX_SEARCH_STEPS_DIAG 2\n" + "#define SMAA_LOCAL_CONTRAST_ADAPTATION_FACTOR 1.5\n" + "#define SMAA_CORNER_ROUNDING 0\n"; + edge_detect_shader = BUILTIN_SHADERS::smaa_pass_1_fragment_shader_luma; // set up shaders std::string vert_preamble( R"SHADER( diff --git a/common/gal/opengl/antialiasing.h b/common/gal/opengl/antialiasing.h index 43f28d6995..97821c5ceb 100644 --- a/common/gal/opengl/antialiasing.h +++ b/common/gal/opengl/antialiasing.h @@ -70,16 +70,11 @@ namespace KIGFX { OPENGL_COMPOSITOR* compositor; }; - enum class SUPERSAMPLING_MODE { - X2, - X4 - }; - class ANTIALIASING_SUPERSAMPLING : public OPENGL_PRESENTOR { public: - ANTIALIASING_SUPERSAMPLING( OPENGL_COMPOSITOR* aCompositor, SUPERSAMPLING_MODE aMode ); + ANTIALIASING_SUPERSAMPLING( OPENGL_COMPOSITOR* aCompositor ); bool Init() override; unsigned int CreateBuffer() override; @@ -93,25 +88,17 @@ namespace KIGFX { private: OPENGL_COMPOSITOR* compositor; - SUPERSAMPLING_MODE mode; unsigned int ssaaMainBuffer; bool areBuffersCreated; bool areShadersCreated; - std::unique_ptr x4_shader; - }; - - enum class SMAA_QUALITY - { - CONSERVATIVE, - AGGRESSIVE }; class ANTIALIASING_SMAA : public OPENGL_PRESENTOR { public: - ANTIALIASING_SMAA( OPENGL_COMPOSITOR* aCompositor, SMAA_QUALITY aQuality ); + ANTIALIASING_SMAA( OPENGL_COMPOSITOR* aCompositor ); bool Init() override; unsigned int CreateBuffer () override; @@ -148,7 +135,6 @@ namespace KIGFX { std::unique_ptr pass_3_shader; GLint pass_3_metrics; - SMAA_QUALITY quality; OPENGL_COMPOSITOR* compositor; }; diff --git a/common/gal/opengl/opengl_compositor.cpp b/common/gal/opengl/opengl_compositor.cpp index 36c67f4c8f..5c26662aa4 100644 --- a/common/gal/opengl/opengl_compositor.cpp +++ b/common/gal/opengl/opengl_compositor.cpp @@ -93,23 +93,15 @@ void OPENGL_COMPOSITOR::Initialize() switch( m_currentAntialiasingMode ) { - case OPENGL_ANTIALIASING_MODE::NONE: + case OPENGL_ANTIALIASING_MODE::SMAA: + m_antialiasing = std::make_unique( this ); + break; + case OPENGL_ANTIALIASING_MODE::SUPERSAMPLING: + m_antialiasing = std::make_unique( this ); + break; + default: m_antialiasing = std::make_unique( this ); break; - case OPENGL_ANTIALIASING_MODE::SUBSAMPLE_CONSERVATIVE: - m_antialiasing = std::make_unique( this, SMAA_QUALITY::CONSERVATIVE ); - break; - case OPENGL_ANTIALIASING_MODE::SUBSAMPLE_AGGRESSIVE: - m_antialiasing = std::make_unique( this, SMAA_QUALITY::AGGRESSIVE ); - break; - case OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X2: - m_antialiasing = - std::make_unique( this, SUPERSAMPLING_MODE::X2 ); - break; - case OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X4: - m_antialiasing = - std::make_unique( this, SUPERSAMPLING_MODE::X4 ); - break; } VECTOR2U dims = m_antialiasing->GetInternalBufferSize(); @@ -432,11 +424,12 @@ void OPENGL_COMPOSITOR::clean() int OPENGL_COMPOSITOR::GetAntialiasSupersamplingFactor() const { - switch( m_currentAntialiasingMode ) + switch ( m_currentAntialiasingMode ) { - case OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X2: return 2; - case OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X4: return 4; - default: return 1; + case OPENGL_ANTIALIASING_MODE::SUPERSAMPLING: + return 2; + default: + return 1; } } @@ -444,8 +437,7 @@ VECTOR2D OPENGL_COMPOSITOR::GetAntialiasRenderingOffset() const { switch( m_currentAntialiasingMode ) { - case OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X2: return VECTOR2D( 0.5, -0.5 ); - case OPENGL_ANTIALIASING_MODE::SUPERSAMPLING_X4: return VECTOR2D( 0.25, -0.25 ); + case OPENGL_ANTIALIASING_MODE::SUPERSAMPLING: return VECTOR2D( 0.5, -0.5 ); default: return VECTOR2D( 0, 0 ); } } diff --git a/common/settings/common_settings.cpp b/common/settings/common_settings.cpp index 059284c5b2..6ff93f11f9 100644 --- a/common/settings/common_settings.cpp +++ b/common/settings/common_settings.cpp @@ -247,10 +247,10 @@ COMMON_SETTINGS::COMMON_SETTINGS() : MOUSE_DRAG_ACTION::NONE ) ); m_params.emplace_back( new PARAM( "graphics.opengl_antialiasing_mode", - &m_Graphics.opengl_aa_mode, 0, 0, 3 ) ); + &m_Graphics.opengl_aa_mode, 0, 0, 2 ) ); m_params.emplace_back( new PARAM( "graphics.cairo_antialiasing_mode", - &m_Graphics.cairo_aa_mode, 0, 0, 3 ) ); + &m_Graphics.cairo_aa_mode, 0, 0, 2 ) ); m_params.emplace_back( new PARAM( "system.autosave_interval", &m_System.autosave_interval, 600 ) ); diff --git a/include/gal/cairo/cairo_compositor.h b/include/gal/cairo/cairo_compositor.h index 1105ade12c..105b18468b 100644 --- a/include/gal/cairo/cairo_compositor.h +++ b/include/gal/cairo/cairo_compositor.h @@ -86,8 +86,6 @@ public: return CAIRO_ANTIALIASING_MODE::FAST; case CAIRO_ANTIALIAS_GOOD: return CAIRO_ANTIALIASING_MODE::GOOD; - case CAIRO_ANTIALIAS_BEST: - return CAIRO_ANTIALIASING_MODE::BEST; default: return CAIRO_ANTIALIASING_MODE::NONE; } diff --git a/include/gal/gal_display_options.h b/include/gal/gal_display_options.h index fda84418ef..40580e99ab 100644 --- a/include/gal/gal_display_options.h +++ b/include/gal/gal_display_options.h @@ -48,10 +48,8 @@ namespace KIGFX enum class OPENGL_ANTIALIASING_MODE { NONE, - SUBSAMPLE_CONSERVATIVE, - SUBSAMPLE_AGGRESSIVE, - SUPERSAMPLING_X2, - SUPERSAMPLING_X4, + SMAA, + SUPERSAMPLING, }; enum class CAIRO_ANTIALIASING_MODE @@ -59,7 +57,6 @@ namespace KIGFX NONE, FAST, GOOD, - BEST, }; enum class GRID_SNAPPING