Class WGLAMDGPUAssociation



  • public class WGLAMDGPUAssociation
    extends java.lang.Object
    Native bindings to the WGL_AMD_gpu_association extension.

    There currently is no way for applications to efficiently use GPU resources in systems that contain more than one GPU. Vendors have provided methods that attempt to split the workload for an application among the available GPU resources. This has proven to be very inefficient because most applications were never written with these sorts of optimizations in mind.

    This extension provides a mechanism for applications to explicitly use the GPU resources on a given system individually. By providing this functionality, a driver allows applications to make appropriate decisions regarding where and when to distribute rendering tasks.

    Requires WGL_ARB_extensions_string and EXT_framebuffer_object.

    • Method Detail

      • wglGetGPUIDsAMD

        public static int wglGetGPUIDsAMD(java.nio.IntBuffer ids)
        Returns the IDs for available GPUs.

        If the function succeeds, the return value is the number of total GPUs available. The value 0 is returned if no GPUs are available or if the call has failed. The ID 0 is reserved and will not be retuned as a valid GPU ID. If the array ids is NULL, the function will only return the total number of GPUs. ids will be tightly packed with no 0 values between valid ids.

        Parameters:
        ids - the array of returned IDs
      • wglGetGPUInfoAMD

        public static int wglGetGPUInfoAMD(int id,
                                           int property,
                                           int dataType,
                                           java.nio.ByteBuffer data)
        
        public static int wglGetGPUInfoAMD(int id,
                                           int property,
                                           int dataType,
                                           java.nio.IntBuffer data)
        
        public static int wglGetGPUInfoAMD(int id,
                                           int property,
                                           int dataType,
                                           java.nio.FloatBuffer data)
        
        Each GPU in a system may have different properties, performance characteristics and different supported OpenGL versions. Use this function to determine which GPU is best suited for a specific task.

        For a string, size will be the number of characters allocated and will include NULL termination. For arrays of type GL_UNSIGNED_INT, GL_INT, and GL_FLOAT size will be the array depth. If the function succeeds, the number of values written will be returned. If the number of values written is equal to size, the query should be repeated with a larger data buffer. Strings should be queried using the GL_UNSIGNED_BYTE type, are UTF-8 encoded and will be NULL terminated. If the function fails, -1 will be returned.

        Parameters:
        id - a GPU id obtained from calling GetGPUIDsAMD
        property - the information being queried. One of:
        GPU_VENDOR_AMDGPU_RENDERER_STRING_AMDGPU_OPENGL_VERSION_STRING_AMDGPU_FASTEST_TARGET_GPUS_AMD
        GPU_RAM_AMDGPU_CLOCK_AMDGPU_NUM_PIPES_AMDGPU_NUM_SIMD_AMD
        GPU_NUM_RB_AMDGPU_NUM_SPI_AMD
        dataType - the data type to be returned. One of:
        UNSIGNED_INTINTFLOATUNSIGNED_BYTE
        data - the buffer which will be filled with the requested information
      • wglGetContextGPUIDAMD

        public static int wglGetContextGPUIDAMD(long hglrc)
        Determine which GPU a context is attached to.

        Unassociated contexts are created by calling CreateContext. Although these contexts are unassociated, their use will still be tied to a single GPU in most cases. For this reason it is advantageous to be able to query the GPU an existing unassociated context resides on. If multiple GPUs are available, it would be undesirable to use one for rendering to visible surfaces and then chose the same one for off-screen rendering.

        Parameters:
        hglrc - the context for which the GPU id will be returned
      • wglCreateAssociatedContextAMD

        public static long wglCreateAssociatedContextAMD(int id)
        Creates an associated context. Upon successful creation, no pixel format is tied to an associated context.
        Parameters:
        id - a valid GPU id
      • wglCreateAssociatedContextAttribsAMD

        public static long wglCreateAssociatedContextAttribsAMD(int id,
                                                                long shareContext,
                                                                java.nio.IntBuffer attribList)
        Create an associated context with a specific GL version.

        All capabilities and limitations of CreateContextAttribsARB apply to CreateAssociatedContextAttribsAMD.

        Parameters:
        id - a valid GPU id
        shareContext - must either be NULL or that of an associated context created with the same GPU ID as id
        attribList - a 0-terminated list of attributes for the context
      • wglDeleteAssociatedContextAMD

        public static boolean wglDeleteAssociatedContextAMD(long hglrc)
        Deletes an associated context. An associated context cannot be deleted by calling DeleteContext.
        Parameters:
        hglrc - a valid associated context created by calling CreateAssociatedContextAMD
      • wglMakeAssociatedContextCurrentAMD

        public static boolean wglMakeAssociatedContextCurrentAMD(long hglrc)
        Makes an associated context current in the current thread.
        Parameters:
        hglrc - a context handle created by calling CreateAssociatedContextAMD
      • wglGetCurrentAssociatedContextAMD

        public static long wglGetCurrentAssociatedContextAMD()
        Returns the current associated context in the current thread.
      • wglBlitContextFramebufferAMD

        public static void wglBlitContextFramebufferAMD(long dstCtx,
                                                        int srcX0,
                                                        int srcY0,
                                                        int srcX1,
                                                        int srcY1,
                                                        int dstX0,
                                                        int dstY0,
                                                        int dstX1,
                                                        int dstY1,
                                                        int mask,
                                                        int filter)
        Blits data from one context to another. This facilitates high performance data communication between multiple contexts.
        Parameters:
        dstCtx - the context handle for the write context
        srcX0 - the source x0 coordinate
        srcY0 - the source Y0 coordinate
        srcX1 - the source X1 coordinate
        srcY1 - the source Y1 coordinate
        dstX0 - the destination X0 coordinate
        dstY0 - the destination Y0 coordinate
        dstX1 - the destination X1 coordinate
        dstY1 - the destination Y1 coordinate
        mask - the bitwise OR of a number of values indicating which buffers are to be copied. One or more of:
        COLOR_BUFFER_BITDEPTH_BUFFER_BITSTENCIL_BUFFER_BIT
        filter - the interpolation method to apply if the image is stretched. One of:
        LINEARNEAREST
      • wglGetGPUIDsAMD

        public static int wglGetGPUIDsAMD(int[] ids)
        Array version of: GetGPUIDsAMD
      • wglGetGPUInfoAMD

        public static int wglGetGPUInfoAMD(int id,
                                           int property,
                                           int dataType,
                                           int[] data)
        
        public static int wglGetGPUInfoAMD(int id,
                                           int property,
                                           int dataType,
                                           float[] data)
        
        Array version of: GetGPUInfoAMD
      • wglCreateAssociatedContextAttribsAMD

        public static long wglCreateAssociatedContextAttribsAMD(int id,
                                                                long shareContext,
                                                                int[] attribList)