Class VeilOpenCL

java.lang.Object
foundry.veil.api.opencl.VeilOpenCL
All Implemented Interfaces:
AutoCloseable, org.lwjgl.system.NativeResource

public final class VeilOpenCL extends Object implements org.lwjgl.system.NativeResource
Veil implementation of OpenCL.
  • Field Details

    • LOGGER

      public static final org.slf4j.Logger LOGGER
  • Method Details

    • getEnvironment

      @Nullable public @Nullable CLEnvironment getEnvironment()
      Returns:
      The default OpenCL environment or null if no device was found
    • getEnvironment

      @Nullable public @Nullable CLEnvironment getEnvironment(CLEnvironmentOptions options)
      Retrieves an environment that follows the specified requirements.
      Parameters:
      options - The requirements for the requested environment
      Returns:
      The environment for a device with those properties or null if no device was found
    • getEnvironment

      @Nullable public @Nullable CLEnvironment getEnvironment(VeilOpenCL.DeviceInfo deviceInfo)
      Retrieves the environment for the specified device.
      Parameters:
      deviceInfo - The device to retrieve the environment for
      Returns:
      The environment for that device or null if no device was found or null if no device was found
    • getPlatforms

      public VeilOpenCL.PlatformInfo[] getPlatforms()
      Returns:
      All platforms OpenCL can be run on
    • getPriorityDevices

      public List<VeilOpenCL.DeviceInfo> getPriorityDevices()
      Returns:
      All devices for all platforms sorted by compute priority
    • free

      @Internal public void free()
      Specified by:
      free in interface org.lwjgl.system.NativeResource
    • tryFree

      @Internal public static void tryFree()
      Attempts to release all OpenCL resources without initializing OpenCL.
    • get

      public static VeilOpenCL get()
      Returns:
      The static Veil OpenCL implementation
    • checkCLError

      public static void checkCLError(IntBuffer errcode) throws CLException
      IntBuffer implementation of checkCLError(int)
      Throws:
      CLException
    • checkCLError

      public static void checkCLError(int errcode) throws CLException
      Checks if the specified error code was not CL10.CL_SUCCESS
      Parameters:
      errcode - The error code to validate
      Throws:
      CLException - If the error code was not success
    • getProgramBuildInfo

      public static String getProgramBuildInfo(long program, long device, int param) throws CLException
      Retrieves the specified program build info string from the specified program and device.
      Parameters:
      program - The program to get the build info for
      device - The device the program was built on
      param - The parameter to get
      Returns:
      The program build info string
      Throws:
      CLException - If any error occurred while trying to get the string
    • getPlatformInfoString

      public static String getPlatformInfoString(long platform, int param) throws CLException
      Retrieves the specified string parameter from the specified platform.
      Parameters:
      platform - The platform to get the string from
      param - The parameter to get
      Returns:
      The platform info string
      Throws:
      CLException - If any error occurred while trying to get the string
    • getDeviceInfoString

      public static String getDeviceInfoString(long device, int param) throws CLException
      Retrieves the specified string parameter from the specified device.
      Parameters:
      device - The device to get the string from
      param - The parameter to get
      Returns:
      The device info string
      Throws:
      CLException - If any error occurred while trying to get the string
    • getDeviceInfoInt

      public static int getDeviceInfoInt(long device, int param) throws CLException
      Retrieves the specified integer parameter from the specified device.
      Parameters:
      device - The device to get the int from
      param - The parameter to get
      Returns:
      The device info int
      Throws:
      CLException - If any error occurred while trying to get the int
    • getDeviceInfoLong

      public static long getDeviceInfoLong(long device, int param) throws CLException
      Retrieves the specified long parameter from the specified device.
      Parameters:
      device - The device to get the long from
      param - The parameter to get
      Returns:
      The device info long
      Throws:
      CLException - If any error occurred while trying to get the long