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

#include <GrD3DTextureRenderTarget.h>

Inheritance diagram for GrD3DTextureRenderTarget:
GrD3DTexture GrD3DRenderTarget GrTexture GrD3DTextureResource GrRenderTarget GrD3DTextureResource GrSurface SkNoncopyable GrSurface SkNoncopyable GrGpuResource GrGpuResource GrIORef< GrGpuResource > GrIORef< GrGpuResource > SkNoncopyable SkNoncopyable

Public Member Functions

GrBackendFormat backendFormat () const override
 
- Public Member Functions inherited from GrD3DTexture
 ~GrD3DTexture () override
 
GrBackendTexture getBackendTexture () const override
 
GrBackendFormat backendFormat () const override
 
D3D12_CPU_DESCRIPTOR_HANDLE shaderResourceView ()
 
void textureParamsModified () override
 
- Public Member Functions inherited from GrTexture
GrTextureasTexture () override
 
const GrTextureasTexture () const override
 
virtual GrBackendTexture getBackendTexture () const =0
 
virtual void textureParamsModified ()=0
 
GrTextureType textureType () const
 
bool hasRestrictedSampling () const
 
void markMipmapsDirty ()
 
void markMipmapsClean ()
 
skgpu::Mipmapped mipmapped () const
 
bool mipmapsAreDirty () const
 
GrMipmapStatus mipmapStatus () const
 
int maxMipmapLevel () const
 
- 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)
 
- Public Member Functions inherited from GrD3DRenderTarget
 ~GrD3DRenderTarget () override
 
GrBackendFormat backendFormat () const override
 
const GrD3DTextureResourcemsaaTextureResource () const
 
GrD3DTextureResourcemsaaTextureResource ()
 
bool canAttemptStencilAttachment (bool useMSAASurface) const override
 
GrBackendRenderTarget getBackendRenderTarget () const override
 
D3D12_CPU_DESCRIPTOR_HANDLE colorRenderTargetView () const
 
DXGI_FORMAT stencilDxgiFormat () const
 
void genKey (skgpu::KeyBuilder *b) const
 
- Public Member Functions inherited from GrRenderTarget
virtual bool alwaysClearStencil () const
 
GrRenderTargetasRenderTarget () override
 
const GrRenderTargetasRenderTarget () const override
 
int numSamples () const
 
virtual GrBackendRenderTarget getBackendRenderTarget () const =0
 
GrAttachmentgetStencilAttachment (bool useMSAASurface) const
 
GrAttachmentgetStencilAttachment () const
 
virtual bool canAttemptStencilAttachment (bool useMSAASurface) const =0
 
void attachStencilAttachment (sk_sp< GrAttachment > stencil, bool useMSAASurface)
 
int numStencilBits (bool useMSAASurface) const
 
int getSamplePatternKey ()
 
const skia_private::TArray< SkPoint > & getSampleLocations ()
 
void setRequiresManualMSAAResolve ()
 
bool requiresManualMSAAResolve () const
 

Static Public Member Functions

static sk_sp< GrD3DTextureRenderTargetMakeNewTextureRenderTarget (GrD3DGpu *, skgpu::Budgeted, SkISize dimensions, int sampleCnt, const D3D12_RESOURCE_DESC &, GrProtected isProtected, GrMipmapStatus, std::string_view label)
 
static sk_sp< GrD3DTextureRenderTargetMakeWrappedTextureRenderTarget (GrD3DGpu *, SkISize dimensions, int sampleCnt, GrWrapCacheable, const GrD3DTextureResourceInfo &, sk_sp< GrD3DResourceState >)
 
- Static Public Member Functions inherited from GrD3DTexture
static sk_sp< GrD3DTextureMakeNewTexture (GrD3DGpu *, skgpu::Budgeted, SkISize dimensions, const D3D12_RESOURCE_DESC &, GrProtected, GrMipmapStatus, std::string_view label)
 
static sk_sp< GrD3DTextureMakeWrappedTexture (GrD3DGpu *, SkISize dimensions, GrWrapCacheable, GrIOType, const GrD3DTextureResourceInfo &, sk_sp< GrD3DResourceState >)
 
static sk_sp< GrD3DTextureMakeAliasingTexture (GrD3DGpu *, sk_sp< GrD3DTexture >, const D3D12_RESOURCE_DESC &newDesc, D3D12_RESOURCE_STATES)
 
- Static Public Member Functions inherited from GrTexture
static bool StealBackendTexture (sk_sp< GrTexture >, GrBackendTexture *, SkImages::BackendTextureReleaseProc *)
 
static void ComputeScratchKey (const GrCaps &caps, const GrBackendFormat &format, SkISize dimensions, GrRenderable, int sampleCnt, skgpu::Mipmapped, GrProtected, 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)
 
