microsoft / microsoft/DirectX-Graphics-Samples

D3D12ExecuteIndirect: "Each triangle gets its own constant buffer per frame"

Open
#869 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug samples
Dominant language
C++
Stars
6.8k
Forks
2.2k
PR merge metrics
No merged PRs in 30d

Description

https://github.com/microsoft/DirectX-Graphics-Samples/blob/51d0c1c5e225186a279bcdf15b7dbf68745301db/Samples/Desktop/D3D12ExecuteIndirect/src/D3D12ExecuteIndirect.h#L106C8-L106C60
"// Each triangle gets its own constant buffer per frame."

https://github.com/microsoft/DirectX-Graphics-Samples/blob/51d0c1c5e225186a279bcdf15b7dbf68745301db/Samples/Desktop/D3D12ExecuteIndirect/src/D3D12ExecuteIndirect.cpp#L415

        for (UINT frame = 0; frame < FrameCount; frame++)
        {
            srvDesc.Buffer.FirstElement = frame * TriangleCount;
            m_device->CreateShaderResourceView(m_constantBuffer.Get(), &srvDesc, cbvSrvHandle);
            cbvSrvHandle.Offset(CbvSrvUavDescriptorCountPerFrame, m_cbvSrvUavDescriptorSize);
        }

Actually, it is a single m_constantBuffer, all triangles per frame get 1 SRV.

Thanks.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the comment in Samples/Desktop/D3D12ExecuteIndirect/src/D3D12ExecuteIndirect.h around line 106 and the SRV setup in D3D12ExecuteIndirect.cpp around line 415. Compare the comment with the shown m_constantBuffer and per-frame descriptor loop. Done means the comment accurately describes the constant-buffer and SRV arrangement.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics, documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.