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


Java VkDeviceQueueCreateInfo.Buffer方法代码示例

本文整理汇总了Java中org.lwjgl.vulkan.VkDeviceQueueCreateInfo.Buffer方法的典型用法代码示例。如果您正苦于以下问题:Java VkDeviceQueueCreateInfo.Buffer方法的具体用法?Java VkDeviceQueueCreateInfo.Buffer怎么用?Java VkDeviceQueueCreateInfo.Buffer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.lwjgl.vulkan.VkDeviceQueueCreateInfo的用法示例。


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

示例1: createDeviceAndGetGraphicsQueueFamily

import org.lwjgl.vulkan.VkDeviceQueueCreateInfo; //导入方法依赖的package包/类
private static DeviceAndGraphicsQueueFamily createDeviceAndGetGraphicsQueueFamily(VkPhysicalDevice physicalDevice) {
    IntBuffer pQueueFamilyPropertyCount = stackMallocInt(1);
    vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, null);
    int queueCount = pQueueFamilyPropertyCount.get(0);
    VkQueueFamilyProperties.Buffer queueProps = VkQueueFamilyProperties.callocStack(queueCount);
    vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, queueProps);
    int graphicsQueueFamilyIndex;
    for (graphicsQueueFamilyIndex = 0; graphicsQueueFamilyIndex < queueCount; graphicsQueueFamilyIndex++) {
        if ((queueProps.get(graphicsQueueFamilyIndex).queueFlags() & VK_QUEUE_GRAPHICS_BIT) != 0)
            break;
    }
    VkDeviceQueueCreateInfo.Buffer queueCreateInfo = VkDeviceQueueCreateInfo.callocStack(1)
            .sType(VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO)
            .queueFamilyIndex(graphicsQueueFamilyIndex)
            .pQueuePriorities(stackFloats(0.0f));

    PointerBuffer extensions = stackMallocPointer(1);
    ByteBuffer VK_KHR_SWAPCHAIN_EXTENSION = stackUTF8(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
    extensions.put(VK_KHR_SWAPCHAIN_EXTENSION);
    extensions.flip();
    PointerBuffer ppEnabledLayerNames = stackMallocPointer(layers.length);
    for (int i = 0; validation && i < layers.length; i++)
        ppEnabledLayerNames.put(layers[i]);
    ppEnabledLayerNames.flip();

    VkDeviceCreateInfo deviceCreateInfo = VkDeviceCreateInfo.callocStack()
            .sType(VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO)
            .pNext(NULL)
            .pQueueCreateInfos(queueCreateInfo)
            .ppEnabledExtensionNames(extensions)
            .ppEnabledLayerNames(ppEnabledLayerNames);

    PointerBuffer pDevice = stackMallocPointer(1);
    int err = vkCreateDevice(physicalDevice, deviceCreateInfo, null, pDevice);
    long device = pDevice.get(0);
    if (err != VK_SUCCESS) {
        throw new AssertionError("Failed to create device: " + translateVulkanResult(err));
    }

    DeviceAndGraphicsQueueFamily ret = new DeviceAndGraphicsQueueFamily();
    ret.device = new VkDevice(device, physicalDevice, deviceCreateInfo);
    ret.queueFamilyIndex = graphicsQueueFamilyIndex;
    return ret;
}
 
开发者ID:LWJGLX,项目名称:autostack,代码行数:45,代码来源:ClearScreenDemoUseNewStack.java

示例2: createDeviceAndGetGraphicsQueueFamily

import org.lwjgl.vulkan.VkDeviceQueueCreateInfo; //导入方法依赖的package包/类
private DeviceAndGraphicsQueueFamily createDeviceAndGetGraphicsQueueFamily(VkPhysicalDevice physicalDevice) {
    IntBuffer pQueueFamilyPropertyCount = memAllocInt(1);
    vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, null);
    int queueCount = pQueueFamilyPropertyCount.get(0);
    VkQueueFamilyProperties.Buffer queueProps = VkQueueFamilyProperties.calloc(queueCount);
    vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, queueProps);
    memFree(pQueueFamilyPropertyCount);
    int graphicsQueueFamilyIndex;
    for (graphicsQueueFamilyIndex = 0; graphicsQueueFamilyIndex < queueCount; graphicsQueueFamilyIndex++) {
        if ((queueProps.get(graphicsQueueFamilyIndex).queueFlags() & VK_QUEUE_GRAPHICS_BIT) != 0)
            break;
    }
    queueProps.free();
    FloatBuffer pQueuePriorities = memAllocFloat(1).put(0.0f);
    pQueuePriorities.flip();
    VkDeviceQueueCreateInfo.Buffer queueCreateInfo = VkDeviceQueueCreateInfo.calloc(1)
            .sType(VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO)
            .queueFamilyIndex(graphicsQueueFamilyIndex)
            .pQueuePriorities(pQueuePriorities);

    PointerBuffer extensions = memAllocPointer(1);
    ByteBuffer VK_KHR_SWAPCHAIN_EXTENSION = memUTF8(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
    extensions.put(VK_KHR_SWAPCHAIN_EXTENSION);
    extensions.flip();
    PointerBuffer ppEnabledLayerNames = memAllocPointer(layers.length);
    for (int i = 0; validation && i < layers.length; i++)
        ppEnabledLayerNames.put(layers[i]);
    ppEnabledLayerNames.flip();

    VkDeviceCreateInfo deviceCreateInfo = VkDeviceCreateInfo.calloc()
            .sType(VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO)
            .pNext(0)
            .pQueueCreateInfos(queueCreateInfo)
            .ppEnabledExtensionNames(extensions)
            .ppEnabledLayerNames(ppEnabledLayerNames);

    PointerBuffer pDevice = memAllocPointer(1);
    int err = vkCreateDevice(physicalDevice, deviceCreateInfo, null, pDevice);
    long device = pDevice.get(0);
    memFree(pDevice);
    if (err != VK_SUCCESS) {
        throw new AssertionError("Failed to create device: " + VKUtil.translateVulkanResult(err));
    }

    VkPhysicalDeviceMemoryProperties memoryProperties = VkPhysicalDeviceMemoryProperties.calloc();
    vkGetPhysicalDeviceMemoryProperties(physicalDevice, memoryProperties);

    DeviceAndGraphicsQueueFamily ret = new DeviceAndGraphicsQueueFamily();
    ret.device = new VkDevice(device, physicalDevice, deviceCreateInfo);
    ret.queueFamilyIndex = graphicsQueueFamilyIndex;
    ret.memoryProperties = memoryProperties;

    deviceCreateInfo.free();
    memFree(ppEnabledLayerNames);
    memFree(VK_KHR_SWAPCHAIN_EXTENSION);
    memFree(extensions);
    memFree(pQueuePriorities);
    return ret;
}
 
