Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(190)

Unified Diff: gpu/vulkan/vulkan_shader_module.h

Issue 1975183003: Added Vulkan Shader Modules with GLSL->SPIR-V translation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check padding Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/vulkan/tests/vulkan_test.cc ('k') | gpu/vulkan/vulkan_shader_module.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/vulkan/vulkan_shader_module.h
diff --git a/gpu/vulkan/vulkan_shader_module.h b/gpu/vulkan/vulkan_shader_module.h
new file mode 100644
index 0000000000000000000000000000000000000000..89c80f7853b418e2b3c8c215ccfa554b9993b03c
--- /dev/null
+++ b/gpu/vulkan/vulkan_shader_module.h
@@ -0,0 +1,59 @@
+// Copyright (c) 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef GPU_VULKAN_VULKAN_SHADER_MODULE_H_
+#define GPU_VULKAN_VULKAN_SHADER_MODULE_H_
+
+#include <string>
+#include <vulkan/vulkan.h>
+
+#include "base/macros.h"
+#include "gpu/vulkan/vulkan_export.h"
+
+namespace gpu {
+
+class VulkanDeviceQueue;
+
+class VULKAN_EXPORT VulkanShaderModule {
+ public:
+ enum class ShaderType {
+ VERTEX,
+ FRAGMENT,
+ };
+
+ VulkanShaderModule(VulkanDeviceQueue* device_queue);
+ ~VulkanShaderModule();
+
+ bool InitializeGLSL(ShaderType type,
+ std::string name,
+ std::string entry_point,
+ std::string source);
+ bool InitializeSPIRV(ShaderType type,
+ std::string name,
+ std::string entry_point,
+ std::string source);
+ void Destroy();
+
+ bool IsValid() const { return handle_ != VK_NULL_HANDLE; }
+ std::string GetErrorMessages() const { return error_messages_; }
+
+ ShaderType shader_type() const { return shader_type_; }
+ const std::string& name() const { return name_; }
+ VkShaderModule handle() const { return handle_; }
+ const std::string& entry_point() const { return entry_point_; }
+
+ private:
+ VulkanDeviceQueue* device_queue_ = nullptr;
+ ShaderType shader_type_ = ShaderType::VERTEX;
+ VkShaderModule handle_ = VK_NULL_HANDLE;
+ std::string name_;
+ std::string entry_point_;
+ std::string error_messages_;
+
+ DISALLOW_COPY_AND_ASSIGN(VulkanShaderModule);
+};
+
+} // namespace gpu
+
+#endif // GPU_VULKAN_VULKAN_SHADER_MODULE_H_
« no previous file with comments | « gpu/vulkan/tests/vulkan_test.cc ('k') | gpu/vulkan/vulkan_shader_module.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698