Aqoole_Hateenaの技術日記

vulkan+raytraceで色々描いてます

Graphics Pipeline基礎知識

Graphics pipelineとは

コマンドの入力によって、データが各ステージで処理される生産ラインのこと。
各ステージは実装によってon/offが可能だが、vertex shaderのステージだけは例外なく実装する必要がある。

Block diagram of the Vulkan pipeline

f:id:Aqoole_Hateena:20220110184943p:plain
Block diagram of the Vulkan pipeline

出典:Vulkan® 1.2.203 - A Specification
Figure 2. Block diagram of the Vulkan pipeline

左がpipelineのフローである。
調べた用語をまとめる。

Tessellation Control Shader

tessellation要素のためのプログラム可能なshader stage.
tessellationとは3頂点などで表されるポリゴンをさらに細かく分割して、より詳細かつ滑らかに表現する技法である。
テッセレーション - Wikipedia
tessellationはVulkanではオプションの操作で、tessellation control shaderとtessellation evaluation shaderの両方がpipelineに含まれる場合に行うことができる。
Vulkan® 1.2.203 - A Specification

Geometry Shader

wikipediaには以下のように説明されている。


ジオメトリシェーダーにより、実行時に頂点数を増減させたり、プリミティブの種類を変更したりすることが可能となる。OpenGLではプリミティブシェーダーとも呼ばれる。

シェーダー - Wikipedia
例えば三角形のメッシュをワイヤーフレームの三角形に変形させることなどが行える。

Vertex Post-Processing

Clip and cullの操作などがここに含まれる。Clip and cullとは描画される範囲を決めることである。
描画されない範囲は捨てて、描画される範囲をrasterizeするために次のステージに送る。

Rasterization

頂点の羅列で表されている図形を将来的にpixelで表現するために、fragment shaderに渡せるようなfragmentsに変換する。
fragmentsとは、図形が載っているpixelのことである。
Vulkanの仕様書には、以下のように説明されている。

Rasterization is the process by which a primitive is converted to a two-dimensional image. Each discrete location of this image contains associated data such as depth, color, or other attributes.
Vulkan® 1.2.203 - A Specification

「Rasterizationとは図形を2次元のimageに変換することで、imageにはdepthやcolorなどの情報が含まれる。」とある。

各pipeline stageの記述方法について

別記事にまとめていく。

Vertex Post-processing

aqoole-hateena.hatenablog.com

更新履歴

2022/1/22 Rasterization 表現を微修正