[Tizen] Add codes for Dali Windows Backend
[platform/core/uifw/dali-core.git] / dali / internal / render / shaders / scene-graph-shader.h
index 42b106d..5caeda6 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_SCENE_GRAPH_SHADER_H__
 
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  */
 
 // INTERNAL INCLUDES
-#include <dali/public-api/common/dali-vector.h>
-#include <dali/public-api/shader-effects/shader-effect.h>
-
 #include <dali/internal/common/shader-data.h>
-
-#include <dali/internal/common/buffer-index.h>
-#include <dali/internal/common/type-abstraction-enums.h>
-
-#include <dali/internal/event/common/event-thread-services.h>
-#include <dali/internal/event/effects/shader-declarations.h>
-
 #include <dali/internal/update/common/property-owner.h>
 #include <dali/internal/update/common/scene-graph-connection-change-propagator.h>
 
-#include <dali/internal/render/gl-resources/gl-resource-owner.h>
-#include <dali/internal/render/gl-resources/texture-declarations.h>
-
-#include <dali/internal/render/common/render-manager.h>
-
 
 namespace Dali
 {
-
 namespace Internal
 {
 
 class Program;
+class ProgramCache;
 
 namespace SceneGraph
 {
 
-class RenderQueue;
-class UniformMeta;
-class TextureCache;
 class ConnectionObserver;
 class SceneController;
-
 /**
- * A base class for a collection of shader programs, to apply an effect to different geometry types.
- * This class is also the default shader so its easier to override default behaviour
+ * A holder class for Program; also enables sharing of uniform properties
  */
 class Shader : public PropertyOwner, public UniformMap::Observer
 {
@@ -66,53 +46,28 @@ public:
 
   /**
    * Constructor
-   * @param hints Geometry hints
+   * @param hints Shader hints
    */
-  Shader( Dali::ShaderEffect::GeometryHints& hints );
+  Shader( Dali::Shader::Hint::Value& hints );
 
   /**
    * Virtual destructor
    */
   virtual ~Shader();
 
-  /**
-   * Second stage initialization, called when added to the UpdateManager
-   * @param renderQueue Used to queue messages from update to render thread.
-   * @param textureCache Used to retrieve effect textures when rendering.
-   */
-  void Initialize( RenderQueue& renderQueue, TextureCache& textureCache );
-
   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-  // The following methods are called during UpdateManager::Update()
+  // The following methods are called during Update
   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
   /**
-   * Query whether a shader geometry hint is set.
+   * Query whether a shader hint is set.
    * @pre The shader has been initialized.
-   * @param[in] hint The geometry hint to check.
-   * @return True if the given geometry hint is set.
-   */
-  bool GeometryHintEnabled( Dali::ShaderEffect::GeometryHints hint ) const
-  {
-    return mGeometryHints & hint;
-  }
-
-  /**
-   * Retrieve the set of geometry hints.
-   * @return The hints.
-   */
-  Dali::ShaderEffect::GeometryHints GetGeometryHints() const
-  {
-    return mGeometryHints;
-  }
-
-  /**
-   * Set the geometry hints.
-   * @param[in] hints The hints.
+   * @param[in] hint The hint to check.
+   * @return True if the given hint is set.
    */
-  void SetGeometryHints( Dali::ShaderEffect::GeometryHints hints )
+  bool HintEnabled( Dali::Shader::Hint::Value hint ) const
   {
-    mGeometryHints = hints;
+    return mHints & hint;
   }
 
   /**
@@ -140,7 +95,7 @@ public:
   }
 
   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-  // The following methods are called in Render thread
+  // The following methods are called during Render
   ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
   /**
@@ -160,23 +115,6 @@ public:
    */
   Program* GetProgram();
 
-public: // Implementation of ObjectOwnerContainer template methods
-
-  /**
-   * Connect the object to the scene graph
-   *
-   * @param[in] sceneController The scene controller - used for sending messages to render thread
-   * @param[in] bufferIndex The current buffer index - used for sending messages to render thread
-   */
-  void ConnectToSceneGraph( SceneController& sceneController, BufferIndex bufferIndex );
-
-  /**
-   * Disconnect the object from the scene graph
-   * @param[in] sceneController The scene controller - used for sending messages to render thread
-   * @param[in] bufferIndex The current buffer index - used for sending messages to render thread
-   */
-  void DisconnectFromSceneGraph( SceneController& sceneController, BufferIndex bufferIndex );
-
 public: // Implementation of ConnectionChangePropagator
 
   /**
@@ -189,8 +127,6 @@ public: // Implementation of ConnectionChangePropagator
    */
   void RemoveConnectionObserver(ConnectionChangePropagator::Observer& observer);
 
-public:
-
 public: // UniformMap::Observer
   /**
    * @copydoc UniformMap::Observer::UniformMappingsChanged
@@ -199,22 +135,11 @@ public: // UniformMap::Observer
 
 private: // Data
 
-  Dali::ShaderEffect::GeometryHints mGeometryHints;    ///< shader geometry hints for building the geometry
-  float                          mGridDensity;      ///< grid density
-
-  Texture*                       mTexture;          ///< Raw Pointer to Texture
-  Integration::ResourceId        mRenderTextureId;  ///< Copy of the texture ID for the render thread
-  Integration::ResourceId        mUpdateTextureId;  ///< Copy of the texture ID for update thread
+  Dali::Shader::Hint::Value     mHints;
 
   Program*                       mProgram;
 
   ConnectionChangePropagator     mConnectionObservers;
-
-  // These members are only safe to access during UpdateManager::Update()
-  RenderQueue*                   mRenderQueue;                   ///< Used for queuing a message for the next Render
-
-  // These members are only safe to access in render thread
-  TextureCache*                  mTextureCache; // Used for retrieving textures in the render thread
 };
 
 } // namespace SceneGraph