microsoft / microsoft/DirectX-Graphics-Samples
ExecuteIndirect example: Which indirect argument buffer structure for which indirect argument type?
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 6.8k
- Forks
- 2.2k
- PR merge metrics
- No merged PRs in 30d
Description
Hey there,
maybe I get something fundamentally wrong but the documentation does not say anything about which indirect argument buffer structure needs to be used for which indirect argument type in the IndirectCommand structure: https://learn.microsoft.com/en-us/windows/win32/direct3d12/indirect-drawing
In the ExecuteIndirect example the SceneConstantBuffer argument is defined as INDIRECT_ARGUMENT_TYPE_CONSTANT_BUFFER_VIEW. Intuitivly I would think that in the IndirectCommand structure the CBV needs to be of type D3D12_CONSTANT_BUFFER_VIEW_DESC which consists of the BufferLocation and its SizeInBytes.
typedef struct D3D12_CONSTANT_BUFFER_VIEW_DESC {
D3D12_GPU_VIRTUAL_ADDRESS BufferLocation;
UINT SizeInBytes;
} D3D12_CONSTANT_BUFFER_VIEW_DESC;
But in the example only a D3D12_GPU_VIRTUAL_ADDRESS is used in the IndirectCommand structure to give the buffer location without the size.
struct IndirectCommand
{
D3D12_GPU_VIRTUAL_ADDRESS cbv;
D3D12_DRAW_ARGUMENTS drawArguments;
};
So why does it work? And is there any documentation to make clear which indirect argument buffer structure needs to be used for which indirect argument type? My search so far didn't give me any answers.
Also there is no documentation which union fields need to be set in D3D12_INDIRECT_ARGUMENT_DESC for which type.
I would find it helpful to have a table in the docs like this:
D3D12_INDIRECT_ARGUMENT_TYPE | D3D12_INDIRECT_ARGUMENT_DESC | Indirect Argument Buffer Structure
**********************************************************************************************************************************
INDIRECT_ARGUMENT_TYPE_DRAW | - | D3D12_DRAW_ARGUMENTS
----------------------------------------------------------------------------------------------------------------------------------
... | ... | ....
----------------------------------------------------------------------------------------------------------------------------------
INDIRECT_ARGUMENT_TYPE_CONSTANT_BUFFER_VIEW | ConstantBufferView | CONSTANT_BUFFER_VIEW_DESC ???
----------------------------------------------------------------------------------------------------------------------------------
...
Thanks for looking into it!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read the linked Direct3D12 indirect-drawing documentation and the ExecuteIndirect example referenced in the issue. Map each indirect argument type to its descriptor fields and indirect buffer structure, then document the mappings and explain the constant-buffer-view case in the relevant documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100