

SwapChainDesc.OutputWindow = Win32Application::GetHwnd() SwapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD SwapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT ThrowIfFailed(m_device->CreateCommandQueue(&queueDesc, IID_PPV_ARGS(&m_commandQueue))) QueueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT QueueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE Describe and create the command queue. GetHardwareAdapter(factory.Get(), &hardwareAdapter) ThrowIfFailed(factory->EnumWarpAdapter(IID_PPV_ARGS(&warpAdapter))) ThrowIfFailed(CreateDXGIFactory1(IID_PPV_ARGS(&factory))) If (SUCCEEDED(D3D12GetDebugInterface(IID_PPV_ARGS(&debugController)))) Load the rendering pipeline dependencies (note that the creation of a software WARP device is entirely optional). In later steps, command lists are obtained from the command allocator and submitted to the command queue. Create the command allocator: ID3D12Device::CreateCommandAllocator.then create a descriptor heap:ĭ3D12_DESCRIPTOR_HEAP_DESC ID3D12Device::CreateDescriptorHeap ID3D12Device::GetDescriptorHandleIncrementSizeĬD3DX12_CPU_DESCRIPTOR_HANDLE GetCPUDescriptorHandleForHeapStart IDXGISwapChain::GetBuffer ID3D12Device::CreateRenderTargetView Fill out a swapchain description, then create the swap chain:ĭXGI_SWAP_CHAIN_DESC IDXGIFactory::CreateSwapChain IDXGISwapChain3::GetCurrentBackBufferIndex.Fill out a command queue description, then create the command queue:ĭ3D12_COMMAND_QUEUE_DESC ID3D12Device::CreateCommandQueue.The process of creating devices and swap chains is very similar to Direct3D 11.ĭ3D12GetDebugInterface ID3D12Debug::EnableDebugLayer

The following code creates the basics for a graphics pipeline. In the projects main source file, start initializing the objects: void D3D12HelloTriangle::OnInit()

class D3D12HelloTriangleįirst define the class in a header file, including a viewport, scissor rectangle and vertex buffer using the structures:Ĭlass D3D12HelloTriangle : public DXSampleĭ3D12HelloTriangle(UINT width, UINT height, std::wstring name) ĭ3D12_VERTEX_BUFFER_VIEW m_vertexBufferView The following expands the code flow above to include the code required for a basic sample.
