当前位置: 首页>>代码示例>>Java>>正文


Java Filter类代码示例

本文整理汇总了Java中org.lwjgl.opencl.api.Filter的典型用法代码示例。如果您正苦于以下问题:Java Filter类的具体用法?Java Filter怎么用?Java Filter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Filter类属于org.lwjgl.opencl.api包,在下文中一共展示了Filter类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSupportedImageFormats

import org.lwjgl.opencl.api.Filter; //导入依赖的package包/类
public List<CLImageFormat> getSupportedImageFormats(final CLContext context, final long flags, final int image_type, final Filter<CLImageFormat> filter) {
	final IntBuffer numBuffer = APIUtil.getBufferInt();
	clGetSupportedImageFormats(context, flags, image_type, null, numBuffer);

	final int num_image_formats = numBuffer.get(0);
	if ( num_image_formats == 0 )
		return null;

	final ByteBuffer formatBuffer = BufferUtils.createByteBuffer(num_image_formats * CLImageFormat.STRUCT_SIZE);
	clGetSupportedImageFormats(context, flags, image_type, formatBuffer, null);

	final List<CLImageFormat> formats = new ArrayList<CLImageFormat>(num_image_formats);
	for ( int i = 0; i < num_image_formats; i++ ) {
		final int offset = num_image_formats * CLImageFormat.STRUCT_SIZE;
		final CLImageFormat format = new CLImageFormat(
			formatBuffer.getInt(offset),
			formatBuffer.getInt(offset + 4)
		);
		if ( filter == null || filter.accept(format) )
			formats.add(format);
	}

	return formats.size() == 0 ? null : formats;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:25,代码来源:InfoUtilFactory.java

示例2: getPlatforms

import org.lwjgl.opencl.api.Filter; //导入依赖的package包/类
public List<CLPlatform> getPlatforms(final Filter<CLPlatform> filter) {
	final IntBuffer numBuffer = APIUtil.getBufferInt();
	clGetPlatformIDs(null, numBuffer);

	final int num_platforms = numBuffer.get(0);
	if ( num_platforms == 0 )
		return null;

	final PointerBuffer platformIDs = APIUtil.getBufferPointer(num_platforms);
	clGetPlatformIDs(platformIDs, null);

	final List<CLPlatform> platforms = new ArrayList<CLPlatform>(num_platforms);
	for ( int i = 0; i < num_platforms; i++ ) {
		final CLPlatform platform = CLPlatform.getCLPlatform(platformIDs.get(i));
		if ( filter == null || filter.accept(platform) )
			platforms.add(platform);
	}

	return platforms.size() == 0 ? null : platforms;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:21,代码来源:InfoUtilFactory.java

示例3: getDevices

import org.lwjgl.opencl.api.Filter; //导入依赖的package包/类
public List<CLDevice> getDevices(final CLPlatform platform, final int device_type, final Filter<CLDevice> filter) {
	platform.checkValid();

	final IntBuffer numBuffer = APIUtil.getBufferInt();
	clGetDeviceIDs(platform, device_type, null, numBuffer);

	final int num_devices = numBuffer.get(0);
	if ( num_devices == 0 )
		return null;

	final PointerBuffer deviceIDs = APIUtil.getBufferPointer(num_devices);
	clGetDeviceIDs(platform, device_type, deviceIDs, null);

	final List<CLDevice> devices = new ArrayList<CLDevice>(num_devices);
	for ( int i = 0; i < num_devices; i++ ) {
		final CLDevice device = platform.getCLDevice(deviceIDs.get(i));
		if ( filter == null || filter.accept(device) )
			devices.add(device);
	}

	return devices.size() == 0 ? null : devices;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:23,代码来源:InfoUtilFactory.java

示例4: initCL

import org.lwjgl.opencl.api.Filter; //导入依赖的package包/类
private void initCL() throws LWJGLException {
	CL.create();

	final List<CLPlatform> platforms = CLPlatform.getPlatforms();
	if ( platforms == null )
		throw new RuntimeException("No OpenCL platforms found.");

	final CLPlatform platform = platforms.get(0);

	final PointerBuffer ctxProps = BufferUtils.createPointerBuffer(3);
	ctxProps.put(CL_CONTEXT_PLATFORM).put(platform.getPointer()).put(0).flip();

	// Find devices with GL sharing support
	final Filter<CLDevice> glSharingFilter = new Filter<CLDevice>() {
		public boolean accept(final CLDevice device) {
			final CLDeviceCapabilities caps = CLCapabilities.getDeviceCapabilities(device);
			return caps.CL_KHR_gl_sharing;
		}
	};
	final List<CLDevice> devices = platform.getDevices(CL_DEVICE_TYPE_GPU, glSharingFilter);

	if ( devices == null )
		throw new RuntimeException("No OpenCL GPU device found.");

	clDevice = devices.get(0);
	// Make sure we use only 1 device
	devices.clear();
	devices.add(clDevice);

	clContext = CLContext.create(platform, devices, new CLContextCallback() {
		protected void handleMessage(final String errinfo, final ByteBuffer private_info) {
			System.out.println("[CONTEXT MESSAGE] " + errinfo);
		}
	}, Display.getDrawable(), errorCode);
	checkCLError(errorCode);

	queue = clCreateCommandQueue(clContext, clDevice, 0, errorCode);
	checkCLError(errorCode);
}
 
开发者ID:apcragg,项目名称:3d-Demo,代码行数:40,代码来源:SpriteShootoutCL.java

示例5: getSupportedImageFormats

import org.lwjgl.opencl.api.Filter; //导入依赖的package包/类
public List<CLImageFormat> getSupportedImageFormats(final long flags, final int image_type, final Filter<CLImageFormat> filter) {
	return util.getSupportedImageFormats(this, flags, image_type, filter);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:4,代码来源:CLContext.java

示例6: initCL

import org.lwjgl.opencl.api.Filter; //导入依赖的package包/类
private void initCL() throws LWJGLException {
	CL.create();

	final List<CLPlatform> platforms = CLPlatform.getPlatforms();
	if ( platforms == null )
		throw new RuntimeException("No OpenCL platforms found.");

	final Filter<CLDevice> glSharingFilter = new Filter<CLDevice>() {
		public boolean accept(final CLDevice device) {
			final CLDeviceCapabilities caps = CLCapabilities.getDeviceCapabilities(device);
			return caps.CL_KHR_gl_sharing;
		}
	};

	CLPlatform platform = null;
	List<CLDevice> devices = null;
	for ( CLPlatform p : platforms ) {
		// Find devices with GL sharing support
		devices = p.getDevices(CL_DEVICE_TYPE_GPU, glSharingFilter);
		if ( devices != null ) {
			platform = p;
			break;
		}
	}

	if ( devices == null )
		throw new RuntimeException("No OpenCL GPU device found.");

	clDevice = devices.get(0);
	// Make sure we use only 1 device
	devices.clear();
	devices.add(clDevice);

	clContext = CLContext.create(platform, devices, new CLContextCallback() {
		protected void handleMessage(final String errinfo, final ByteBuffer private_info) {
			System.out.println("[CONTEXT MESSAGE] " + errinfo);
		}
	}, Display.getDrawable(), errorCode);
	checkCLError(errorCode);

	queue = clCreateCommandQueue(clContext, clDevice, 0, errorCode);
	checkCLError(errorCode);
}
 
开发者ID:Superloup10,项目名称:Wolf_game,代码行数:44,代码来源:SpriteShootoutCL.java

示例7: getPlatforms

import org.lwjgl.opencl.api.Filter; //导入依赖的package包/类
/**
 * Returns a list of the available platforms, filtered by the specified filter.
 *
 * @param filter the platform filter
 *
 * @return the available platforms
 */
public static List<CLPlatform> getPlatforms(final Filter<CLPlatform> filter) {
	return util.getPlatforms(filter);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:11,代码来源:CLPlatform.java

示例8: getDevices

import org.lwjgl.opencl.api.Filter; //导入依赖的package包/类
/**
 * Returns a list of the available devices on this platform that
 * match the specified type, filtered by the specified filter.
 *
 * @param device_type the device type
 * @param filter      the device filter
 *
 * @return the available devices
 */
public List<CLDevice> getDevices(final int device_type, final Filter<CLDevice> filter) {
	return util.getDevices(this, device_type, filter);
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:13,代码来源:CLPlatform.java


注:本文中的org.lwjgl.opencl.api.Filter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。