本文整理汇总了Java中org.lwjgl.vulkan.VkCommandBufferBeginInfo.free方法的典型用法代码示例。如果您正苦于以下问题:Java VkCommandBufferBeginInfo.free方法的具体用法?Java VkCommandBufferBeginInfo.free怎么用?Java VkCommandBufferBeginInfo.free使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.lwjgl.vulkan.VkCommandBufferBeginInfo
的用法示例。
在下文中一共展示了VkCommandBufferBeginInfo.free方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例2: 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;
}