Java 类org.lwjgl.vulkan.VkFramebufferCreateInfo 实例源码

项目:autostack    文件:ClearScreenDemoUseNewStack.java   
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;
}
项目:autostack    文件:ClearScreenDemoUseCallerStack.java   
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;
}
项目:oreon-engine    文件:VKRenderEngine.java   
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;
}
项目:lwjgl3-swt    文件:ClearScreenDemo.java   
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;
}