MCPcopy Create free account
hub / github.com/TheRealMJP/DeferredTexturing / RenderDepth

Method RenderDepth

BindlessDeferred/MeshRenderer.cpp:618–648  ·  view source on GitHub ↗

Renders all meshes using depth-only rendering

Source from the content-addressed store, hash-verified

616
617// Renders all meshes using depth-only rendering
618void MeshRenderer::RenderDepth(ID3D12GraphicsCommandList* cmdList, const Camera& camera, ID3D12PipelineState* pso, uint64 numVisible)
619{
620 cmdList->SetGraphicsRootSignature(depthRootSignature);
621 cmdList->SetPipelineState(pso);
622 cmdList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
623
624 Float4x4 world;
625
626 // Set constant buffers
627 meshVSConstants.Data.World = world;
628 meshVSConstants.Data.View = camera.ViewMatrix();
629 meshVSConstants.Data.WorldViewProjection = world * camera.ViewProjectionMatrix();
630 meshVSConstants.Upload();
631 meshVSConstants.SetAsGfxRootParameter(cmdList, 0);
632
633 // Bind vertices and indices
634 D3D12_VERTEX_BUFFER_VIEW vbView = model->VertexBuffer().VBView();
635 D3D12_INDEX_BUFFER_VIEW ibView = model->IndexBuffer().IBView();
636 cmdList->IASetVertexBuffers(0, 1, &vbView);
637 cmdList->IASetIndexBuffer(&ibView);
638
639 // Draw all meshes
640 for(uint64 i = 0; i < numVisible; ++i)
641 {
642 uint64 meshIdx = meshDrawIndices[i];
643 const Mesh& mesh = model->Meshes()[meshIdx];
644
645 // Draw the whole mesh
646 cmdList->DrawIndexedInstanced(mesh.NumIndices(), 1, mesh.IndexOffset(), mesh.VertexOffset(), 0);
647 }
648}
649
650// Renders all meshes using depth-only rendering for a sun shadow map
651void MeshRenderer::RenderDepthPrepass(ID3D12GraphicsCommandList* cmdList, const Camera& camera)

Callers

nothing calls this directly

Calls 7

UploadMethod · 0.80
SetAsGfxRootParameterMethod · 0.80
NumIndicesMethod · 0.80
IndexOffsetMethod · 0.80
VertexOffsetMethod · 0.80
VBViewMethod · 0.45
IBViewMethod · 0.45

Tested by

no test coverage detected