blob: ad24453ef6af52be545c57370c98a1ffdbacb618 [file] [log] [blame]
Greg Daniel164a9f02016-02-22 09:56:40 -05001/*
2* Copyright 2016 Google Inc.
3*
4* Use of this source code is governed by a BSD-style license that can be
5* found in the LICENSE file.
6*/
7
8#ifndef GrVkDescriptorPool_DEFINED
9#define GrVkDescriptorPool_DEFINED
10
11#include "GrVkResource.h"
12
13#include "vulkan/vulkan.h"
14
15class GrVkGpu;
16
egdanielc2dc1b22016-03-18 13:18:23 -070017/**
18 * We require that all descriptor sets are of a single descriptor type. We also use a pool to only
19 * make one type of descriptor set. Thus a single VkDescriptorPool will only allocated space for
20 * for one type of descriptor.
21 */
Greg Daniel164a9f02016-02-22 09:56:40 -050022class GrVkDescriptorPool : public GrVkResource {
23public:
egdanielc2dc1b22016-03-18 13:18:23 -070024 explicit GrVkDescriptorPool(const GrVkGpu* gpu, VkDescriptorType type, uint32_t count);
Greg Daniel164a9f02016-02-22 09:56:40 -050025
26 VkDescriptorPool descPool() const { return fDescPool; }
27
28 void reset(const GrVkGpu* gpu);
29
30 // Returns whether or not this descriptor pool could be used, assuming it gets fully reset and
egdanielc2dc1b22016-03-18 13:18:23 -070031 // not in use by another draw, to support the requested type and count.
32 bool isCompatible(VkDescriptorType type, uint32_t count) const;
Greg Daniel164a9f02016-02-22 09:56:40 -050033
34private:
35 void freeGPUData(const GrVkGpu* gpu) const override;
36
egdanielc2dc1b22016-03-18 13:18:23 -070037 VkDescriptorType fType;
38 uint32_t fCount;
Greg Daniel164a9f02016-02-22 09:56:40 -050039 VkDescriptorPool fDescPool;
40
41 typedef GrVkResource INHERITED;
42};
43
bsalomonbc2f4df2016-02-22 13:09:26 -080044#endif