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

Unified Diff: gpu/vulkan/vulkan_descriptor_layout.cc

Issue 1989013002: Added Vulkan Descriptor Sets and Samplers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Separated out descriptor layout 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/vulkan_descriptor_layout.h ('k') | gpu/vulkan/vulkan_descriptor_pool.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/vulkan/vulkan_descriptor_layout.cc
diff --git a/gpu/vulkan/vulkan_descriptor_layout.cc b/gpu/vulkan/vulkan_descriptor_layout.cc
new file mode 100644
index 0000000000000000000000000000000000000000..bc5772faf4ae37c55805b24ced2d842ec829e75b
--- /dev/null
+++ b/gpu/vulkan/vulkan_descriptor_layout.cc
@@ -0,0 +1,49 @@
+// 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.
+
+#include "gpu/vulkan/vulkan_descriptor_layout.h"
+
+#include "base/logging.h"
+#include "gpu/vulkan/vulkan_descriptor_pool.h"
+#include "gpu/vulkan/vulkan_device_queue.h"
+
+namespace gpu {
+
+VulkanDescriptorLayout::VulkanDescriptorLayout(VulkanDeviceQueue* device_queue)
+ : device_queue_(device_queue) {}
+
+VulkanDescriptorLayout::~VulkanDescriptorLayout() {
+ DCHECK_EQ(static_cast<VkDescriptorSetLayout>(VK_NULL_HANDLE), handle_);
+}
+
+bool VulkanDescriptorLayout::Initialize(
+ const std::vector<VkDescriptorSetLayoutBinding>& layout) {
+ VkResult result = VK_SUCCESS;
+ VkDevice device = device_queue_->GetVulkanDevice();
+
+ VkDescriptorSetLayoutCreateInfo layout_create_info = {};
+ layout_create_info.sType =
+ VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
+ layout_create_info.bindingCount = static_cast<uint32_t>(layout.size());
+ layout_create_info.pBindings = layout.data();
+
+ result = vkCreateDescriptorSetLayout(device, &layout_create_info, nullptr,
+ &handle_);
+ if (VK_SUCCESS != result) {
+ DLOG(ERROR) << "vkCreateDescriptorSetLayout() failed: " << result;
+ return false;
+ }
+
+ return true;
+}
+
+void VulkanDescriptorLayout::Destroy() {
+ if (VK_NULL_HANDLE != handle_) {
+ vkDestroyDescriptorSetLayout(
+ device_queue_->GetVulkanDevice(), handle_, nullptr);
+ handle_ = VK_NULL_HANDLE;
+ }
+}
+
+} // namespace gpu
« no previous file with comments | « gpu/vulkan/vulkan_descriptor_layout.h ('k') | gpu/vulkan/vulkan_descriptor_pool.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698