Class WGLAMDGPUAssociation
- java.lang.Object
-
- org.lwjgl.opengl.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.
-
-
Field Summary
Fields Modifier and Type Field and Description static int
WGL_GPU_CLOCK_AMD
WGL_GPU_FASTEST_TARGET_GPUS_AMD
WGL_GPU_NUM_PIPES_AMD
WGL_GPU_NUM_RB_AMD
WGL_GPU_NUM_SIMD_AMD
WGL_GPU_NUM_SPI_AMD
WGL_GPU_OPENGL_VERSION_STRING_AMD
WGL_GPU_RAM_AMD
WGL_GPU_RENDERER_STRING_AMD
WGL_GPU_VENDOR_AMDAccepted by theproperty
parameter ofGetGPUInfoAMD
.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description 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.static long
wglCreateAssociatedContextAMD(int id)
Creates an associated context.static long
wglCreateAssociatedContextAttribsAMD(int id, long shareContext, int[] attribList)
Array version of:CreateAssociatedContextAttribsAMD
static long
wglCreateAssociatedContextAttribsAMD(int id, long shareContext, java.nio.IntBuffer attribList)
Create an associated context with a specific GL version.static boolean
wglDeleteAssociatedContextAMD(long hglrc)
Deletes an associated context.static int
wglGetContextGPUIDAMD(long hglrc)
Determine which GPU a context is attached to.static long
wglGetCurrentAssociatedContextAMD()
Returns the current associated context in the current thread.static int
wglGetGPUIDsAMD(int[] ids)
Array version of:GetGPUIDsAMD
static int
wglGetGPUIDsAMD(java.nio.IntBuffer ids)
Returns the IDs for available GPUs.static int
wglGetGPUInfoAMD(int id, int property, int dataType, java.nio.ByteBuffer data)
Each GPU in a system may have different properties, performance characteristics and different supported OpenGL versions.static int
wglGetGPUInfoAMD(int id, int property, int dataType, float[] data)
Array version of:GetGPUInfoAMD
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.static int
wglGetGPUInfoAMD(int id, int property, int dataType, int[] data)
Array version of:GetGPUInfoAMD
static int
wglGetGPUInfoAMD(int id, int property, int dataType, java.nio.IntBuffer data)
Each GPU in a system may have different properties, performance characteristics and different supported OpenGL versions.static boolean
wglMakeAssociatedContextCurrentAMD(long hglrc)
Makes an associated context current in the current thread.
-
-
-
Field Detail
-
WGL_GPU_VENDOR_AMD, WGL_GPU_RENDERER_STRING_AMD, WGL_GPU_OPENGL_VERSION_STRING_AMD, WGL_GPU_FASTEST_TARGET_GPUS_AMD, WGL_GPU_RAM_AMD, WGL_GPU_CLOCK_AMD, WGL_GPU_NUM_PIPES_AMD, WGL_GPU_NUM_SIMD_AMD, WGL_GPU_NUM_RB_AMD, WGL_GPU_NUM_SPI_AMD
Accepted by theproperty
parameter ofGetGPUInfoAMD
.
-
-
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
isNULL
, 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 includeNULL
termination. For arrays of type GL_UNSIGNED_INT, GL_INT, and GL_FLOATsize
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 tosize
, the query should be repeated with a largerdata
buffer. Strings should be queried using the GL_UNSIGNED_BYTE type, are UTF-8 encoded and will beNULL
terminated. If the function fails, -1 will be returned.- Parameters:
id
- a GPU id obtained from callingGetGPUIDsAMD
property
- the information being queried. One of:GPU_VENDOR_AMD
GPU_RENDERER_STRING_AMD
GPU_OPENGL_VERSION_STRING_AMD
GPU_FASTEST_TARGET_GPUS_AMD
GPU_RAM_AMD
GPU_CLOCK_AMD
GPU_NUM_PIPES_AMD
GPU_NUM_SIMD_AMD
GPU_NUM_RB_AMD
GPU_NUM_SPI_AMD
dataType
- the data type to be returned. One of:UNSIGNED_INT
INT
FLOAT
UNSIGNED_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 toCreateAssociatedContextAttribsAMD
.- Parameters:
id
- a valid GPU idshareContext
- must either beNULL
or that of an associated context created with the same GPU ID asid
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 callingDeleteContext
.- Parameters:
hglrc
- a valid associated context created by callingCreateAssociatedContextAMD
-
wglMakeAssociatedContextCurrentAMD
public static boolean wglMakeAssociatedContextCurrentAMD(long hglrc)
Makes an associated context current in the current thread.- Parameters:
hglrc
- a context handle created by callingCreateAssociatedContextAMD
-
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 contextsrcX0
- the source x0 coordinatesrcY0
- the source Y0 coordinatesrcX1
- the source X1 coordinatesrcY1
- the source Y1 coordinatedstX0
- the destination X0 coordinatedstY0
- the destination Y0 coordinatedstX1
- the destination X1 coordinatedstY1
- the destination Y1 coordinatemask
- the bitwise OR of a number of values indicating which buffers are to be copied. One or more of:COLOR_BUFFER_BIT
DEPTH_BUFFER_BIT
STENCIL_BUFFER_BIT
filter
- the interpolation method to apply if the image is stretched. One of:LINEAR
NEAREST
-
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)
Array version of:CreateAssociatedContextAttribsAMD
-
-