microsoft / microsoft/DirectX-Graphics-Samples
D3D12HelloWindow.cpp *(Desktop)
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 6.8k
- Forks
- 2.2k
- PR merge metrics
- No merged PRs in 30d
Description
*(Desktop)
Its nice to see these have been sort of recently updated since last I looked at DirectX.
Might I suggest this as a hold over for the ('&' required l-value) until someone gets back at the examples.
template <class T>
constexpr auto& lvalue(T&& value) noexcept {
return value;
}
void D3D12HelloWindow::PopulateCommandList()
{
// Command list allocators can only be reset when the associated
// command lists have finished execution on the GPU; apps should use
// fences to determine GPU execution progress.
ThrowIfFailed(m_commandAllocator->Reset());
// However, when ExecuteCommandList() is called on a particular command
// list, that command list can then be reset at any time and must be before
// re-recording.
ThrowIfFailed(m_commandList->Reset(m_commandAllocator.Get(), m_pipelineState.Get()));
// Indicate that the back buffer will be used as a render target.
m_commandList->ResourceBarrier(1, &lvalue(CD3DX12_RESOURCE_BARRIER::Transition(m_renderTargets[m_frameIndex].Get(), D3D12_RESOURCE_STATE_PRESENT, D3D12_RESOURCE_STATE_RENDER_TARGET)));
CD3DX12_CPU_DESCRIPTOR_HANDLE rtvHandle(m_rtvHeap->GetCPUDescriptorHandleForHeapStart(), m_frameIndex, m_rtvDescriptorSize);
// Record commands.
const float clearColor[] = { 0.0f, 0.2f, 0.4f, 1.0f };
m_commandList->ClearRenderTargetView(rtvHandle, clearColor, 0, nullptr);
// Indicate that the back buffer will now be used to present.
m_commandList->ResourceBarrier(1, &lvalue(CD3DX12_RESOURCE_BARRIER::Transition(m_renderTargets[m_frameIndex].Get(), D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PRESENT)));
ThrowIfFailed(m_commandList->Close());
}
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
Start with D3D12HelloWindow.cpp and inspect PopulateCommandList, especially the two ResourceBarrier calls shown in the issue. Build the D3D12HelloWindow desktop sample to reproduce the required l-value problem; done means the sample compiles with the suggested temporary workaround and the command list still records both barriers correctly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics, desktop
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100