Skip to content

Commit cec5492

Browse files
committed
Merge pull request #8 from Microsoft/develop
merge develop branch for new release
2 parents 86b7ce2 + af0d7fe commit cec5492

23 files changed

+2721
-64
lines changed

.gitattributes

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto
3+
4+
# Explicitly declare code/VS files as CRLF
5+
*.cpp eol=crlf
6+
*.h eol=crlf
7+
*.hlsl eol=crlf
8+
*.vcxproj eol=crlf
9+
*.filters eol=crlf
10+
*.sln eol=crlf
11+
12+
# Explicitly declare resource files as binary
13+
*.bin binary

Samples/D3D12Bundles/src/FrameResource.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ void FrameResource::SetCityPositions(FLOAT intervalX, FLOAT intervalZ)
7676

7777
// The y position is based off of the city's row and column
7878
// position to prevent z-fighting.
79-
m_modelMatrices[i * m_cityColumnCount + j] = XMMatrixTranslation(cityOffsetX, 0.02f * (i * m_cityColumnCount + j), cityOffsetZ);
79+
XMStoreFloat4x4(&m_modelMatrices[i * m_cityColumnCount + j], XMMatrixTranslation(cityOffsetX, 0.02f * (i * m_cityColumnCount + j), cityOffsetZ));
8080
}
8181
}
8282
}
@@ -123,17 +123,17 @@ void FrameResource::PopulateCommandList(ID3D12GraphicsCommandList* pCommandList,
123123

124124
void XM_CALLCONV FrameResource::UpdateConstantBuffers(FXMMATRIX view, CXMMATRIX projection)
125125
{
126-
XMMATRIX* pModel;
126+
XMMATRIX model;
127127
XMFLOAT4X4 mvp;
128128

129129
for (UINT i = 0; i < m_cityRowCount; i++)
130130
{
131131
for (UINT j = 0; j < m_cityColumnCount; j++)
132132
{
133-
pModel = &m_modelMatrices[i * m_cityColumnCount + j];
133+
model = XMLoadFloat4x4(&m_modelMatrices[i * m_cityColumnCount + j]);
134134

135135
// Compute the model-view-projection matrix.
136-
XMStoreFloat4x4(&mvp, XMMatrixTranspose(*pModel * view * projection));
136+
XMStoreFloat4x4(&mvp, XMMatrixTranspose(model * view * projection));
137137

138138
// Copy this matrix into the appropriate location in the upload heap subresource.
139139
memcpy(&m_pConstantBuffers[i * m_cityColumnCount + j], &mvp, sizeof(mvp));

Samples/D3D12Bundles/src/FrameResource.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class FrameResource
3636
ConstantBuffer* m_pConstantBuffers;
3737
UINT64 m_fenceValue;
3838

39-
vector<XMMATRIX> m_modelMatrices;
39+
vector<XMFLOAT4X4> m_modelMatrices;
4040
UINT m_cityRowCount;
4141
UINT m_cityColumnCount;
4242

Samples/D3D12DynamicIndexing/src/FrameResource.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ void FrameResource::SetCityPositions(FLOAT intervalX, FLOAT intervalZ)
7777

7878
// The y position is based off of the city's row and column
7979
// position to prevent z-fighting.
80-
m_modelMatrices[i * m_cityColumnCount + j] = XMMatrixTranslation(cityOffsetX, 0.02f * (i * m_cityColumnCount + j), cityOffsetZ);
80+
XMStoreFloat4x4(&m_modelMatrices[i * m_cityColumnCount + j], XMMatrixTranslation(cityOffsetX, 0.02f * (i * m_cityColumnCount + j), cityOffsetZ));
8181
}
8282
}
8383
}
@@ -123,17 +123,17 @@ void FrameResource::PopulateCommandList(ID3D12GraphicsCommandList* pCommandList,
123123

124124
void XM_CALLCONV FrameResource::UpdateConstantBuffers(FXMMATRIX view, CXMMATRIX projection)
125125
{
126-
XMMATRIX* pModel;
126+
XMMATRIX model;
127127
XMFLOAT4X4 mvp;
128128

129129
for (UINT i = 0; i < m_cityRowCount; i++)
130130
{
131131
for (UINT j = 0; j < m_cityColumnCount; j++)
132132
{
133-
pModel = &m_modelMatrices[i * m_cityColumnCount + j];
133+
model = XMLoadFloat4x4(&m_modelMatrices[i * m_cityColumnCount + j]);
134134

135135
// Compute the model-view-projection matrix.
136-
XMStoreFloat4x4(&mvp, XMMatrixTranspose(*pModel * view * projection));
136+
XMStoreFloat4x4(&mvp, XMMatrixTranspose(model * view * projection));
137137

138138
// Copy this matrix into the appropriate location in the upload heap subresource.
139139
memcpy(&m_pConstantBuffers[i * m_cityColumnCount + j], &mvp, sizeof(mvp));

Samples/D3D12DynamicIndexing/src/FrameResource.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class FrameResource
3636
ConstantBuffer* m_pConstantBuffers;
3737
UINT64 m_fenceValue;
3838

39-
vector<XMMATRIX> m_modelMatrices;
39+
vector<XMFLOAT4X4> m_modelMatrices;
4040
UINT m_cityRowCount;
4141
UINT m_cityColumnCount;
4242
UINT m_cityMaterialCount;

Samples/D3D12ExecuteIndirect/src/D3D12ExecuteIndirect.cpp

Lines changed: 53 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "stdafx.h"
1313
#include "D3D12ExecuteIndirect.h"
1414

15+
const UINT D3D12ExecuteIndirect::CommandBufferSizePerFrame = TriangleCount * sizeof(IndirectCommand);
1516
const float D3D12ExecuteIndirect::TriangleHalfWidth = 0.05f;
1617
const float D3D12ExecuteIndirect::TriangleDepth = 1.0f;
1718
const float D3D12ExecuteIndirect::CullingCutoff = 0.5f;
@@ -354,7 +355,7 @@ void D3D12ExecuteIndirect::LoadAssets()
354355
m_constantBufferData[n].velocity = XMFLOAT4(GetRandomFloat(0.01f, 0.02f), 0.0f, 0.0f, 0.0f);
355356
m_constantBufferData[n].offset = XMFLOAT4(GetRandomFloat(-5.0f, -1.5f), GetRandomFloat(-1.0f, 1.0f), GetRandomFloat(0.0f, 2.0f), 0.0f);
356357
m_constantBufferData[n].color = XMFLOAT4(GetRandomFloat(0.5f, 1.0f), GetRandomFloat(0.5f, 1.0f), GetRandomFloat(0.5f, 1.0f), 1.0f);
357-
m_constantBufferData[n].projection = XMMatrixTranspose(XMMatrixPerspectiveFovLH(XM_PIDIV4, m_aspectRatio, 0.01f, 20.0f));
358+
XMStoreFloat4x4(&m_constantBufferData[n].projection, XMMatrixTranspose(XMMatrixPerspectiveFovLH(XM_PIDIV4, m_aspectRatio, 0.01f, 20.0f)));
358359

359360
for (int frame = 0; frame < FrameCount; frame++)
360361
{
@@ -410,7 +411,7 @@ void D3D12ExecuteIndirect::LoadAssets()
410411
{
411412
std::vector<IndirectCommand> commands;
412413
commands.resize(TriangleResourceCount);
413-
const UINT commandBufferSize = TriangleResourceCount * sizeof(IndirectCommand);
414+
const UINT commandBufferSize = CommandBufferSizePerFrame * FrameCount;
414415

415416
ThrowIfFailed(m_device->CreateCommittedResource(
416417
&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT),
@@ -477,46 +478,48 @@ void D3D12ExecuteIndirect::LoadAssets()
477478
CD3DX12_CPU_DESCRIPTOR_HANDLE processedCommandsHandle(m_cbvSrvUavHeap->GetCPUDescriptorHandleForHeapStart(), ProcessedCommandsOffset, m_cbvSrvUavDescriptorSize);
478479
for (UINT frame = 0; frame < FrameCount; frame++)
479480
{
480-
// Allocate a buffer large enough to hold all of the indirect commands.
481+
// Allocate a buffer large enough to hold all of the indirect commands
482+
// for a single frame as well as a UAV counter.
481483
ThrowIfFailed(m_device->CreateCommittedResource(
482484
&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT),
483485
D3D12_HEAP_FLAG_NONE,
484-
&CD3DX12_RESOURCE_DESC::Buffer(commandBufferSize / FrameCount, D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS),
485-
D3D12_RESOURCE_STATE_UNORDERED_ACCESS,
486+
&CD3DX12_RESOURCE_DESC::Buffer(CommandBufferSizePerFrame + sizeof(UINT), D3D12_RESOURCE_FLAG_ALLOW_UNORDERED_ACCESS),
487+
D3D12_RESOURCE_STATE_COPY_DEST,
486488
nullptr,
487489
IID_PPV_ARGS(&m_processedCommandBuffers[frame])));
488490

489-
// Allocate a counter for the UAV.
490-
ThrowIfFailed(m_device->CreateCommittedResource(
491-
&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_UPLOAD),
492-
D3D12_HEAP_FLAG_NONE,
493-
&CD3DX12_RESOURCE_DESC::Buffer(sizeof(UINT)),
494-
D3D12_RESOURCE_STATE_GENERIC_READ,
495-
nullptr,
496-
IID_PPV_ARGS(&m_processedCommandBufferCounters[frame])));
497-
498491
D3D12_UNORDERED_ACCESS_VIEW_DESC uavDesc = {};
499492
uavDesc.Format = DXGI_FORMAT_UNKNOWN;
500493
uavDesc.ViewDimension = D3D12_UAV_DIMENSION_BUFFER;
501494
uavDesc.Buffer.FirstElement = 0;
502495
uavDesc.Buffer.NumElements = TriangleCount;
503496
uavDesc.Buffer.StructureByteStride = sizeof(IndirectCommand);
504-
uavDesc.Buffer.CounterOffsetInBytes = 0;
497+
uavDesc.Buffer.CounterOffsetInBytes = CommandBufferSizePerFrame;
505498
uavDesc.Buffer.Flags = D3D12_BUFFER_UAV_FLAG_NONE;
506499

507500
m_device->CreateUnorderedAccessView(
508501
m_processedCommandBuffers[frame].Get(),
509-
m_processedCommandBufferCounters[frame].Get(),
502+
m_processedCommandBuffers[frame].Get(),
510503
&uavDesc,
511504
processedCommandsHandle);
512505

513-
// Map the UAV counters. We don't unmap these until the app closes.
514-
// Keeping things mapped for the lifetime of the resource is okay.
515-
ThrowIfFailed(m_processedCommandBufferCounters[frame]->Map(0, nullptr, reinterpret_cast<void**>(&m_pMappedUavCounters[frame])));
516-
ZeroMemory(m_pMappedUavCounters[frame], sizeof(UINT));
517-
518506
processedCommandsHandle.Offset(CbvSrvUavDescriptorCountPerFrame, m_cbvSrvUavDescriptorSize);
519507
}
508+
509+
// Allocate a buffer that can be used to reset the UAV counters and initialize
510+
// it to 0.
511+
ThrowIfFailed(m_device->CreateCommittedResource(
512+
&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_UPLOAD),
513+
D3D12_HEAP_FLAG_NONE,
514+
&CD3DX12_RESOURCE_DESC::Buffer(sizeof(UINT)),
515+
D3D12_RESOURCE_STATE_GENERIC_READ,
516+
nullptr,
517+
IID_PPV_ARGS(&m_processedCommandBufferCounterReset)));
518+
519+
UINT8* pMappedCounterReset = nullptr;
520+
ThrowIfFailed(m_processedCommandBufferCounterReset->Map(0, nullptr, reinterpret_cast<void**>(&pMappedCounterReset)));
521+
ZeroMemory(pMappedCounterReset, sizeof(UINT));
522+
m_processedCommandBufferCounterReset->Unmap(0, nullptr);
520523
}
521524

522525
// Close the command list and execute it to begin the vertex buffer copy into
@@ -571,8 +574,6 @@ void D3D12ExecuteIndirect::OnUpdate()
571574

572575
UINT8* destination = m_pCbvDataBegin + (TriangleCount * m_frameIndex * sizeof(ConstantBufferData));
573576
memcpy(destination, &m_constantBufferData[0], TriangleCount * sizeof(ConstantBufferData));
574-
575-
ZeroMemory(m_pMappedUavCounters[m_frameIndex], sizeof(UINT));
576577
}
577578

578579
// Render the scene.
@@ -655,6 +656,12 @@ void D3D12ExecuteIndirect::PopulateCommandLists()
655656

656657
m_computeCommandList->SetComputeRoot32BitConstants(RootConstants, 4, reinterpret_cast<void*>(&m_csRootConstants), 0);
657658

659+
// Reset the UAV counter for this frame.
660+
m_computeCommandList->CopyBufferRegion(m_processedCommandBuffers[m_frameIndex].Get(), CommandBufferSizePerFrame, m_processedCommandBufferCounterReset.Get(), 0, sizeof(UINT));
661+
662+
D3D12_RESOURCE_BARRIER barrier = CD3DX12_RESOURCE_BARRIER::Transition(m_processedCommandBuffers[m_frameIndex].Get(), D3D12_RESOURCE_STATE_COPY_DEST, D3D12_RESOURCE_STATE_UNORDERED_ACCESS);
663+
m_computeCommandList->ResourceBarrier(1, &barrier);
664+
658665
m_computeCommandList->Dispatch(static_cast<UINT>(ceil(TriangleCount / float(ComputeThreadBlockSize))), 1, 1);
659666
}
660667

@@ -698,19 +705,33 @@ void D3D12ExecuteIndirect::PopulateCommandLists()
698705
m_commandList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
699706
m_commandList->IASetVertexBuffers(0, 1, &m_vertexBufferView);
700707

701-
// Draw the triangles that have not been culled.
702-
m_commandList->ExecuteIndirect(
703-
m_commandSignature.Get(),
704-
TriangleCount,
705-
m_enableCulling ? m_processedCommandBuffers[m_frameIndex].Get() : m_commandBuffer.Get(),
706-
m_enableCulling ? 0 : TriangleCount * m_frameIndex * sizeof(IndirectCommand),
707-
m_enableCulling ? m_processedCommandBufferCounters[m_frameIndex].Get() : nullptr,
708-
0);
708+
if (m_enableCulling)
709+
{
710+
// Draw the triangles that have not been culled.
711+
m_commandList->ExecuteIndirect(
712+
m_commandSignature.Get(),
713+
TriangleCount,
714+
m_processedCommandBuffers[m_frameIndex].Get(),
715+
0,
716+
m_processedCommandBuffers[m_frameIndex].Get(),
717+
CommandBufferSizePerFrame);
718+
}
719+
else
720+
{
721+
// Draw all of the triangles.
722+
m_commandList->ExecuteIndirect(
723+
m_commandSignature.Get(),
724+
TriangleCount,
725+
m_commandBuffer.Get(),
726+
CommandBufferSizePerFrame * m_frameIndex,
727+
nullptr,
728+
0);
729+
}
709730

710731
// Indicate that the command buffer may be used by the compute shader
711732
// and that the back buffer will now be used to present.
712733
barriers[0].Transition.StateBefore = D3D12_RESOURCE_STATE_INDIRECT_ARGUMENT;
713-
barriers[0].Transition.StateAfter = m_enableCulling ? D3D12_RESOURCE_STATE_UNORDERED_ACCESS : D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE;
734+
barriers[0].Transition.StateAfter = m_enableCulling ? D3D12_RESOURCE_STATE_COPY_DEST : D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE;
714735
barriers[1].Transition.StateBefore = D3D12_RESOURCE_STATE_RENDER_TARGET;
715736
barriers[1].Transition.StateAfter = D3D12_RESOURCE_STATE_PRESENT;
716737

Samples/D3D12ExecuteIndirect/src/D3D12ExecuteIndirect.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ class D3D12ExecuteIndirect : public DXSample
3232
static const UINT FrameCount = 3;
3333
static const UINT TriangleCount = 1024;
3434
static const UINT TriangleResourceCount = TriangleCount * FrameCount;
35+
static const UINT CommandBufferSizePerFrame;
3536
static const UINT ComputeThreadBlockSize = 128; // Should match the value in compute.hlsl.
3637
static const float TriangleHalfWidth; // The x and y offsets used by the triangle vertices.
3738
static const float TriangleDepth; // The z offset used by the triangle vertices.
@@ -49,7 +50,7 @@ class D3D12ExecuteIndirect : public DXSample
4950
XMFLOAT4 velocity;
5051
XMFLOAT4 offset;
5152
XMFLOAT4 color;
52-
XMMATRIX projection;
53+
XMFLOAT4X4 projection;
5354

5455
// Constant buffers are 256-byte aligned. Add padding in the struct to allow multiple buffers
5556
// to be array-indexed.
@@ -141,8 +142,7 @@ class D3D12ExecuteIndirect : public DXSample
141142
ComPtr<ID3D12Resource> m_depthStencil;
142143
ComPtr<ID3D12Resource> m_commandBuffer;
143144
ComPtr<ID3D12Resource> m_processedCommandBuffers[FrameCount];
144-
ComPtr<ID3D12Resource> m_processedCommandBufferCounters[FrameCount];
145-
UINT8* m_pMappedUavCounters[FrameCount];
145+
ComPtr<ID3D12Resource> m_processedCommandBufferCounterReset;
146146
D3D12_VERTEX_BUFFER_VIEW m_vertexBufferView;
147147

148148
void LoadPipeline();

Samples/D3D12HelloWorld/readme.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ This collection of samples act as an introduction to Direct3D 12. Each sample bu
44
This sample shows you how to create a window, Direct3D device (with debug layers enabled), and present to the window. These are the basic elements that every sample uses.
55
## Hello Triangle Sample
66
This sample shows you how to draw a static triangle using a vertex buffer.
7+
## Hello Texture Sample
8+
This sample shows you how to apply a Texture2D to triangle.
79
## Hello Bundles Sample
810
This sample shows you how to use Bundles to draw a static triangle more efficiently.
911
## Hello Constant Buffers Sample

Samples/D3D12HelloWorld/src/D3D12HelloWorld.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "D3D12HelloWindow", "HelloWi
1111
EndProject
1212
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "D3D12HelloConstBuffers", "HelloConstBuffers\D3D12HelloConstBuffers.vcxproj", "{6F49D366-B5F1-432B-A3E8-5D1CA57865F9}"
1313
EndProject
14+
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "D3D12HelloTexture", "HelloTexture\D3D12HelloTexture.vcxproj", "{16B13BB4-D82D-4AC1-8B40-C6BCCC99954B}"
15+
EndProject
1416
Global
1517
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1618
Debug|x64 = Debug|x64
@@ -33,6 +35,10 @@ Global
3335
{6F49D366-B5F1-432B-A3E8-5D1CA57865F9}.Debug|x64.Build.0 = Debug|x64
3436
{6F49D366-B5F1-432B-A3E8-5D1CA57865F9}.Release|x64.ActiveCfg = Release|x64
3537
{6F49D366-B5F1-432B-A3E8-5D1CA57865F9}.Release|x64.Build.0 = Release|x64
38+
{16B13BB4-D82D-4AC1-8B40-C6BCCC99954B}.Debug|x64.ActiveCfg = Debug|x64
39+
{16B13BB4-D82D-4AC1-8B40-C6BCCC99954B}.Debug|x64.Build.0 = Debug|x64
40+
{16B13BB4-D82D-4AC1-8B40-C6BCCC99954B}.Release|x64.ActiveCfg = Release|x64
41+
{16B13BB4-D82D-4AC1-8B40-C6BCCC99954B}.Release|x64.Build.0 = Release|x64
3642
EndGlobalSection
3743
GlobalSection(SolutionProperties) = preSolution
3844
HideSolutionNode = FALSE

Samples/D3D12HelloWorld/src/HelloConstBuffers/D3D12HelloConstBuffers.cpp

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,12 @@ void D3D12HelloConstBuffers::LoadPipeline()
136136
}
137137

138138
ThrowIfFailed(m_device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&m_commandAllocator)));
139-
ThrowIfFailed(m_device->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_BUNDLE, IID_PPV_ARGS(&m_bundleAllocator)));
140139
}
141140

