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

#include <GrVkFramebuffer.h>

Inheritance diagram for GrVkFramebuffer:
GrVkManagedResource GrManagedResource SkNoncopyable

Public Member Functions

 GrVkFramebuffer (const GrVkGpu *gpu, sk_sp< GrVkImage > colorAttachment, sk_sp< const GrVkRenderPass > renderPass, std::unique_ptr< GrVkSecondaryCommandBuffer >)
 
VkFramebuffer framebuffer () const
 
bool isExternal () const
 
const GrVkRenderPassexternalRenderPass () const
 
std::unique_ptr< GrVkSecondaryCommandBufferexternalCommandBuffer ()
 
void returnExternalGrSecondaryCommandBuffer (std::unique_ptr< GrVkSecondaryCommandBuffer >)
 
const GrVkRenderPasscompatibleRenderPass () const
 
GrVkResourceProvider::CompatibleRPHandle compatibleRenderPassHandle () const
 
GrVkImagecolorAttachment ()
 
GrVkImageresolveAttachment ()
 
GrVkImagestencilAttachment ()
 
- 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 sk_sp< const GrVkFramebufferMake (GrVkGpu *gpu, SkISize dimensions, sk_sp< const GrVkRenderPass > compatibleRenderPass, GrVkImage *colorAttachment, GrVkImage *resolveAttachment, GrVkImage *stencilAttachment, GrVkResourceProvider::CompatibleRPHandle)
 

Private Member Functions

 ~GrVkFramebuffer () override
 
void freeGPUData () const override
 

Additional Inherited Members

- Protected Attributes inherited from GrVkManagedResource
const GrVkGpufGpu
 

Detailed Description

Definition at line 23 of file GrVkFramebuffer.h.

Constructor & Destructor Documentation

◆ GrVkFramebuffer()

GrVkFramebuffer::GrVkFramebuffer ( const GrVkGpu gpu,
sk_sp< GrVkImage colorAttachment,
sk_sp< const GrVkRenderPass renderPass,
std::unique_ptr< GrVkSecondaryCommandBuffer externalCommandBuffer 
)

Definition at line 81 of file GrVkFramebuffer.cpp.

86 , fColorAttachment(std::move(colorAttachment))
87 , fExternalRenderPass(std::move(renderPass))
88 , fExternalCommandBuffer(std::move(externalCommandBuffer)) {}
GrVkImage * colorAttachment()
std::unique_ptr< GrVkSecondaryCommandBuffer > externalCommandBuffer()

Member Function Documentation

◆ colorAttachment()

GrVkImage * GrVkFramebuffer::colorAttachment ( )
inline

Definition at line 73 of file GrVkFramebuffer.h.

73{ return fColorAttachment.get(); }
T * get() const
Definition SkRefCnt.h:303

◆ compatibleRenderPass()

const GrVkRenderPass * GrVkFramebuffer::compatibleRenderPass ( ) const
inline

Definition at line 67 of file GrVkFramebuffer.h.

67{ return fCompatibleRenderPass.get(); }

◆ compatibleRenderPassHandle()

GrVkResourceProvider::CompatibleRPHandle GrVkFramebuffer::compatibleRenderPassHandle ( ) const
inline

Definition at line 69 of file GrVkFramebuffer.h.

69 {
70 return fCompatibleRenderPassHandle;
71 }

◆ externalCommandBuffer()

std::unique_ptr< GrVkSecondaryCommandBuffer > GrVkFramebuffer::externalCommandBuffer ( )

Definition at line 118 of file GrVkFramebuffer.cpp.

118 {
119 SkASSERT(fExternalCommandBuffer);
120 return std::move(fExternalCommandBuffer);
121}
#define SkASSERT(cond)
Definition SkAssert.h:116

◆ externalRenderPass()

const GrVkRenderPass * GrVkFramebuffer::externalRenderPass ( ) const
inline

Definition at line 45 of file GrVkFramebuffer.h.

45{ return fExternalRenderPass.get(); }

◆ framebuffer()

VkFramebuffer GrVkFramebuffer::framebuffer ( ) const
inline

Definition at line 39 of file GrVkFramebuffer.h.

39 {
40 SkASSERT(!this->isExternal());
41 return fFramebuffer;
42 }
bool isExternal() const

◆ freeGPUData()

void GrVkFramebuffer::freeGPUData ( ) const
overrideprivatevirtual

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

Implements GrManagedResource.

Definition at line 92 of file GrVkFramebuffer.cpp.

