OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef GPU_VULKAN_VULKAN_SHADER_MODULE_H_ |
| 6 #define GPU_VULKAN_VULKAN_SHADER_MODULE_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vulkan/vulkan.h> |
| 10 |
| 11 #include "base/macros.h" |
| 12 #include "gpu/vulkan/vulkan_export.h" |
| 13 |
| 14 namespace gpu { |
| 15 |
| 16 class VulkanDeviceQueue; |
| 17 |
| 18 class VULKAN_EXPORT VulkanShaderModule { |
| 19 public: |
| 20 enum class ShaderType { |
| 21 VERTEX, |
| 22 FRAGMENT, |
| 23 }; |
| 24 |
| 25 VulkanShaderModule(VulkanDeviceQueue* device_queue); |
| 26 ~VulkanShaderModule(); |
| 27 |
| 28 bool InitializeGLSL(ShaderType type, |
| 29 std::string name, |
| 30 std::string entry_point, |
| 31 std::string source); |
| 32 bool InitializeSPIRV(ShaderType type, |
| 33 std::string name, |
| 34 std::string entry_point, |
| 35 std::string source); |
| 36 void Destroy(); |
| 37 |
| 38 bool IsValid() const { return handle_ != VK_NULL_HANDLE; } |
| 39 std::string GetErrorMessages() const { return error_messages_; } |
| 40 |
| 41 ShaderType shader_type() const { return shader_type_; } |
| 42 const std::string& name() const { return name_; } |
| 43 VkShaderModule handle() const { return handle_; } |
| 44 const std::string& entry_point() const { return entry_point_; } |
| 45 |
| 46 private: |
| 47 VulkanDeviceQueue* device_queue_ = nullptr; |
| 48 ShaderType shader_type_ = ShaderType::VERTEX; |
| 49 VkShaderModule handle_ = VK_NULL_HANDLE; |
| 50 std::string name_; |
| 51 std::string entry_point_; |
| 52 std::string error_messages_; |
| 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(VulkanShaderModule); |
| 55 }; |
| 56 |
| 57 } // namespace gpu |
| 58 |
| 59 #endif // GPU_VULKAN_VULKAN_SHADER_MODULE_H_ |
OLD | NEW |