LoginSignup
0
0

More than 3 years have passed since last update.

初めてのVulkanプログラミング step6 グラフィクスパイプライン作成

Last updated at Posted at 2019-12-22

6章のオブジェクトを組み合わせてグラフィクスパイプラインを作成することができます。
現在あるオブジェクトは以下の通りです。

  • シェーダステージ: プログラム可能なパイプラインの機能:フラグメントシェーダや、バーテックスシェーダなど
  • 固定機能 パイプラインの固定ステージを定義する機能:アッセンブリー、ラスタライザー,ビューポート、カラーブレンディング パイプラインレイアウト
  • レンダーパス:パイプラインステージによって作成、参照されるデータの使用方法

全て組み合わせてグラフィクスパイプラインを作成するためにvkGraphicsCreate構造体に定義して、createGraphicsPipeline関数で生成します。


    VkGraphicsPipelineCreateInfo pipelineCreateInfo;
    pipelineCreateInfo.sType = VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO;
    pipelineCreateInfo.pNext = nullptr;
    pipelineCreateInfo.flags = 0;
    pipelineCreateInfo.stageCount = 2;
    pipelineCreateInfo.pStages = shaderStages ;
    pipelineCreateInfo.pVertexInputState = &vertexInputCreateInfo;
    pipelineCreateInfo.pInputAssemblyState = &inputAssemblyCreateInfo;
    pipelineCreateInfo.pTessellationState = nullptr;
    pipelineCreateInfo.pViewportState = &viewportStateCreateInfo;
    pipelineCreateInfo.pRasterizationState = &rasterizationCreateinfo;
    pipelineCreateInfo.pMultisampleState = &multisampleCreateInfo;
    pipelineCreateInfo.pDepthStencilState = nullptr;
    pipelineCreateInfo.pColorBlendState = &colorBlendCreateInfo;
    pipelineCreateInfo.pDynamicState = nullptr;
    pipelineCreateInfo.layout = _pipelineLayout;
    pipelineCreateInfo.renderPass = _renderPass;
    pipelineCreateInfo.subpass = 0;
    pipelineCreateInfo.basePipelineHandle = VK_NULL_HANDLE;
    pipelineCreateInfo.basePipelineIndex = -1;

    err = vkCreateGraphicsPipelines(_device, VK_NULL_HANDLE, 1 ,&pipelineCreateInfo, nullptr, &_pipeline);
    if (VK_SUCCESS != err) {
        assert(0 && "Vulkan ERROR: Create Pipeline failed!!");
        std::exit(-1);
    }

次の章では、フレームバッファーを設定し、描写コマンドを発行します。これが終わると、画像をモニターに表示することができます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0