Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | List of all members
GrVkDescriptorPool Class Reference

#include <GrVkDescriptorPool.h>

Inheritance diagram for GrVkDescriptorPool:
GrVkManagedResource GrManagedResource SkNoncopyable

Public Member Functions

VkDescriptorPool descPool () const
 
bool isCompatible (VkDescriptorType type, uint32_t count) const
 
- Public Member Functions inherited from GrVkManagedResource
 GrVkManagedResource (const GrVkGpu *gpu)
 
- Public Member Functions inherited from GrManagedResource
 GrManagedResource ()
 
virtual ~GrManagedResource ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Static Public Member Functions

static GrVkDescriptorPoolCreate (GrVkGpu *gpu, VkDescriptorType type, uint32_t count)
 

Private Member Functions

void freeGPUData () const override
 

Additional Inherited Members

- Protected Attributes inherited from GrVkManagedResource
const GrVkGpufGpu
 

Detailed Description

We require that all descriptor sets are of a single descriptor type. We also use a pool to only make one type of descriptor set. Thus a single VkDescriptorPool will only allocated space for for one type of descriptor.

Definition at line 23 of file GrVkDescriptorPool.h.

Member Function Documentation

◆ Create()

GrVkDescriptorPool * GrVkDescriptorPool::Create ( GrVkGpu gpu,
VkDescriptorType  type,
uint32_t  count 
)
static

Definition at line 14 of file GrVkDescriptorPool.cpp.

15 {
16 VkDescriptorPoolSize poolSize;
17 memset(&poolSize, 0, sizeof(VkDescriptorPoolSize));
18 poolSize.descriptorCount = count;
19 poolSize.type = type;
20
22 memset(&createInfo, 0, sizeof(VkDescriptorPoolCreateInfo));
24 createInfo.pNext = nullptr;
25 createInfo.flags = 0;
26 // This is an over/conservative estimate since each set may contain more than count descriptors.
27 createInfo.maxSets = count;
28 createInfo.poolSizeCount = 1;
29 createInfo.pPoolSizes = &poolSize;
30
31 VkDescriptorPool pool;
33 GR_VK_CALL_RESULT(gpu, result, CreateDescriptorPool(gpu->device(), &createInfo, nullptr,
34 &pool));
35 if (result != VK_SUCCESS) {
36 return nullptr;
37 }
38 return new GrVkDescriptorPool(gpu, pool, type, count);
39}
AutoreleasePool pool
int count
#define GR_VK_CALL_RESULT(GPU, RESULT, X)
Definition GrVkUtil.h:35
VkDevice device() const
Definition GrVkGpu.h:71
GAsyncResult * result
const VkDescriptorPoolSize * pPoolSizes
VkDescriptorPoolCreateFlags flags
VkDescriptorType type
VkResult
@ VK_SUCCESS
@ VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO

◆ descPool()

VkDescriptorPool GrVkDescriptorPool::descPool ( ) const
inline

Definition at line 27 of file GrVkDescriptorPool.h.

27{ return fDescPool; }

◆ freeGPUData()

void GrVkDescriptorPool::freeGPUData ( ) const
overrideprivatevirtual

Must be implemented by any subclasses. Deletes any GPU data associated with this resource

Implements GrManagedResource.

Definition at line 49 of file GrVkDescriptorPool.cpp.

49 {
50 // Destroying the VkDescriptorPool will automatically free and delete any VkDescriptorSets
51 // allocated from the pool.
52 GR_VK_CALL(fGpu->vkInterface(), DestroyDescriptorPool(fGpu->device(), fDescPool, nullptr));
53}
#define GR_VK_CALL(IFACE, X)
Definition GrVkUtil.h:24
const skgpu::VulkanInterface * vkInterface() const
Definition GrVkGpu.h:60

◆ isCompatible()

bool GrVkDescriptorPool::isCompatible ( VkDescriptorType  type,
uint32_t  count 
) const

Definition at line 45 of file GrVkDescriptorPool.cpp.

45 {
46 return fType == type && count <= fCount;
47}

The documentation for this class was generated from the following files: