Index: src/gpu/vk/GrVkDescriptorSetManager.h |
diff --git a/src/gpu/vk/GrVkDescriptorSetManager.h b/src/gpu/vk/GrVkDescriptorSetManager.h |
index 33a7720ab34cb38d4eaae1f03c3d6cf64f2b35e3..1f405a524f9361c6e1c8b3cf3869697ba00dd920 100644 |
--- a/src/gpu/vk/GrVkDescriptorSetManager.h |
+++ b/src/gpu/vk/GrVkDescriptorSetManager.h |
@@ -16,6 +16,7 @@ |
class GrVkDescriptorSet; |
class GrVkGpu; |
+class GrVkUniformHandler; |
/** |
* This class handles the allocation of descriptor sets for a given VkDescriptorSetLayout. It will |
@@ -28,33 +29,30 @@ public: |
GrVkDescriptorSetManager(GrVkGpu* gpu, |
VkDescriptorSetLayout layout, |
VkDescriptorType, |
- uint32_t samplerCount); |
+ uint32_t descCountPerSet, |
+ const GrVkUniformHandler* handler = nullptr); |
~GrVkDescriptorSetManager() {} |
void abandon(); |
void release(const GrVkGpu* gpu); |
+ VkDescriptorSetLayout layout() const; |
+ |
const GrVkDescriptorSet* getDescriptorSet(GrVkGpu* gpu, const Handle& handle); |
void recycleDescriptorSet(const GrVkDescriptorSet*); |
- int isCompatible(uint32_t numSamplers) const { return numSamplers == fNumSamplerBindings; } |
+ bool isCompatible(VkDescriptorType type, const GrVkUniformHandler*) const; |
private: |
struct DescriptorPoolManager { |
DescriptorPoolManager(VkDescriptorSetLayout layout, VkDescriptorType type, |
- uint32_t samplerCount, GrVkGpu* gpu) |
+ uint32_t descCountPerSet, GrVkGpu* gpu) |
: fDescLayout(layout) |
, fDescType(type) |
+ , fDescCountPerSet(descCountPerSet) |
, fCurrentDescriptorCount(0) |
, fPool(nullptr) { |
- if (VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER == type) { |
- fDescCountPerSet = kNumUniformDescPerSet; |
- } else { |
- SkASSERT(VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER); |
- fDescCountPerSet = samplerCount; |
- } |
- |
SkASSERT(fDescCountPerSet < kStartNumDescriptors); |
fMaxDescriptors = kStartNumDescriptors; |
SkASSERT(fMaxDescriptors > 0); |
@@ -71,7 +69,7 @@ private: |
void freeGPUResources(const GrVkGpu* gpu); |
void abandonGPUResources(); |
- VkDescriptorSetLayout fDescLayout; // Not owned by this class |
+ VkDescriptorSetLayout fDescLayout; |
VkDescriptorType fDescType; |
uint32_t fDescCountPerSet; |
uint32_t fMaxDescriptors; |
@@ -80,7 +78,6 @@ private: |
private: |
enum { |
- kNumUniformDescPerSet = 2, |
kMaxDescriptors = 1024, |
kStartNumDescriptors = 16, // must be less than kMaxUniformDescriptors |
}; |
@@ -88,10 +85,9 @@ private: |
void getNewPool(GrVkGpu* gpu); |
}; |
- DescriptorPoolManager fPoolManager; |
- SkTArray<const GrVkDescriptorSet*> fFreeSets; |
- // If the number of bindings is 0 we assume this is for uniform buffers |
- uint32_t fNumSamplerBindings; |
+ DescriptorPoolManager fPoolManager; |
+ SkTArray<const GrVkDescriptorSet*, true> fFreeSets; |
+ SkSTArray<4, uint32_t> fBindingVisibilities; |
}; |
#endif |