Code Monkey home page Code Monkey logo

dx12-sandbox's Introduction

dx12-sandbox

A sandbox to test and play around with DirectX 12 API.

Prerequisities

This sandbox requires that the host machine has a DirectX 12 supported GPU and Windows 10 installed.

Notes About Using Direct3D 12

Procedure of initializing the Direct3D 12 goes as following.

(N is the amount of buffers used within the application)

  1. [Optional] Enable debug layer.
  2. [Optional] Enumerate and select a graphics adapter (IDXGIAdapter).
  3. Create a device (ID3D12Device).
  4. Create a command queue (ID3D12CommandQueue).
  5. Create a swap chain (IDXGISwapChain).
  6. Create a descriptor heap for render target views (ID3D12DescriptorHeap).
  7. Create N-amount of render target views (ID3D12Resource).
  8. Create a command allocator (ID3D12CommandAllocator).

Note that before initializing Direct3D, we also need to register window class and create a window.

Procedure of initializing resources (e.g. assets) for Direct3D 12 goes as following.

  1. Serialize and create a root signature (ID3D12RootSignature).
  2. Load and compile shaders (ID3DBlob).
  3. Create a pipeline state object (ID3D12PipelineState).
  4. Create and close a command list (ID3D12GraphicsCommandList).
  5. Create and fill vertex buffer (ID3D12Resource).
  6. Create a vertex buffer view (D3D12_VERTEX_BUFFER_VIEW).
  7. Wait until resources are in sync with GPU (ID3D12Fence).

Procedure of rendering in Direct3D 12 goes as following.

  1. Reset command list allocator for the next buffer (ID3D12CommandAllocator).
  2. Reset command list for the next buffer (ID3D12GraphicsCommandList).
  3. Set the graphics root signature.
  4. Set viewport.
  5. Set scissor rectangles.
  6. Use barrier to indicate that backbuffer is now the render target.
  7. Add commands into the command list.
  8. Use barrier to indicate that backbuffer is being presented after commands have finished.
  9. Close command list.
  10. Execute command list.
  11. Present the backbuffer.
  12. Wait until GPU has finished.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.