本文整理匯總了Java中org.lwjgl.vulkan.VkDeviceQueueCreateInfo類的典型用法代碼示例。如果您正苦於以下問題:Java VkDeviceQueueCreateInfo類的具體用法?Java VkDeviceQueueCreateInfo怎麽用?Java VkDeviceQueueCreateInfo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
VkDeviceQueueCreateInfo類屬於org.lwjgl.vulkan包,在下文中一共展示了VkDeviceQueueCreateInfo類的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;
}
示例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;
}
示例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;
}