142141
// Load the sample assets.
143142
void D3D12HelloConstBuffers::LoadAssets()
144143
{
145-
// Create a root signature consisting of a single CBV parameter.
144+
// Create a root signature consisting of a descriptor table with a single CBV.
146145
{
147146
CD3DX12_DESCRIPTOR_RANGE ranges[1];
148147
CD3DX12_ROOT_PARAMETER rootParameters[1];
@@ -274,18 +273,6 @@ void D3D12HelloConstBuffers::LoadAssets()
274273
memcpy(m_pCbvDataBegin, &m_constantBufferData, sizeof(m_constantBufferData));
275274
}
276275

277-
// Create and record the bundle.
278-
{
279-
ThrowIfFailed(m_device->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_BUNDLE, m_bundleAllocator.Get(), m_pipelineState.Get(), IID_PPV_ARGS(&m_bundle)));
280-
m_bundle->SetDescriptorHeaps(1, m_cbvHeap.GetAddressOf());
281-
m_bundle->SetGraphicsRootSignature(m_rootSignature.Get());
282-
m_bundle->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
283-
m_bundle->IASetVertexBuffers(0, 1, &m_vertexBufferView);
284-
m_bundle->SetGraphicsRootDescriptorTable(0, m_cbvHeap->GetGPUDescriptorHandleForHeapStart());
285-
m_bundle->DrawInstanced(3, 1, 0, 0);
286-
ThrowIfFailed(m_bundle->Close());
287-
}
288-
289276
// Create synchronization objects and wait until assets have been uploaded to the GPU.
290277
{
291278
ThrowIfFailed(m_device->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&m_fence)));
@@ -367,6 +354,7 @@ void D3D12HelloConstBuffers::PopulateCommandList()
367354
ID3D12DescriptorHeap* ppHeaps[] = { m_cbvHeap.Get() };
368355
m_commandList->SetDescriptorHeaps(_countof(ppHeaps), ppHeaps);
369356

