當前位置: 首頁>>代碼示例>>Java>>正文


Java VkSubpassDescription類代碼示例

本文整理匯總了Java中org.lwjgl.vulkan.VkSubpassDescription的典型用法代碼示例。如果您正苦於以下問題:Java VkSubpassDescription類的具體用法?Java VkSubpassDescription怎麽用?Java VkSubpassDescription使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


VkSubpassDescription類屬於org.lwjgl.vulkan包,在下文中一共展示了VkSubpassDescription類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createClearRenderPass

import org.lwjgl.vulkan.VkSubpassDescription; //導入依賴的package包/類
private static long createClearRenderPass(VkDevice device, int colorFormat) {
    VkAttachmentDescription.Buffer attachments = VkAttachmentDescription.callocStack(1)
            .format(colorFormat)
            .samples(VK_SAMPLE_COUNT_1_BIT)
            .loadOp(VK_ATTACHMENT_LOAD_OP_CLEAR)
            .storeOp(VK_ATTACHMENT_STORE_OP_STORE)
            .stencilLoadOp(VK_ATTACHMENT_LOAD_OP_DONT_CARE)
            .stencilStoreOp(VK_ATTACHMENT_STORE_OP_DONT_CARE)
            .initialLayout(VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL)
            .finalLayout(VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL);

    VkAttachmentReference.Buffer colorReference = VkAttachmentReference.callocStack(1)
            .attachment(0)
            .layout(VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL);

    VkSubpassDescription.Buffer subpass = VkSubpassDescription.callocStack(1)
            .pipelineBindPoint(VK_PIPELINE_BIND_POINT_GRAPHICS)
            .flags(VK_FLAGS_NONE)
            .pInputAttachments(null)
            .colorAttachmentCount(colorReference.remaining())
            .pColorAttachments(colorReference)
            .pResolveAttachments(null)
            .pDepthStencilAttachment(null)
            .pPreserveAttachments(null);

    VkRenderPassCreateInfo renderPassInfo = VkRenderPassCreateInfo.callocStack()
            .sType(VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO)
            .pNext(NULL)
            .pAttachments(attachments)
            .pSubpasses(subpass)
            .pDependencies(null);

    LongBuffer pRenderPass = stackMallocLong(1);
    int err = vkCreateRenderPass(device, renderPassInfo, null, pRenderPass);
    long renderPass = pRenderPass.get(0);
    if (err != VK_SUCCESS) {
        throw new AssertionError("Failed to create clear render pass: " + translateVulkanResult(err));
    }
    return renderPass;
}
 
開發者ID:LWJGLX,項目名稱:autostack,代碼行數:41,代碼來源:ClearScreenDemoUseNewStack.java

示例2: createRenderPass

import org.lwjgl.vulkan.VkSubpassDescription; //導入依賴的package包/類
private long createRenderPass(VkDevice device, int colorFormat) {
    VkAttachmentDescription.Buffer attachments = VkAttachmentDescription.calloc(1)
            .format(colorFormat)
            .samples(VK_SAMPLE_COUNT_1_BIT)
            .loadOp(VK_ATTACHMENT_LOAD_OP_CLEAR)
            .storeOp(VK_ATTACHMENT_STORE_OP_STORE)
            .stencilLoadOp(VK_ATTACHMENT_LOAD_OP_DONT_CARE)
            .stencilStoreOp(VK_ATTACHMENT_STORE_OP_DONT_CARE)
            .initialLayout(VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL)
            .finalLayout(VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL);

    VkAttachmentReference.Buffer colorReference = VkAttachmentReference.calloc(1)
            .attachment(0)
            .layout(VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL);

    VkSubpassDescription.Buffer subpass = VkSubpassDescription.calloc(1)
            .pipelineBindPoint(VK_PIPELINE_BIND_POINT_GRAPHICS)
            .flags(0)
            .pInputAttachments(null)
            .colorAttachmentCount(colorReference.remaining())
            .pColorAttachments(colorReference) // <- only color attachment
            .pResolveAttachments(null)
            .pDepthStencilAttachment(null)
            .pPreserveAttachments(null);

    VkRenderPassCreateInfo renderPassInfo = VkRenderPassCreateInfo.calloc()
            .sType(VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO)
            .pNext(0)
            .pAttachments(attachments)
            .pSubpasses(subpass)
            .pDependencies(null);

    LongBuffer pRenderPass = memAllocLong(1);
    int err = vkCreateRenderPass(device, renderPassInfo, null, pRenderPass);
    long renderPass = pRenderPass.get(0);
    memFree(pRenderPass);
    renderPassInfo.free();
    colorReference.free();
    subpass.free();
    attachments.free();
    if (err != VK_SUCCESS) {
        throw new AssertionError("Failed to create clear render pass: " + VKUtil.translateVulkanResult(err));
    }
    
    return renderPass;
}
 
開發者ID:oreonengine,項目名稱:oreon-engine,代碼行數:47,代碼來源:VKRenderEngine.java

示例3: createClearRenderPass

import org.lwjgl.vulkan.VkSubpassDescription; //導入依賴的package包/類
private static long createClearRenderPass(VkDevice device, int colorFormat) {
    VkAttachmentDescription.Buffer attachments = VkAttachmentDescription.calloc(1)
            .format(colorFormat)
            .samples(VK_SAMPLE_COUNT_1_BIT)
            .loadOp(VK_ATTACHMENT_LOAD_OP_CLEAR)
            .storeOp(VK_ATTACHMENT_STORE_OP_STORE)
            .stencilLoadOp(VK_ATTACHMENT_LOAD_OP_DONT_CARE)
            .stencilStoreOp(VK_ATTACHMENT_STORE_OP_DONT_CARE)
            .initialLayout(VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL)
            .finalLayout(VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL);

    VkAttachmentReference.Buffer colorReference = VkAttachmentReference.calloc(1)
            .attachment(0)
            .layout(VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL);

    VkSubpassDescription.Buffer subpass = VkSubpassDescription.calloc(1)
            .pipelineBindPoint(VK_PIPELINE_BIND_POINT_GRAPHICS)
            .flags(VK_FLAGS_NONE)
            .pInputAttachments(null)
            .colorAttachmentCount(colorReference.remaining())
            .pColorAttachments(colorReference)
            .pResolveAttachments(null)
            .pDepthStencilAttachment(null)
            .pPreserveAttachments(null);

    VkRenderPassCreateInfo renderPassInfo = VkRenderPassCreateInfo.calloc()
            .sType(VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO)
            .pNext(NULL)
            .pAttachments(attachments)
            .pSubpasses(subpass)
            .pDependencies(null);

    LongBuffer pRenderPass = memAllocLong(1);
    int err = vkCreateRenderPass(device, renderPassInfo, null, pRenderPass);
    long renderPass = pRenderPass.get(0);
    memFree(pRenderPass);
    renderPassInfo.free();
    colorReference.free();
    subpass.free();
    attachments.free();
    if (err != VK_SUCCESS) {
        throw new AssertionError("Failed to create clear render pass: " + translateVulkanResult(err));
    }
    return renderPass;
}
 
開發者ID:httpdigest,項目名稱:lwjgl3-swt,代碼行數:46,代碼來源:ClearScreenDemo.java


注:本文中的org.lwjgl.vulkan.VkSubpassDescription類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。