Skip to content

Instantly share code, notes, and snippets.

@yorung
Created September 3, 2016 11:39
Show Gist options
  • Save yorung/728d933f716c31bdcc4ccdb15b9d250a to your computer and use it in GitHub Desktop.
Save yorung/728d933f716c31bdcc4ccdb15b9d250a to your computer and use it in GitHub Desktop.
[DX12] Set index buffer, forget D3D12_INDEX_BUFFER_VIEW.
void SetIndexBuffer(ID3D12GraphicsCommandList* list, ID3D12Resource* indexBuffer)
{
D3D12_RESOURCE_DESC desc = indexBuffer->GetDesc();
D3D12_INDEX_BUFFER_VIEW indexBufferView = { indexBuffer->GetGPUVirtualAddress(), (UINT)desc.Width, AFIndexTypeToDevice };
list->IASetIndexBuffer(&indexBufferView);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment