Class DirectContext
- java.lang.Object
-
- io.github.humbleui.skija.impl.Native
-
- io.github.humbleui.skija.impl.Managed
-
- io.github.humbleui.skija.impl.RefCnt
-
- io.github.humbleui.skija.DirectContext
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class DirectContext extends RefCnt
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.github.humbleui.skija.impl.RefCnt
RefCnt._FinalizerHolder
-
Nested classes/interfaces inherited from class io.github.humbleui.skija.impl.Managed
Managed.CleanerThunk
-
-
Field Summary
-
Fields inherited from class io.github.humbleui.skija.impl.Managed
_cleanable
-
-
Constructor Summary
Constructors Constructor Description DirectContext(long ptr)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void_nAbandon(long ptr)static long_nFlush(long ptr)static long_nMakeDirect3D(long adapterPtr, long devicePtr, long queuePtr)static long_nMakeGL()static long_nMakeMetal(long devicePtr, long queuePtr)static void_nReset(long ptr, int flags)static long_nSubmit(long ptr, boolean syncCpu)voidabandon()Abandons all GPU resources and assumes the underlying backend 3D API context is no longer usable.@NotNull DirectContextflush()static @NotNull DirectContextmakeDirect3D(long adapterPtr, long devicePtr, long queuePtr)Creates Direct3D direct rendering context from D3D12 native objects.static @NotNull DirectContextmakeGL()static @NotNull DirectContextmakeMetal(long devicePtr, long queuePtr)@NotNull DirectContextresetAll()@NotNull DirectContextresetGL(GLBackendState... states)@NotNull DirectContextresetGLAll()voidsubmit(boolean syncCpu)Submit outstanding work to the gpu from all previously un-submitted flushes.-
Methods inherited from class io.github.humbleui.skija.impl.RefCnt
_nGetFinalizer, _nGetRefCount, getRefCount, toString
-
Methods inherited from class io.github.humbleui.skija.impl.Managed
_nInvokeFinalizer, close, isClosed
-
Methods inherited from class io.github.humbleui.skija.impl.Native
_nativeEquals, equals, getPtr, hashCode
-
-
-
-
Method Detail
-
makeGL
@NotNull @Contract("-> new") public static @NotNull DirectContext makeGL()
-
makeMetal
@NotNull @Contract("-> this") public static @NotNull DirectContext makeMetal(long devicePtr, long queuePtr)
-
makeDirect3D
@NotNull @Contract("-> this") public static @NotNull DirectContext makeDirect3D(long adapterPtr, long devicePtr, long queuePtr)Creates Direct3D direct rendering context from D3D12 native objects.
For more information refer to skia GrDirectContext class.
- Parameters:
adapterPtr- pointer to IDXGIAdapter1 object; must be not zerodevicePtr- pointer to ID3D12Device objetc, which is created with provided adapter in adapterPtr; must be not zeroqueuePtr- Pointer to ID3D12CommandQueue object, which is created with provided device in devicePtr with type D3D12_COMMAND_LIST_TYPE_DIRECT; must be not zero
-
flush
@NotNull @Contract("-> this") public @NotNull DirectContext flush()
-
resetAll
@NotNull @Contract("-> this") public @NotNull DirectContext resetAll()
-
resetGLAll
@NotNull @Contract("-> this") public @NotNull DirectContext resetGLAll()
-
resetGL
@NotNull @Contract("_ -> this") public @NotNull DirectContext resetGL(GLBackendState... states)
-
submit
public void submit(boolean syncCpu)
Submit outstanding work to the gpu from all previously un-submitted flushes.
If the syncCpu flag is true this function will return once the gpu has finished with all submitted work.
For more information refer to skia GrDirectContext::submit(bool syncCpu) method.
- Parameters:
syncCpu- flag to sync cpu and gpu work submission
-
abandon
public void abandon()
Abandons all GPU resources and assumes the underlying backend 3D API context is no longer usable. Call this if you have lost the associated GPU context, and thus internal texture, buffer, etc. references/IDs are now invalid. Calling this ensures that the destructors of the context and any of its created resource objects will not make backend 3D API calls. Content rendered but not previously flushed may be lost. After this function is called all subsequent calls on the context will fail or be no-ops.
The typical use case for this function is that the underlying 3D context was lost and further API calls may crash.
For Vulkan, even if the device becomes lost, the VkQueue, VkDevice, or VkInstance used to create the context must be kept alive even after abandoning the context. Those objects must live for the lifetime of the context object itself. The reason for this is so that we can continue to delete any outstanding GrBackendTextures/RenderTargets which must be cleaned up even in a device lost state.
-
_nMakeGL
@Internal public static long _nMakeGL()
-
_nMakeMetal
@Internal public static long _nMakeMetal(long devicePtr, long queuePtr)
-
_nMakeDirect3D
@Internal public static long _nMakeDirect3D(long adapterPtr, long devicePtr, long queuePtr)
-
_nFlush
@Internal public static long _nFlush(long ptr)
-
_nSubmit
@Internal public static long _nSubmit(long ptr, boolean syncCpu)
-
_nReset
@Internal public static void _nReset(long ptr, int flags)
-
_nAbandon
@Internal public static void _nAbandon(long ptr)
-
-