Class SurfaceProxy
- All Implemented Interfaces:
RefCounted
- Direct Known Subclasses:
RenderTargetProxy
SurfaceProxy implements the proxy pattern for GpuSurface,
it targets a GpuSurface with three instantiation methods: deferred,
lazy-callback and wrapped.
Target: The backing GPU texture or framebuffer that referenced by this proxy.
Instantiate: Create new GPU surfaces or find surfaces in ResourceCache
when they are actually required on flush.
BackingFit: Indicates whether a backing store needs to be an exact match or
can be larger than is strictly necessary. True: Exact; False: Approx. See
ISurface.FLAG_APPROX_FIT, the default is exact.
UseAllocator:
- False: This surface will be instantiated outside the allocator (e.g. for surfaces that are instantiated in on-flush callbacks).
- True:
SurfaceAllocatorshould instantiate this surface.
Threading: Proxies can be created on any thread, and change the reference count
through RefCnt.ref() and RefCnt.unref(). If proxy is, or will be used by
render thread, its final RefCnt.unref() must be called on render thread (the
case where render thread will have ownership). This is because the backing GPU
texture can only be operated on render thread.
Use ImageProxyCache to obtain SurfaceProxy objects.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classDeprecated.static interfaceDeprecated.Lazy-callback function. -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.Deprecated.abstract voidclear()Deprecated.De-instantiate.abstract booleandoLazyInstantiation(ResourceProvider resourceProvider) Deprecated.booleanDeprecated.final @NonNull BackendFormatDeprecated.abstract intDeprecated.Returns the physical height of the backing surface.abstract UniqueIDDeprecated.abstract intDeprecated.Returns the physical width of the backing surface.Deprecated.If this is a texturable surface and the surface is already instantiated, return its backingImage; if not, return null.@Nullable @RawPtr GpuRenderTargetDeprecated.If this is a renderable surface and the surface is already instantiated, return its backingGpuRenderTarget; if not, return null.abstract @Nullable @RawPtr GpuSurfaceDeprecated.final intDeprecated.Returns the logical height of this surface.longDeprecated.Retrieves the amount of GPU memory that will be or currently is used by this resource in bytes.abstract intDeprecated.Returns the number of samples per pixel in color buffers (one if non-MSAA).final intDeprecated.How many render tasks has this surface been the target of?final UniqueIDDeprecated.The contract for the unique ID is: For wrapped resources: the unique ID will match that of the wrapped resource For deferred resources: The unique ID will be different from the real resource, when it is allocated The surface's unique ID will not change across the instantiates call The unique IDs of the proxies and the resources draw from the same pool What this boils down to is that the unique ID of a surface can be used to consistently track/identify a surface but should never be used to distinguish between resources and proxies - beware!Deprecated.final intgetWidth()Deprecated.Returns the logical width of this surface.inthashCode()Deprecated.abstract booleaninstantiate(ResourceProvider resourceProvider) Deprecated.Instantiates the backing store, if necessary.abstract booleanDeprecated.Returns whether the backing store references the wrapped object.final booleanDeprecated.Does the resource count against the resource budget?final booleanDeprecated.final booleanisExact()Deprecated.If set to exact or approx size is equal to exact size.abstract booleanDeprecated.Returns true if the backing store is instantiated.abstract booleanisLazy()Deprecated.Returns true if the surface has a lazy callback and not instantiated.final booleanDeprecated.Returns true if the surface has a lazy callback, not instantiated, loose fit and dimension is not known.final booleanDeprecated.final booleanDeprecated.final booleanDeprecated.The pixel values of this surface's texture cannot be modified (e.g.final voidDeprecated.Called when this task becomes a target of a.invalid reference
RenderTaskfinal booleanDeprecated.voidDeprecated.abstract booleanDeprecated.Proxies that are already instantiated and whose backing texture cannot be recycled to instantiate other proxies do not need to be considered bySurfaceAllocator.final booleanDeprecated.final booleanDeprecated.Methods inherited from class icyllis.arc3d.core.RefCnt
create, create, deallocate, getRefCnt, getRefCntAcquire, getRefCntVolatile, move, move, ref, unique, unref
-
Method Details
-
isLazy
public abstract boolean isLazy()Deprecated.Returns true if the surface has a lazy callback and not instantiated. -
isLazyMost
public final boolean isLazyMost()Deprecated.Returns true if the surface has a lazy callback, not instantiated, loose fit and dimension is not known. -
getWidth
public final int getWidth()Deprecated.Returns the logical width of this surface. The result is undefined ifisLazyMost()returns true.- Returns:
- the desired width of the surface
-
getHeight
public final int getHeight()Deprecated.Returns the logical height of this surface. The result is undefined ifisLazyMost()returns true.- Returns:
- the desired height of the surface
-
getBackingWidth
public abstract int getBackingWidth()Deprecated.Returns the physical width of the backing surface. The result is undefined ifisLazyMost()returns true.- Returns:
- the width of the backing store
-
getBackingHeight
public abstract int getBackingHeight()Deprecated.Returns the physical height of the backing surface. The result is undefined ifisLazyMost()returns true.- Returns:
- the height of the backing store
-
isExact
public final boolean isExact()Deprecated.If set to exact or approx size is equal to exact size. Must call when not lazy-most. Equivalent to getWidth() == getBackingWidth() invalid input: '&'invalid input: '&' getHeight() == getBackingHeight();- Returns:
- true if backing fit is (as if) exact
- See Also:
-
getSampleCount
public abstract int getSampleCount()Deprecated.Returns the number of samples per pixel in color buffers (one if non-MSAA). If this surface it non-renderable, this method always returns one.- Returns:
- the number of samples, greater than (multisample) or equal to one
-
getBackendFormat
Deprecated.- Returns:
- the backend format of the surface
-
getUniqueID
Deprecated.The contract for the unique ID is:- For wrapped resources: the unique ID will match that of the wrapped resource
- For deferred resources:
- The unique ID will be different from the real resource, when it is allocated
- The surface's unique ID will not change across the instantiates call
- The unique IDs of the proxies and the resources draw from the same pool
- Returns:
- a reference for identity hash map
-
getBackingUniqueID
Deprecated. -
isInstantiated
public abstract boolean isInstantiated()Deprecated.Returns true if the backing store is instantiated. -
instantiate
Deprecated.Instantiates the backing store, if necessary.- Parameters:
resourceProvider- the resource provider to create textures- Returns:
- success or not
-
clear
public abstract void clear()Deprecated.De-instantiate. Called after instantiated. -
shouldSkipAllocator
public abstract boolean shouldSkipAllocator()Deprecated.Proxies that are already instantiated and whose backing texture cannot be recycled to instantiate other proxies do not need to be considered bySurfaceAllocator. -
isBackingWrapped
public abstract boolean isBackingWrapped()Deprecated.Returns whether the backing store references the wrapped object. Always false if not instantiated. -
isUsedAsTaskTarget
public final void isUsedAsTaskTarget()Deprecated.Called when this task becomes a target of a.invalid reference
RenderTask -
getTaskTargetCount
public final int getTaskTargetCount()Deprecated.How many render tasks has this surface been the target of? -
getGpuSurface
Deprecated. -
getGpuImage
Deprecated.If this is a texturable surface and the surface is already instantiated, return its backingImage; if not, return null. -
getGpuRenderTarget
Deprecated.If this is a renderable surface and the surface is already instantiated, return its backingGpuRenderTarget; if not, return null. -
isBudgeted
public final boolean isBudgeted()Deprecated.Does the resource count against the resource budget?Always true for lazy-callback resources; set from the backing resource for wrapped resources; only meaningful if 'mLazyInstantiateCallback' is non-null.
-
isReadOnly
public final boolean isReadOnly()Deprecated.The pixel values of this surface's texture cannot be modified (e.g. doesn't support write pixels or MIP map level regen). Read-only proxies also bypass interval tracking and assignment in ResourceAllocator. -
isProtected
public final boolean isProtected()Deprecated. -
isManualMSAAResolve
public final boolean isManualMSAAResolve()Deprecated. -
wrapsGLDefaultFB
public final boolean wrapsGLDefaultFB()Deprecated. -
wrapsVkSecondaryCB
public final boolean wrapsVkSecondaryCB()Deprecated. -
isDeferredListTarget
public final boolean isDeferredListTarget()Deprecated. -
setIsDeferredListTarget
@Internal public void setIsDeferredListTarget()Deprecated. -
isUserExact
@Internal public final boolean isUserExact()Deprecated. -
asImageProxy
Deprecated.- Returns:
- the texture proxy associated with the surface proxy, may be NULL.
-
asRenderTargetProxy
Deprecated.- Returns:
- the render target proxy associated with the surface proxy, may be NULL.
-
getUniqueKey
Deprecated.- Returns:
- the unique key for this proxy, may be NULL
-
getMemorySize
public long getMemorySize()Deprecated.Retrieves the amount of GPU memory that will be or currently is used by this resource in bytes. It is approximate since we aren't aware of additional padding or copies made by the driver.- Returns:
- the amount of GPU memory used in bytes
-
hashCode
public int hashCode()Deprecated. -
equals
Deprecated. -
doLazyInstantiation
Deprecated.
-