| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrVkDescriptorPool_DEFINED | 8 #ifndef GrVkDescriptorPool_DEFINED |
| 9 #define GrVkDescriptorPool_DEFINED | 9 #define GrVkDescriptorPool_DEFINED |
| 10 | 10 |
| 11 #include "GrVkResource.h" | 11 #include "GrVkResource.h" |
| 12 | 12 |
| 13 #include "vulkan/vulkan.h" | 13 #include "vulkan/vulkan.h" |
| 14 | 14 |
| 15 class GrVkGpu; | 15 class GrVkGpu; |
| 16 | 16 |
| 17 class GrVkDescriptorPool : public GrVkResource { | 17 class GrVkDescriptorPool : public GrVkResource { |
| 18 public: | 18 public: |
| 19 class DescriptorTypeCounts { | 19 class DescriptorTypeCounts { |
| 20 public: | 20 public: |
| 21 DescriptorTypeCounts() { | 21 DescriptorTypeCounts() { |
| 22 memset(fDescriptorTypeCount, 0, sizeof(fDescriptorTypeCount)); | 22 memset(fDescriptorTypeCount, 0, sizeof(fDescriptorTypeCount)); |
| 23 } | 23 } |
| 24 | 24 |
| 25 void setTypeCount(VkDescriptorType type, uint8_t count); | 25 void setTypeCount(VkDescriptorType type, uint8_t count); |
| 26 uint32_t numPoolSizes() const; | 26 int numPoolSizes() const; |
| 27 | 27 |
| 28 // Determines if for each i, that.fDescriptorTypeCount[i] <= fDescriptor
TypeCount[i]; | 28 // Determines if for each i, that.fDescriptorTypeCount[i] <= fDescriptor
TypeCount[i]; |
| 29 bool isSuperSet(const DescriptorTypeCounts& that) const; | 29 bool isSuperSet(const DescriptorTypeCounts& that) const; |
| 30 private: | 30 private: |
| 31 uint8_t fDescriptorTypeCount[VK_DESCRIPTOR_TYPE_RANGE_SIZE]; | 31 uint8_t fDescriptorTypeCount[VK_DESCRIPTOR_TYPE_RANGE_SIZE]; |
| 32 | 32 |
| 33 friend class GrVkDescriptorPool; | 33 friend class GrVkDescriptorPool; |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 explicit GrVkDescriptorPool(const GrVkGpu* gpu, const DescriptorTypeCounts&
typeCounts); | 36 explicit GrVkDescriptorPool(const GrVkGpu* gpu, const DescriptorTypeCounts&
typeCounts); |
| 37 | 37 |
| 38 VkDescriptorPool descPool() const { return fDescPool; } | 38 VkDescriptorPool descPool() const { return fDescPool; } |
| 39 | 39 |
| 40 void reset(const GrVkGpu* gpu); | 40 void reset(const GrVkGpu* gpu); |
| 41 | 41 |
| 42 // Returns whether or not this descriptor pool could be used, assuming it ge
ts fully reset and | 42 // Returns whether or not this descriptor pool could be used, assuming it ge
ts fully reset and |
| 43 // not in use by another draw, to support the requested typeCounts. | 43 // not in use by another draw, to support the requested typeCounts. |
| 44 bool isCompatible(const DescriptorTypeCounts& typeCounts) const; | 44 bool isCompatible(const DescriptorTypeCounts& typeCounts) const; |
| 45 | 45 |
| 46 private: | 46 private: |
| 47 void freeGPUData(const GrVkGpu* gpu) const override; | 47 void freeGPUData(const GrVkGpu* gpu) const override; |
| 48 | 48 |
| 49 DescriptorTypeCounts fTypeCounts; | 49 DescriptorTypeCounts fTypeCounts; |
| 50 VkDescriptorPool fDescPool; | 50 VkDescriptorPool fDescPool; |
| 51 | 51 |
| 52 typedef GrVkResource INHERITED; | 52 typedef GrVkResource INHERITED; |
| 53 }; | 53 }; |
| 54 | 54 |
| 55 | 55 #endif |
| 56 #endif | |
| OLD | NEW |