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 INVALID = -1, | |
piman
2016/05/16 23:35:31
nit: do we need INVALID? e.g. IsValid is based on
David Yen
2016/05/17 18:13:57
Done.
| |
22 VERTEX, | |
23 FRAGMENT, | |
24 }; | |
25 | |
26 VulkanShaderModule(VulkanDeviceQueue* device_queue); | |
27 ~VulkanShaderModule(); | |
28 | |
29 bool InitializeGLSL(ShaderType type, | |
30 const std::string& name, | |
piman
2016/05/16 23:35:31
nit: std::string (no const ref), and use std::move
David Yen
2016/05/17 18:14:16
Done.
| |
31 const std::string& entry_point, | |
32 const std::string& source); | |
33 bool InitializeSPIRV(ShaderType type, | |
34 const std::string& name, | |
35 const std::string& entry_point, | |
36 const std::string& source); | |
37 void Destroy(); | |
38 | |
39 bool IsValid() const { return handle_ != VK_NULL_HANDLE; } | |
40 std::string GetErrorMessages() const { return error_messages_; } | |
41 | |
42 ShaderType shader_type() const { return shader_type_; } | |
43 const std::string& name() const { return name_; } | |
44 VkShaderModule handle() const { return handle_; } | |
45 const std::string& entry_point() const { return entry_point_; } | |
46 | |
47 private: | |
48 VulkanDeviceQueue* device_queue_ = nullptr; | |
49 ShaderType shader_type_ = ShaderType::INVALID; | |
50 VkShaderModule handle_ = VK_NULL_HANDLE; | |
51 std::string name_; | |
52 std::string entry_point_; | |
53 std::string error_messages_; | |
54 | |
55 DISALLOW_COPY_AND_ASSIGN(VulkanShaderModule); | |
56 }; | |
57 | |
58 } // namespace gpu | |
59 | |
60 #endif // GPU_VULKAN_VULKAN_SHADER_MODULE_H_ | |
OLD | NEW |