Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
GrD3DAttachment Class Reference

#include <GrD3DAttachment.h>

Inheritance diagram for GrD3DAttachment:
GrAttachment GrD3DTextureResource GrSurface SkNoncopyable GrGpuResource GrIORef< GrGpuResource > SkNoncopyable

Public Member Functions

 ~GrD3DAttachment () override
 
GrBackendFormat backendFormat () const override
 
D3D12_CPU_DESCRIPTOR_HANDLE view () const
 
- Public Member Functions inherited from GrAttachment
 GR_DECL_BITFIELD_CLASS_OPS_FRIENDS (UsageFlags)
 
 ~GrAttachment () override
 
UsageFlags supportedUsages () const
 
int numSamples () const
 
skgpu::Mipmapped mipmapped () const
 
bool hasPerformedInitialClear () const
 
void markHasPerformedInitialClear ()
 
- Public Member Functions inherited from GrSurface
SkISize dimensions () const
 
int width () const
 
int height () const
 
SkRect getBoundsRect () const
 
virtual GrBackendFormat backendFormat () const =0
 
void setRelease (sk_sp< skgpu::RefCntedCallback > releaseHelper)
 
void setRelease (ReleaseProc proc, ReleaseCtx ctx)
 
virtual GrTextureasTexture ()
 
virtual const GrTextureasTexture () const
 
virtual GrRenderTargetasRenderTarget ()
 
virtual const GrRenderTargetasRenderTarget () const
 
GrInternalSurfaceFlags flags () const
 
bool readOnly () const
 
bool framebufferOnly () const
 
bool isProtected () const
 
void setFramebufferOnly ()
 
- Public Member Functions inherited from GrGpuResource
bool wasDestroyed () const
 
const GrDirectContextgetContext () const
 
GrDirectContextgetContext ()
 
size_t gpuMemorySize () const
 
UniqueID uniqueID () const
 
const skgpu::UniqueKeygetUniqueKey () const
 
std::string getLabel () const
 
void setLabel (std::string_view label)
 
CacheAccess cacheAccess ()
 
const CacheAccess cacheAccess () const
 
ProxyAccess proxyAccess ()
 
ResourcePriv resourcePriv ()
 
const ResourcePriv resourcePriv () const
 
virtual void dumpMemoryStatistics (SkTraceMemoryDump *traceMemoryDump) const
 
virtual const char * getResourceType () const =0
 
- Public Member Functions inherited from GrIORef< GrGpuResource >
bool unique () const
 
void ref () const
 
void unref () const
 
void refCommandBuffer () const
 
void unrefCommandBuffer () const
 
- Public Member Functions inherited from SkNoncopyable
 SkNoncopyable ()=default
 
 SkNoncopyable (SkNoncopyable &&)=default
 
SkNoncopyableoperator= (SkNoncopyable &&)=default
 
- Public Member Functions inherited from GrD3DTextureResource
 GrD3DTextureResource (const GrD3DTextureResourceInfo &info, sk_sp< GrD3DResourceState > state)
 
virtual ~GrD3DTextureResource ()
 
ID3D12Resource * d3dResource () const
 
DXGI_FORMAT dxgiFormat () const
 
GrBackendFormat getBackendFormat () const
 
sk_sp< Resource > resource () const
 
uint32_t mipLevels () const
 
sk_sp< GrD3DResourceStategrD3DResourceState () const
 
D3D12_RESOURCE_STATES currentState () const
 
void setResourceState (const GrD3DGpu *gpu, D3D12_RESOURCE_STATES newResourceState, unsigned int subresource=D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES)
 
void prepareForPresent (GrD3DGpu *gpu)
 
unsigned int sampleQualityPattern () const
 
void updateResourceState (D3D12_RESOURCE_STATES newState)
 
void setResourceRelease (sk_sp< GrSurface::RefCntedReleaseProc > releaseHelper)
 

Static Public Member Functions

static sk_sp< GrD3DAttachmentMakeStencil (GrD3DGpu *gpu, SkISize dimensions, int sampleCnt, DXGI_FORMAT format)
 
