2 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include <dali/internal/render/shaders/scene-graph-shader.h>
22 #include <dali/integration-api/debug.h>
23 #include <dali/internal/render/queue/render-queue.h>
24 #include <dali/internal/render/common/render-debug.h>
25 #include <dali/internal/render/shaders/program.h>
26 #include <dali/internal/common/image-sampler.h>
38 Shader::Shader( Dali::Shader::ShaderHints& hints )
41 mConnectionObservers()
43 AddUniformMapObserver( *this );
48 mConnectionObservers.Destroy( *this );
51 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
52 // The following methods are called during RenderManager::Render()
53 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
54 void Shader::SetProgram( Internal::ShaderDataPtr shaderData,
55 ProgramCache* programCache,
56 bool modifiesGeometry )
58 DALI_LOG_TRACE_METHOD_FMT( Debug::Filter::gShader, "%d\n", shaderData->GetHashValue() );
60 mProgram = Program::New( *programCache, shaderData, modifiesGeometry );
61 // The program cache owns the Program object so we don't need to worry about this raw allocation here.
63 mConnectionObservers.ConnectionsChanged(*this);
66 Program* Shader::GetProgram()
71 void Shader::ConnectToSceneGraph( SceneController& sceneController, BufferIndex bufferIndex )
75 void Shader::DisconnectFromSceneGraph( SceneController& sceneController, BufferIndex bufferIndex )
79 void Shader::AddConnectionObserver( ConnectionChangePropagator::Observer& observer )
81 mConnectionObservers.Add(observer);
84 void Shader::RemoveConnectionObserver( ConnectionChangePropagator::Observer& observer )
86 mConnectionObservers.Remove(observer);
89 void Shader::UniformMappingsChanged( const UniformMap& mappings )
91 // Our uniform map, or that of one of the watched children has changed.
92 // Inform connected observers.
93 mConnectionObservers.ConnectedUniformMapChanged();
96 } // namespace SceneGraph
98 } // namespace Internal