/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
mDepthWriteMode( depthWriteMode ),
mDepthTestMode( depthTestMode ),
mUpdateAttributesLocation( true ),
- mPremultipledAlphaEnabled( preMultipliedAlphaEnabled )
+ mPremultipledAlphaEnabled( preMultipliedAlphaEnabled ),
+ mShaderChanged( false )
{
if( blendingBitmask != 0u )
{
if( uniformMapDataProvider.GetUniformMapChanged( bufferIndex ) ||
node.GetUniformMapChanged(bufferIndex) ||
- mUniformIndexMap.Count() == 0)
+ mUniformIndexMap.Count() == 0 ||
+ mShaderChanged )
{
+ // Reset shader pointer
+ mShaderChanged = false;
+
const SceneGraph::CollectedUniformMap& uniformMap = uniformMapDataProvider.GetUniformMap( bufferIndex );
const SceneGraph::CollectedUniformMap& uniformMapNode = node.GetUniformMap( bufferIndex );
}
}
-bool Renderer::BindTextures( Context& context, Program& program )
+bool Renderer::BindTextures( Context& context, Program& program, Vector<GLuint>& boundTextures )
{
uint32_t textureUnit = 0;
bool result = true;
if( textures[i] )
{
result = textures[i]->Bind(context, textureUnit, samplers[i] );
+ boundTextures.PushBack( textures[i]->GetId() );
if( result && program.GetSamplerUniformLocation( i, uniformLocation ) )
{
program.SetUniform1i( uniformLocation, textureUnit );
return mStencilParameters.stencilOperationOnZPass;
}
+void Renderer::Upload( Context& context )
+{
+ mGeometry->Upload( context );
+}
+
void Renderer::Render( Context& context,
BufferIndex bufferIndex,
const SceneGraph::NodeDataProvider& node,
const Matrix& viewMatrix,
const Matrix& projectionMatrix,
const Vector3& size,
- bool blend )
+ bool blend,
+ Vector<GLuint>& boundTextures )
{
// Get the program to use:
Program* program = mRenderDataProvider->GetShader().GetProgram();
// Take the program into use so we can send uniforms to it
program->Use();
- if( DALI_LIKELY( BindTextures( context, *program ) ) )
+ if( DALI_LIKELY( BindTextures( context, *program, boundTextures ) ) )
{
// Only set up and draw if we have textures and they are all valid
mUpdateAttributesLocation = false;
}
- mGeometry->UploadAndDraw( context,
- bufferIndex,
- mAttributesLocation,
- mIndexedDrawFirstElement,
- mIndexedDrawElementsCount );
+ mGeometry->Draw( context,
+ bufferIndex,
+ mAttributesLocation,
+ mIndexedDrawFirstElement,
+ mIndexedDrawElementsCount );
}
}
sortAttributes.geometry = mGeometry;
}
+void Renderer::SetShaderChanged( bool value )
+{
+ mShaderChanged = value;
+}
+
} // namespace SceneGraph
} // namespace Internal