2 * Copyright (c) 2018 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.
17 #include <dali/internal/update/rendering/shader-cache.h>
18 #include <dali/graphics-api/graphics-api-controller.h>
27 ShaderCache::ShaderCache( Dali::Graphics::API::Controller& controller )
28 : mController( controller )
32 Dali::Graphics::API::Accessor<Dali::Graphics::API::Shader> ShaderCache::GetShader(
33 const Dali::Graphics::API::ShaderDetails::ShaderSource& vsh,
34 const Dali::Graphics::API::ShaderDetails::ShaderSource& fsh )
36 for( auto&& item : mItems )
38 if( item.vertexSource == vsh && item.fragmentSource == fsh )
44 mController.CreateShader( mController.GetShaderFactory()
45 .SetShaderModule( Graphics::API::ShaderDetails::PipelineStage::VERTEX,
46 Graphics::API::ShaderDetails::Language::SPIRV_1_0,
48 .SetShaderModule( Graphics::API::ShaderDetails::PipelineStage::FRAGMENT,
49 Graphics::API::ShaderDetails::Language::SPIRV_1_0,
51 mItems.emplace_back( Item() = { shaderRef, vsh, fsh } );
55 } // namespace SceneGraph
56 } // namespace Internal