- Static Public Member Functions inherited from GrAttachment
static void ComputeSharedAttachmentUniqueKey (const GrCaps &caps, const GrBackendFormat &format, SkISize dimensions, UsageFlags requiredUsage, int sampleCnt, skgpu::Mipmapped mipmapped, GrProtected isProtected, GrMemoryless memoryless, skgpu::UniqueKey *key)
 
static void ComputeScratchKey (const GrCaps &caps, const GrBackendFormat &format, SkISize dimensions, UsageFlags requiredUsage, int sampleCnt, skgpu::Mipmapped mipmapped, GrProtected, GrMemoryless, skgpu::ScratchKey *key)
 
- Static Public Member Functions inherited from GrSurface
static size_t ComputeSize (const GrBackendFormat &, SkISize dimensions, int colorSamplesPerPixel, skgpu::Mipmapped, bool binSize=false)
 
- Static Public Member Functions inherited from GrGpuResource
static uint32_t CreateUniqueID ()
 
- Static Public Member Functions inherited from GrD3DTextureResource
static bool InitTextureResourceInfo (GrD3DGpu *gpu, const D3D12_RESOURCE_DESC &desc, D3D12_RESOURCE_STATES initialState, GrProtected, D3D12_CLEAR_VALUE *, GrD3DTextureResourceInfo *)
 
static std::pair< GrD3DTextureResourceInfo, sk_sp< GrD3DResourceState > > CreateMSAA (GrD3DGpu *gpu, SkISize dimensions, int sampleCnt, const GrD3DTextureResourceInfo &info, SkColor4f clearColor)
 

Protected Member Functions

void onRelease () override
 
void onAbandon () override
 
- Protected Member Functions inherited from GrAttachment
 GrAttachment (GrGpu *gpu, SkISize dimensions, UsageFlags supportedUsages, int sampleCnt, skgpu::Mipmapped mipmapped, GrProtected isProtected, std::string_view label, GrMemoryless memoryless=GrMemoryless::kNo)
 
- Protected Member Functions inherited from GrSurface
void setGLRTFBOIDIs0 ()
 
bool glRTFBOIDis0 () const
 
void setRequiresManualMSAAResolve ()
 
bool requiresManualMSAAResolve () const
 
void setReadOnly ()
 
void setVkRTSupportsInputAttachment ()
 
 GrSurface (GrGpu *gpu, const SkISize &dimensions, skgpu::Protected isProtected, std::string_view label)
 
 ~GrSurface () override
 
void onRelease () override
 
void onAbandon () override
 
- Protected Member Functions inherited from GrGpuResource
void registerWithCache (skgpu::Budgeted)
 
void registerWithCacheWrapped (GrWrapCacheable)
 
 GrGpuResource (GrGpu *, std::string_view label)
 
virtual ~GrGpuResource ()
 
GrGpugetGpu () const
 
virtual void onRelease ()
 
virtual void onAbandon ()
 
virtual void setMemoryBacking (SkTraceMemoryDump *, const SkString &) const
 
SkString getResourceName () const
 
void dumpMemoryStatisticsPriv (SkTraceMemoryDump *traceMemoryDump, const SkString &resourceName, const char *type, size_t size) const
 
- Protected Member Functions inherited from GrIORef< GrGpuResource >
 GrIORef ()
 
bool internalHasRef () const
 
bool internalHasNoCommandBufferUsages () const
 
void addInitialRef () const
 
- Protected Member Functions inherited from GrD3DTextureResource
void releaseResource (GrD3DGpu *gpu)
 

Additional Inherited Members

- Public Types inherited from GrAttachment
enum class  UsageFlags : uint8_t { kStencilAttachment = 0x1 , kColorAttachment = 0x2 , kTexture = 0x4 }
 
- Public Types inherited from GrSurface
typedef void * ReleaseCtx
 
typedef void(* ReleaseProc) (ReleaseCtx)
 
- Public Types inherited from GrIORef< GrGpuResource >
enum  LastRemovedRef
 
- Protected Attributes inherited from GrD3DTextureResource
GrD3DTextureResourceInfo fInfo
 
sk_sp< GrD3DResourceStatefState
 

Detailed Description

Definition at line 19 of file GrD3DAttachment.h.

Constructor & Destructor Documentation

◆ ~GrD3DAttachment()

GrD3DAttachment::~GrD3DAttachment ( )
inlineoverride

Definition at line 26 of file GrD3DAttachment.h.

