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

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: revert ref pointer... bad idea I think? 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
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..716f06f6f64f37848179d7563584f1b73b18b156
--- /dev/null
+++ b/gpu/vulkan/vulkan_shader_module.h
@@ -0,0 +1,60 @@
+// 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 {
+ 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.
+ VERTEX,
+ FRAGMENT,
+ };
+
+ VulkanShaderModule(VulkanDeviceQueue* device_queue);
+ ~VulkanShaderModule();
+
+ bool InitializeGLSL(ShaderType type,
+ 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.
+ const std::string& entry_point,
+ const std::string& source);
+ bool InitializeSPIRV(ShaderType type,
+ const std::string& name,
+ const std::string& entry_point,
+ const 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::INVALID;
+ 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_

Powered by Google App Engine
This is Rietveld 408576698