Package icyllis.arc3d.engine

# Class ImmediateContext

java.lang.Object
icyllis.arc3d.core.RefCnt
icyllis.arc3d.engine.Context
icyllis.arc3d.engine.ImmediateContext

All Implemented Interfaces:
  `RefCounted`

public final class ImmediateContext extends Context
Immediate context is used for command list execution and queue submission. That thread is also known as command execution thread and submission thread.

- ## Field Summary

  ### Fields inherited from class icyllis.arc3d.engine.Context

  `mDevice, mOwnerThread, mResourceProvider`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ImmediateContext(Device device, QueueManager queueManager)`
  Use backend utility class to create context.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `addTask(@RawPtr Task task)`
  `void`
  `checkForFinishedWork()`
  `CommandBuffer`
  `currentCommandBuffer()`
  `protected void`
  `deallocate()`
  Override this method to invoke de-allocation of the underlying resource.
  `void`
  `freeGpuResources()`
  Frees GPU resources created and held by the Context.
  `QueueManager`
  `getQueueManager()`
  `boolean`
  `init()`
  `boolean`
  `isDeviceLost()`
  `boolean`
  `isDiscarded()`
  `@SharedPtr RecordingContext`
  `makeRecordingContext()`
  `@SharedPtr RecordingContext`
  `makeRecordingContext(RecordingContextOptions options)`
  `void`
  `performDeferredCleanup(long msNotUsed)`
  Purge GPU resources on the Context that haven't been used in the past 'msNotUsed' milliseconds or are otherwise marked for deletion, regardless of whether the context is under budget.
  `void`
  `resetContext(int state)`
  The context normally assumes that no outsider is setting state within the underlying 3D API's context/device.
  `boolean`
  `submit()`

  ### Methods inherited from class icyllis.arc3d.engine.Context

  `checkOwnerThread, getBackend, getCaps, getCompressedBackendFormat, getContextID, getCurrentBudgetedBytes, getCurrentPurgeableBytes, getDefaultBackendFormat, getDevice, getLogger, getMaxBudgetedBytes, getMaxRenderTargetSize, getMaxSurfaceSampleCount, getMaxTextureSize, getOptions, getOwnerThread, getRendererProvider, getResourceProvider, getSharedResourceCache, init, isImmediate, isOwnerThread, matches`

  ### Methods inherited from class icyllis.arc3d.core.RefCnt

  `create, create, getRefCnt, getRefCntAcquire, getRefCntVolatile, move, move, ref, unique, unref`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ImmediateContext

    @Internal public ImmediateContext(Device device, QueueManager queueManager)
    Use backend utility class to create context.

- ## Method Details

  - ### makeRecordingContext

    @Nullable @SharedPtr public @SharedPtr RecordingContext makeRecordingContext()

  - ### makeRecordingContext

    @Nullable @SharedPtr public @SharedPtr RecordingContext makeRecordingContext(RecordingContextOptions options)

  - ### resetContext

    public void resetContext(int state)
    The context normally assumes that no outsider is setting state within the underlying 3D API's context/device. This call informs the context that the state was modified and it should resend.

    The flag bits, state, is dependent on which backend is used by the context, only GL.

    See Also:
      - `Engine.GLBackendState`

  - ### isDiscarded

    public boolean isDiscarded()

  - ### getQueueManager

    @Internal public QueueManager getQueueManager()

  - ### addTask

    public boolean addTask(@RawPtr @RawPtr Task task)

  - ### submit

    public boolean submit()

  - ### checkForFinishedWork

    public void checkForFinishedWork()

  - ### currentCommandBuffer

    @VisibleForTesting @Internal public CommandBuffer currentCommandBuffer()

  - ### isDeviceLost

    public boolean isDeviceLost()
    Overrides:
      `isDeviceLost` in class `Context`

  - ### freeGpuResources

    public void freeGpuResources()
    Description copied from class: `Context`
    Frees GPU resources created and held by the Context. Can be called to reduce GPU memory pressure. Any resources that are still in use (e.g. being used by work submitted to the GPU) will not be deleted by this call. If the caller wants to make sure all resources are freed, then they should first make sure to submit and wait on any outstanding work.
    Specified by:
      `freeGpuResources` in class `Context`

  - ### performDeferredCleanup

    public void performDeferredCleanup(long msNotUsed)
    Description copied from class: `Context`
    Purge GPU resources on the Context that haven't been used in the past 'msNotUsed' milliseconds or are otherwise marked for deletion, regardless of whether the context is under budget.
    Specified by:
      `performDeferredCleanup` in class `Context`

  - ### init

    public boolean init()

  - ### deallocate

    protected void deallocate()
    Description copied from class: `RefCnt`
    Override this method to invoke de-allocation of the underlying resource.
    Overrides:
      `deallocate` in class `Context`