- Static Public Member Functions inherited from GrD3DRenderTarget
static sk_sp< GrD3DRenderTargetMakeWrappedRenderTarget (GrD3DGpu *, SkISize, int sampleCnt, const GrD3DTextureResourceInfo &, sk_sp< GrD3DResourceState >)
 

Protected Member Functions

void onAbandon () override
 
void onRelease () override
 
- Protected Member Functions inherited from GrD3DTexture
 GrD3DTexture (GrD3DGpu *, SkISize dimensions, const GrD3DTextureResourceInfo &, sk_sp< GrD3DResourceState >, const GrD3DDescriptorHeap::CPUHandle &shaderResourceView, GrMipmapStatus, std::string_view label)
 
GrD3DGpugetD3DGpu () const
 
void onAbandon () override
 
void onRelease () override
 
bool onStealBackendTexture (GrBackendTexture *, SkImages::BackendTextureReleaseProc *) override
 
void onSetLabel () override
 
- Protected Member Functions inherited from GrTexture
 GrTexture (GrGpu *, const SkISize &, GrProtected, GrTextureType, GrMipmapStatus, std::string_view label)
 
virtual bool onStealBackendTexture (GrBackendTexture *, SkImages::BackendTextureReleaseProc *)=0
 
void computeScratchKey (skgpu::ScratchKey *) const override
 
- 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)
 
- Protected Member Functions inherited from GrD3DRenderTarget
 GrD3DRenderTarget (GrD3DGpu *gpu, SkISize dimensions, const GrD3DTextureResourceInfo &info, sk_sp< GrD3DResourceState > state, const GrD3DTextureResourceInfo &msaaInfo, sk_sp< GrD3DResourceState > msaaState, const GrD3DDescriptorHeap::CPUHandle &colorRenderTargetView, const GrD3DDescriptorHeap::CPUHandle &resolveRenderTargetView, std::string_view label)
 
 GrD3DRenderTarget (GrD3DGpu *gpu, SkISize dimensions, const GrD3DTextureResourceInfo &info, sk_sp< GrD3DResourceState > state, const GrD3DDescriptorHeap::CPUHandle &renderTargetView, std::string_view label)
 
void onAbandon () override
 
void onRelease () override
 
size_t onGpuMemorySize () const override
 
void onSetLabel () override
 
- Protected Member Functions inherited from GrRenderTarget
 GrRenderTarget (GrGpu *, const SkISize &, int sampleCount, GrProtected, std::string_view label, sk_sp< GrAttachment > stenicl=nullptr)
 
 ~GrRenderTarget () override
 
void onAbandon () override
 
void onRelease () override
 

Additional Inherited Members

- 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 26 of file GrD3DTextureRenderTarget.h.

Member Function Documentation

◆ backendFormat()

GrBackendFormat GrD3DTextureRenderTarget::backendFormat ( ) const
inlineoverridevirtual

Reimplemented from GrD3DRenderTarget.

Definition at line 41 of file GrD3DTextureRenderTarget.h.

41{ return this->getBackendFormat(); }
GrBackendFormat getBackendFormat() const

◆ MakeNewTextureRenderTarget()

sk_sp< GrD3DTextureRenderTarget > GrD3DTextureRenderTarget::MakeNewTextureRenderTarget ( GrD3DGpu gpu,
skgpu::Budgeted  budgeted,
SkISize  dimensions,
int  sampleCnt,
const D3D12_RESOURCE_DESC &  resourceDesc,
GrProtected  isProtected,
GrMipmapStatus  mipmapStatus,
std::string_view  label 
)
static

Definition at line 105 of file GrD3DTextureRenderTarget.cpp.