92 {
93 SkASSERT(this->isExternal() || fFramebuffer != VK_NULL_HANDLE);
94 if (!this->isExternal()) {
95 GR_VK_CALL(fGpu->vkInterface(), DestroyFramebuffer(fGpu->device(), fFramebuffer, nullptr));
96 }
97
98 // TODO: having freeGPUData virtual on GrManagedResource be const seems like a bad restriction
99 // since we are changing the internal objects of these classes when it is called. We should go
100 // back a revisit how much of a headache it would be to make this function non-const
101 GrVkFramebuffer* nonConstThis = const_cast<GrVkFramebuffer*>(this);
102 nonConstThis->releaseResources();
103}
#define GR_VK_CALL(IFACE, X)
Definition GrVkUtil.h:24
const skgpu::VulkanInterface * vkInterface() const
Definition GrVkGpu.h:60
VkDevice device() const
Definition GrVkGpu.h:71
#define VK_NULL_HANDLE
Definition vulkan_core.h:46

◆ isExternal()

bool GrVkFramebuffer::isExternal ( ) const
inline

Definition at line 44 of file GrVkFramebuffer.h.

44{ return fExternalRenderPass.get(); }

◆ Make()

sk_sp< const GrVkFramebuffer > GrVkFramebuffer::Make ( GrVkGpu gpu,
SkISize  dimensions,
sk_sp< const GrVkRenderPass compatibleRenderPass,
GrVkImage colorAttachment,
GrVkImage resolveAttachment,
GrVkImage stencilAttachment,
GrVkResourceProvider::CompatibleRPHandle  compatibleRenderPassHandle 
)
static

Definition at line 16 of file GrVkFramebuffer.cpp.

23 {
24 // At the very least we need a renderPass and a colorAttachment
27
28 VkImageView attachments[3];
29 attachments[0] = colorAttachment->framebufferView()->imageView();
30 int numAttachments = 1;
32 attachments[numAttachments++] = resolveAttachment->framebufferView()->imageView();
33 }
35 attachments[numAttachments++] = stencilAttachment->framebufferView()->imageView();
36 }
37
38 VkFramebufferCreateInfo createInfo;
39 memset(&createInfo, 0, sizeof(VkFramebufferCreateInfo));
41 createInfo.pNext = nullptr;
42 createInfo.flags = 0;
44 createInfo.attachmentCount = numAttachments;
45 createInfo.pAttachments = attachments;
46 createInfo.width = dimensions.width();
47 createInfo.height = dimensions.height();
48 createInfo.layers = 1;
49
50 VkFramebuffer framebuffer;
51 VkResult err;
52 GR_VK_CALL_RESULT(gpu, err, CreateFramebuffer(gpu->device(), &createInfo, nullptr,
53 &framebuffer));
54 if (err) {
55 return nullptr;
56 }
57
62}
#define GR_VK_CALL_RESULT(GPU, RESULT, X)
Definition GrVkUtil.h:35
sk_sp< T > sk_ref_sp(T *obj)
Definition SkRefCnt.h:381
const GrVkRenderPass * compatibleRenderPass() const
GrVkResourceProvider::CompatibleRPHandle compatibleRenderPassHandle() const
GrVkImage * resolveAttachment()
VkFramebuffer framebuffer() const
GrVkImage * stencilAttachment()
VkImageView imageView() const
const GrVkImageView * framebufferView() const
Definition GrVkImage.h:105
VkRenderPass vkRenderPass() const
constexpr int32_t width() const
Definition SkSize.h:36
constexpr int32_t height() const
Definition SkSize.h:37
const VkImageView * pAttachments
VkStructureType sType
VkFramebufferCreateFlags flags
VkResult
@ VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO

◆ resolveAttachment()

GrVkImage * GrVkFramebuffer::resolveAttachment ( )
inline

Definition at line 74 of file GrVkFramebuffer.h.

74{ return fResolveAttachment.get(); }

◆ returnExternalGrSecondaryCommandBuffer()

void GrVkFramebuffer::returnExternalGrSecondaryCommandBuffer ( std::unique_ptr< GrVkSecondaryCommandBuffer cmdBuffer)

Definition at line 112 of file GrVkFramebuffer.cpp.

113 {
114 SkASSERT(!fExternalCommandBuffer);
115 fExternalCommandBuffer = std::move(cmdBuffer);
116}

◆ stencilAttachment()

GrVkImage * GrVkFramebuffer::stencilAttachment ( )
inline

Definition at line 75 of file GrVkFramebuffer.h.

75{ return fStencilAttachment.get(); }

◆ ~GrVkFramebuffer()

GrVkFramebuffer::~GrVkFramebuffer ( )
overrideprivate

Definition at line 90 of file GrVkFramebuffer.cpp.

90{}

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