// INTERNAL INCLUDES
#include <dali/internal/common/image-sampler.h>
#include <dali/internal/render/gl-resources/context.h>
+#include <dali/internal/render/renderers/render-sampler.h>
#include <dali/internal/render/shaders/scene-graph-shader.h>
#include <dali/internal/render/shaders/program.h>
#include <dali/internal/render/data-providers/node-data-provider.h>
#include <dali/internal/render/shaders/scene-graph-shader.h>
// INTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
#include <dali/internal/render/queue/render-queue.h>
#include <dali/internal/render/common/render-debug.h>
-#include <dali/internal/render/gl-resources/context.h>
-#include <dali/internal/render/gl-resources/texture.h>
-#include <dali/internal/render/gl-resources/texture-cache.h>
-#include <dali/internal/render/gl-resources/texture-units.h>
#include <dali/internal/render/shaders/program.h>
-#include <dali/internal/render/shaders/uniform-meta.h>
#include <dali/internal/common/image-sampler.h>
-// See render-debug.h
-#ifdef DALI_PRINT_RENDER_INFO
-
-#include <sstream>
-#define DALI_DEBUG_OSTREAM(streamName) std::stringstream streamName;
-
-#define DALI_PRINT_UNIFORM(streamName,bufferIndex,name,value) \
- { \
- streamName << " " << name << ": " << value; \
- }
-
-#define DALI_PRINT_CUSTOM_UNIFORM(streamName,bufferIndex,name,property) \
- { \
- streamName << " " << name << ": "; \
- property.DebugPrint( streamName, bufferIndex ); \
- }
-
-#define DALI_PRINT_SHADER_UNIFORMS(streamName) \
- { \
- std::string debugString( streamName.str() ); \
- DALI_LOG_RENDER_INFO( " %s\n", debugString.c_str() ); \
- }
-
-#else // DALI_PRINT_RENDER_INFO
-
-#define DALI_DEBUG_OSTREAM(streamName)
-#define DALI_PRINT_UNIFORM(streamName,bufferIndex,name,value)
-#define DALI_PRINT_CUSTOM_UNIFORM(streamName,bufferIndex,name,property)
-#define DALI_PRINT_SHADER_UNIFORMS(streamName)
-
-#endif // DALI_PRINT_RENDER_INFO
namespace Dali
{
namespace Internal
{
-template <> struct ParameterType< Dali::ShaderEffect::GeometryHints> : public BasicType< Dali::ShaderEffect::GeometryHints > {};
-template <> struct ParameterType< Dali::ShaderEffect::UniformCoordinateType > : public BasicType< Dali::ShaderEffect::UniformCoordinateType > {};
-
namespace SceneGraph
{
Shader::Shader( Dali::ShaderEffect::GeometryHints& hints )
: mGeometryHints( hints ),
- mGridDensity( Dali::ShaderEffect::DEFAULT_GRID_DENSITY ),
- mTexture( NULL ),
- mRenderTextureId( 0 ),
- mUpdateTextureId( 0 ),
mProgram( NULL ),
- mConnectionObservers(),
- mRenderQueue( NULL ),
- mTextureCache( NULL )
+ mConnectionObservers()
{
AddUniformMapObserver( *this );
}
mConnectionObservers.Destroy( *this );
}
-void Shader::Initialize( RenderQueue& renderQueue, TextureCache& textureCache )
-{
- mRenderQueue = &renderQueue;
- mTextureCache = &textureCache;
-}
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// The following methods are called during RenderManager::Render()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
*/
// 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
{
*/
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()
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
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
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
+++ /dev/null
-#ifndef __DALI_INTERNAL_UNIFORM_META_H__
-#define __DALI_INTERNAL_UNIFORM_META_H__
-
-/*
- * Copyright (c) 2014 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <string>
-#include <cstring> // for memcpy & memset
-
-// INTERNAL INCLUDES
-#include <dali/public-api/math/compile-time-math.h>
-#include <dali/public-api/object/property.h>
-#include <dali/public-api/shader-effects/shader-effect.h>
-#include <dali/internal/common/message.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace SceneGraph
-{
-
-class PropertyBase;
-
-/**
- * Holds the metadata associated with a Shader uniform.
- */
-class UniformMeta
-{
-public:
-
- /**
- * Create a UniformMeta.
- */
- static UniformMeta* New( const std::string& name, const PropertyBase& property, Dali::ShaderEffect::UniformCoordinateType coordType )
- {
- return new UniformMeta( name, property, coordType );
- }
-
- /**
- * Copy constructor
- * @param [in] meta The UniformMeta to copy.
- */
- UniformMeta( const UniformMeta& meta )
- : name( meta.name ),
- property( meta.property ),
- cacheIndex( meta.cacheIndex ),
- coordinateType( meta.coordinateType )
- {
- }
-
- /**
- * Set the coordinate type.
- * @param [in] coordType The new coordinate type.
- */
- void SetCoordinateType( Dali::ShaderEffect::UniformCoordinateType coordType )
- {
- coordinateType = coordType;
- }
-
-private:
-
- /**
- * Constructor
- */
- UniformMeta( const std::string& uniformName, const PropertyBase& prop, Dali::ShaderEffect::UniformCoordinateType coordType )
- : name( uniformName ),
- property( prop ),
- cacheIndex( 0 ),
- coordinateType( coordType )
- {
- }
-
- // Undefined
- UniformMeta& operator=( const UniformMeta& rhs );
-
-public:
-
- std::string name; ///< name of uniform to set/animate
- const PropertyBase& property; ///< reference to the corresponding property
- unsigned int cacheIndex; ///< internal program cache index
- Dali::ShaderEffect::UniformCoordinateType coordinateType; ///< The coordinate type of the uniform
-
-
-};
-
-} // namespace SceneGraph
-
-} // namespace Internal
-
-} // namespace Dali
-
-#endif // __DALI_INTERNAL_UNIFORM_META_H__
}
mImpl->shaders.PushBack( shader );
-
- // Allows the shader to dispatch texture requests to the cache
- shader->Initialize( mImpl->renderQueue, mImpl->sceneController->GetTextureCache() );
}
void UpdateManager::RemoveShader( Shader* shader )