1 #ifndef DALI_GRAPHICS_VULKAN_SHADER
2 #define DALI_GRAPHICS_VULKAN_SHADER
5 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/graphics/vulkan/vulkan-types.h>
31 class Shader : public VkManaged // can be overriden as ShaderGLSL for example
37 VERTEX = static_cast<int>( vk::ShaderStageFlagBits::eVertex ),
38 FRAGMENT = static_cast<int>( vk::ShaderStageFlagBits::eFragment ),
39 COMPUTE = static_cast<int>( vk::ShaderStageFlagBits::eCompute ),
40 GEOMETRY = static_cast<int>( vk::ShaderStageFlagBits::eGeometry ),
49 static Handle<Shader> New( Graphics& graphics, const vk::ShaderModuleCreateInfo& info );
52 * Creates new shader module from SPIRV code
58 static Handle<Shader> New( Graphics& graphics, const void* bytes, std::size_t size );
65 vk::ShaderModule GetVkShaderModule() const;
67 const std::vector<vk::DescriptorSetLayout>& GetDescriptorSetLayouts() const;
69 bool OnDestroy() override;
71 operator vk::ShaderModule() const
73 return GetVkShaderModule();
78 void SetDescriptorSetLayout( uint32_t set, vk::DescriptorSetLayoutCreateInfo info );
82 Shader( Graphics& graphics, const vk::ShaderModuleCreateInfo& info );
87 std::unique_ptr<Impl> mImpl;
90 using ShaderRef = Handle<Shader>;
94 } // Namespace Graphics
98 #endif // DALI_GRAPHICS_VULKAN_SHADER