Skip to content

Commit

Permalink
Remove redundant per-object CB in DX12ChunksScene
Browse files Browse the repository at this point in the history
Removing because per-object CB is supposed to be managed by ChunkPass.

Removing it means a change to the CBV/SRV heap layout:
Before: [0]=Per-scene CB, [1]=Per-object CB, [2]=Shadow Map SRV
After:  [0]=Per-scene CB, [1]=Shadow Map SRV
  • Loading branch information
quadpixels committed Nov 5, 2023
1 parent 5c2b091 commit 5a60866
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions dx12helloworld/DX12ChunksScene.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ void DX12ChunksScene::InitResources() {
CD3DX12_CPU_DESCRIPTOR_HANDLE handle1(cbv_heap->GetCPUDescriptorHandleForHeapStart());
g_device12->CreateConstantBufferView(&per_scene_cbv_desc, handle1);

// Per Object CB view
// Per Object CB view (Deprecated, it's now in ChunkPass)
/*handle1.Offset(cbv_descriptor_size);
D3D12_CONSTANT_BUFFER_VIEW_DESC per_obj_cbv_desc{};
per_obj_cbv_desc.BufferLocation = chunk_pass_normal->d_per_object_cbs->GetGPUVirtualAddress();
per_obj_cbv_desc.SizeInBytes = 256;
handle1.Offset(cbv_descriptor_size);
g_device12->CreateConstantBufferView(&per_obj_cbv_desc, handle1);
g_device12->CreateConstantBufferView(&per_obj_cbv_desc, handle1);*/

// Depth buffer
D3D12_CLEAR_VALUE depthOptimizedClearValue = {};
Expand Down Expand Up @@ -295,7 +295,7 @@ void DX12ChunksScene::Render() {

command_list->SetDescriptorHeaps(_countof(ppHeaps), ppHeaps);

CD3DX12_GPU_DESCRIPTOR_HANDLE handle_srv(cbv_heap->GetGPUDescriptorHandleForHeapStart(), 2, cbv_descriptor_size);
CD3DX12_GPU_DESCRIPTOR_HANDLE handle_srv(cbv_heap->GetGPUDescriptorHandleForHeapStart(), 1, cbv_descriptor_size);
command_list->SetGraphicsRootDescriptorTable(2, handle_srv);
command_list->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);

Expand Down

0 comments on commit 5a60866

Please sign in to comment.