Flutter Engine
The Flutter Engine
Classes | Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
GrVkRenderPass Class Reference

#include <GrVkRenderPass.h>

Inheritance diagram for GrVkRenderPass:
GrVkManagedResource GrManagedResource SkNoncopyable

Classes

struct  AttachmentsDescriptor
 
struct  LoadStoreOps
 

Public Types

enum  AttachmentFlags : uint32_t { kColor_AttachmentFlag = 0x1 , kStencil_AttachmentFlag = 0x2 , kResolve_AttachmentFlag = 0x4 , kExternal_AttachmentFlag = 0x8 }
 
enum class  SelfDependencyFlags { kNone = 0 , kForInputAttachment = 1 << 0 , kForNonCoherentAdvBlend = 1 << 1 }
 
enum class  LoadFromResolve { kNo , kLoad }
 

Public Member Functions

 GrVkRenderPass (const GrVkGpu *gpu, VkRenderPass renderPass, uint32_t colorAttachmentIndex)
 
 GR_DECL_BITFIELD_CLASS_OPS_FRIENDS (SelfDependencyFlags)
 
bool colorAttachmentIndex (uint32_t *index) const
 
bool stencilAttachmentIndex (uint32_t *index) const
 
bool hasStencilAttachment () const
 
bool hasResolveAttachment () const
 
SelfDependencyFlags selfDependencyFlags () const
 
LoadFromResolve loadFromResolve () const
 
bool isCompatible (GrVkRenderTarget *target, SelfDependencyFlags selfDepFlags, LoadFromResolve) const
 
bool isCompatible (const GrVkRenderPass &renderPass) const
 
bool isCompatible (const AttachmentsDescriptor &, const AttachmentFlags &, SelfDependencyFlags selfDepFlags, LoadFromResolve) const
 
