private static long[] createFramebuffers(VkDevice device, Swapchain swapchain, long renderPass, int width, int height) { LongBuffer attachments = stackMallocLong(1); VkFramebufferCreateInfo fci = VkFramebufferCreateInfo.callocStack() .sType(VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO) .pAttachments(attachments) .flags(VK_FLAGS_NONE) .height(height) .width(width) .layers(1) .pNext(NULL) .renderPass(renderPass); // Create a framebuffer for each swapchain image long[] framebuffers = new long[swapchain.images.length]; LongBuffer pFramebuffer = stackMallocLong(1); for (int i = 0; i < swapchain.images.length; i++) { attachments.put(0, swapchain.imageViews[i]); int err = vkCreateFramebuffer(device, fci, null, pFramebuffer); long framebuffer = pFramebuffer.get(0); if (err != VK_SUCCESS) { throw new AssertionError("Failed to create framebuffer: " + translateVulkanResult(err)); } framebuffers[i] = framebuffer; } return framebuffers; }
private long[] createFramebuffers(VkDevice device, Swapchain swapchain, long renderPass, int width, int height) { LongBuffer attachments = memAllocLong(1); VkFramebufferCreateInfo fci = VkFramebufferCreateInfo.calloc() .sType(VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO) .pAttachments(attachments) .flags(0) .height(height) .width(width) .layers(1) .pNext(0) .renderPass(renderPass); // Create a framebuffer for each swapchain image long[] framebuffers = new long[swapchain.images.length]; LongBuffer pFramebuffer = memAllocLong(1); for (int i = 0; i < swapchain.images.length; i++) { attachments.put(0, swapchain.imageViews[i]); int err = vkCreateFramebuffer(device, fci, null, pFramebuffer); long framebuffer = pFramebuffer.get(0); if (err != VK_SUCCESS) { throw new AssertionError("Failed to create framebuffer: " + VKUtil.translateVulkanResult(err)); } framebuffers[i] = framebuffer; } memFree(attachments); memFree(pFramebuffer); fci.free(); return framebuffers; }
private static long[] createFramebuffers(VkDevice device, Swapchain swapchain, long renderPass, int width, int height) { LongBuffer attachments = memAllocLong(1); VkFramebufferCreateInfo fci = VkFramebufferCreateInfo.calloc() .sType(VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO) .pAttachments(attachments) .flags(VK_FLAGS_NONE) .height(height) .width(width) .layers(1) .pNext(NULL) .renderPass(renderPass); // Create a framebuffer for each swapchain image long[] framebuffers = new long[swapchain.images.length]; LongBuffer pFramebuffer = memAllocLong(1); for (int i = 0; i < swapchain.images.length; i++) { attachments.put(0, swapchain.imageViews[i]); int err = vkCreateFramebuffer(device, fci, null, pFramebuffer); long framebuffer = pFramebuffer.get(0); if (err != VK_SUCCESS) { throw new AssertionError("Failed to create framebuffer: " + translateVulkanResult(err)); } framebuffers[i] = framebuffer; } memFree(attachments); memFree(pFramebuffer); fci.free(); return framebuffers; }