} // anon namespace
-ShaderEffectPtr ShaderEffect::New( Dali::ShaderEffect::GeometryHints hints )
-{
- ThreadLocalStorage& tls = ThreadLocalStorage::Get();
- UpdateManager& updateManager = tls.GetUpdateManager();
- ShaderFactory& shaderFactory = tls.GetShaderFactory();
-
- // Create a new scene-object, temporarily owned
- Shader* sceneObject = new Shader( hints );
- DALI_ASSERT_DEBUG( NULL != sceneObject );
-
- ShaderEffectPtr shaderEffect( new ShaderEffect( updateManager, shaderFactory, *sceneObject ) );
- shaderEffect->RegisterObject();
-
- return shaderEffect;
-}
-
ShaderEffectPtr ShaderEffect::New( const string& vertexShader,
const string& fragmentShader,
GeometryType geometryType,
return shaderEffect;
}
+ShaderEffectPtr ShaderEffect::New( Dali::ShaderEffect::GeometryHints hints )
+{
+ ThreadLocalStorage& tls = ThreadLocalStorage::Get();
+ UpdateManager& updateManager = tls.GetUpdateManager();
+
+ ShaderEffectPtr shaderEffect( new ShaderEffect( updateManager, hints ) );
+ shaderEffect->RegisterObject();
+
+ return shaderEffect;
+}
+
+ShaderEffect::ShaderEffect( UpdateManager& updateManager, Dali::ShaderEffect::GeometryHints hints )
+: mUpdateManager( updateManager ),
+ mConnectionCount (0),
+ mGeometryHints( hints )
+{
+ mSceneObject = new Shader( hints );
+ DALI_ASSERT_DEBUG( NULL != mSceneObject );
+
+ // Transfer shader ownership to a scene message
+ AddShaderMessage( mUpdateManager, *mSceneObject );
+}
+
ShaderEffect::~ShaderEffect()
{
DALI_ASSERT_DEBUG( mSceneObject != NULL );
}
}
-ShaderEffect::ShaderEffect( UpdateManager& updateManager, ShaderFactory& shaderFactory, Shader& sceneObject )
-: mUpdateManager( updateManager ),
- mShaderFactory( shaderFactory ),
- mSceneObject( &sceneObject ),
- mConnectionCount (0)
-{
- // Transfer shader ownership to a scene message
- AddShaderMessage( mUpdateManager, *mSceneObject );
-}
-
void ShaderEffect::SetEffectImage( Dali::Image image )
{
// if images are the same, do nothing
void ShaderEffect::SetProgram( GeometryType geometryType, ShaderSubTypes subType,
const string& vertexSource, const string& fragmentSource,
- ShaderEffect::FixedVertexShader fixedShader )
+ GeometryState modifiesGeometry )
{
- SetProgramImpl(geometryType, subType, vertexSource, fragmentSource, fixedShader);
+ SetProgramImpl(geometryType, subType, vertexSource, fragmentSource, modifiesGeometry);
}
void ShaderEffect::SetProgram( GeometryType geometryType, ShaderSubTypes subType,
const std::string& vertexPrefix, const std::string& fragmentPrefix,
const std::string& vertexSource, const std::string& fragmentSource,
- ShaderEffect::FixedVertexShader fixedShader )
+ GeometryState modifiesGeometry )
{
const std::string vertex( vertexPrefix + vertexSource );
const std::string fragment( fragmentPrefix + fragmentSource );
- SetProgramImpl( geometryType, subType, vertex, fragment, fixedShader );
+ SetProgramImpl( geometryType, subType, vertex, fragment, modifiesGeometry );
}
void ShaderEffect::Connect()
{
hint = Dali::ShaderEffect::HINT_BLENDING;
}
+ else if(s == "HINT_DOESNT_MODIFY_GEOMETRY")
+ {
+ hint = Dali::ShaderEffect::HINT_DOESNT_MODIFY_GEOMETRY;
+ }
else
{
DALI_ASSERT_ALWAYS(!"Geometry hint unknown" );
}
// Add the program
- SetProgramImpl( geometryType, subType, vertexSource, fragmentSource, ShaderEffect::FLEXIBLE );
+ SetProgramImpl( geometryType, subType, vertexSource, fragmentSource );
+}
+
+void ShaderEffect::SetProgramImpl( GeometryType geometryType, ShaderSubTypes subType,
+ const string& vertexSource, const string& fragmentSource )
+{
+ GeometryState modifiesGeometry = MODIFIES_GEOMETRY;
+
+ if( (mGeometryHints & Dali::ShaderEffect::HINT_DOESNT_MODIFY_GEOMETRY ) != 0 )
+ {
+ modifiesGeometry = DOESNT_MODIFY_GEOMETRY;
+ }
+
+ SetProgramImpl( geometryType, subType, vertexSource, fragmentSource, modifiesGeometry );
}
void ShaderEffect::SetProgramImpl( GeometryType geometryType, ShaderSubTypes subType,
const string& vertexSource, const string& fragmentSource,
- ShaderEffect::FixedVertexShader fixedShader )
+ GeometryState modifiesGeometry )
{
// Load done asynchronously in update thread. SetProgram message below must be processed afterwards.
// Therefore, resource manager cannot farm out the loading to the adaptor resource threads,
// but must instead use synchronous loading via PlatformAbstraction::LoadFile()
+
+ ThreadLocalStorage& tls = ThreadLocalStorage::Get();
+ ShaderFactory& shaderFactory = tls.GetShaderFactory();
size_t shaderHash;
- ResourceTicketPtr ticket( mShaderFactory.Load(vertexSource, fragmentSource, shaderHash) );
- DALI_LOG_INFO( Debug::Filter::gShader, Debug::General, "ShaderEffect: SetProgram(geometryType %d subType:%d ticket.id:%d)\n", geometryType, subType, ticket->GetId() );
+ ResourceTicketPtr ticket( shaderFactory.Load(vertexSource, fragmentSource, shaderHash) );
- bool areVerticesFixed = (fixedShader == ShaderEffect::FIXED);
+ DALI_LOG_INFO( Debug::Filter::gShader, Debug::General, "ShaderEffect: SetProgram(geometryType %d subType:%d ticket.id:%d)\n", geometryType, subType, ticket->GetId() );
// Add shader program to scene-object using a message to the UpdateManager
- SetShaderProgramMessage( mUpdateManager, *mSceneObject, geometryType, subType, ticket->GetId(), shaderHash, areVerticesFixed );
+ SetShaderProgramMessage( mUpdateManager, *mSceneObject, geometryType, subType, ticket->GetId(), shaderHash, modifiesGeometry==MODIFIES_GEOMETRY );
mTickets.push_back(ticket); // add ticket to collection to keep it alive.
}
namespace Internal
{
-class ShaderFactory;
-
namespace SceneGraph
{
class UpdateManager;
class ShaderEffect : public ProxyObject
{
public:
-
typedef Dali::ShaderEffect::UniformCoordinateType UniformCoordinateType;
+ enum GeometryState
+ {
+ DOESNT_MODIFY_GEOMETRY,
+ MODIFIES_GEOMETRY
+ };
+
/**
* Create a new ShaderEffect with no programs
* @param hints GeometryHints to define the geometry of the rendered object
*/
const Dali::ShaderEffect::Extension& GetExtension() const;
- enum FixedVertexShader
- {
- FLEXIBLE,
- FIXED,
- };
-
/**
* Add a GeometryType specific default program to this ShaderEffect
* @param[in] geometryType The GeometryType rendered by the shader program
* @param[in] subType The subtype, one of ShaderSubTypes.
* @param[in] vertexSource The source code for the vertex shader
* @param[in] fragmentSource The source code for the fragment shader
+ * @param[in] modifiesGeometry True if the shader modifies geometry
*/
void SetProgram( GeometryType geometryType, ShaderSubTypes subType,
const std::string& vertexSource, const std::string& fragmentSource,
- FixedVertexShader fixedVertexShader=FLEXIBLE);
+ GeometryState modifiesGeometry );
/**
* Add a GeometryType specific default program to this ShaderEffect.
* @param[in] fragmentPrefix The prefix source code for the fragment shader
* @param[in] vertexSource The source code for the vertex shader
* @param[in] fragmentSource The source code for the fragment shader
- * @param[in] fixedVertexShader True if this shader doesn't change the vertices
+ * @param[in] modifiesGeometry True if the shader modifies geometry
*/
void SetProgram( GeometryType geometryType, ShaderSubTypes subType,
const std::string& vertexPrefix, const std::string& fragmentPrefix,
const std::string& vertexSource, const std::string& fragmentSource,
- FixedVertexShader fixedVertexShader=FLEXIBLE);
+ GeometryState modifiesGeometry );
/**
* Notify ShaderEffect that it's being used by an Actor.
/**
* Protected constructor.
*/
- ShaderEffect( SceneGraph::UpdateManager& updateManager, ShaderFactory& shaderFactory, SceneGraph::Shader& sceneObject );
+ ShaderEffect( SceneGraph::UpdateManager& updateManager, Dali::ShaderEffect::GeometryHints hints );
/**
* A reference counted object may only be deleted by calling Unreference()
/**
* Send shader program to scene-graph object.
- * Uses the shader hints to determine whether the vertices are fixed.
+ * Uses the shader hints to determine whether the shader modifies geometry
* @param[in] geometryType The GeometryType rendered by the shader program
* @param[in] subType The subtype, one of ShaderSubTypes.
* @param[in] vertexSource The source code for the vertex shader
* @param[in] fragmentSource The source code for the fragment shader
- * @param[in] fixedVertexShader True if this shader doesn't change the vertices
+ */
+ void SetProgramImpl( GeometryType geometryType, ShaderSubTypes subType,
+ const std::string& vertexSource, const std::string& fragmentSource );
+
+ /**
+ * Send shader program to scene-graph object.
+ * @param[in] geometryType The GeometryType rendered by the shader program
+ * @param[in] subType The subtype, one of ShaderSubTypes.
+ * @param[in] vertexSource The source code for the vertex shader
+ * @param[in] fragmentSource The source code for the fragment shader
+ * @param[in] modifiesGeometry True if the shader modifies geometry
*/
void SetProgramImpl( GeometryType geometryType, ShaderSubTypes subType,
const std::string& vertexSource, const std::string& fragmentSource,
- FixedVertexShader fixedVertexShader );
+ GeometryState modifiesGeometry );
private: // Data
- SceneGraph::UpdateManager& mUpdateManager; ///< reference to the update manager
- ShaderFactory& mShaderFactory; ///< reference to the shader factory
-
- SceneGraph::Shader* mSceneObject; ///< pointer to the scene shader, should not be changed on this thread
-
- Dali::Image mImage; ///< Client-side handle for the effect image
-
- CustomUniformMetaLookup mCustomMetadata; ///< Used for accessing metadata for custom Shader properties
-
+ SceneGraph::UpdateManager& mUpdateManager;///< reference to the update manager
+ SceneGraph::Shader* mSceneObject; ///< pointer to the scene shader, should not be changed on this thread
+ Dali::Image mImage; ///< Client-side handle for the effect image
+ CustomUniformMetaLookup mCustomMetadata; ///< Used for accessing metadata for custom Shader properties
IntrusivePtr<Dali::ShaderEffect::Extension> mExtension;
-
- std::vector<ResourceTicketPtr> mTickets; ///< Collection of shader program tickets
-
- unsigned int mConnectionCount; ///< number of on-stage ImageActors using this shader effect
+ std::vector<ResourceTicketPtr> mTickets; ///< Collection of shader program tickets
+ unsigned int mConnectionCount; ///< number of on-stage ImageActors using this shader effect
+ Dali::ShaderEffect::GeometryHints mGeometryHints; ///< shader geometry hints for building the geometry
// Default properties
typedef std::map<std::string, Property::Index> DefaultPropertyLookup;
{
mDefaultShader = ShaderEffect::New();
- mDefaultShader->SetProgram( GEOMETRY_TYPE_IMAGE, SHADER_DEFAULT, FlatColorTextureVertex, FlatColorTextureFragment, ShaderEffect::FIXED );
+ mDefaultShader->SetProgram( GEOMETRY_TYPE_IMAGE, SHADER_DEFAULT, FlatColorTextureVertex, FlatColorTextureFragment, ShaderEffect::DOESNT_MODIFY_GEOMETRY );
- mDefaultShader->SetProgram( GEOMETRY_TYPE_TEXT, SHADER_DEFAULT, DistanceFieldFontVertex, DistanceFieldFontFragment, ShaderEffect::FIXED );
+ mDefaultShader->SetProgram( GEOMETRY_TYPE_TEXT, SHADER_DEFAULT, DistanceFieldFontVertex, DistanceFieldFontFragment, ShaderEffect::DOESNT_MODIFY_GEOMETRY );
LoadTextSubtypeShaders(mDefaultShader); // TODO: Remove when applications no longer need these shaders
SHADER_DEF_USE_LIGHTING, // fragment shader defs
CustomMeshPrefixVertex + MeshColorNoTextureVertex,
CustomMeshPrefixFragment + MeshColorNoTextureFragment,
- ShaderEffect::FIXED );
+ ShaderEffect::DOESNT_MODIFY_GEOMETRY );
mDefaultShader->SetProgram( GEOMETRY_TYPE_MESH, SHADER_EVENLY_LIT,
"", // Vertex shader defs
"", // fragment shader defs
CustomMeshPrefixVertex + MeshColorNoTextureVertex,
CustomMeshPrefixFragment + MeshColorNoTextureFragment,
- ShaderEffect::FIXED );
+ ShaderEffect::DOESNT_MODIFY_GEOMETRY );
mDefaultShader->SetProgram( GEOMETRY_TYPE_MESH, SHADER_RIGGED_AND_LIT,
SHADER_DEF_USE_BONES, // vertex shader defs
SHADER_DEF_USE_LIGHTING, // fragment shader defs
CustomMeshPrefixVertex + MeshColorNoTextureVertex,
CustomMeshPrefixFragment + MeshColorNoTextureFragment,
- ShaderEffect::FLEXIBLE);
+ ShaderEffect::MODIFIES_GEOMETRY );
mDefaultShader->SetProgram( GEOMETRY_TYPE_MESH, SHADER_RIGGED_AND_EVENLY_LIT,
SHADER_DEF_USE_BONES, // Vertex shader defs
"", // Fragment shader defs
CustomMeshPrefixVertex + MeshColorNoTextureVertex,
CustomMeshPrefixFragment + MeshColorNoTextureFragment,
- ShaderEffect::FLEXIBLE);
+ ShaderEffect::MODIFIES_GEOMETRY );
mDefaultShader->SetProgram( GEOMETRY_TYPE_MESH, SHADER_RIGGED_AND_VERTEX_COLOR,
(SHADER_DEF_USE_BONES SHADER_DEF_USE_COLOR), // Vertex shader defs
SHADER_DEF_USE_COLOR, // Fragment shader defs
CustomMeshPrefixVertex + MeshColorNoTextureVertex,
CustomMeshPrefixFragment + MeshColorNoTextureFragment,
- ShaderEffect::FLEXIBLE);
+ ShaderEffect::MODIFIES_GEOMETRY );
mDefaultShader->SetProgram( GEOMETRY_TYPE_MESH, SHADER_VERTEX_COLOR,
SHADER_DEF_USE_COLOR, // Vertex shader defs
SHADER_DEF_USE_COLOR, // Fragment shader defs
CustomMeshPrefixVertex + MeshColorNoTextureVertex,
CustomMeshPrefixFragment + MeshColorNoTextureFragment,
- ShaderEffect::FIXED);
+ ShaderEffect::DOESNT_MODIFY_GEOMETRY );
// Textured meshes
mDefaultShader->SetProgram( GEOMETRY_TYPE_TEXTURED_MESH, SHADER_DEFAULT,
SHADER_DEF_USE_LIGHTING, // fragment shader defs
CustomMeshPrefixVertex + MeshVertex,
CustomMeshPrefixFragment + MeshFragment,
- ShaderEffect::FIXED);
+ ShaderEffect::DOESNT_MODIFY_GEOMETRY );
mDefaultShader->SetProgram( GEOMETRY_TYPE_TEXTURED_MESH, SHADER_EVENLY_LIT,
"", // Fragment shader defs
CustomMeshPrefixVertex + MeshVertex,
CustomMeshPrefixFragment + MeshFragment,
- ShaderEffect::FIXED);
+ ShaderEffect::DOESNT_MODIFY_GEOMETRY );
mDefaultShader->SetProgram( GEOMETRY_TYPE_TEXTURED_MESH, SHADER_RIGGED_AND_LIT,
SHADER_DEF_USE_BONES, // Vertex shader defs
SHADER_DEF_USE_LIGHTING, // Fragment shader defs
CustomMeshPrefixVertex + MeshVertex,
CustomMeshPrefixFragment + MeshFragment,
- ShaderEffect::FLEXIBLE);
+ ShaderEffect::MODIFIES_GEOMETRY );
mDefaultShader->SetProgram( GEOMETRY_TYPE_TEXTURED_MESH, SHADER_RIGGED_AND_EVENLY_LIT,
SHADER_DEF_USE_BONES, // Vertex shader defs
"", // Fragment shader defs
CustomMeshPrefixVertex + MeshVertex,
CustomMeshPrefixFragment + MeshFragment,
- ShaderEffect::FLEXIBLE);
+ ShaderEffect::MODIFIES_GEOMETRY );
}
void ShaderFactory::LoadTextSubtypeShaders(ShaderEffectPtr shaderEffect)
SHADER_DEF_USE_GRADIENT,
SHADER_DEF_USE_GRADIENT,
DistanceFieldFontVertex, DistanceFieldFontFragment,
- ShaderEffect::FIXED);
+ ShaderEffect::DOESNT_MODIFY_GEOMETRY );
- shaderEffect->SetProgram(GEOMETRY_TYPE_TEXT, SHADER_GRADIENT_GLOW, DistanceFieldFontGlowVertex, DistanceFieldFontGlowFragment, ShaderEffect::FIXED);
+ shaderEffect->SetProgram(GEOMETRY_TYPE_TEXT, SHADER_GRADIENT_GLOW, DistanceFieldFontGlowVertex, DistanceFieldFontGlowFragment, ShaderEffect::DOESNT_MODIFY_GEOMETRY );
- shaderEffect->SetProgram(GEOMETRY_TYPE_TEXT, SHADER_GRADIENT_SHADOW, DistanceFieldFontShadowVertex, DistanceFieldFontShadowFragment, ShaderEffect::FIXED);
+ shaderEffect->SetProgram(GEOMETRY_TYPE_TEXT, SHADER_GRADIENT_SHADOW, DistanceFieldFontShadowVertex, DistanceFieldFontShadowFragment, ShaderEffect::DOESNT_MODIFY_GEOMETRY );
- shaderEffect->SetProgram(GEOMETRY_TYPE_TEXT, SHADER_GRADIENT_OUTLINE, DistanceFieldFontOutlineVertex, DistanceFieldFontOutlineFragment, ShaderEffect::FIXED);
+ shaderEffect->SetProgram(GEOMETRY_TYPE_TEXT, SHADER_GRADIENT_OUTLINE, DistanceFieldFontOutlineVertex, DistanceFieldFontOutlineFragment, ShaderEffect::DOESNT_MODIFY_GEOMETRY );
- shaderEffect->SetProgram(GEOMETRY_TYPE_TEXT, SHADER_GRADIENT_OUTLINE_GLOW, DistanceFieldFontOutlineGlowVertex, DistanceFieldFontOutlineGlowFragment, ShaderEffect::FIXED);
+ shaderEffect->SetProgram(GEOMETRY_TYPE_TEXT, SHADER_GRADIENT_OUTLINE_GLOW, DistanceFieldFontOutlineGlowVertex, DistanceFieldFontOutlineGlowFragment, ShaderEffect::DOESNT_MODIFY_GEOMETRY );
}
Program& program = mShader->GetProgram( *mContext, geometryType, subType, programIndex );
// Check culling (does not need the program to be in use)
- bool areVerticesFixed = program.AreVerticesFixed();
- if( cull && areVerticesFixed )
+ if( cull && ! program.ModifiesGeometry() )
{
if( IsOutsideClipSpace( modelMatrix, gModelViewProjectionMatrix ) )
{
// IMPLEMENTATION
-Program* Program::New( const Integration::ResourceId& resourceId, Integration::ShaderData* shaderData, Context& context, bool fixedVertices )
+Program* Program::New( const Integration::ResourceId& resourceId, Integration::ShaderData* shaderData, Context& context, bool modifiesGeometry )
{
size_t shaderHash = shaderData->GetHashValue();
Program* program = context.GetCachedProgram( shaderHash );
if( NULL == program )
{
// program not found so create it
- program = new Program( shaderData, context, fixedVertices );
+ program = new Program( shaderData, context, modifiesGeometry );
program->Load();
ResetAttribsUniforms();
}
-bool Program::AreVerticesFixed()
+bool Program::ModifiesGeometry()
{
- return mAreVerticesFixed;
+ return mModifiesGeometry;
}
-Program::Program(Integration::ShaderData* shaderData, Context& context, bool areVerticesFixed )
+Program::Program(Integration::ShaderData* shaderData, Context& context, bool modifiesGeometry )
: mContext( context ),
mGlAbstraction( context.GetAbstraction() ),
mProjectionMatrix( NULL ),
mFragmentShaderId( 0 ),
mProgramId( 0 ),
mProgramData(shaderData),
- mAreVerticesFixed(areVerticesFixed)
+ mModifiesGeometry( modifiesGeometry )
{
// reserve space for standard uniforms
mUniformLocations.reserve( UNIFORM_TYPE_LAST );
* and optionally precompiled binary. If the binary is empty the program bytecode
* is copied into it after compilation and linking)
* @param [in] context GL context
- * @param [in] fixedVertices True if the vertex shader does not change verts
+ * @param [in] modifiesGeometry True if the shader modifies geometry
* @return pointer to the program
*/
- static Program* New( const Integration::ResourceId& resourceId, Integration::ShaderData* shaderData, Context& context, bool fixedVertices );
+ static Program* New( const Integration::ResourceId& resourceId, Integration::ShaderData* shaderData, Context& context, bool modifiesGeometry );
/**
* Takes this program into use
void GlContextDestroyed();
/**
- * @return true if this program does not change vertex position
+ * @return true if this program modifies geometry
*/
- bool AreVerticesFixed();
+ bool ModifiesGeometry();
/**
* Set the projection matrix that has currently been sent
* Constructor, private so no direct instantiation
* @param[in] shaderData A pointer to a data structure containing the program source and binary
* @param[in] context The GL context state cache.
- * @param[in] areVerticesFixed True if the vertex shader does not move vertices
+ * @param[in] modifiesGeometry True if the vertex shader changes geometry
*/
- Program( Integration::ShaderData* shaderData, Context& context, bool areVerticesFixed );
+ Program( Integration::ShaderData* shaderData, Context& context, bool modifiesGeometry );
public:
GLint mUniformCacheInt[ MAX_UNIFORM_CACHE_SIZE ]; ///< Value cache for uniforms of single int
GLfloat mUniformCacheFloat[ MAX_UNIFORM_CACHE_SIZE ]; ///< Value cache for uniforms of single float
GLfloat mUniformCacheFloat4[ MAX_UNIFORM_CACHE_SIZE ][4]; ///< Value cache for uniforms of four float
- bool mAreVerticesFixed; ///< True if the program does not change vertex position
+ bool mModifiesGeometry; ///< True if the program changes geometry
};
} // namespace Internal
new (slot) DerivedType( this, &Shader::SetGridDensity, density );
}
-void Shader::ForwardHints( BufferIndex updateBufferIndex, int hint )
+void Shader::ForwardHints( BufferIndex updateBufferIndex, Dali::ShaderEffect::GeometryHints hint )
{
- typedef MessageValue1< Shader, int > DerivedType;
+ typedef MessageValue1< Shader, Dali::ShaderEffect::GeometryHints > DerivedType;
// Reserve some memory inside the render queue
unsigned int* slot = mRenderQueue->ReserveMessageSlot( updateBufferIndex, sizeof( DerivedType ) );
Integration::ResourceId resourceId,
Integration::ShaderDataPtr shaderData,
Context* context,
- bool areVerticesFixed )
+ bool modifiesGeometry )
{
DALI_LOG_TRACE_METHOD_FMT(Debug::Filter::gShader, "%d %d\n", (int)geometryType, resourceId);
bool precompiledBinary = shaderData->HasBinary();
- Program* program = Program::New( resourceId, shaderData.Get(), *context, areVerticesFixed );
+ Program* program = Program::New( resourceId, shaderData.Get(), *context, modifiesGeometry );
ShaderSubTypes theSubType = subType;
if( subType == SHADER_SUBTYPE_ALL )
* Retrieve the set of geometry hints.
* @return The hints.
*/
- int GetGeometryHints() const
+ Dali::ShaderEffect::GeometryHints GetGeometryHints() const
{
return mGeometryHints;
}
* Set the geometry hints.
* @param[in] hints The hints.
*/
- void SetGeometryHints( int hints )
+ void SetGeometryHints( Dali::ShaderEffect::GeometryHints hints )
{
mGeometryHints = hints;
}
* @param[in] updateBufferIndex The current update buffer index.
* @param[in] hint The geometry hints.
*/
- void ForwardHints( BufferIndex updateBufferIndex, int hint );
+ void ForwardHints( BufferIndex updateBufferIndex, Dali::ShaderEffect::GeometryHints hint );
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// The following methods are called in Render thread
* @param[in] resourceId The resource ID for the program.
* @param[in] shaderData The program's vertex/fragment source and optionally compiled bytecode
* @param[in] context Reference to the GL context.
- * @param[in] areVerticesFixed True if the vertex shader does not change vertex position
+ * @param[in] modifiesGeometry True if the vertex shader changes geometry
*/
void SetProgram( GeometryType geometryType,
Internal::ShaderSubTypes subType,
Integration::ResourceId resourceId,
Integration::ShaderDataPtr shaderData,
Context* context,
- bool areVerticesFixed );
+ bool modifiesGeometry );
/**
* Determine if subtypes are required for the given geometry type
typedef OwnerContainer< UniformMeta* > UniformMetaContainer;
- int mGeometryHints; ///< shader geometry hints for building the geometry
+ 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
TextureCache* mTextureCache; // Used for retrieving textures in the render thread
};
+} // namespace SceneGraph
+
+template <> struct ParameterType<Dali::ShaderEffect::GeometryHints> : public BasicType< Dali::ShaderEffect::GeometryHints >
+{
+};
+
+namespace SceneGraph
+{
+
// Messages for Shader, to be processed in Update thread.
inline void SetTextureIdMessage( EventToUpdate& eventToUpdate, const Shader& shader, Integration::ResourceId textureId )
inline void SetHintsMessage( EventToUpdate& eventToUpdate, const Shader& shader, Dali::ShaderEffect::GeometryHints hint )
{
- typedef MessageDoubleBuffered1< Shader, int > LocalType;
+ typedef MessageDoubleBuffered1< Shader, Dali::ShaderEffect::GeometryHints > LocalType;
// Reserve some memory inside the message queue
unsigned int* slot = eventToUpdate.ReserveMessageSlot( sizeof( LocalType ) );
DALI_ASSERT_DEBUG(false);
}
-void UpdateManager::SetShaderProgram( Shader* shader, GeometryType geometryType, ShaderSubTypes subType, ResourceId resourceId, size_t shaderHash, bool fixed )
+void UpdateManager::SetShaderProgram( Shader* shader, GeometryType geometryType, ShaderSubTypes subType, ResourceId resourceId, size_t shaderHash, bool modifiesGeometry )
{
DALI_LOG_TRACE_METHOD_FMT(Debug::Filter::gShader, " - (geometryType:%d subType:%d id:%d hash:%d)\n", geometryType, subType, resourceId, shaderHash);
unsigned int* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
// Construct message in the render queue memory; note that delete should not be called on the return value
- new (slot) DerivedType( shader, &Shader::SetProgram, geometryType, subType, resourceId, shaderData, &(mImpl->renderManager.GetContext()), fixed );
+ new (slot) DerivedType( shader, &Shader::SetProgram, geometryType, subType, resourceId, shaderData, &(mImpl->renderManager.GetContext()), modifiesGeometry );
}
}
* @param[in] subType The program subtype
* @param[in] resourceId A ResourceManager ticket ID for the program data (source and compiled binary)
* @param[in] shaderHash hash key created with vertex and fragment shader code
- * @param[in] fixed True if the vertex shader doesn't alter vertices
+ * @param[in] modifiesGeometry True if the vertex shader modifies geometry
*/
- void SetShaderProgram( Shader* shader, GeometryType geometryType, ShaderSubTypes subType, Integration::ResourceId resourceId, size_t shaderHash, bool fixed );
+ void SetShaderProgram( Shader* shader, GeometryType geometryType, ShaderSubTypes subType, Integration::ResourceId resourceId, size_t shaderHash, bool modifiesGeometry );
/**
* Add an animatable mesh
ShaderSubTypes subType,
Integration::ResourceId resourceId,
size_t shaderHash,
- bool fixed )
+ bool modifiesGeometry )
{
typedef MessageValue6< UpdateManager, Shader*, GeometryType, ShaderSubTypes, Integration::ResourceId, size_t, bool > LocalType;
unsigned int* slot = manager.GetEventToUpdate().ReserveMessageSlot( sizeof( LocalType ) );
// Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::SetShaderProgram, &shader, geometryType, subType, resourceId, shaderHash, fixed );
+ new (slot) LocalType( &manager, &UpdateManager::SetShaderProgram, &shader, geometryType, subType, resourceId, shaderHash, modifiesGeometry );
}
// The render thread can safely change the AnimatableMesh
*/
enum GeometryHints
{
- HINT_NONE = 0x00, ///< no hints
- HINT_GRID_X = 0x01, ///< Geometry must be subdivided in X
- HINT_GRID_Y = 0x02, ///< Geometry must be subdivided in Y
- HINT_GRID = (HINT_GRID_X | HINT_GRID_Y),
- HINT_DEPTH_BUFFER = 0x04, ///< Needs depth buffering turned on
- HINT_BLENDING = 0x08 ///< Notifies the actor to use blending even if it's fully opaque. Needs actor's blending set to BlendingMode::AUTO
+ HINT_NONE = 0x00, ///< no hints
+ HINT_GRID_X = 0x01, ///< Geometry must be subdivided in X
+ HINT_GRID_Y = 0x02, ///< Geometry must be subdivided in Y
+ HINT_GRID = (HINT_GRID_X | HINT_GRID_Y),
+ HINT_DEPTH_BUFFER = 0x04, ///< Needs depth buffering turned on
+ HINT_BLENDING = 0x08, ///< Notifies the actor to use blending even if it's fully opaque. Needs actor's blending set to BlendingMode::AUTO
+ HINT_DOESNT_MODIFY_GEOMETRY = 0x10 ///< Notifies that the vertex shader will not change geometry (enables bounding box culling)
};
/**