Class DirectContext

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class DirectContext
    extends RefCnt
    • Constructor Detail

      • DirectContext

        @Internal
        public DirectContext​(long ptr)
    • 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 zero
        devicePtr - pointer to ID3D12Device objetc, which is created with provided adapter in adapterPtr; must be not zero
        queuePtr - 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()
      • 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)