Skip to content

zenny-chen/Use-Direct3D-12-Compute-Shader-in-C-Basic-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

Use Direct3D 12 Compute Shader in C (Basic)

Use Direct3D 12 Compute Shader in C (Basic)


This is a simple sample that describes how to use Direct3D 12 compute shader in the C programming language. Why C? Because the C-style COM APIs for Direct3D 12 contain no magical wrappers, it will fully demonstrate the whole process in detail without concealment.

The function of this sample is very simple. It calculates the sum of each int element in the source buffer with 10, and stores the result to the corresponding location in the destination buffer.

The genenral process is as follows:

  1. Initialize all the necessary assets.
  2. Initialize the command list and the command queue
  3. Create the source buffer object and the destination buffer object.
  4. Do the compute operation and fetch the result.
  5. Release all the resources.

The demo project is built with Visual Studio 2022 community. Before you start, you may have to do the following stuffs.

  1. Ensure that Visual Studio 2022 (Community) has been installed.
  2. Ensure that Windows Kits for Windows 10 with DirectX 12 SDK have been installed. This can be installed with Visual Studio Installer.
  3. Now, you can open the solution file (.sln) in this sample and check the directory in which DirectX 12 SDK was installed.

About

Use Direct3D 12 Compute Shader in C (Basic)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published