Skip to content
Chuck Walbourn edited this page Jan 20, 2023 · 52 revisions

GitHub Release Date GitHub last commit

Azure DevOps Win32 Azure DevOps CMake Azure DevOps MinGW

DirectX SDK Samples

This repo contains samples that originally shipped in the legacy DirectX SDK. These are all Windows desktop applications for Windows 7 Service Pack 1 or later.

They have all been cleaned up to build using the Windows SDK, and DO NOT require the DirectX SDK to build. Projects for Visual Studio 2019 are provided.

Direct3D 9, Direct3D 10, and other legacy DirectX SDK samples can be found in the directx-sdk-legacy-samples repo.

Projects

  • *_2019 projects build with Visual Studio 2019 using the Windows 10 SDK installed

Tutorials

Direct3D11Tutorials

This is the DirectX SDK's Direct3D 11 tutorial series updated to use the Windows SDK without any dependencies on legacy DirectX SDK content.

Direct3D11TutorialsDXUT

The original Direct3D 10 tutorial series covered Win32 basics in Tutorial01 - Tutorial07, and DXUT in Tutorial08 - Tutorial10. This is Tutorial08 - Tutorial10 updated to use DXUT for Direct3D 11 framework for Windows desktop applications.

Direct3D11TutorialsFX11

The original Direct3D 10 tutorial series covered Win32 basics in Tutorial01 - Tutorial07, DXUT in Tutorial08 - Tutorial10, and then Effects 10 in Tutorial11 - Tutorial14. This is Tutorial11 - Tutorial14 updated to use the DXUT for Direct3D 11 framework and Effects 11 library for Windows desktop applications.

Graphics Samples

AdaptiveTessellationCS40

AdaptiveTessellationCS40 demonstrates some adaptive tessellation techniques implemented using Compute Shader 4.0. You can use the radio buttons in the user interface to switch which tessellation schemes to use and observe how the tessellation pattern changes. The tessellation schemes implemented here are now identical to the triangle patch-based tessellation of Direct3D11 Tessellator Stage. So potentially the technique here could be a fallback solution for future games or other applications that use DirectX 11 hardware tessellation when they are running on devices that support only DirectX 10.x, because Compute Shader 4.0 runs on most DirectX 10.x-capable hardware.

Compute Shader allows more general algorithms to be implemented on the GPU. While the fully featured Compute Shader 5.0 requires Direct3D 11 hardware, a subset of that—Compute Shader 4.x—runs on existing Direct3D 10-compatible hardware, if the driver supports it.

BasicCompute11

This sample shows the basic usage of DirectX11 Compute Shader (aka DirectCompute) by implementing array A + array B.

BasicHLSL11

This sample loads a mesh, create vertex and pixel shaders from files, and then uses the shaders to render the mesh.

BasicHLSLFX11

This sample loads a mesh, create vertex and pixel shaders from files, and then uses the shaders to render the mesh.

This is a Direct3D 11 version of the Direct3D 10 BasicHLSL10 sample. BasicHLSL11 is a version of the same sample that does not make use of Effects 11.

CascadedShadowMaps11

This sample demonstrates the cascaded shadow map (CSM) algorithm. This algorithm also demonstrates several techniques that can be used to make efficient use of the shadow map.

ComputeShaderSort11

This sample demonstrates the basic usage of the DirectX 11 Compute Shader 4.0 feature to implement a bitonic sort algorithm. It also highlights the considerations that must be taken to achieve good performance.

DynamicShaderLinkage11

This Direct3D 11 sample demonstrates use of Shader Model 5 shader interfaces and Direct3D 11 support for linking shader interface methods at runtime.

DynamicShaderLinkageFX11

This sample loads a mesh, create vertex and pixel shaders from files, and then uses the shaders to render the mesh.

This is an Effects 11 version of the Direct3D 11 sample DynamicShaderLinkage11.

EmptyProject11

This sample is a bare-bones DXUT application provided as a convenient starting point for your own Windows desktop Direct3D 11 application. This is the minimum needed to get a DXUT-based application running, but it does nothing but clear the screen to a background color.

FixedFuncEMUFX11

This sample attempts to emulate certain aspects of the Direct3D 9 fixed function pipeline in a Direct3D 11 environment.

This is a Direct3D 11 version of the Direct3D 10 FixedFuncEMU sample.

FluidCS11

This sample illustrates how to implement a simple optimized 2D particle fluid simulation. It uses a technique called Smoothed Particle Hydrodynamics to perform the fluid simulation based on the paper “Particle-Based Fluid Simulation for Interactive Applications” by Matthias Müller. To further optimize the simulation for the GPU, a spatial grid is implemented based on the article “Broad-Phase Collision Detection with CUDA” by Scott Le Grand.

HDRToneMappingCS11

HDRToneMappingCS11 shows how to setup and run the compute shader(CS), which is one of the most exciting new features of Direct3D 11. Although the sample only utilizes the CS to implement HDR tone-mapping, the concept should extend easily to other post-processing algorithms, as well as to more general calculations.

InstancingFX11

This is the Direct3D 10 Instancing sample updated for Direct3D 11.

MultithreadedRendering11

This is the DirectX SDK's MultithreadedRendering11 sample updated to use Visual Studio 2015 and the Windows SDK 8.1 without any dependencies on legacy DirectX SDK content.

NBodyGravityCS11

This is one of the Compute Shader demos shown at GDC09. This sample shows an N-Body particle system implemented using Compute Shader 4.0. Because of benefits brought by Compute Shader, it achieves significantly higher frames per second than the previous NBodyGravity sample under the Direct3D 10 section, which was implemented using Direct3D 10 Pixel Shader and Geometry Shader.

OIT11

Demonstrates a technique for achieving order-independent transparency in Direct3D 11.

SimpleBezier11

DirectX 11 introduces three new stages to the graphics pipeline: the Hull-Shader Stage, the fixed-function Tessellator Stage, and the Domain-Shader Stage. Together, these stages operate in between the vertex shader and geometry shader to provide the flexibility to implement a variety of different surface representations, including Bezier patches and subdivision surfaces. This sample demonstrates the basic usage of the DirectX 11 tessellation feature to render a simple cubic Bezier patch.

SimpleSample11

This sample can be used as a starting point for your own Windows desktop Direct3D 11 application. This builds on EmptyProject11 by adding a simple status HUD, common controls, and access to the device settings dialog.

SubD11

The SubD11 sample implements the algorithm described in the paper "Approximating Catmull-Clark Subdivision Surfaces with Bicubic Patches" by Charles Loop and Scott Schaefer. This sample is similar to the DirectX SDK SubD10 sample, except that it has been enhanced to take advantage of three new Direct3D 11 pipeline stages: the hull shader, the tessellator, and the domain shader.

VarianceShadows11

VarianceShadows11 demonstrates how to integrate cascaded shadow maps with variance shadow maps.

This sample demonstrates how to use the cascaded shadow map (CSM) algorithm with the variance shadow map (VSM) algorithm. This sample is an extension of the CascadedShadowMaps11 sample. Percentage closer filtering has been removed and variance shadow maps have been added.

Math Samples

Collision

This sample demonstrates DirectXMath using the DirectX Tool Kit and DXUT for Direct3D 11 framework for Windows desktop applications.

Tools Samples

BC6HBC7EncoderCS

This sample implements BC6H/BC7 encoding/decoding using DirectCompute 4.0 acceleration. BC6H and BC7 are two new block-compressed texture formats introduced in Direct3D 11 that target much better visual quality than previous BC texture formats.

Note that this functionality has been integrated into the DirectXTex library.

GDFTrace

The Game Definition File Validator (GDFTrace.exe) utility is a debugging aid for working with Game Definition File Editor (GDF) files for Windows Vista, Windows 7, Windows 8, and Windows 8.1 Preview. It is a command-line tool for validating the XML against the schema, displaying a 'human readable' summary, and generating validation warnings. It can be used either directly extracting the GDF from the containing EXE/DLL file, or against the 'raw' XML file.

XAudio2 Samples

This is a collection of the DirectX SDK's original XAudio2 samples updated to use Visual Studio 2015 and the Windows SDK 8.1 without any dependencies on legacy DirectX SDK content.

  • XAudio2BasicSound - This sample demonstrates the XAudio2 API by showing you how to initialize the XAudio2 engine, create a mastering voice, and play sample files.
  • XAudio2AsyncStream - This sample shows you how to play streaming audio using asynchronous file I/O and the XAudio2 API. Note: Originally called "XAudio2BasicStream" in the legacy DirectX SDK.
  • XAudio2Sound3D - This sample shows you how to use the X3DAudio API with XAudio2 for playing spatialized audio.
  • XAudio2CustomAPO - This sample shows you how to create and use custom APOs with XAudio2.

