MCPcopy Create free account
hub / github.com/GPUOpen-Effects/TressFX / BeginBackbufferRenderPass

Method BeginBackbufferRenderPass

src/DX12/DX12EngineInterfaceImpl.cpp:1275–1311  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1273}
1274
1275void EI_Device::BeginBackbufferRenderPass()
1276{
1277 using namespace DirectX::Detail;
1278 const wchar_t pPassName[] = L"BackBufferRenderPass";
1279 UINT size = static_cast<UINT>((wcslen(pPassName) + 1) * sizeof(wchar_t));
1280 m_currentCommandBuffer.commandBuffer.Get()->BeginEvent(PIX_EVENT_UNICODE_VERSION, pPassName, size);
1281
1282 // First transition the current back buffer to render target from present resource
1283 CD3DX12_RESOURCE_BARRIER barrier = CD3DX12_RESOURCE_BARRIER::Transition(m_swapChain.GetCurrentBackBufferResource(), D3D12_RESOURCE_STATE_PRESENT, D3D12_RESOURCE_STATE_RENDER_TARGET);
1284 m_currentCommandBuffer.commandBuffer->ResourceBarrier(1, &barrier);
1285
1286 D3D12_CPU_DESCRIPTOR_HANDLE cpuHandle[MaxRenderAttachments];
1287
1288 cpuHandle[0] = *m_swapChain.GetCurrentBackBufferRTV();
1289 cpuHandle[1] = m_depthBuffer->DSView->GetCPU();
1290
1291 m_currentCommandBuffer.commandBuffer->OMSetRenderTargets(1, cpuHandle, FALSE, &cpuHandle[1]);
1292
1293 // Setup fast clear
1294 D3D12_CLEAR_VALUE clearValues[2];
1295 clearValues[0].Format = m_swapChain.GetFormat();
1296 clearValues[0].Color[0] = 0.0f;
1297 clearValues[0].Color[1] = 0.0f;
1298 clearValues[0].Color[2] = 0.0f;
1299 clearValues[0].Color[3] = 1.0f;
1300
1301 clearValues[1].Format = DXGI_FORMAT_D32_FLOAT;
1302 clearValues[1].DepthStencil.Depth = 1.0f;
1303 clearValues[1].DepthStencil.Stencil = 0;
1304
1305 // Do a clear before rendering everything out to the swap chain buffer
1306 m_currentCommandBuffer.commandBuffer->ClearRenderTargetView(cpuHandle[0], clearValues[0].Color, 0, nullptr);
1307 // Only clear depth as we don't currently have a stencil
1308 m_currentCommandBuffer.commandBuffer->ClearDepthStencilView(cpuHandle[1], D3D12_CLEAR_FLAG_DEPTH, clearValues[1].DepthStencil.Depth, clearValues[1].DepthStencil.Stencil, 0, nullptr);
1309
1310 CAULDRON_DX12::SetViewportAndScissor(m_currentCommandBuffer.commandBuffer.Get(), 0, 0, m_width, m_height);
1311}
1312
1313void EI_Device::EndRenderPass()
1314{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected