Package icyllis.arc3d.opengl
Class GLRenderTarget
java.lang.Object
icyllis.arc3d.engine.Resource
icyllis.arc3d.engine.GpuSurface
icyllis.arc3d.engine.GpuRenderTarget
icyllis.arc3d.opengl.GLRenderTarget
- All Implemented Interfaces:
RefCounted
Represents OpenGL framebuffers.
-
Nested Class Summary
Nested classes/interfaces inherited from class icyllis.arc3d.engine.GpuRenderTarget
GpuRenderTarget.ResourceKey
-
Field Summary
Fields inherited from class icyllis.arc3d.engine.GpuRenderTarget
mSurfaceFlags
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Make sure the stencil attachment is valid.protected boolean
Describes the backend format of color buffers.Describes the backend render target of this render target.getColorAttachment
(int index) int
Get the number of implicit depth bits, or 0 if no depth.Get the dynamic or implicit stencil buffer, or null if no stencil.protected GLDevice
int
getResolveAttachment
(int index) int
int
Get the number of implicit stencil bits, or 0 if no stencil.boolean
static @SharedPtr GLRenderTarget
makeWrapped
(Context context, int width, int height, BackendFormat format, int sampleCount, int framebuffer, int depthBits, int stencilBits, boolean ownership) Make aGLRenderTarget
that wraps existing framebuffers without accessing their backing buffers (texture and stencil).protected void
Subclass should override this method to free GPU resources in the backend API.toString()
Methods inherited from class icyllis.arc3d.engine.GpuRenderTarget
asImage, asRenderTarget, getHeight, getSampleCount, getSurfaceFlags, getWidth, numColorTargets
Methods inherited from class icyllis.arc3d.engine.Resource
getContext, getKey, getLabel, getMemorySize, getUniqueID, hasAnyRefs, hasCacheRef, hasCommandBufferRef, hasUsageRef, isBudgeted, isDestroyed, isPurgeable, isWrapped, onSetLabel, ref, refCommandBuffer, setKey, setLabel, setNonCacheable, unref, unrefCommandBuffer
-
Method Details
-
makeWrapped
@Nonnull @SharedPtr public static @SharedPtr GLRenderTarget makeWrapped(Context context, int width, int height, BackendFormat format, int sampleCount, int framebuffer, int depthBits, int stencilBits, boolean ownership) Make aGLRenderTarget
that wraps existing framebuffers without accessing their backing buffers (texture and stencil).- Parameters:
width
- the effective width of framebufferheight
- the effective height of framebuffer
-
getRenderFramebuffer
public int getRenderFramebuffer() -
getResolveFramebuffer
public int getResolveFramebuffer() -
bindStencil
public void bindStencil()Make sure the stencil attachment is valid. Even though a color buffer op doesn't use stencil, our FBO still needs to be "framebuffer complete". If this render target is already bound, this method ensures the stencil attachment is valid (attached or detached), if stencil buffers reset right before. -
getBackendFormat
Description copied from class:GpuRenderTarget
Describes the backend format of color buffers.- Specified by:
getBackendFormat
in classGpuRenderTarget
-
isProtected
public boolean isProtected()- Specified by:
isProtected
in classGpuSurface
- Returns:
- true if we are working with protected content
-
getColorAttachment
- Specified by:
getColorAttachment
in classGpuRenderTarget
-
getColorAttachment
- Specified by:
getColorAttachment
in classGpuRenderTarget
-
getColorAttachments
- Specified by:
getColorAttachments
in classGpuRenderTarget
-
getResolveAttachment
- Specified by:
getResolveAttachment
in classGpuRenderTarget
-
getResolveAttachment
- Specified by:
getResolveAttachment
in classGpuRenderTarget
-
getResolveAttachments
- Specified by:
getResolveAttachments
in classGpuRenderTarget
-
getDepthStencilAttachment
Description copied from class:GpuRenderTarget
Get the dynamic or implicit stencil buffer, or null if no stencil.- Specified by:
getDepthStencilAttachment
in classGpuRenderTarget
-
getDepthBits
public int getDepthBits()Description copied from class:GpuRenderTarget
Get the number of implicit depth bits, or 0 if no depth.- Specified by:
getDepthBits
in classGpuRenderTarget
-
getStencilBits
public int getStencilBits()Description copied from class:GpuRenderTarget
Get the number of implicit stencil bits, or 0 if no stencil.- Specified by:
getStencilBits
in classGpuRenderTarget
-
getBackendRenderTarget
Description copied from class:GpuRenderTarget
Describes the backend render target of this render target.- Specified by:
getBackendRenderTarget
in classGpuRenderTarget
-
canAttachStencil
protected boolean canAttachStencil()- Specified by:
canAttachStencil
in classGpuRenderTarget
- Returns:
- whether a stencil buffer can be attached to this render target.
-
onRelease
protected void onRelease()Description copied from class:Resource
Subclass should override this method to free GPU resources in the backend API. -
getDevice
-
toString
-