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


Java VkCommandBufferBeginInfo类代码示例

本文整理汇总了Java中org.lwjgl.vulkan.VkCommandBufferBeginInfo的典型用法代码示例。如果您正苦于以下问题:Java VkCommandBufferBeginInfo类的具体用法?Java VkCommandBufferBeginInfo怎么用?Java VkCommandBufferBeginInfo使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: submitPostPresentBarrier

import org.lwjgl.vulkan.VkCommandBufferBeginInfo; //导入依赖的package包/类
private static void submitPostPresentBarrier(long image, VkCommandBuffer commandBuffer, VkQueue queue) {
    VkCommandBufferBeginInfo cmdBufInfo = VkCommandBufferBeginInfo.calloc()
            .sType(VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO)
            .pNext(NULL);
    int err = vkBeginCommandBuffer(commandBuffer, cmdBufInfo);
    cmdBufInfo.free();
    if (err != VK_SUCCESS) {
        throw new AssertionError("Failed to begin command buffer: " + translateVulkanResult(err));
    }

    VkImageMemoryBarrier.Buffer postPresentBarrier = createPostPresentBarrier(image);
    vkCmdPipelineBarrier(
        commandBuffer,
        VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
        VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
        VK_FLAGS_NONE,
        null, // No memory barriers,
        null, // No buffer barriers,
        postPresentBarrier); // one image barrier
    postPresentBarrier.free();

    err = vkEndCommandBuffer(commandBuffer);
    if (err != VK_SUCCESS) {
        throw new AssertionError("Failed to wait for idle queue: " + translateVulkanResult(err));
    }

    // Submit the command buffer
    submitCommandBuffer(queue, commandBuffer);
}
 
开发者ID:httpdigest,项目名称:lwjgl3-swt,代码行数:30,代码来源:ClearScreenDemo.java

示例2: submitPostPresentBarrier

import org.lwjgl.vulkan.VkCommandBufferBeginInfo; //导入依赖的package包/类
@UseNewStack
private static void submitPostPresentBarrier(long image, VkCommandBuffer commandBuffer, VkQueue queue) {
    VkCommandBufferBeginInfo cmdBufInfo = VkCommandBufferBeginInfo.callocStack()
            .sType(VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO)
            .pNext(NULL);
    int err = vkBeginCommandBuffer(commandBuffer, cmdBufInfo);
    if (err != VK_SUCCESS) {
        throw new AssertionError("Failed to begin command buffer: " + translateVulkanResult(err));
    }

    VkImageMemoryBarrier.Buffer postPresentBarrier = VkImageMemoryBarrier.callocStack(1)
            .sType(VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER)
            .pNext(NULL)
            .srcAccessMask(0)
            .dstAccessMask(VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT)
            .oldLayout(VK_IMAGE_LAYOUT_PRESENT_SRC_KHR)
            .newLayout(VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL)
            .srcQueueFamilyIndex(VK_QUEUE_FAMILY_IGNORED)
            .dstQueueFamilyIndex(VK_QUEUE_FAMILY_IGNORED)
            .image(image);
    postPresentBarrier.subresourceRange()
            .aspectMask(VK_IMAGE_ASPECT_COLOR_BIT)
            .baseMipLevel(0)
            .levelCount(1)
            .baseArrayLayer(0)
            .layerCount(1);
    vkCmdPipelineBarrier(
        commandBuffer,
        VK_PIPELINE_STAGE_ALL_COMMANDS_BIT,
        VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
        VK_FLAGS_NONE,
        null, // No memory barriers,
        null, // No buffer barriers,
        postPresentBarrier); // one image barrier

    err = vkEndCommandBuffer(commandBuffer);
    if (err != VK_SUCCESS) {
        throw new AssertionError("Failed to wait for idle queue: " + translateVulkanResult(err));
    }

    // Submit the command buffer
    submitCommandBuffer(queue, commandBuffer);
}
 
开发者ID:LWJGLX,项目名称:autostack,代码行数:44,代码来源:ClearScreenDemoUseNewStack.java

示例3: recreate

import org.lwjgl.vulkan.VkCommandBufferBeginInfo; //导入依赖的package包/类
void recreate(VkCommandBuffer setupCommandBuffer,
			  VkDevice device,
			  VkPhysicalDevice physicalDevice,
			  long surface,
			  ColorFormatAndSpace colorFormatAndSpace,
			  VkQueue queue,
			  long renderPass,
			  long renderCommandPool,
			  long pipeline,
			  Vertices vertices) {
    // Begin the setup command buffer (the one we will use for swapchain/framebuffer creation)
    VkCommandBufferBeginInfo cmdBufInfo = VkCommandBufferBeginInfo.calloc()
            .sType(VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO)
            .pNext(0);
    int err = vkBeginCommandBuffer(setupCommandBuffer, cmdBufInfo);
    cmdBufInfo.free();
    if (err != VK_SUCCESS) {
        throw new AssertionError("Failed to begin setup command buffer: " + VKUtil.translateVulkanResult(err));
    }
    long oldChain = swapchain != null ? swapchain.swapchainHandle : VK_NULL_HANDLE;
    // Create the swapchain (this will also add a memory barrier to initialize the framebuffer images)
    swapchain = createSwapChain(device, physicalDevice, surface, oldChain, setupCommandBuffer,
            width, height, colorFormatAndSpace.colorFormat, colorFormatAndSpace.colorSpace);
    err = vkEndCommandBuffer(setupCommandBuffer);
    if (err != VK_SUCCESS) {
        throw new AssertionError("Failed to end setup command buffer: " + VKUtil.translateVulkanResult(err));
    }
    submitCommandBuffer(queue, setupCommandBuffer);
    vkQueueWaitIdle(queue);

    if (framebuffers != null) {
        for (int i = 0; i < framebuffers.length; i++)
            vkDestroyFramebuffer(device, framebuffers[i], null);
    }
    framebuffers = createFramebuffers(device, swapchain, renderPass, width, height);
    // Create render command buffers
    if (renderCommandBuffers != null) {
        vkResetCommandPool(device, renderCommandPool, 0);
    }
    renderCommandBuffers = createRenderCommandBuffers(device, renderCommandPool, framebuffers, renderPass, width, height, pipeline,
            vertices.verticesBuf);

    mustRecreate = false;
}
 
开发者ID:oreonengine,项目名称:oreon-engine,代码行数:45,代码来源:VKRenderEngine.java


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