本文整理汇总了Java中org.lwjgl.PointerBuffer.get方法的典型用法代码示例。如果您正苦于以下问题:Java PointerBuffer.get方法的具体用法?Java PointerBuffer.get怎么用?Java PointerBuffer.get使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.PointerBuffer
的用法示例。
在下文中一共展示了PointerBuffer.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculateImageSize
import org.lwjgl.PointerBuffer; //导入方法依赖的package包/类
/**
* Calculates the number of bytes in the specified cl_mem image region.
* This implementation assumes 1 byte per element, because we cannot the
* image type.
*
* @param region the image region
* @param row_pitch the row pitch
* @param slice_pitch the slice pitch
*
* @return the region size in bytes
*/
static int calculateImageSize(final PointerBuffer region, long row_pitch, long slice_pitch) {
if ( !LWJGLUtil.CHECKS )
return 0;
final long w = region.get(0);
final long h = region.get(1);
final long d = region.get(2);
if ( LWJGLUtil.DEBUG && (w < 1 || h < 1 || d < 1) )
throw new IllegalArgumentException("Invalid cl_mem image region dimensions: " + w + " x " + h + " x " + d);
if ( row_pitch == 0 )
row_pitch = w;
else if ( LWJGLUtil.DEBUG && row_pitch < w )
throw new IllegalArgumentException("Invalid row pitch specified: " + row_pitch);
if ( slice_pitch == 0 )
slice_pitch = row_pitch * h;
else if ( LWJGLUtil.DEBUG && slice_pitch < (row_pitch * h) )
throw new IllegalArgumentException("Invalid slice pitch specified: " + slice_pitch);
return (int)(slice_pitch * d);
}
示例2: getFirstPhysicalDevice
import org.lwjgl.PointerBuffer; //导入方法依赖的package包/类
/**
* Returns the handle to the first physical device connected to the system.
*
* @param instance The instance of the vulkan
*
* @return The handle to the first physical device.
*/
public static VkPhysicalDevice getFirstPhysicalDevice(VkInstance instance)
{
IntBuffer gpuCount = memAllocInt(1);
vkEnumeratePhysicalDevices(instance, gpuCount, null);
PointerBuffer devices = memAllocPointer(gpuCount.get(0));
vkEnumeratePhysicalDevices(instance, gpuCount, devices);
VkPhysicalDevice firstPhysicalDevice = new VkPhysicalDevice(devices.get(0), instance);
memFree(gpuCount);
memFree(devices);
return firstPhysicalDevice;
}
示例3: paramGlfwMonitor
import org.lwjgl.PointerBuffer; //导入方法依赖的package包/类
public static MethodCall paramGlfwMonitor(MethodCall mc, long monitor) {
PointerBuffer monitors = org.lwjgl.glfw.GLFW.glfwGetMonitors();
for (int i = 0; i < monitors.remaining(); i++) {
long m = monitors.get(i);
if (m == monitor) {
mc.paramEnum("monitor[" + i + "]");
return mc;
}
}
mc.param(monitor);
return mc;
}
示例4: returnValueGlfwMonitor
import org.lwjgl.PointerBuffer; //导入方法依赖的package包/类
public static long returnValueGlfwMonitor(long monitor, MethodCall mc) {
PointerBuffer monitors = org.lwjgl.glfw.GLFW.glfwGetMonitors();
for (int i = 0; i < monitors.remaining(); i++) {
long m = monitors.get(i);
if (m == monitor) {
mc.returnValueEnum("monitor[" + i + "]");
return monitor;
}
}
mc.returnValue(monitor);
return monitor;
}
示例5: checkGlfwMonitor
import org.lwjgl.PointerBuffer; //导入方法依赖的package包/类
public static void checkGlfwMonitor(long monitor) {
if (monitor == 0L)
return;
PointerBuffer pb = org.lwjgl.glfw.GLFW.glfwGetMonitors();
for (int i = 0; i < pb.remaining(); i++) {
if (pb.get(i) == monitor)
return;
}
throwIAEOrLogError("Provided 'monitor' argument is not a valid GLFW monitor handle: " + monitor);
}
示例6: create
import org.lwjgl.PointerBuffer; //导入方法依赖的package包/类
public static void create()
{
PointerBuffer displayPointers = glfwGetMonitors();
Display.displays = new ArrayList<>();
for(int i = 0; i < displayPointers.limit(); i++)
{
long id = displayPointers.get(i);
Display.displays.add(new Display(id));
}
glfwSetMonitorCallback(new DisplayCallback());
}
示例7: getMonitors
import org.lwjgl.PointerBuffer; //导入方法依赖的package包/类
@Override
public IMonitor[] getMonitors() {
PointerBuffer monitors = GLFW.glfwGetMonitors();
IMonitor[] result = new IMonitor[monitors.limit()];
for(int i = 0; i < result.length; i++)
result[i] = new GLFWMonitor(monitors.get(i), i);
return result;
}
示例8: registerCLPlatforms
import org.lwjgl.PointerBuffer; //导入方法依赖的package包/类
/**
* Called from clGetPlatformIDs to register new platforms.
*
* @param platforms a buffer containing CLPlatform pointers.
*/
static void registerCLPlatforms(final PointerBuffer platforms, final IntBuffer num_platforms) {
if ( platforms == null )
return;
final int pos = platforms.position();
final int count = min(num_platforms.get(0), platforms.remaining()); // We can't depend on .remaining()
for ( int i = 0; i < count; i++ ) {
final long id = platforms.get(pos + i);
if ( !clPlatforms.containsKey(id) )
new CLPlatform(id);
}
}
示例9: registerCLDevices
import org.lwjgl.PointerBuffer; //导入方法依赖的package包/类
/**
* Called from <code>clGetDeviceIDs</code> to register new devices.
*
* @param devices a buffer containing CLDevice pointers.
*/
void registerCLDevices(final PointerBuffer devices, final IntBuffer num_devices) {
final int pos = devices.position();
final int count = min(num_devices.get(num_devices.position()), devices.remaining()); // We can't depend on .remaining()
for ( int i = 0; i < count; i++ ) {
final long id = devices.get(pos + i);
if ( !clDevices.hasObject(id) )
new CLDevice(id, this);
}
}
示例10: createDeviceQueue
import org.lwjgl.PointerBuffer; //导入方法依赖的package包/类
@NoTransform
private static VkQueue createDeviceQueue(VkDevice device, int queueFamilyIndex) {
PointerBuffer pQueue = stackMallocPointer(1);
vkGetDeviceQueue(device, queueFamilyIndex, 0, pQueue);
long queue = pQueue.get(0);
return new VkQueue(queue, device);
}
示例11: createCommandBuffer
import org.lwjgl.PointerBuffer; //导入方法依赖的package包/类
private static VkCommandBuffer createCommandBuffer(VkDevice device, long commandPool) {
VkCommandBufferAllocateInfo cmdBufAllocateInfo = VkCommandBufferAllocateInfo.callocStack()
.sType(VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO)
.commandPool(commandPool)
.level(VK_COMMAND_BUFFER_LEVEL_PRIMARY)
.commandBufferCount(1);
PointerBuffer pCommandBuffer = stackMallocPointer(1);
int err = vkAllocateCommandBuffers(device, cmdBufAllocateInfo, pCommandBuffer);
long commandBuffer = pCommandBuffer.get(0);
if (err != VK_SUCCESS) {
throw new AssertionError("Failed to allocate command buffer: " + translateVulkanResult(err));
}
return new VkCommandBuffer(commandBuffer, device);
}
示例12: getInfoSize
import org.lwjgl.PointerBuffer; //导入方法依赖的package包/类
public long getInfoSize(final T object, final int param_name) {
object.checkValid();
final PointerBuffer buffer = APIUtil.getBufferPointer();
getInfo(object, param_name, buffer.getBuffer(), null);
return buffer.get(0);
}
示例13: getInfoSizeArray
import org.lwjgl.PointerBuffer; //导入方法依赖的package包/类
public long[] getInfoSizeArray(final T object, final int param_name) {
object.checkValid();
final int size = getInfoSizeArraySize(object, param_name);
final PointerBuffer buffer = APIUtil.getBufferPointer(size);
getInfo(object, param_name, buffer.getBuffer(), null);
final long[] array = new long[size];
for ( int i = 0; i < size; i++ )
array[i] = buffer.get(i);
return array;
}
示例14: getSizeRet
import org.lwjgl.PointerBuffer; //导入方法依赖的package包/类
protected final int getSizeRet(final T object, final int param_name) {
final PointerBuffer bytes = APIUtil.getBufferPointer();
final int errcode = getInfo(object, param_name, null, bytes);
if ( errcode != CL_SUCCESS )
throw new IllegalArgumentException("Invalid parameter specified: " + LWJGLUtil.toHexString(param_name));
return (int)bytes.get(0);
}
示例15: getFirstPhysicalDevice
import org.lwjgl.PointerBuffer; //导入方法依赖的package包/类
/**
* This method will enumerate the physical devices (i.e. GPUs) the system has available for us, and will just return
* the first one.
*/
private static VkPhysicalDevice getFirstPhysicalDevice(VkInstance instance) {
IntBuffer pPhysicalDeviceCount = stackMallocInt(1);
int err = vkEnumeratePhysicalDevices(instance, pPhysicalDeviceCount, null);
if (err != VK_SUCCESS) {
throw new AssertionError("Failed to get number of physical devices: " + translateVulkanResult(err));
}
PointerBuffer pPhysicalDevices = stackMallocPointer(pPhysicalDeviceCount.get(0));
err = vkEnumeratePhysicalDevices(instance, pPhysicalDeviceCount, pPhysicalDevices);
long physicalDevice = pPhysicalDevices.get(0);
if (err != VK_SUCCESS) {
throw new AssertionError("Failed to get physical devices: " + translateVulkanResult(err));
}
return new VkPhysicalDevice(physicalDevice, instance);
}