Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ExecuteIndirect example: Which indirect argument buffer structure for which indirect argument type? #900

Open
caotrem opened this issue Jan 11, 2025 · 0 comments

Comments

@caotrem
Copy link

caotrem commented Jan 11, 2025

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant