This project is used to study DX11
The whole picture of render pipeline includes:
| Part | Name | Description | Mandatory | Once / Repeat At | API Used | Sample |
| ------ | ------ | ------ | ------ | ------ | ------ | ------ |
| 1.1 | CreateDeviceAndSwapChain | Standard API to create 3 objects:
**[ID3D11Device](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nn-d3d11-id3d11device)**
**[ID3D11DeviceContext](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nn-d3d11-id3d11devicecontext)**
**[IDXGISwapChain](https://learn.microsoft.com/en-us/windows/win32/api/dxgi/nn-dxgi-idxgiswapchain)** | Yes | Once | [D3D11CreateDeviceAndSwapChain()](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-d3d11createdeviceandswapchain) | [Draw Frame](https://linyinghao.cn/gitlab/clark/studydx/-/wikis/Direct3D-11-Draw-Frame) |
| 1.2 | DefineRenderTargetView | Get back buffer from swapchain, then create target view using back buffer | Yes | Once | [ID3D11Device->CreateRenderTargetView()](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11device-createrendertargetview) | [Draw Frame](https://linyinghao.cn/gitlab/clark/studydx/-/wikis/Direct3D-11-Draw-Frame) |
| 1.3 | DefineDepthStencilView | Do this if depth testing or stencil testing required | No | Once | [ID3D11Device->CreateDepthStencilState()](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11device-createdepthstencilstate)
[ID3D11DeviceContext->OMSetDepthStencilState()](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11devicecontext-omsetdepthstencilstate)
[ID3D11Device->CreateTexture2D()](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11device-createtexture2d)
[ID3D11Device->CreateDepthStencilView()](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11device-createdepthstencilview) | [Apply Depth Buffer](https://linyinghao.cn/gitlab/clark/studydx/-/wikis/Direct3D-11-Apply-Depth-Buffer) |
| 1.4 | DefineRenderTarget | Set render target view(and depth stencil) view as render target | Yes | Once | [ID3D11DeviceContext->OMSetRenderTargets()](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11devicecontext-omsetrendertargets) | [Apply Depth Buffer](https://linyinghao.cn/gitlab/clark/studydx/-/wikis/Direct3D-11-Apply-Depth-Buffer) |
| 2.1 | ClearRenderTargetView | Sets all the elements in a render target to one value | Yes | Frame | [ID3D11DeviceContext->ClearRenderTargetView()](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11devicecontext-clearrendertargetview) | [Draw Frame](https://linyinghao.cn/gitlab/clark/studydx/-/wikis/Direct3D-11-Draw-Frame) |
| 2.2 | ClearDepthStencilView | Clears the depth-stencil resource.
Do this if depth testing or stencil testing required | No | Frame | [ID3D11DeviceContext->ClearDepthStencilView()](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11devicecontext-cleardepthstencilview) | [Apply Depth Buffer](https://linyinghao.cn/gitlab/clark/studydx/-/wikis/Direct3D-11-Apply-Depth-Buffer) |
| 2.3 | DefineVertexBuffer | Define vertices array and create vertex buffer | Yes | Graphic object | [ID3D11Device->CreateBuffer()](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11device-createbuffer)
[ID3D11DeviceContext->IASetVertexBuffers()](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11devicecontext-iasetvertexbuffers) | [Draw Triangle](https://linyinghao.cn/gitlab/clark/studydx/-/wikis/Direct3D-11-Draw-Triangle) |
| 2.4 | DefineIndexBuffer | Define indices array and create index buffer | Yes | Graphic object | [ID3D11Device->CreateBuffer()](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11device-createbuffer)
[ID3D11DeviceContext->IASetIndexBuffer()](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11devicecontext-iasetindexbuffer) | [Use Index Buffer](https://linyinghao.cn/gitlab/clark/studydx/-/wikis/Direct3D-11-Use-Index-Buffer) |
| 2.5 | DefineTransConstBuffer | Define transformation array and create buffer, then bind it to vertex buffer | Yes | Graphic object | [ID3D11Device->CreateBuffer()](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11device-createbuffer)
[ID3D11DeviceContext->VSSetConstantBuffers()](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11devicecontext-vssetconstantbuffers) | [Draw Rotating Image](https://linyinghao.cn/gitlab/clark/studydx/-/wikis/Direct3D-11-Draw-Rotating-Image) |
| 2.6 | DefineColorConstBuffer | Define color array and create buffer, then bind it to vertex buffer | Yes | Graphic object | [ID3D11Device->CreateBuffer()](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11device-createbuffer)
[ID3D11DeviceContext->PSSetConstantBuffers()](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11devicecontext-pssetconstantbuffers) | [Draw Cube Color](https://linyinghao.cn/gitlab/clark/studydx/-/wikis/Direct3D-11-Draw-Cube-Color) |
| 2.7 | DefineVertexShader | Create vertex shader and bind it to device | Yes | Graphic object | [ID3D11Device->CreateVertexShader()](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11device-createvertexshader)
[ID3D11DeviceContext->VSSetShader()](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11devicecontext-vssetshader) | [Draw Triangle](https://linyinghao.cn/gitlab/clark/studydx/-/wikis/Direct3D-11-Draw-Triangle) |
| 2.8 | DefinePixelShader | Create pixel shader and bind it to device | Yes | Graphic object | [ID3D11Device->CreatePixelShader()](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11device-createpixelshader)
[ID3D11DeviceContext->PSSetShader()](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11devicecontext-pssetshader) | [Draw Triangle](https://linyinghao.cn/gitlab/clark/studydx/-/wikis/Direct3D-11-Draw-Triangle) |
| 2.9 | DefineInputLayout | Create an input-layout object to describe the input-buffer data for the input-assembler stage | Yes | Graphic object | [ID3D11Device->CreateInputLayout()](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11device-createinputlayout)
[ID3D11DeviceContext->IASetInputLayout()](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11devicecontext-iasetinputlayout) | [Draw Triangle](https://linyinghao.cn/gitlab/clark/studydx/-/wikis/Direct3D-11-Draw-Triangle) |
| 2.10 | DefinePrimitiveTopology | Bind information about the primitive type, and data order that describes input data for the input assembler stage | Yes | Graphic object | [ID3D11DeviceContext->IASetPrimitiveTopology()](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11devicecontext-iasetprimitivetopology) | [Draw Triangle](https://linyinghao.cn/gitlab/clark/studydx/-/wikis/Direct3D-11-Draw-Triangle) |
| 2.11 | DefineViewPorts | Bind an array of viewports to the rasterizer stage of the pipeline | Yes | Graphic object | [ID3D11DeviceContext->RSSetViewports()](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11devicecontext-rssetviewports) | [Draw Frame](https://linyinghao.cn/gitlab/clark/studydx/-/wikis/Direct3D-11-Draw-Frame) |
| 2.12 | DrawPrimitive | Draw primitives | Yes | Graphic object | [ID3D11DeviceContext->DrawIndexed()](https://learn.microsoft.com/en-us/windows/win32/api/d3d11/nf-d3d11-id3d11devicecontext-drawindexed) | [Use Index Buffer](https://linyinghao.cn/gitlab/clark/studydx/-/wikis/Direct3D-11-Use-Index-Buffer) |
| 3 | Present | Presents a rendered image to the user | Yes | Frame | [IDXGISwapChain->Present()](https://learn.microsoft.com/en-us/windows/win32/api/dxgi/nf-dxgi-idxgiswapchain-present) | [Draw Frame](https://linyinghao.cn/gitlab/clark/studydx/-/wikis/Direct3D-11-Draw-Frame) |