357+
m_commandList->SetGraphicsRootDescriptorTable(0, m_cbvHeap->GetGPUDescriptorHandleForHeapStart());
370358
m_commandList->RSSetViewports(1, &m_viewport);
371359
m_commandList->RSSetScissorRects(1, &m_scissorRect);
372360

@@ -379,9 +367,9 @@ void D3D12HelloConstBuffers::PopulateCommandList()
379367
// Record commands.
380368
const float clearColor[] = { 0.0f, 0.2f, 0.4f, 1.0f };
381369
m_commandList->ClearRenderTargetView(rtvHandle, clearColor, 0, nullptr);
382-
383-
// Execute the commands stored in the bundle.
384-
m_commandList->ExecuteBundle(m_bundle.Get());
370+
m_commandList->IASetPrimitiveTopology(D3D_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
371+
m_commandList->IASetVertexBuffers(0, 1, &m_vertexBufferView);
372+
m_commandList->DrawInstanced(3, 1, 0, 0);
385373

386374
// Indicate that the back buffer will now be used to present.
387375
m_commandList->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(m_renderTargets[m_frameIndex].Get(), D3D12_RESOURCE_STATE_RENDER_TARGET, D3D12_RESOURCE_STATE_PRESENT));

0 commit comments

Comments
 (0)