26{}

Member Function Documentation

◆ backendFormat()

GrBackendFormat GrD3DAttachment::backendFormat ( ) const
inlineoverridevirtual

Implements GrSurface.

Definition at line 28 of file GrD3DAttachment.h.

28{ return GrBackendFormat::MakeDxgi(fFormat); }

◆ MakeStencil()

sk_sp< GrD3DAttachment > GrD3DAttachment::MakeStencil ( GrD3DGpu gpu,
SkISize  dimensions,
int  sampleCnt,
DXGI_FORMAT  format 
)
static

Definition at line 34 of file GrD3DAttachment.cpp.

37 {
38 D3D12_RESOURCE_DESC resourceDesc = {};
39 resourceDesc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D;
40 resourceDesc.Alignment = 0; // default alignment
41 resourceDesc.Width = dimensions.width();
42 resourceDesc.Height = dimensions.height();
43 resourceDesc.DepthOrArraySize = 1;
44 resourceDesc.MipLevels = 1;
45 resourceDesc.Format = format;
46 resourceDesc.SampleDesc.Count = sampleCnt;
47 resourceDesc.SampleDesc.Quality = DXGI_STANDARD_MULTISAMPLE_QUALITY_PATTERN;
48 resourceDesc.Layout = D3D12_TEXTURE_LAYOUT_UNKNOWN; // use driver-selected swizzle
49 resourceDesc.Flags = D3D12_RESOURCE_FLAG_ALLOW_DEPTH_STENCIL;
50
51 D3D12_CLEAR_VALUE clearValue = {};
52 clearValue.Format = format;
53 clearValue.DepthStencil.Depth = 0;
54 clearValue.DepthStencil.Stencil = 0;
55
58 D3D12_RESOURCE_STATE_DEPTH_WRITE,
59 GrProtected::kNo, &clearValue, &info)) {
60 return nullptr;
61 }
62
64 gpu->resourceProvider().createDepthStencilView(info.fResource.get());
65
69 format, resourceDesc, info,
70 std::move(state),
71 view,
72 /*label=*/"D3DAttachment_MakeStencil"));
73}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
D3D12_CPU_DESCRIPTOR_HANDLE view() const
GrD3DResourceProvider & resourceProvider()
Definition: GrD3DGpu.h:38
GrD3DDescriptorHeap::CPUHandle createDepthStencilView(ID3D12Resource *textureResource)
static bool InitTextureResourceInfo(GrD3DGpu *gpu, const D3D12_RESOURCE_DESC &desc, D3D12_RESOURCE_STATES initialState, GrProtected, D3D12_CLEAR_VALUE *, GrD3DTextureResourceInfo *)
SkISize dimensions() const
Definition: GrSurface.h:27
AtkStateType state
uint32_t uint32_t * format
constexpr int32_t width() const
Definition: SkSize.h:36
constexpr int32_t height() const
Definition: SkSize.h:37

◆ onAbandon()

void GrD3DAttachment::onAbandon ( )
overrideprotectedvirtual

Overridden to abandon any internal handles, ptrs, etc to backend API resources. This may be called when the underlying 3D context is no longer valid and so no backend API calls should be made.

Reimplemented from GrGpuResource.

Definition at line 82 of file GrD3DAttachment.cpp.

82 {
83 GrD3DGpu* gpu = this->getD3DGpu();
84 this->releaseResource(gpu);
85
87}
void releaseResource(GrD3DGpu *gpu)
void onAbandon() override
Definition: GrSurface.cpp:86

◆ onRelease()

void GrD3DAttachment::onRelease ( )
overrideprotectedvirtual

Overridden to free GPU resources in the backend API.

Reimplemented from GrGpuResource.

Definition at line 75 of file GrD3DAttachment.cpp.

75 {
76 GrD3DGpu* gpu = this->getD3DGpu();
77 this->releaseResource(gpu);
78
80}
void onRelease() override
Definition: GrSurface.cpp:81

◆ view()

D3D12_CPU_DESCRIPTOR_HANDLE GrD3DAttachment::view ( ) const
inline

Definition at line 30 of file GrD3DAttachment.h.

30{ return fView.fHandle; }
D3D12_CPU_DESCRIPTOR_HANDLE fHandle

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