113 {
115 D3D12_RESOURCE_STATES initialState = sampleCnt > 1 ? D3D12_RESOURCE_STATE_RESOLVE_DEST
116 : D3D12_RESOURCE_STATE_RENDER_TARGET;
117
118 D3D12_CLEAR_VALUE clearValue = {};
119 clearValue.Format = resourceDesc.Format;
120 clearValue.Color[0] = 0;
121 clearValue.Color[1] = 0;
122 clearValue.Color[2] = 0;
123 clearValue.Color[3] = 0;
124
125 if (!GrD3DTextureResource::InitTextureResourceInfo(gpu, resourceDesc, initialState,
126 isProtected, &clearValue, &info)) {
127 return nullptr;
128 }
130 static_cast<D3D12_RESOURCE_STATES>(info.fResourceState)));
131
133 gpu->resourceProvider().createShaderResourceView(info.fResource.get());
134
135 const GrD3DDescriptorHeap::CPUHandle renderTargetView =
136 gpu->resourceProvider().createRenderTargetView(info.fResource.get());
137
138 if (sampleCnt > 1) {
141 // created MSAA surface we assume will be used for masks, so clear to transparent black
142 SkColor4f clearColor = { 0, 0, 0, 0 };
143 std::tie(msInfo, msState) =
144 GrD3DTextureResource::CreateMSAA(gpu, dimensions, sampleCnt, info, clearColor);
145 if (!msInfo.fResource || !msState) {
146 return nullptr;
147 }
148
149 const GrD3DDescriptorHeap::CPUHandle msaaRenderTargetView =
151
153 budgeted,
155 info,
156 std::move(state),
158 msInfo,
159 std::move(msState),
160 msaaRenderTargetView,
161 renderTargetView,
163 label);
165 } else {
167 budgeted,
169 info,
170 std::move(state),
172 renderTargetView,
174 label);
176 }
177}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213
GrD3DResourceProvider & resourceProvider()
Definition: GrD3DGpu.h:38
GrD3DDescriptorHeap::CPUHandle createShaderResourceView(ID3D12Resource *resource, unsigned int mostDetailedMip=0, unsigned int mipLevels=-1)
GrD3DDescriptorHeap::CPUHandle createRenderTargetView(ID3D12Resource *textureResource)
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)
D3D12_CPU_DESCRIPTOR_HANDLE shaderResourceView()
Definition: GrD3DTexture.h:45
SkISize dimensions() const
Definition: GrSurface.h:27
bool isProtected() const
Definition: GrSurface.h:87
GrMipmapStatus mipmapStatus() const
Definition: GrTexture.h:66
T * get() const
Definition: GrD3DTypes.h:108
AtkStateType state
gr_cp< ID3D12Resource > fResource
Definition: GrD3DTypes.h:180

◆ MakeWrappedTextureRenderTarget()

sk_sp< GrD3DTextureRenderTarget > GrD3DTextureRenderTarget::MakeWrappedTextureRenderTarget ( GrD3DGpu gpu,
SkISize  dimensions,
int  sampleCnt,
GrWrapCacheable  cacheable,
const GrD3DTextureResourceInfo info,
sk_sp< GrD3DResourceState state 
)
static

Definition at line 179 of file GrD3DTextureRenderTarget.cpp.

185 {
186 // TODO: If a client uses their own heap to allocate, how do we manage that?
187 // Adopted textures require both image and allocation because we're responsible for freeing
188 //SkASSERT(VK_NULL_HANDLE != info.fImage &&
189 // (kBorrow_GrWrapOwnership == wrapOwnership || VK_NULL_HANDLE != info.fAlloc.fMemory));
190
193
195 gpu->resourceProvider().createShaderResourceView(info.fResource.get());
196
197 const GrD3DDescriptorHeap::CPUHandle renderTargetView =
198 gpu->resourceProvider().createRenderTargetView(info.fResource.get());
199
200 if (sampleCnt > 1) {
203 // for wrapped MSAA surface we assume clear to white
204 SkColor4f clearColor = { 1, 1, 1, 1 };
205 std::tie(msInfo, msState) =
206 GrD3DTextureResource::CreateMSAA(gpu, dimensions, sampleCnt, info, clearColor);
207 if (!msInfo.fResource || !msState) {
208 return nullptr;
209 }
210
211 const GrD3DDescriptorHeap::CPUHandle msaaRenderTargetView =
213
215 gpu,
217 info,
218 std::move(state),
220 msInfo,
221 std::move(msState),
222 msaaRenderTargetView,
223 renderTargetView,
225 cacheable,
226 /*label=*/"MakeWrappedTextureRenderTargetWithMSAASurface");
228 } else {
232 info,
233 std::move(state),
235 renderTargetView,
237 cacheable,
238 /*label=*/"MakeWrappedTextureRenderTarget"));
239 }
240}
GrMipmapStatus
Definition: GrTypesPriv.h:523

◆ onAbandon()

void GrD3DTextureRenderTarget::onAbandon ( )
inlineoverrideprotectedvirtual

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 GrD3DRenderTarget.

Definition at line 44 of file GrD3DTextureRenderTarget.h.

44 {
45 // In order to correctly handle calling texture idle procs, GrD3DTexture must go first.
48 }
void onAbandon() override
void onAbandon() override

◆ onRelease()

void GrD3DTextureRenderTarget::onRelease ( )
inlineoverrideprotectedvirtual

Overridden to free GPU resources in the backend API.

Reimplemented from GrD3DRenderTarget.

Definition at line 50 of file GrD3DTextureRenderTarget.h.

50 {
51 // In order to correctly handle calling texture idle procs, GrD3DTexture must go first.
54 }
void onRelease() override
void onRelease() override

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