bool isCompatibleExternalRP (VkRenderPass) const
 
 SkDEBUGCODE (bool isExternal() const { return fAttachmentFlags &kExternal_AttachmentFlag;}) bool equalLoadStoreOps(const LoadStoreOps &colorOps
 
VkRenderPass vkRenderPass () const
 
const VkExtent2Dgranularity () const
 
uint32_t clearValueCount () const
 
void genKey (skgpu::KeyBuilder *) 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 GrVkRenderPassCreateSimple (GrVkGpu *, AttachmentsDescriptor *, AttachmentFlags, SelfDependencyFlags selfDepFlags, LoadFromResolve)
 
static GrVkRenderPassCreate (GrVkGpu *, const GrVkRenderPass &compatibleRenderPass, const LoadStoreOps &colorOp, const LoadStoreOps &resolveOp, const LoadStoreOps &stencilOp)
 
static void GenKey (skgpu::KeyBuilder *, AttachmentFlags, const AttachmentsDescriptor &, SelfDependencyFlags selfDepFlags, LoadFromResolve, uint64_t externalRenderPass)
 

Public Attributes

const LoadStoreOpsresolveOps
 
const LoadStoreOps const LoadStoreOps &stencilOps const
 

Additional Inherited Members

- Protected Attributes inherited from GrVkManagedResource
const GrVkGpufGpu
 

Detailed Description

Definition at line 24 of file GrVkRenderPass.h.

Member Enumeration Documentation

◆ AttachmentFlags

Enumerator
kColor_AttachmentFlag 
kStencil_AttachmentFlag 
kResolve_AttachmentFlag 
kExternal_AttachmentFlag 

Definition at line 83 of file GrVkRenderPass.h.

83 : uint32_t {
87 // The external attachment flag signals that this render pass is imported from an external
88 // client. Since we don't know every attachment on the render pass we don't set any of the
89 // specific attachment flags when using external. However, the external render pass must
90 // at least have a color attachment.
92 };

◆ LoadFromResolve

Enumerator
kNo 
kLoad 

Definition at line 102 of file GrVkRenderPass.h.

102 {
103 kNo,
104 kLoad,
105 };
@ kNo
Don't pre-clip the geometry before applying the (perspective) matrix.

◆ SelfDependencyFlags

Enumerator
kNone 
kForInputAttachment 
kForNonCoherentAdvBlend 

Definition at line 95 of file GrVkRenderPass.h.

95 {
96 kNone = 0,
97 kForInputAttachment = 1 << 0,
98 kForNonCoherentAdvBlend = 1 << 1,
99 };
@ kNone
Definition: layer.h:53

Constructor & Destructor Documentation

◆ GrVkRenderPass()

GrVkRenderPass::GrVkRenderPass ( const GrVkGpu gpu,
VkRenderPass  renderPass,
uint32_t  colorAttachmentIndex 
)
inlineexplicit

Definition at line 45 of file GrVkRenderPass.h.

47 : INHERITED(gpu)
48 , fRenderPass(renderPass)
49 , fAttachmentFlags(kExternal_AttachmentFlag)
50 , fSelfDepFlags(SelfDependencyFlags::kNone)
51 , fLoadFromResolve(LoadFromResolve::kNo)
52 , fClearValueCount(0)
53 , fColorAttachmentIndex(colorAttachmentIndex) {}
bool colorAttachmentIndex(uint32_t *index) const

Member Function Documentation

◆ clearValueCount()

uint32_t GrVkRenderPass::clearValueCount ( ) const
inline

Definition at line 158 of file GrVkRenderPass.h.

158{ return fClearValueCount; }

◆ colorAttachmentIndex()

bool GrVkRenderPass::colorAttachmentIndex ( uint32_t *  index) const

Definition at line 344 of file GrVkRenderPass.cpp.

344 {
345 *index = fColorAttachmentIndex;
346 if ((fAttachmentFlags & kColor_AttachmentFlag) ||
347 (fAttachmentFlags & kExternal_AttachmentFlag)) {
348 return true;
349 }
350 return false;
351}

◆ Create()

GrVkRenderPass * GrVkRenderPass::Create ( GrVkGpu gpu,
const GrVkRenderPass compatibleRenderPass,
const LoadStoreOps colorOp,
const LoadStoreOps resolveOp,
const LoadStoreOps stencilOp 
)
static

Definition at line 73 of file GrVkRenderPass.cpp.

77 {
78 AttachmentFlags attachmentFlags = compatibleRenderPass.fAttachmentFlags;
79 AttachmentsDescriptor attachmentsDescriptor = compatibleRenderPass.fAttachmentsDescriptor;
80 SelfDependencyFlags selfDepFlags = compatibleRenderPass.fSelfDepFlags;
81 LoadFromResolve loadFromResolve = compatibleRenderPass.fLoadFromResolve;
82 return Create(gpu, attachmentFlags, &attachmentsDescriptor, colorOp, resolveOp, stencilOp,
83 selfDepFlags, loadFromResolve);
84}
LoadFromResolve loadFromResolve() const
static GrVkRenderPass * Create(GrVkGpu *, const GrVkRenderPass &compatibleRenderPass, const LoadStoreOps &colorOp, const LoadStoreOps &resolveOp, const LoadStoreOps &stencilOp)

◆ CreateSimple()

GrVkRenderPass * GrVkRenderPass::CreateSimple ( GrVkGpu gpu,
AttachmentsDescriptor attachmentsDescriptor,
AttachmentFlags  attachmentFlags,
SelfDependencyFlags  selfDepFlags,
LoadFromResolve  loadFromResolve 
)
static

Definition at line 52 of file GrVkRenderPass.cpp.

56 {
57 static const GrVkRenderPass::LoadStoreOps kBasicLoadStoreOps(VK_ATTACHMENT_LOAD_OP_LOAD,
59 switch (loadFromResolve) {
61 return Create(gpu, attachmentFlags, attachmentsDescriptor, kBasicLoadStoreOps,
62 kBasicLoadStoreOps, kBasicLoadStoreOps, selfDepFlags, loadFromResolve);
64 static const GrVkRenderPass::LoadStoreOps kDiscardLoadStoreOps(
66 return Create(gpu, attachmentFlags, attachmentsDescriptor, kDiscardLoadStoreOps,
67 kBasicLoadStoreOps, kBasicLoadStoreOps, selfDepFlags, loadFromResolve);
68 }
69 }
71}
#define SkUNREACHABLE
Definition: SkAssert.h:135
@ VK_ATTACHMENT_LOAD_OP_LOAD
Definition: vulkan_core.h:2148
@ VK_ATTACHMENT_LOAD_OP_DONT_CARE
Definition: vulkan_core.h:2150
@ VK_ATTACHMENT_STORE_OP_DONT_CARE
Definition: vulkan_core.h:2157
@ VK_ATTACHMENT_STORE_OP_STORE
Definition: vulkan_core.h:2156

◆ genKey()

void GrVkRenderPass::genKey ( skgpu::KeyBuilder b) const

Definition at line 450 of file GrVkRenderPass.cpp.

450 {
451 GenKey(b, fAttachmentFlags, fAttachmentsDescriptor, fSelfDepFlags,
452 fLoadFromResolve, (uint64_t)fRenderPass);
453}
static void GenKey(skgpu::KeyBuilder *, AttachmentFlags, const AttachmentsDescriptor &, SelfDependencyFlags selfDepFlags, LoadFromResolve, uint64_t externalRenderPass)
static bool b

◆ GenKey()

void GrVkRenderPass::GenKey ( skgpu::KeyBuilder b,
AttachmentFlags  attachmentFlags,
const AttachmentsDescriptor attachmentsDescriptor,
SelfDependencyFlags  selfDepFlags,
LoadFromResolve  loadFromResolve,
uint64_t  externalRenderPass 
)
static

Definition at line 455 of file GrVkRenderPass.cpp.

460 {
461 b->add32(attachmentFlags);
462 if (attachmentFlags & kColor_AttachmentFlag) {
463 b->add32(attachmentsDescriptor.fColor.fFormat);
464 b->add32(attachmentsDescriptor.fColor.fSamples);
465 }
466 if (attachmentFlags & kResolve_AttachmentFlag) {
467 b->add32(attachmentsDescriptor.fResolve.fFormat);
468 b->add32(attachmentsDescriptor.fResolve.fSamples);
469 }
470 if (attachmentFlags & kStencil_AttachmentFlag) {
471 b->add32(attachmentsDescriptor.fStencil.fFormat);
472 b->add32(attachmentsDescriptor.fStencil.fSamples);
473 }
474
475 uint32_t extraFlags = (uint32_t)selfDepFlags;
476 SkASSERT(extraFlags < (1 << 30));
477 SkASSERT((uint32_t)loadFromResolve <= 2);
478 extraFlags |= ((uint32_t)loadFromResolve << 30);
479
480 b->add32(extraFlags);
481
482 if (attachmentFlags & kExternal_AttachmentFlag) {
483 SkASSERT(!(attachmentFlags & ~kExternal_AttachmentFlag));
484 b->add32((uint32_t)(externalRenderPass & 0xFFFFFFFF));
485 b->add32((uint32_t)(externalRenderPass>>32));
486 }
487}
#define SkASSERT(cond)
Definition: SkAssert.h:116

◆ GR_DECL_BITFIELD_CLASS_OPS_FRIENDS()

GrVkRenderPass::GR_DECL_BITFIELD_CLASS_OPS_FRIENDS ( SelfDependencyFlags  )

◆ granularity()

const VkExtent2D & GrVkRenderPass::granularity ( ) const
inline

Definition at line 154 of file GrVkRenderPass.h.

154{ return fGranularity; }

◆ hasResolveAttachment()

bool GrVkRenderPass::hasResolveAttachment ( ) const
inline

Definition at line 124 of file GrVkRenderPass.h.

124{ return fAttachmentFlags & kResolve_AttachmentFlag; }

◆ hasStencilAttachment()

bool GrVkRenderPass::hasStencilAttachment ( ) const
inline

Definition at line 123 of file GrVkRenderPass.h.

123{ return fAttachmentFlags & kStencil_AttachmentFlag; }

◆ isCompatible() [1/3]

bool GrVkRenderPass::isCompatible ( const AttachmentsDescriptor desc,
const AttachmentFlags flags,
SelfDependencyFlags  selfDepFlags,
LoadFromResolve  loadFromResolve 
) const

Definition at line 366 of file GrVkRenderPass.cpp.

369 {
370 SkASSERT(!(fAttachmentFlags & kExternal_AttachmentFlag));
371 if (flags != fAttachmentFlags) {
372 return false;
373 }
374
375 if (fAttachmentFlags & kColor_AttachmentFlag) {
376 if (!fAttachmentsDescriptor.fColor.isCompatible(desc.fColor)) {
377 return false;
378 }
379 }
380 if (fAttachmentFlags & kResolve_AttachmentFlag) {
381 if (!fAttachmentsDescriptor.fResolve.isCompatible(desc.fResolve)) {
382 return false;
383 }
384 }
385 if (fAttachmentFlags & kStencil_AttachmentFlag) {
386 if (!fAttachmentsDescriptor.fStencil.isCompatible(desc.fStencil)) {
387 return false;
388 }
389 }
390
391 if (fSelfDepFlags != selfDepFlags) {
392 return false;
393 }
394
395 if (fLoadFromResolve != loadFromResolve) {
396 return false;
397 }
398
399 return true;
400}
FlutterSemanticsFlag flags
bool isCompatible(const AttachmentDesc &desc) const

◆ isCompatible() [2/3]

bool GrVkRenderPass::isCompatible ( const GrVkRenderPass renderPass) const

Definition at line 417 of file GrVkRenderPass.cpp.

417 {
418 SkASSERT(!(fAttachmentFlags & kExternal_AttachmentFlag));
419 return this->isCompatible(renderPass.fAttachmentsDescriptor, renderPass.fAttachmentFlags,
420 renderPass.fSelfDepFlags, renderPass.fLoadFromResolve);
421}
bool isCompatible(GrVkRenderTarget *target, SelfDependencyFlags selfDepFlags, LoadFromResolve) const

◆ isCompatible() [3/3]

bool GrVkRenderPass::isCompatible ( GrVkRenderTarget target,
SelfDependencyFlags  selfDepFlags,
LoadFromResolve  loadFromResolve 
) const

Definition at line 402 of file GrVkRenderPass.cpp.

404 {
405 SkASSERT(!(fAttachmentFlags & kExternal_AttachmentFlag));
406
407 AttachmentsDescriptor desc;
409 if (!target->getAttachmentsDescriptor(&desc, &flags, this->hasResolveAttachment(),
410 this->hasStencilAttachment())) {
411 return false;
412 }
413
414 return this->isCompatible(desc, flags, selfDepFlags, loadFromResolve);
415}
uint32_t * target

◆ isCompatibleExternalRP()

bool GrVkRenderPass::isCompatibleExternalRP ( VkRenderPass  renderPass) const

Definition at line 423 of file GrVkRenderPass.cpp.

423 {
424 SkASSERT(fAttachmentFlags & kExternal_AttachmentFlag);
425 return fRenderPass == renderPass;
426}

◆ loadFromResolve()

LoadFromResolve GrVkRenderPass::loadFromResolve ( ) const
inline

Definition at line 127 of file GrVkRenderPass.h.

127{ return fLoadFromResolve; }

◆ selfDependencyFlags()

SelfDependencyFlags GrVkRenderPass::selfDependencyFlags ( ) const
inline

Definition at line 126 of file GrVkRenderPass.h.

126{ return fSelfDepFlags; }

◆ SkDEBUGCODE()

GrVkRenderPass::SkDEBUGCODE ( bool isExternal() const { return fAttachmentFlags &kExternal_AttachmentFlag;}  ) const &

◆ stencilAttachmentIndex()

bool GrVkRenderPass::stencilAttachmentIndex ( uint32_t *  index) const

Definition at line 355 of file GrVkRenderPass.cpp.

355 {
356 *index = 0;
357 if (fAttachmentFlags & kColor_AttachmentFlag) {
358 ++(*index);
359 }
360 if (fAttachmentFlags & kStencil_AttachmentFlag) {
361 return true;
362 }
363 return false;
364}

◆ vkRenderPass()

VkRenderPass GrVkRenderPass::vkRenderPass ( ) const
inline

Definition at line 152 of file GrVkRenderPass.h.

152{ return fRenderPass; }

Member Data Documentation

◆ const

const LoadStoreOps const LoadStoreOps& stencilOps GrVkRenderPass::const

Definition at line 150 of file GrVkRenderPass.h.

◆ resolveOps

const LoadStoreOps& GrVkRenderPass::resolveOps

Definition at line 149 of file GrVkRenderPass.h.


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