Shader binary synchronous simplified IO 90/42490/8
authorAndrew Cox <andrew.cox@partner.samsung.com>
Tue, 23 Jun 2015 18:03:05 +0000 (19:03 +0100)
committerAndrew Cox <andrew.cox@partner.samsung.com>
Mon, 13 Jul 2015 11:04:30 +0000 (12:04 +0100)
Change-Id: Ie09e73965389ba0229a42ecd7f9e32f49764710e
Signed-off-by: Andrew Cox <andrew.cox@partner.samsung.com>
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.cpp
automated-tests/src/dali-toolkit/dali-toolkit-test-utils/test-platform-abstraction.h

index ad8de5cf5fd5d5e4ba254835953dc36811732fcf..6acbca7a6806e54755eb585977e052b28ad41b0a 100644 (file)
@@ -66,7 +66,7 @@ void TestPlatformAbstraction::Resume()
 
 ImageDimensions TestPlatformAbstraction::GetClosestImageSize( const std::string& filename,
                                                               ImageDimensions size,
-                                                              FittingMode::Type scalingMode,
+                                                              FittingMode::Type fittingMode,
                                                               SamplingMode::Type samplingMode,
                                                               bool orientationCorrection )
 {
@@ -77,7 +77,7 @@ ImageDimensions TestPlatformAbstraction::GetClosestImageSize( const std::string&
 
 ImageDimensions TestPlatformAbstraction::GetClosestImageSize( Integration::ResourcePointer resourceBuffer,
                                                    ImageDimensions size,
-                                                   FittingMode::Type scalingMode,
+                                                   FittingMode::Type fittingMode,
                                                    SamplingMode::Type samplingMode,
                                                    bool orientationCorrection )
 {
@@ -92,7 +92,7 @@ ImageDimensions TestPlatformAbstraction::GetClosestImageSize( Integration::Resou
 void TestPlatformAbstraction::LoadResource(const Integration::ResourceRequest& request)
 {
   std::ostringstream out;
-  out << "Type:" << request.GetType()->id << ", Path: " << request.GetPath() << std::endl;
+  out << "Type:" << request.GetType()->id << ", Path: " << request.GetPath() << std::endl ;
 
   mTrace.PushCall("LoadResource", out.str());
   if(mRequest != NULL)
@@ -193,7 +193,7 @@ void TestPlatformAbstraction::SetDpi (unsigned int dpiHorizontal, unsigned int d
 /**
  * @copydoc PlatformAbstraction::LoadFile()
  */
-bool TestPlatformAbstraction::LoadFile( const std::string& filename, std::vector< unsigned char >& buffer ) const
+bool TestPlatformAbstraction::LoadFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const
 {
   mTrace.PushCall("LoadFile", "");
   if( mLoadFileResult.loadResult )
@@ -205,11 +205,11 @@ bool TestPlatformAbstraction::LoadFile( const std::string& filename, std::vector
 }
 
 /**
- * @copydoc PlatformAbstraction::LoadShaderBinFile()
+ * @copydoc PlatformAbstraction::LoadShaderBinaryFile()
  */
-bool TestPlatformAbstraction::LoadShaderBinFile( const std::string& filename, std::vector< unsigned char >& buffer ) const
+bool TestPlatformAbstraction::LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const
 {
-  mTrace.PushCall("LoadShaderBinFile", "");
+  mTrace.PushCall("LoadShaderBinaryFile", "");
   if( mLoadFileResult.loadResult )
   {
     buffer = mLoadFileResult.buffer;
@@ -221,7 +221,7 @@ bool TestPlatformAbstraction::LoadShaderBinFile( const std::string& filename, st
 /**
  * @copydoc PlatformAbstraction::SaveFile()
  */
-bool TestPlatformAbstraction::SaveFile(const std::string& filename, std::vector< unsigned char >& buffer) const
+bool TestPlatformAbstraction::SaveFile(const std::string& filename, const unsigned char * buffer, unsigned int numBytes) const
 {
   mTrace.PushCall("SaveFile", "");
   return false;
@@ -260,7 +260,8 @@ bool TestPlatformAbstraction::WasCalled(TestFuncEnum func)
     case LoadResourceFunc:                    return mTrace.FindMethod("LoadResource");
     case SaveResourceFunc:                    return mTrace.FindMethod("SaveResource");
     case LoadFileFunc:                        return mTrace.FindMethod("LoadFile");
-    case LoadShaderBinFileFunc:               return mTrace.FindMethod("LoadShaderBinFile");
+    case LoadShaderBinaryFileFunc:            return mTrace.FindMethod("LoadShaderBinaryFile");
+    case SaveShaderBinaryFileFunc:            return mTrace.FindMethod("SaveShaderBinaryFile");
     case SaveFileFunc:                        return mTrace.FindMethod("SaveFile");
     case CancelLoadFunc:                      return mTrace.FindMethod("CancelLoad");
     case GetResourcesFunc:                    return mTrace.FindMethod("GetResources");
@@ -346,7 +347,7 @@ void TestPlatformAbstraction::SetClosestImageSize(const Vector2& size)
   mClosestSize = size;
 }
 
-void TestPlatformAbstraction::SetLoadFileResult( bool result, std::vector< unsigned char >& buffer )
+void TestPlatformAbstraction::SetLoadFileResult( bool result, Dali::Vector< unsigned char >& buffer )
 {
   mLoadFileResult.loadResult = result;
   if( result )
index 3a69ae774a1cd620ec2e0cc5c39a3d958b83cab0..c35b2c2eaa46b344b20c7d5204d54fb410971ad2 100644 (file)
@@ -70,7 +70,7 @@ public:
     }
 
     bool loadResult;
-    std::vector< unsigned char> buffer;
+    Dali::Vector< unsigned char> buffer;
   };
 
   /**
@@ -103,7 +103,7 @@ public:
    */
   virtual ImageDimensions GetClosestImageSize( const std::string& filename,
                                                  ImageDimensions size,
-                                                 FittingMode::Type scalingMode,
+                                                 FittingMode::Type fittingMode,
                                                  SamplingMode::Type samplingMode,
                                                  bool orientationCorrection );
 
@@ -112,7 +112,7 @@ public:
    */
   virtual ImageDimensions GetClosestImageSize( Integration::ResourcePointer resourceBuffer,
                                                ImageDimensions size,
-                                               FittingMode::Type scalingMode,
+                                               FittingMode::Type fittingMode,
                                                SamplingMode::Type samplingMode,
                                                bool orientationCorrection );
 
@@ -160,20 +160,24 @@ public:
    * @copydoc PlatformAbstraction::SetDpi()
    */
   virtual void SetDpi (unsigned int dpiHorizontal, unsigned int dpiVertical);
+
   /**
    * @copydoc PlatformAbstraction::LoadFile()
    */
-  virtual bool LoadFile( const std::string& filename, std::vector< unsigned char >& buffer ) const;
+  virtual bool LoadFile( const std::string& filename, Dali::Vector< unsigned char >& buffer ) const;
 
   /**
-   * @copydoc PlatformAbstraction::LoadShaderBinFile()
+   * @copydoc PlatformAbstraction::LoadShaderBinaryFile()
    */
-  virtual bool LoadShaderBinFile( const std::string& filename, std::vector< unsigned char >& buffer ) const;
+  virtual bool LoadShaderBinaryFile( const std::string& filename, Dali::Vector< unsigned char >& buffer
+) const;
+
+  virtual bool SaveShaderBinaryFile( const std::string& filename, const unsigned char * buffer, unsigned int numBytes ) const { return true; }
 
   /**
    * @copydoc PlatformAbstraction::SaveFile()
    */
-  virtual bool SaveFile(const std::string& filename, std::vector< unsigned char >& buffer) const;
+  virtual bool SaveFile(const std::string& filename, const unsigned char * buffer, unsigned int numBytes) const;
 
   virtual void JoinLoaderThreads();
 
@@ -189,7 +193,8 @@ public: // TEST FUNCTIONS
     SaveResourceFunc,
     SaveFileFunc,
     LoadFileFunc,
-    LoadShaderBinFileFunc,
+    LoadShaderBinaryFileFunc,
+    SaveShaderBinaryFileFunc,
     CancelLoadFunc,
     GetResourcesFunc,
     IsLoadingFunc,
@@ -239,7 +244,7 @@ public: // TEST FUNCTIONS
 
   void SetClosestImageSize(const Vector2& size);
 
-  void SetLoadFileResult( bool result, std::vector< unsigned char >& buffer );
+  void SetLoadFileResult( bool result, Dali::Vector< unsigned char >& buffer );
 
   void SetSaveFileResult( bool result );