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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 #include "gpu/vulkan/vulkan_descriptor_layout.h"
6
7 #include "base/logging.h"
8 #include "gpu/vulkan/vulkan_descriptor_pool.h"
9 #include "gpu/vulkan/vulkan_device_queue.h"
10
11 namespace gpu {
12
13 VulkanDescriptorLayout::VulkanDescriptorLayout(VulkanDeviceQueue* device_queue)
14 : device_queue_(device_queue) {}
15
16 VulkanDescriptorLayout::~VulkanDescriptorLayout() {
17 DCHECK_EQ(static_cast<VkDescriptorSetLayout>(VK_NULL_HANDLE), handle_);
18 }
19
20 bool VulkanDescriptorLayout::Initialize(
21 const std::vector<VkDescriptorSetLayoutBinding>& layout) {
22 VkResult result = VK_SUCCESS;
23 VkDevice device = device_queue_->GetVulkanDevice();
24
25 VkDescriptorSetLayoutCreateInfo layout_create_info = {};
26 layout_create_info.sType =
27 VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO;
28 layout_create_info.bindingCount = static_cast<uint32_t>(layout.size());
29 layout_create_info.pBindings = layout.data();
30
31 result = vkCreateDescriptorSetLayout(device, &layout_create_info, nullptr,
32 &handle_);
33 if (VK_SUCCESS != result) {
34 DLOG(ERROR) << "vkCreateDescriptorSetLayout() failed: " << result;
35 return false;
36 }
37
38 return true;
39 }
40
41 void VulkanDescriptorLayout::Destroy() {
42 if (VK_NULL_HANDLE != handle_) {
43 vkDestroyDescriptorSetLayout(
44 device_queue_->GetVulkanDevice(), handle_, nullptr);
45 handle_ = VK_NULL_HANDLE;
46 }
47 }
48
49 } // namespace gpu
OLDNEW
« 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