开发者ID:oreonengine,项目名称:oreon-engine,代码行数:60,代码来源:VKRenderEngine.java

示例3: createDeviceAndGetGraphicsQueueFamily

import org.lwjgl.vulkan.VkDeviceQueueCreateInfo; //导入方法依赖的package包/类
private static DeviceAndGraphicsQueueFamily createDeviceAndGetGraphicsQueueFamily(VkPhysicalDevice physicalDevice) {
    IntBuffer pQueueFamilyPropertyCount = memAllocInt(1);
    vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, null);
    int queueCount = pQueueFamilyPropertyCount.get(0);
    VkQueueFamilyProperties.Buffer queueProps = VkQueueFamilyProperties.calloc(queueCount);
    vkGetPhysicalDeviceQueueFamilyProperties(physicalDevice, pQueueFamilyPropertyCount, queueProps);
    memFree(pQueueFamilyPropertyCount);
    int graphicsQueueFamilyIndex;
    for (graphicsQueueFamilyIndex = 0; graphicsQueueFamilyIndex < queueCount; graphicsQueueFamilyIndex++) {
        if ((queueProps.get(graphicsQueueFamilyIndex).queueFlags() & VK_QUEUE_GRAPHICS_BIT) != 0)
            break;
    }
    queueProps.free();
    FloatBuffer pQueuePriorities = memAllocFloat(1).put(0.0f);
    pQueuePriorities.flip();
    VkDeviceQueueCreateInfo.Buffer queueCreateInfo = VkDeviceQueueCreateInfo.calloc(1)
            .sType(VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO)
            .queueFamilyIndex(graphicsQueueFamilyIndex)
            .pQueuePriorities(pQueuePriorities);

    PointerBuffer extensions = memAllocPointer(1);
    ByteBuffer VK_KHR_SWAPCHAIN_EXTENSION = memUTF8(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
    extensions.put(VK_KHR_SWAPCHAIN_EXTENSION);
    extensions.flip();
    PointerBuffer ppEnabledLayerNames = memAllocPointer(layers.length);
    for (int i = 0; validation && i < layers.length; i++)
        ppEnabledLayerNames.put(layers[i]);
    ppEnabledLayerNames.flip();

    VkDeviceCreateInfo deviceCreateInfo = VkDeviceCreateInfo.calloc()
            .sType(VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO)
            .pNext(NULL)
            .pQueueCreateInfos(queueCreateInfo)
            .ppEnabledExtensionNames(extensions)
            .ppEnabledLayerNames(ppEnabledLayerNames);

    PointerBuffer pDevice = memAllocPointer(1);
    int err = vkCreateDevice(physicalDevice, deviceCreateInfo, null, pDevice);
    long device = pDevice.get(0);
    memFree(pDevice);
    if (err != VK_SUCCESS) {
        throw new AssertionError("Failed to create device: " + translateVulkanResult(err));
    }

    DeviceAndGraphicsQueueFamily ret = new DeviceAndGraphicsQueueFamily();
    ret.device = new VkDevice(device, physicalDevice, deviceCreateInfo);
    ret.queueFamilyIndex = graphicsQueueFamilyIndex;

    deviceCreateInfo.free();
    memFree(ppEnabledLayerNames);
    memFree(VK_KHR_SWAPCHAIN_EXTENSION);
    memFree(extensions);
    memFree(pQueuePriorities);
    return ret;
}
 
开发者ID:httpdigest,项目名称:lwjgl3-swt,代码行数:56,代码来源:ClearScreenDemo.java


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