Also contains some new samples that weren't in the original DirectX SDK:

  • XAudio2Enumerate - This sample shows how to enumerate audio devices and initialize an XAudio2 mastering voice for a specific device.
  • XAudio2MFStream - This samples uses Media Foundation to decode a media audio file (which could be compressed with any number of codecs) and streams it through an XAudio2 voice. This technique is most useful for XAudio 2.8 on Windows 8.x which only supports PCM and ADPCM, and not more aggressive lossy compressed schemes which are supported by Media Foundation..
  • XAudio2WaveBank - This sample shows how to play in-memory audio using an XACT-style wave bank.

Also contains a Common folder

  • WAVFileReader.h/.cpp module which can be used to load a .WAV file for playback with XAudio2. It optionally returns loop-point information as well as supporting the standard PCM, MS-ADPCM, and WAVEFORMATEXTENSIBLE formats supported by XAudio2.
  • WaveBankReader.h/.cpp module which is used by the XAudio2AsyncStream and XAudio2WaveBank samples. It is used to parse XACT3-style wave banks.

The XBWTool command-line tool is a simple way to build XACT-style wave banks without using the legacy DirectX SDK's XACT tool or XACTBLD command-line tool. It can be used to build .xwb files suitable for both the XAudio2AsyncStream or XAudio2WaveBank samples, and are binary compatible with the XACT3 DirectX SDK (June 2010) wave bank format. This tool cannot generate XACT sound banks.

Note: The XAudio2Samples_201x_Win10 projects build using XAudio 2.9 which requires Windows 10. The XAudio2Samples_NuGetRedist_201xK projects build using XAudio 2.9 via the XAudio2Redist and supports Windows 7 SP1, Windows 8.0, Windows 8.1, or Windows 10.

XInput Samples

This is a collection of the DirectX SDK's original XInput samples updated to use the Windows SDK without any dependencies on legacy DirectX SDK content.

  • RumbleController - This sample demonstrates XInput's force-feedback rumble API, XInputSetState. This API is available in all versions of XInput.
  • SimpleController - This sample demonstrates XInput's most basic API, XInputGetState. This API is available in all versions of XInput.

Note: The XInputSamples_201x projects build using XInput 1.4 which requires Windows 8 or later and XInput 9.1.0 which works on Windows Vista or later.

DirectInput Samples

These are the original DirectX SDK Windows desktop samples for the legacy DirectInput API updated to build with the Windows SDK without using the legacy DirectX SDK.

  • Joystick - The Joystick sample program obtains and displays joystick data.
  • FFConst - The FFConst sample program applies raw forces to a force-feedback input device, illustrating how a simulator-type application can use force feedback to generate forces computed by a physics engine.
  • CustomFormat - This sample illustrates the use of a custom data format.

Miscellaneous Samples

CoreDetection

This is the DirectX SDK's CoreDetection Windows desktop sample updated to eliminate all dependencies on legacy DirectX SDK content.

This sample also works around some known issues with the GetLogicalProcessorInformation API. See KB932370.

See the Coding For Multiple Cores on Xbox 360 and Microsoft Windows article for more information.

For AMD, particularly the Ryzen CPUs, see GPUOpen.

For Intel, particularly the new Hybrid designs with P- and E-cores, see GameTechDev.

VideoMemory

This is the DirectX SDK's VideoMemory sample updated to use the Windows SDK without any dependencies on legacy DirectX SDK content.

InstallHelpers

D3D11InstallHelper

The D3D11InstallHelper sample is designed to simplify detection of the Direct3D 11 API, automatically install the system update if applicable to an end-user's computer, and to provide appropriate messages to the end-user on manual procedure if a newer Service Pack is required.

See Direct3D 11 deployment for game developers.

FirewallInstallHelper

The FirewallInstallHelper is a sample DLL that can be called from an installer to register an application with the Windows Firewall exception list.

See Windows Firewall for Game Developers.

GameuxInstallHelper

The GameuxInstallHelper is a DLL for use with install/setup programs to handle registration of Game Definition Files (GDF) with Windows Vista, Windows 7, and Windows 8 desktop games. For Windows 7 and Windows 8, the utility registers the GDFv2 schema data file using IGameExplorer2. For Windows Vista, the utility handles the additional manual steps required for registering a GDFv2 schema data file using the IGameExplorer interface.

See Windows Games Explorer for Game Developers.