D3D11 D3D12
Resources ID3D11Resource

ID3D11Buffer
ID3D11Device::CreateBuffer

ID3D11Texture1D
ID3D11Device::CreateTexture1D

ID3D11Texture2D
ID3D11Device::CreateTexture2D

ID3D11Texture3D
ID3D11Device::CreateTexture3D
ID3D12Resource
ID3D12Device::CreateCommittedResource
(Committed : Virtual address space with physical pages for the resource)
Resources(tiled) D3D11_RESOURCE_MISC_TILED

D3D11_RESOURCE_MISC_TILED_POOL
ID3D12Device::CreateReservedResources
(Reserved : Virtual memory only)

ID3D12Device::CreateHeap
(page-mappable physical memory)
Resources(data upload) Appearance of single timeline

number of copies not obvious

initial data(D3D11_SUBRESOURCE_DATA)

UpdataSubresource

Map
GET Timeline(1 copy) : CopyTextureRegion, CopyBufferRegion from mappable memory

CPU Timeline(1 copy) : Map

Shared Timeline(2 copies) : D3DX12 UpdateSubresource helper

Shaders and State Objects ID3D11Device::Create*
ID3D11DeviceContext::*Set*

* : VS/PS/HS/DS/GS/CS/OM/RS/SO/IA
or : Shader, Input Layout, Blend State, Rasterizer State, Depth Stencil State
ID3D12Device::Create*PipelineState

ID3D12GraphicsCommandList::SetPipelineState
Work Submission Automatic(Driver-managed)

ID3D11DeviceContext::Flush(Optional)
ID3D12CommandList
(Similar to D3D11 defered context,
Records commands to be submitted later)

ID3D12CommandAllocator
(Backing memory for commands)

ID3D12CommandQueue
(FIFO set of work to schedule,
Single queue in D3D11)
CPU/GPU Synchronization Automatic(Diver-managed)

CPU waits for GPU during
Present()/Map()
ID3D12Fence
(GPU can signal when it is done with a chunk of work)

Memory must not be destroyed until GPU has completed
(Committed resources, heaps, command allocators, etc)

Memory must not be over-written until GPU has completed
(CPU-accesible resources with GPU operations reading from them need to be "renamed" to avoid stalling GPU)

CPU/GPU Synchronization Map(D3D11_MAP_WRITE_DISCARD) Allocate additional memory

Use fences to understand when GPU operations are done

Consider ring buffers consisting of large buffers
Resouce Binding Views

ID3D11Device::Create*View
ID3D11*View
ID3D11DeviceContext::*Set*
Descriptors

ID3D12Device::Create*View
ID3D12Device::CreateDescriptorHeap
ID3D12DescriptorHeap
ID3D12CommandList::Set*RootDescriptorTable
Resource Binding(Root Signature) Implicit

Each shader stage has descriptor tables mapping 128 Shader-Resource-Views to t0~t127, 14 Constant-Buffers to b0~b13 etc.

Incremental bindings, driver does renaming of descriptor tables

Root Parameter - Descriptor Table
0 => {VS descriptor Range b0~b13}
1 => {VS descriptor Range t0~t127}
2 => {VS descriptor Range s0~s16}
3 => {VS descriptor Range b0~b13}
........................................................
14 => {VS descriptor Range s0~s16}
15 => {VS descriptor Range u0~u63}
Explicit

App controls mapping from root parameter all the way to shader register

App responsible for renaming descriptor tables

App can control descriptors are shared between shader stages frequency of updates, etc
Resource State Automatic(dirver-tracked) App responsible for telling driver when resource usage is changing
(Fine-grained synchronization(pipeline stalls)
e.g RTV => SRV

Cache flushes

Memory layout changes(RTV/DSV/decompression))

D3D12 resource transition barrier
Other Barriers ID3D11DeviceContext2::TiledResourceBarrier

Dispatch/Draw implied UAV barrier
D3D12 aliasing barrier

By default, UAV ops in subsequent draw/dispatches can happen in parallel
(Explicit UAV barrier to serialize
Perf gains to be had if workloads can be parallelized)
Swapchains DXGI_SWAP_EFFECT
(SEQUENTIAL, DISCARD, FLIP_SEQUENTIAL)

Automatic buffer rotation
(Only need RTV for back buffer 0)
DXGI_SWAP_EFFECT
(FLIP_SEQUENTIAL, FLIP_DISCARD)

Explicit buffer rotation
(Need RTV for each back buffer
IDXGISwapChain3::GetCurrentBackBufferIndex to choose which one to render to)
Fixed-Function Rendering GenerateMips, DrawAuto App is responsible for creating shaders to do these operations

D3DX12 may include a library of examples
Misc ID3D11Query / ID3D11Predicate
(GetData)

UAV/SO hidden counter

Resource dynamic MinLOD

Draw*Indirect/DispatchIndirect

DepthStencil formats interleaved

ResizeTilePool
ID3D12QueryHeap / ID3D12Resource
(ResolveQueryData)

App responsible for allocation and management of SO/UAV counters

SRV descriptor static Min LOD

ExecuteIndirect

DepthStencil formats planar

Reserved resource mapped to multiple heaps

 

'삽질 > 뻘짓' 카테고리의 다른 글

좋은 코드에 대한 딜레마.  (0) 2023.03.27
[DirectX12] 1.스키마 & VS 초기 세팅  (0) 2022.10.29
정형 데이터 vs 비정형 데이터  (0) 2022.10.06
[DirectX11] PipeLine Buffer Binding  (0) 2022.08.17
복사했습니다!