Add environment variable for multisampling 85/132885/3
authorHeeyong Song <heeyong.song@samsung.com>
Thu, 8 Jun 2017 07:01:10 +0000 (16:01 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Fri, 9 Jun 2017 09:40:04 +0000 (18:40 +0900)
Change-Id: Ia086b802d262e446f60ab8420dd70d9fe6797429

adaptors/base/environment-options.cpp
adaptors/base/environment-options.h
adaptors/base/environment-variables.h
adaptors/common/adaptor-impl.cpp
adaptors/common/gl/egl-factory.cpp
adaptors/common/gl/egl-factory.h
adaptors/common/gl/egl-implementation.cpp
adaptors/common/gl/egl-implementation.h

index a029a30..0dbf614 100644 (file)
@@ -107,6 +107,7 @@ EnvironmentOptions::EnvironmentOptions()
   mThreadingMode( ThreadingMode::COMBINED_UPDATE_RENDER ),
   mRenderRefreshRate( 1 ),
   mGlesCallAccumulate( false ),
+  mMultiSamplingLevel( 0 ),
   mLogFunction( NULL )
 {
   ParseEnvironmentOptions();
@@ -253,6 +254,11 @@ unsigned int EnvironmentOptions::GetRenderRefreshRate() const
   return mRenderRefreshRate;
 }
 
+unsigned int EnvironmentOptions::GetMultiSamplingLevel() const
+{
+  return mMultiSamplingLevel;
+}
+
 bool EnvironmentOptions::PerformanceServerRequired() const
 {
   return ( ( GetPerformanceStatsLoggingOptions() > 0) ||
@@ -396,6 +402,15 @@ void EnvironmentOptions::ParseEnvironmentOptions()
       mRenderRefreshRate = renderRefreshRate;
     }
   }
+
+  int multiSamplingLevel( 0 );
+  if( GetIntegerEnvironmentVariable( DALI_ENV_MULTI_SAMPLING_LEVEL, multiSamplingLevel ) )
+  {
+    if( multiSamplingLevel > 0 )
+    {
+      mMultiSamplingLevel = multiSamplingLevel;
+    }
+  }
 }
 
 } // Adaptor
index 792f8ba..dacaa11 100644 (file)
@@ -203,6 +203,11 @@ public:
    */
   unsigned int GetRenderRefreshRate() const;
 
+  /**
+   * @return The number of samples required in multisample buffers
+   */
+  unsigned int GetMultiSamplingLevel() const;
+
 private: // Internal
 
   /**
@@ -238,6 +243,7 @@ private: // Data
   ThreadingMode::Type mThreadingMode;             ///< threading mode
   unsigned int mRenderRefreshRate;                ///< render refresh rate
   bool mGlesCallAccumulate;                       ///< Whether or not to accumulate gles call statistics
+  unsigned int mMultiSamplingLevel;               ///< The number of samples required in multisample buffers
 
   Dali::Integration::Log::LogFunction mLogFunction;
 
index a3c2963..fa010f9 100644 (file)
@@ -93,6 +93,8 @@ namespace Adaptor
 
 #define DALI_REFRESH_RATE "DALI_REFRESH_RATE"
 
+#define DALI_ENV_MULTI_SAMPLING_LEVEL "DALI_MULTI_SAMPLING_LEVEL"
+
 } // namespace Adaptor
 
 } // namespace Internal
index ab2ecac..a3dc3ee 100644 (file)
@@ -132,7 +132,7 @@ void Adaptor::Initialize( Dali::Configuration::ContextLoss configuration )
     mGLES = new GlImplementation();
   }
 
-  mEglFactory = new EglFactory();
+  mEglFactory = new EglFactory( mEnvironmentOptions->GetMultiSamplingLevel() );
 
   EglSyncImplementation* eglSyncImpl = mEglFactory->GetSyncImplementation();
 
index 1301016..f9cf846 100644 (file)
@@ -30,11 +30,16 @@ namespace Internal
 namespace Adaptor
 {
 
-EglFactory::EglFactory()
+EglFactory::EglFactory( unsigned int multiSamplingLevel )
 : mEglImplementation(NULL),
   mEglImageExtensions(NULL),
-  mEglSync(new EglSyncImplementation) // Created early, as needed by Core constructor
+  mEglSync(new EglSyncImplementation), // Created early, as needed by Core constructor
+  mMultiSamplingLevel( 4 )
 {
+  if( multiSamplingLevel > 0 )
+  {
+    mMultiSamplingLevel = multiSamplingLevel;
+  }
 }
 
 EglFactory::~EglFactory()
@@ -48,8 +53,8 @@ EglFactory::~EglFactory()
 EglInterface* EglFactory::Create()
 {
   // Created by RenderThread (After Core construction)
-  mEglImplementation = new EglImplementation();
-  mEglImageExtensions = new EglImageExtensions(mEglImplementation);
+  mEglImplementation = new EglImplementation( mMultiSamplingLevel );
+  mEglImageExtensions = new EglImageExtensions( mEglImplementation );
 
   mEglSync->Initialize(mEglImplementation); // The sync impl needs the EglDisplay
   return mEglImplementation;
index a97d555..5b449a1 100644 (file)
@@ -39,7 +39,7 @@ public:
   /**
    * Constructor
    */
-  EglFactory();
+  EglFactory( unsigned int multiSamplingLevel );
 
   /**
    * Destructor
@@ -83,6 +83,8 @@ private:
   EglImplementation* mEglImplementation;
   EglImageExtensions* mEglImageExtensions;
   EglSyncImplementation* mEglSync;
+
+  unsigned int mMultiSamplingLevel;
 };
 
 }
index c73525f..dd2a59e 100644 (file)
@@ -52,7 +52,7 @@ namespace Adaptor
   } \
 }
 
-EglImplementation::EglImplementation()
+EglImplementation::EglImplementation( unsigned int multiSamplingLevel )
   : mEglNativeDisplay(0),
     mEglNativeWindow(0),
     mCurrentEglNativePixmap(0),
@@ -64,7 +64,8 @@ EglImplementation::EglImplementation()
     mIsOwnSurface(true),
     mContextCurrent(false),
     mIsWindow(true),
-    mColorDepth(COLOR_DEPTH_24)
+    mColorDepth(COLOR_DEPTH_24),
+    mMultiSamplingLevel( multiSamplingLevel )
 {
 }
 
@@ -334,7 +335,7 @@ void EglImplementation::ChooseConfig( bool isWindowType, ColorDepth depth )
   configAttribs.PushBack( 8 );
 #ifndef DALI_PROFILE_UBUNTU
   configAttribs.PushBack( EGL_SAMPLES );
-  configAttribs.PushBack( 4 );
+  configAttribs.PushBack( mMultiSamplingLevel );
   configAttribs.PushBack( EGL_SAMPLE_BUFFERS );
   configAttribs.PushBack( 1 );
 #endif // DALI_PROFILE_UBUNTU
index 47976d1..9cad11e 100644 (file)
@@ -42,8 +42,9 @@ class EglImplementation : public EglInterface
 public:
   /**
    * Constructor
+   * @param environmentOptions To check the envirionment options
    */
-  EglImplementation();
+  EglImplementation( unsigned int multiSamplingLevel );
 
   /**
    * Destructor
@@ -193,6 +194,8 @@ private:
   bool                 mContextCurrent;
   bool                 mIsWindow;
   ColorDepth           mColorDepth;
+
+  unsigned int         mMultiSamplingLevel;
 };
 
 } // namespace Adaptor