diff --git a/Samples/Desktop/D3D1211On12/readme.md b/Samples/Desktop/D3D1211On12/readme.md index 141ee45cd..f6ee74d6b 100644 --- a/Samples/Desktop/D3D1211On12/readme.md +++ b/Samples/Desktop/D3D1211On12/readme.md @@ -4,15 +4,15 @@ languages: - cpp products: - windows-api-win32 -name: 11 on 12 Sample -urlFragment: 11-on-12-sample-win32 +name: Direct3D 12 11-on-12 sample +urlFragment: d3d12-11-on-12-sample-win32 description: Demonstrates how to use Direct3D 11-based rendering in combination with Direct3D 12. extendedZipContent: - path: LICENSE target: LICENSE --- -# 11 on 12 Sample +# Direct3D 12 11-on-12 sample ![11On12 GUI](src/D3D1211On12.png) diff --git a/Samples/Desktop/D3D12Bundles/readme.md b/Samples/Desktop/D3D12Bundles/readme.md index 3fed74e7c..f085a7fc5 100644 --- a/Samples/Desktop/D3D12Bundles/readme.md +++ b/Samples/Desktop/D3D12Bundles/readme.md @@ -4,21 +4,20 @@ languages: - cpp products: - windows-api-win32 -name: Bundles Sample -urlFragment: bundles-sample-win32 +name: Direct3D 12 bundles sample +urlFragment: d3d12-bundles-sample-win32 description: Demonstrates the use of Direct3D 12 bundles. extendedZipContent: - path: LICENSE target: LICENSE --- - -# Bundles Sample +# Direct3D 12 bundles sample ![Bundles GUI](src/D3D12Bundles.png) -This sample demonstrates the use of Direct3D 12 Bundles. An app can use Bundles to group a small number of API commands together for execution later. When a Bundle is created, the driver will perform as much pre-processing as possible to make it inexpensive to execute the Bundle later. Part of this pre-processing means that there are certain restrictions on what operations can be performed within a Bundle. +This sample demonstrates the use of Direct3D 12 bundles. An app can use bundles to group a small number of API commands together for execution later. When a bundle is created, the driver will perform as much pre-processing as possible to make it inexpensive to execute the bundle later. Part of this pre-processing means that there are certain restrictions on what operations can be performed within a bundle. -## Optional Features +## Optional features This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. diff --git a/Samples/Desktop/D3D12DepthBoundsTest/readme.md b/Samples/Desktop/D3D12DepthBoundsTest/readme.md index 2af31957a..7f86663b2 100644 --- a/Samples/Desktop/D3D12DepthBoundsTest/readme.md +++ b/Samples/Desktop/D3D12DepthBoundsTest/readme.md @@ -1,7 +1,21 @@ -# Depth Bounds Test Sample +--- +page_type: sample +languages: +- cpp +products: +- windows-api-win32 +name: Direct3D 12 depth bounds test sample +urlFragment: d3d12-depth-bounds-test-sample-win32 +description: Demonstrates the depth bound test in Direct3D 12. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 depth bounds test sample ![DepthBounds GUI](src/D3D12DepthBoundsTest.png) This sample demonstrates the depth bound test in Direct3D 12. Depth-bounds testing allows pixels to be discarded if the currently-stored depth value is outside the range specified by Min and Max, inclusive. -See more detail about depth bounds test in the following page. https://msdn.microsoft.com/en-us/library/windows/desktop/mt492658(v=vs.85).aspx \ No newline at end of file +For more detail about depth bounds test, see [**ID3D12GraphicsCommandList1::OMSetDepthBounds**](https://docs.microsoft.com/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist1-omsetdepthbounds). diff --git a/Samples/Desktop/D3D12DynamicIndexing/readme.md b/Samples/Desktop/D3D12DynamicIndexing/readme.md index 68496c897..afc1edad7 100644 --- a/Samples/Desktop/D3D12DynamicIndexing/readme.md +++ b/Samples/Desktop/D3D12DynamicIndexing/readme.md @@ -1,7 +1,21 @@ -# Dynamic Indexing Sample +--- +page_type: sample +languages: +- cpp +products: +- windows-api-win32 +name: Direct3D 12 dynamic indexing sample +urlFragment: d3d12-dynamic-indexing-sample-win32 +description: Demonstrates the use of new features available in HLSL's Shader Model 5.1—specifically, dynamic indexing and unbounded descriptor tables. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 dynamic indexing sample ![DynamicIndexing GUI](src/D3D12DynamicIndexing.png) -This sample demonstrates the use of new features available in HLSL's Shader Model 5.1 - specifically dynamic indexing and unbounded descriptor tables. With dynamic indexing, shaders can now index into an array without knowing the value of the index at compile time. When combined with unbounded arrays, this adds another level of indirection and flexibility for shader authors and art pipelines. +This sample demonstrates the use of new features available in HLSL's Shader Model 5.1—specifically, dynamic indexing and unbounded descriptor tables. With dynamic indexing, shaders can now index into an array without knowing the value of the index at compile time. When combined with unbounded arrays, this adds another level of indirection and flexibility for shader authors and art pipelines. -### Optional Features +### Optional features This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. \ No newline at end of file diff --git a/Samples/Desktop/D3D12ExecuteIndirect/readme.md b/Samples/Desktop/D3D12ExecuteIndirect/readme.md index 31dfc4926..c3ee6cf4e 100644 --- a/Samples/Desktop/D3D12ExecuteIndirect/readme.md +++ b/Samples/Desktop/D3D12ExecuteIndirect/readme.md @@ -1,10 +1,24 @@ -# Execute Indirect Sample +--- +page_type: sample +languages: +- cpp +products: +- windows-api-win32 +name: Direct3D 12 execute indirect sample +urlFragment: d3d12-execute-indirect-sample-win32 +description: Demonstrates how to generate dynamic GPU workloads using the graphics command list's [**ID3D12GraphicsCommandList::ExecuteIndirect**](https://docs.microsoft.com/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist-executeindirect) API. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 execute indirect sample ![ExecuteIndirect GUI](src/D3D12ExecuteIndirect.png) -This sample demostrates how to generate dynamic GPU workloads using the graphics command list's ExecuteIndirect API. In this sample, a large number of triangles animate across the screen and a compute shader is used to determine which triangles are visible. The draw calls for those triangles are then aggregated into a buffer that is processed by the ExecuteIndirect API so that only those triangles are processed by the graphics pipeline. +This sample demonstrates how to generate dynamic GPU workloads using the graphics command list's [**ID3D12GraphicsCommandList::ExecuteIndirect**](https://docs.microsoft.com/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist-executeindirect) API. In this sample, a large number of triangles animate across the screen, and a compute shader is used to determine which triangles are visible. The draw calls for those triangles are then aggregated into a buffer that is processed by the ExecuteIndirect API so that only those triangles are processed by the graphics pipeline. ### Controls SPACE bar - toggles the compute shader on and off. -### Optional Features -This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. \ No newline at end of file +### Optional features +This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. diff --git a/Samples/Desktop/D3D12Fullscreen/readme.md b/Samples/Desktop/D3D12Fullscreen/readme.md index 8c36056f2..1ecbb0328 100644 --- a/Samples/Desktop/D3D12Fullscreen/readme.md +++ b/Samples/Desktop/D3D12Fullscreen/readme.md @@ -1,4 +1,18 @@ -# Fullscreen sample +--- +page_type: sample +languages: +- cpp +products: +- windows-api-win32 +name: Direct3D 12 fullscreen sample +urlFragment: d3d12-fullscreen-sample-win32 +description: Illustrates how to handle fullscreen <-> windowed transitions and window resizing in DirectX 12. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 fullscreen sample ![Fullscreen GUI](src/D3D12Fullscreen.png) This sample illustrates how to handle fullscreen <-> windowed transitions and window resizing in DirectX 12. @@ -7,5 +21,5 @@ This sample illustrates how to handle fullscreen <-> windowed transitions and wi SPACE bar - toggles between windowed and fullscreen modes. LEFT/RIGHT arrow keys - changes the resolution of the scene. -### Optional Features +### Optional features This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. \ No newline at end of file diff --git a/Samples/Desktop/D3D12HDR/readme.md b/Samples/Desktop/D3D12HDR/readme.md index 3f63901e2..e43b455f0 100644 --- a/Samples/Desktop/D3D12HDR/readme.md +++ b/Samples/Desktop/D3D12HDR/readme.md @@ -1,7 +1,21 @@ -# HDR sample +--- +page_type: sample +languages: +- cpp +products: +- windows-api-win32 +name: Direct3D 12 HDR sample +urlFragment: d3d12-hdr-sample-win32 +description: Illustrates how to render HDR content, and detect whether the current display supports it. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 HDR sample ![HDR GUI](src/D3D12HDR.png) -This sample illustrates how to render HDR content and detect whether the current display supports it. +This sample illustrates how to render HDR content, and detect whether the current display supports it. ### Controls SPACE bar/ALT+ENTER - toggles between windowed and fullscreen modes. diff --git a/Samples/Desktop/D3D12HelloWorld/readme.md b/Samples/Desktop/D3D12HelloWorld/readme.md index 32c84db96..a5e752a6c 100644 --- a/Samples/Desktop/D3D12HelloWorld/readme.md +++ b/Samples/Desktop/D3D12HelloWorld/readme.md @@ -1,19 +1,45 @@ -# Hello World Samples +--- +page_type: sample +languages: +- cpp +products: +- windows-api-win32 +name: Direct3D 12 Hello, World! samples +urlFragment: d3d12-hello-world-samples-win32 +description: This collection of samples act as an introduction to Direct3D 12. Each sample introduces an elementary concept, and lays a foundation for all of the Direct3D 12 samples. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 Hello, World! samples ![HelloWorlds GUI](src/D3D12HelloWorlds.png) -This collection of samples act as an introduction to Direct3D 12. Each sample introduces an elementary concept and lays a foundation for all of the Direct3D 12 samples. -## Hello Window Sample +This collection of samples act as an introduction to Direct3D 12. Each sample introduces an elementary concept, and lays a foundation for all of the Direct3D 12 samples. + +## Hello, window! sample + 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. -## Hello Triangle Sample + +## Hello, triangle! sample + This sample shows you how to draw a static triangle using a vertex buffer. -## Hello Texture Sample + +## Hello, texture! sample + This sample shows you how to apply a Texture2D to triangle. -## Hello Bundles Sample + +## Hello, bundles! sample + This sample shows you how to use Bundles to draw a static triangle more efficiently. -## Hello Constant Buffers Sample + +## Hello, constant buffers! sample + This sample shows you how to animate a triangle using a constant buffer. -## Hello Frame Buffering Sample + +## Hello, frame buffering! sample + This sample shows you how to use fences and multiple allocators to queue up multiple frames to the GPU. -### Optional Features +### Optional features The Texture and Constant Buffer samples have been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. \ No newline at end of file diff --git a/Samples/Desktop/D3D12HeterogeneousMultiadapter/readme.md b/Samples/Desktop/D3D12HeterogeneousMultiadapter/readme.md index d22c3f71f..3eb7e702c 100644 --- a/Samples/Desktop/D3D12HeterogeneousMultiadapter/readme.md +++ b/Samples/Desktop/D3D12HeterogeneousMultiadapter/readme.md @@ -1,12 +1,26 @@ -# Heterogeneous Multiadapter Sample +--- +page_type: sample +languages: +- cpp +products: +- windows-api-win32 +name: Direct3D 12 heterogeneous multiadapter sample +urlFragment: d3d12-heterogeneous-multiadapter-sample-win32 +description: Demonstrates how to share workloads among multiple heterogeneous GPUs using shared heaps. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 heterogeneous multiadapter sample ![HeterogeneousMultiadapter GUI](src/D3D12HeterogeneousMultiadapter.png) -This sample demostrates how to share workloads amongst multiple heterogeneous GPUs using shared heaps. In this sample, a large number of triangles are rendered to an intermediate render target on one GPU, then a second GPU performs a blur and presents it to the screen. +This sample demonstrates how to share workloads among multiple heterogeneous GPUs using shared heaps. In this sample, a large number of triangles are rendered to an intermediate render target on one GPU, then a second GPU performs a blur, and presents it to the screen. ## Requirements This sample is designed to run on a system with more than one GPU. This sample particularly targets hybrid laptops with a high performance discrete GPU and a lower performance integrated GPU. -For demonstration purposes, this sample will also run on a system with a single GPU and will use the software WARP adapter as the second GPU. You will need to install the "Graphics Tools" feature to make the DirectX 12 WARP rasterizer available. This can be done either by pressing ALT+F5 in Visual Studio (which launches the Graphics Debugger and automatically installs the feature if it is not available), or by navigating to the "Manage Optional Features" page in the Settings app and manually adding it from there. It should be noted, however, that the sample puts the primary workload on the adapter that is not connected to the display - which happens to be the WARP adapter - so it will actually run slower in this configuration than if there was no secondary adapter used at all. +For demonstration purposes, this sample will also run on a system with a single GPU and will use the software WARP adapter as the second GPU. You will need to install the **Graphics tools** feature to make the DirectX 12 WARP rasterizer available. This can be done either by pressing ALT+F5 in Visual Studio (which launches the Graphics Debugger, and automatically installs the feature if it is not available), or by navigating to the **Manage optional features** page in the Windows **Settings** app, and manually adding it from there. It should be noted, however, that the sample puts the primary workload on the adapter that is not connected to the display—which happens to be the WARP adapter—so it will actually run slower in this configuration than if there was no secondary adapter used at all. ### Optional Features -This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. \ No newline at end of file +This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. diff --git a/Samples/Desktop/D3D12LinkedGpus/readme.md b/Samples/Desktop/D3D12LinkedGpus/readme.md index ad00676d3..bf3b9b587 100644 --- a/Samples/Desktop/D3D12LinkedGpus/readme.md +++ b/Samples/Desktop/D3D12LinkedGpus/readme.md @@ -1,9 +1,23 @@ -# Linked GPU Sample +--- +page_type: sample +languages: +- cpp +products: +- windows-api-win32 +name: Direct3D 12 linked GPU sample +urlFragment: d3d12-linked-gpu-sample-win32 +description: This sample demonstrates how to use two linked homogeneous (that is, CrossFire/SLI) GPUs to achieve greater performance than possible with only one GPU. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 linked GPU sample ![LinkedGPus GUI](src/LinkedGpus/D3D12LinkedGpus.png) -This sample demonstrates how to use two linked homogeneous (i.e. CrossFire/SLI) GPUs to achieve greater performance than possible with only one GPU. In particular, this sample shows the usage of a technique called Alternate Frame Rendering (AFR) which essentially allows you to use each GPU to render every other frame allowing a theoretical maximum performance of 2 times that of only one GPU. This is of course only theoretical and in practicality, there are things like inter-frame dependencies (things rendered on one GPU required by the other GPU for rendering the next frame) that add some overhead that doesn't otherwise exist in a single GPU case. Things like this limit the maximum benefit two GPUs can provide you over one. +This sample demonstrates how to use two linked homogeneous (that is, CrossFire/SLI) GPUs to achieve greater performance than possible with only one GPU. In particular, this sample shows the usage of a technique called Alternate Frame Rendering (AFR) which essentially allows you to use each GPU to render every other frame allowing a theoretical maximum performance of 2 times that of only one GPU. This is of course only theoretical and in practicality, there are things like inter-frame dependencies (things rendered on one GPU required by the other GPU for rendering the next frame) that add some overhead that doesn't otherwise exist in a single GPU case. Things like this limit the maximum benefit two GPUs can provide you over one. -Linked GPUs is what most people currently think of when someone mentions 'MultiGPU' and this sample shows how to utilize both GPUs using explicit MultiGPU. Most importantly, it shows how the app has full explicit control over the GPU hardware through the API (eg. work submission, synchronization, memory management, etc. can be controlled explicitly for each GPU independently). +Linked GPUs is what most people currently think of when someone mentions 'MultiGPU' and this sample shows how to utilize both GPUs using explicit MultiGPU. Most importantly, it shows how the app has full explicit control over the GPU hardware through the API (for example, work submission, synchronization, memory management, etc. can be controlled explicitly for each GPU independently). ## Solution structure There are three projects in this sample's Visual Studio solution: @@ -11,35 +25,35 @@ There are three projects in this sample's Visual Studio solution: * **LinkedGpusAffinity** - an upgrade of the SingleGpu project incorporating the D3DX12AffinityLayer library * **LinkedGpus** - an upgrade of the SingleGpu project showing raw usage of the NodeMask API -We included the SingleGpu project in the solution so that you can diff it against the LinkedGpusAffinity project and get an idea of what it's like to integrate MultiGPU into your game using the affinity layer. For more information on the steps to integrate the affinity layer into your project, take a look at the library's [readme.md](https://github.com/Microsoft/DirectX-Graphics-Samples/tree/master/Libraries/D3DX12AffinityLayer) +We included the SingleGpu project in the solution so that you can diff it against the LinkedGpusAffinity project and get an idea of what it's like to integrate MultiGPU into your game using the affinity layer. For more information on the steps to integrate the affinity layer into your project, take a look at the library's [readme.md](https://github.com/Microsoft/DirectX-Graphics-Samples/tree/master/Libraries/D3DX12AffinityLayer) -Beginners that want to enable MultiGPU in their apps should start by understanding the single GPU version and the affinity layer version as it shows simplified MultiGPU management of resource uploading, cross-GPU synchronization, etc. The affinity layer exists independent of the sample and can also be copied into your app for usage under the provided license. +Beginners that want to enable MultiGPU in their apps should start by understanding the single GPU version and the affinity layer version as it shows simplified MultiGPU management of resource uploading, cross-GPU synchronization, etc. The affinity layer exists independent of the sample and can also be copied into your app for usage under the provided license. # The Affinity Layer Library -One important thing to note about this sample is that it also demonstrates the usage of a helper library called the affinity layer. When working with two GPUs, the CPU will need to submit work to each GPU. Certain objects (ie. command lists, command queues, etc) can be 'affinitized' allowing work to be submitted to a specific GPU. The affinity layer also provides a simple way for the app to submit work to multiple GPUs at the same time. The affinity layer adds a thin layer of abstraction to help you enable MultiGPU in your app. +One important thing to note about this sample is that it also demonstrates the usage of a helper library called the affinity layer. When working with two GPUs, the CPU will need to submit work to each GPU. Certain objects (that is, command lists, command queues, etc) can be 'affinitized' allowing work to be submitted to a specific GPU. The affinity layer also provides a simple way for the app to submit work to multiple GPUs at the same time. The affinity layer adds a thin layer of abstraction to help you enable MultiGPU in your app. -This library is intended to help apps kick start their MultiGPU implementation. The library itself is called the affinity layer in that execution and resources can be 'affinitized' to one or more GPUs in the system. This library should help developers quickly bring up DirectX 12 MultiGPU in their engines. +This library is intended to help apps kick start their MultiGPU implementation. The library itself is called the affinity layer in that execution and resources can be 'affinitized' to one or more GPUs in the system. This library should help developers quickly bring up DirectX 12 MultiGPU in their engines. ## What do you mean by 'MultiGPU'? -MultiGPU can take on a few meanings. The name indicates that we are referring to the use of multiple GPUs in a user's systems but does not imply how or why. At the core, the MultiGPU features in DirectX 12 are designed to expose multiple GPUs to the app. The power is then in the app's hands to use those GPUs to their maximum potential. +MultiGPU can take on a few meanings. The name indicates that we are referring to the use of multiple GPUs in a user's systems but does not imply how or why. At the core, the MultiGPU features in DirectX 12 are designed to expose multiple GPUs to the app. The power is then in the app's hands to use those GPUs to their maximum potential. All in all, the idea of MultiGPU in DirectX 12 is to give the app full access to the graphics hardware in the system whether it is execution resources, graphics memory, etc. ## Exactly what problem does the library try to solve right now? -Currently, this library tries to help developers implement one of the most commonly used MultiGPU techniques, Alternate Frame Rendering (AFR) using linked GPUs. There are a large number of other possibilities with DirectX 12's explicit MultiGPU features but AFR is one of the most widely used techniques. The library may be expanded in the future to support other scenarios. +Currently, this library tries to help developers implement one of the most commonly used MultiGPU techniques, Alternate Frame Rendering (AFR) using linked GPUs. There are a large number of other possibilities with DirectX 12's explicit MultiGPU features but AFR is one of the most widely used techniques. The library may be expanded in the future to support other scenarios. -There are many other possible techniques (other than AFR) for MultiGPU; some that are suitable candidates to be abstracted out into a library like the affinity layer, others that are not. We are looking at other scenarios where the library can fit in as a (almost) drop in solution. +There are many other possible techniques (other than AFR) for MultiGPU; some that are suitable candidates to be abstracted out into a library like the affinity layer, others that are not. We are looking at other scenarios where the library can fit in as a (almost) drop in solution. ## What is Alternate Frame Rendering (AFR)? -AFR does exactly as the name suggests. Frames are rendered in an alternating (i.e. round-robin) manner on each of the GPUs in the system. If there are two GPUs, the first GPU will render every even frame and the second GPU will render every odd frame. Since both GPUs can render in parallel, the theoretical maximum rendering frequency is twice that of a single GPU system. This is of course assuming both GPUs are identical in power, which, in linked GPU systems, they almost always are. +AFR does exactly as the name suggests. Frames are rendered in an alternating (that is, round-robin) manner on each of the GPUs in the system. If there are two GPUs, the first GPU will render every even frame and the second GPU will render every odd frame. Since both GPUs can render in parallel, the theoretical maximum rendering frequency is twice that of a single GPU system. This is of course assuming both GPUs are identical in power, which, in linked GPU systems, they almost always are. ## How does the library help apps implement AFR? One of the most common methods of achieving dual GPU AFR is to: - * Duplicate all non-system memory resources on both GPUs (i.e. textures, buffers, render targets, etc.) + * Duplicate all non-system memory resources on both GPUs (that is, textures, buffers, render targets, etc.) * Execute the same work on both GPUs * The ideal case being GPU1 starts rendering when GPU0 is 50% through it's rendering pass theoretically doubling the frame rate - * Copy any inter-frame dependencies across the GPUs so that they are available when the next frame (ie. the other GPU) starts rendering + * Copy any inter-frame dependencies across the GPUs so that they are available when the next frame (that is, the other GPU) starts rendering * An example of this might be a temporal AA dependency from frame N-1 needed for frame N Conceptually, it might look something like this: @@ -48,21 +62,21 @@ Conceptually, it might look something like this: GPU1 |---Frame 1---|---Frame 3---|---Frame 5---|--- etc ``` -The library and sample demonstrate exactly this. The library provides the app a simple abstracted way of executing commands, uploading data, and synchronizing on one or many GPUs simultaneously. Frame pacing is something that generally needs to be tuned for each application and is currently omitted from the samples. +The library and sample demonstrate exactly this. The library provides the app a simple abstracted way of executing commands, uploading data, and synchronizing on one or many GPUs simultaneously. Frame pacing is something that generally needs to be tuned for each application and is currently omitted from the samples. -Another thing to note is that this library does allow for apps to switch between single GPU and multi GPU scenarios. You don't need two code paths. The library does naturally come with some CPU overhead. Please profile your games and if the extra CPU usage seems to be abnormal, feel free to let us know. +Another thing to note is that this library does allow for apps to switch between single GPU and multi GPU scenarios. You don't need two code paths. The library does naturally come with some CPU overhead. Please profile your games and if the extra CPU usage seems to be abnormal, feel free to let us know. # Other considerations ## What if I'm using a 3rd party library? -All resources in Direct3D 12 need to specify a Node mask to run properly targeting a specific GPU. If the 3rd party library doesn't support MultiGPU and is creating resources on your behalf, it will need to be updated to take a NodeMask parameter to be set on Direct3D 12 object creation. After that you can instantiate the library for N number of GPUs. The affinity objects have a GetChildObject method to access underlying affinitized D3D12 resources to pass to the active instance of the library. +All resources in Direct3D 12 need to specify a Node mask to run properly targeting a specific GPU. If the 3rd party library doesn't support MultiGPU and is creating resources on your behalf, it will need to be updated to take a NodeMask parameter to be set on Direct3D 12 object creation. After that you can instantiate the library for N number of GPUs. The affinity objects have a GetChildObject method to access underlying affinitized D3D12 resources to pass to the active instance of the library. ## I've heard terms like 'Linked' and 'Unlinked' MultiGPU; what do they mean? -Simplifying a bit, linked GPUs usually refer to multiple GPUs connected in a way which satisfies a specific OS/API contract enabling the NodeMask feature. In conforming to this special contract, it's possible for application simultaneously use the linked GPUs more efficiently than if they were unlinked. Though this is not necessarily always the case, linked GPUs are often found in pairs as identical cards from the same vendor sometimes even physically connected by a special cable. +Simplifying a bit, linked GPUs usually refer to multiple GPUs connected in a way which satisfies a specific OS/API contract enabling the NodeMask feature. In conforming to this special contract, it's possible for application simultaneously use the linked GPUs more efficiently than if they were unlinked. Though this is not necessarily always the case, linked GPUs are often found in pairs as identical cards from the same vendor sometimes even physically connected by a special cable. -Unlinked GPUs on the other hand can be completely different in power and even vendor. The DirectX 12 API also allows communication between unlinked GPUs though it may be slower/less efficient than what linked GPUs can manage. As a tradeoff, unlinked GPUs open a huge number of possibilities essentially removing restrictions on video card capability, vendor, etc. Any card of any capability should be able to work with any other card. +Unlinked GPUs on the other hand can be completely different in power and even vendor. The DirectX 12 API also allows communication between unlinked GPUs though it may be slower/less efficient than what linked GPUs can manage. As a tradeoff, unlinked GPUs open a huge number of possibilities essentially removing restrictions on video card capability, vendor, etc. Any card of any capability should be able to work with any other card. -This sample and library currently focus on the linked GPU case. If you want an example of unlinked GPU usage, please refer to this sample: +This sample and library currently focus on the linked GPU case. If you want an example of unlinked GPU usage, please refer to this sample: https://github.com/Microsoft/DirectX-Graphics-Samples/tree/master/Samples/Desktop/D3D12HeterogeneousMultiadapter @@ -70,4 +84,4 @@ https://github.com/Microsoft/DirectX-Graphics-Samples/tree/master/Samples/Deskto The samples are designed to run on a system with more than one GPU and the GPUs must be linked. The samples particularly target dual linked GPUs (typically identical cards). The samples will also run on single GPU and heterogeneous GPUs, but won't be able to take advantage of the features being highlighted. ### Optional Features -These samples have been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. \ No newline at end of file +These samples have been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. \ No newline at end of file diff --git a/Samples/Desktop/D3D12MeshShaders/readme.md b/Samples/Desktop/D3D12MeshShaders/readme.md index eb372f501..bbb274ec7 100644 --- a/Samples/Desktop/D3D12MeshShaders/readme.md +++ b/Samples/Desktop/D3D12MeshShaders/readme.md @@ -1,45 +1,57 @@ -# D3D12 Mesh Shader Samples -This collection of projects act as an introduction to meshlets and rendering with DirectX Mesh Shaders. +--- +page_type: sample +languages: +- cpp +products: +- windows-api-win32 +name: Direct3D 12 mesh shader samples +urlFragment: d3d12-mesh-shader-samples-win32 +description: This collection of projects act as an introduction to meshlets, and rendering with DirectX mesh shaders. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 mesh shader samples +This collection of projects act as an introduction to meshlets, and rendering with DirectX mesh shaders. ### Getting Started * DirectX Mesh Shader spec/documentation is available at [DirectX Mesh Shader Specs](https://microsoft.github.io/DirectX-Specs/d3d/MeshShader.html) site. # Projects -## 1. Meshlet Generator Library -This library provides a lightweight API for generating meshlets from streams of position and index data. The public interface can be found in D3D12MeshletGenerator.h. +## 1. Wavefront Converter Command Line Tool +This project acts as an example of how to incorporate [DirectXMesh](https://github.com/microsoft/DirectXMesh) meshlet generation functionality into a complete mesh conversion application. The application is structured as a basic command line tool for loading and processing obj files. The processed mesh is exported using a simple binary runtime file format targeted at fast loading and rendering with DirectX apps. -## 2. Wavefront Converter Command Line Tool -This project acts as an example of how to integrate the meshlet generator library into a complete mesh conversion application. The application is structured as a basic command line tool for loading and processing obj files using the [DirectXMesh](https://github.com/microsoft/DirectXMesh) library. The processed mesh is exported using a simple binary runtime file format targeted at fast loading and rendering with DirectX apps. - -## 3. Meshlet Viewer +## 2. Meshlet Viewer This project demonstrates the basics of how to render a meshletized model using DirectX 12. This application loads the binary model files exported by the Wavefront Converter command line tool. ![D3D12 Meshlet Render Preview](src/MeshletRender/D3D12MeshletRender.png) -## 4. [Meshlet Instancing](src/MeshletInstancing/readme.md) +## 3. [Meshlet Instancing](src/MeshletInstancing/readme.md) In the Mesh Shader Pipeline API there's no concept of instancing such as in the legacy pipeline. This leaves the logic of instancing meshes entirely up to application code. An inefficient implementation can waste precious threads within threadgroups. This sample demonstrates an implementation which aims to optimize instancing of meshletized meshes by packing the final, unfilled meshlets of multiple instances into a single threadgroup. ![D3D12 Meshlet Instancing Preview](src/MeshletInstancing/D3D12MeshletInstancing.png) -## 5. [Meshlet Culling](src/MeshletCull/readme.md) +## 4. [Meshlet Culling](src/MeshletCull/readme.md) The generic functionality of amplification shaders make them a useful tool for an innumerable number of tasks. This sample demonstrates the basics of amplification shaders by showcasing how to cull meshlests before ever dispatching a mesh shader threadgroup into the pipeline. ![D3D12 Meshlet Culling Preview](src/MeshletCull/D3D12MeshletCull.png) -## 6. [Instancing Culling & Dynamic LOD Selection](src/DynamicLOD/readme.md) +## 5. [Instancing Culling & Dynamic LOD Selection](src/DynamicLOD/readme.md) This sample presents an advanced shader technique using amplification shaders to do per-instance frustum culling and level-of-detail (LOD) selection entirely on the GPU for an arbitrary number of mesh instances. ![D3D12 Dynamic LOD Preview](src/DynamicLOD/D3D12DynamicLOD.png) ## Requirements * [Visual Studio 2019](https://www.visualstudio.com/). -* [Windows SDK Insider Preview](https://www.microsoft.com/en-us/software-download/windowsinsiderpreviewSDK). +* [Windows SDK Insider Preview](https://www.microsoft.com//software-download/windowsinsiderpreviewSDK). * Windows 10 Insider Preview * Windows SDK 19041 * DirectX 12 GPU with compatible drivers - [NVIDIA RTX](https://developer.nvidia.com/directx) ## Further resources * [DirectX Mesh Shader Spec](https://microsoft.github.io/DirectX-Specs/d3d/MeshShader.html) +* [DirectXMesh Repository](https://github.com/microsoft/DirectXMesh) * [NVIDIA Mesh Shader Blog](https://devblogs.nvidia.com/introduction-turing-mesh-shaders/) ## Feedback and Questions diff --git a/Samples/Desktop/D3D12Multithreading/readme.md b/Samples/Desktop/D3D12Multithreading/readme.md index 39c6b3f7b..c74a861c1 100644 --- a/Samples/Desktop/D3D12Multithreading/readme.md +++ b/Samples/Desktop/D3D12Multithreading/readme.md @@ -1,7 +1,21 @@ -# Multithreading Sample +--- +page_type: sample +languages: +- cpp +products: +- windows-api-win32 +name: Direct3D 12 multithreading sample +urlFragment: d3d12-multithreading-sample-win32 +description: This sample demonstrates the use of multiple threads with Direct3D 12. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 multithreading sample ![Multithreading GUI](src/D3D12Multithreading.png) This sample demonstrates the use of multiple threads with Direct3D 12. An app can use multithreading to improve efficiency by building command lists on multiple threads asynchronously. The majority of the CPU cost is associated with command list building, not command list execution. Apps must ensure they never concurrently call methods on the same command list or command allocator. -### Optional Features +### Optional features This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. \ No newline at end of file diff --git a/Samples/Desktop/D3D12On7/readme.md b/Samples/Desktop/D3D12On7/readme.md index 190824d92..bf028465b 100644 --- a/Samples/Desktop/D3D12On7/readme.md +++ b/Samples/Desktop/D3D12On7/readme.md @@ -1,7 +1,21 @@ -# D3D12On7 Sample +--- +page_type: sample +languages: +- cpp +products: +- windows-api-win32 +name: Direct3D 12 12-On-7 sample +urlFragment: d3d12-12-on-7-sample-win32 +description: Demonstrates how to write an app that supports running with Direct3D 12 both on Windows 7 and Windows 10 with the same packaging layout and executable. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 12-On-7 sample ![12on7 GUI](src/D3D12On7.png) -This sample showcases how to use D3D12 on Windows 7, aka D3D12On7. Specifically, this sample demonstrates how to write an app that supports running with D3D12 both on Windows 7 and 10 with the same packaging layout and executable. +This sample showcases how to use D3D12 on Windows 7, also known as D3D12On7. Specifically, this sample demonstrates how to write an app that supports running with Direct3D 12 both on Windows 7 and Windows 10 with the same packaging layout and executable. D3D12 on Windows 7 is quite different to D3D12 on Windows 10. To use D3D12 on Windows 10, all you need to do is link to D3D12.lib and you're on your way. But D3D12 doesn't exist on Windows 7 in such a way that you can do that. Instead, apps that want to use D3D12 on Windows 7 need to redistribute the D3D12.dll file, along with supporting binaries. Then, at runtime, you'll need to be explicit about which D3D12.dll you are going to use, either the one bundled with your app, or the one that comes from the OS. diff --git a/Samples/Desktop/D3D12PipelineStateCache/readme.md b/Samples/Desktop/D3D12PipelineStateCache/readme.md index 247fbc93f..0919cb11e 100644 --- a/Samples/Desktop/D3D12PipelineStateCache/readme.md +++ b/Samples/Desktop/D3D12PipelineStateCache/readme.md @@ -1,6 +1,20 @@ -# Pipeline State Cache Sample -This sample demonstrates the use of Direct3D 12 Pipeline State Object (PSO) libraries. An app can use PSO libraries to cache compiled PSOs to disk and avoid costly shader compilation during subsequent runs. Using PSO libaries can accelerate app load times and reduce rendering glitches caused by driver shader compilation. +--- +page_type: sample +languages: +- cpp +products: +- windows-api-win32 +name: Direct3D 12 pipeline state cache sample +urlFragment: d3d12-pipeline-state-cache-sample-win32 +description: This sample demonstrates the use of binary occlusion queries and predication in Direct3D 12. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 pipeline state cache sample +This sample demonstrates the use of Direct3D 12 pipeline state object (PSO) libraries. An app can use PSO libraries to cache compiled PSOs to disk and avoid costly shader compilation during subsequent runs. Using PSO libaries can accelerate app load times and reduce rendering glitches caused by driver shader compilation. This sample also demonstrates the use of an "uber shader" which is a shader that can perform a variety of effects by taking advantage of dynamic branching on the GPU. The motivation behind an uber shader is to alleviate frame rate glitches caused by an app compiling a PSO it hasn't encountered before. When this happens the app can simply configure the uber shader PSO (which it can compile up front at load time) with the desired effect and use that until the faster and more specialized PSO is done compiling. This results in slightly lower GPU performance for a while but produces more consistent and smoother results. -### Optional Features +### Optional features This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. \ No newline at end of file diff --git a/Samples/Desktop/D3D12PredicationQueries/readme.md b/Samples/Desktop/D3D12PredicationQueries/readme.md index a7df0f4ea..250fd8e60 100644 --- a/Samples/Desktop/D3D12PredicationQueries/readme.md +++ b/Samples/Desktop/D3D12PredicationQueries/readme.md @@ -1,7 +1,21 @@ -# Predication and Queries Sample +--- +page_type: sample +languages: +- cpp +products: +- windows-api-win32 +name: Direct3D 12 predication and queries sample +urlFragment: d3d12-predication-and-queries-sample-win32 +description: This sample demonstrates the use of binary occlusion queries and predication in Direct3D 12. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 predication and queries sample ![PredicationQueries GUI](src/D3D12PredicationQueries.png) This sample demonstrates the use of binary occlusion queries and predication in Direct3D 12. The sample renders two quads; one of them animates and periodically occludes the other. For each rendered frame, a binary occlusion query is executed and the SetPredication API is used to conditionally draw the potentially occluded quad. A transparency effect is used to illustrate when the query determines that the quad is fully occluded. -### Optional Features +### Optional features This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. \ No newline at end of file diff --git a/Samples/Desktop/D3D12Raytracing/readme.md b/Samples/Desktop/D3D12Raytracing/readme.md index dbd55f941..d3fc06f28 100644 --- a/Samples/Desktop/D3D12Raytracing/readme.md +++ b/Samples/Desktop/D3D12Raytracing/readme.md @@ -1,4 +1,18 @@ -# D3D12 Raytracing Samples +--- +page_type: sample +languages: +- cpp +products: +- windows-api-win32 +name: Direct3D 12 raytracing samples +urlFragment: d3d12-raytracing-samples-win32 +description: This collection of samples act as an introduction to DirectX Raytracing (DXR). +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 raytracing samples This collection of samples act as an introduction to DirectX Raytracing (DXR). The samples are divided into tutorials and advanced samples. Each tutorial sample introduces a few new DXR concepts. Advanced samples demonstrate more complex techniques and applications of raytracing. ### Getting Started diff --git a/Samples/Desktop/D3D12ReservedResources/readme.md b/Samples/Desktop/D3D12ReservedResources/readme.md index 2affbe76e..c0bc6b7c5 100644 --- a/Samples/Desktop/D3D12ReservedResources/readme.md +++ b/Samples/Desktop/D3D12ReservedResources/readme.md @@ -1,7 +1,21 @@ -# Reserved Resources Sample +--- +page_type: sample +languages: +- cpp +products: +- windows-api-win32 +name: Direct3D 12 reserved resources sample +urlFragment: d3d12-reserved-resources-sample-win32 +description: This sample demonstrates the use of reserved resources in DirectX 12. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 reserved resources sample ![ReservedResources GUI](src/D3D12ReservedResources.png) This sample demonstrates the use of reserved resources in DirectX 12. In this sample, a quad is textured with a reserved (aka: tiled) resource containing a full mip chain. The currently visible mip is mapped and unmapped to the reserved resource on demand. By pressing the arrow keys, you can change which mip is visible. The sample also demonstrates that all the tiles in a reserved resource are not required to reside in the same heap. This functionality allows apps to persist heaps containing tiles that are likely to be used again and discard heaps that are no longer needed. -### Optional Features +### Optional features This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. \ No newline at end of file diff --git a/Samples/Desktop/D3D12Residency/readme.md b/Samples/Desktop/D3D12Residency/readme.md index 036bebc02..7f0cc3445 100644 --- a/Samples/Desktop/D3D12Residency/readme.md +++ b/Samples/Desktop/D3D12Residency/readme.md @@ -1,7 +1,21 @@ -# The D3D12 Residency Starter Library +--- +page_type: sample +languages: +- cpp +products: +- windows-api-win32 +name: Direct3D 12 residency starter library +urlFragment: d3d12-residency-starter-library-win32 +description: This library is intended to be a low-integration-cost turnkey solution to managing your Direct3D 12 heaps/committed resources. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 residency starter library ## What is this library? -This library is intended to be a low-integration-cost turnkey solution to managing your D3D12 heaps/committed resources to reduce the chance that you will get into an overcommitted video memory situation as well as ensure your performance remains as good as it can be when you do end up in that situation. +This library is intended to be a low-integration-cost turnkey solution to managing your Direct3D 12 heaps/committed resources to reduce the chance that you will get into an overcommitted video memory situation as well as ensure your performance remains as good as it can be when you do end up in that situation. It implements essentially the same memory management behavior that a D3D11 app would get from the layers below the API. In D3D12, the layers below the API cannot do this for you on account of the more flexible API, more direct access to memory, and bindless architecture. That's where this residency library comes in. @@ -33,47 +47,49 @@ From this, you can infer that in order for a D3D12 application to achieve the sa * Synchronize correctly so that rendering cannot happen until these heaps are made resident * Track when heaps are in use on the GPU so that they can be evicted only when the GPU is done with them -The library provides interfaces to indicate when a resource is going to be used for rendering and handles all of the ```MakeResident```/```Evict``` calls as well as all the required synchronization. +The library provides interfaces to indicate when a resource is going to be used for rendering and handles all of the **MakeResident**/**Evict** calls as well as all the required synchronization. ## Alright, how do I use it? Here are the high level steps for using the library: -1. Create a ```D3DX12Residency::ResidencyManager``` -2. Create a ```D3DX12Residency::ManagedObject``` for every heap/committed resource you want the library to manage - 1. The library works by tracking/evicting/making resident the ```ManagedObject's``` underlying heap/committed resource -3. Use ```ResidencyManager::BeginTrackingObject``` to start managing each ```ManagedObject``` -4. Use a ```D3DX12Residency::ResidencySet``` to track which heaps will be used in a particular command list (it will be a 1:1 relationship) - 1. It's essentially a list of ```ManagedObjects``` which will need to be resident when a command list executes -5. Use ```ResidencyManager::ExecuteCommandLists``` to execute the workload which takes a command queue, array of command lists, an array of residency sets, and a count +1. Create a **D3DX12Residency::ResidencyManager** +2. Create a **D3DX12Residency::ManagedObject** for every heap/committed resource you want the library to manage + 1. The library works by tracking/evicting/making resident the **ManagedObject**'s underlying heap/committed resource +3. Use **ResidencyManager::BeginTrackingObject** to start managing each **ManagedObject** +4. Use a **D3DX12Residency::ResidencySet** to track which heaps will be used in a particular command list (it will be a 1:1 relationship) + 1. It's essentially a list of **ManagedObject**s which will need to be resident when a command list executes +5. Use **ResidencyManager::ExecuteCommandLists** to execute the workload which takes a command queue, array of command lists, an array of residency sets, and a count 1. This will execute the command lists and ensure all of the heaps/committed resources that you need to execute are resident at the right times -### Optional Features +### Optional features This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. ### FAQs -#### What exactly is Residency? -Residency correlates to whether a heap is accessible by the GPU or not. If it is not resident, you should not be touching that resource (neither read nor write). A resident resource can be used by the GPU. The ```MakeResident``` and ```Evict``` calls are what controls whether a heap is resident or not. +#### What exactly is residency? +Residency correlates to whether a heap is accessible by the GPU or not. If it is not resident, you should not be touching that resource (neither read nor write). A resident resource can be used by the GPU. The **MakeResident** and **Evict** calls are what controls whether a heap is resident or not. -#### What does calling ```Evict``` do? -```Evict``` is essentially a promise that you will not touch the heap until you call ```MakeResident``` again at which point you also promise to wait until ```MakeResident``` returns to start using that heap. It means that VidMM (Video Memory Manager) can repurpose that memory (eg. for another app) if the system is under memory pressure and it needs it. +#### What does calling **Evict** do? +**Evict** is essentially a promise that you will not touch the heap until you call **MakeResident** again at which point you also promise to wait until **MakeResident** returns to start using that heap. It means that VidMM (Video Memory Manager) can repurpose that memory (eg. for another app) if the system is under memory pressure and it needs it. -Note that when you call ```Evict```, the heap is only marked for eviction. VidMM will try really hard not to evict it if it doesn't need to thereby making the subsequent ```MakeResident``` call (when you call it) a no-op (ie. nothing needs to happen and your heap is ready for use almost immediately). +Note that when you call **Evict**, the heap is only marked for eviction. VidMM will try really hard not to evict it if it doesn't need to thereby making the subsequent **MakeResident** call (when you call it) a no-op (ie. nothing needs to happen and your heap is ready for use almost immediately). -#### What does calling ```MakeResident``` do? -```MakeResident``` is a blocking call which will bring your heap data and page table mappings back as they were before you called Evict. You don't need to copy the data back in. +#### What does calling **MakeResident** do? +**MakeResident** is a blocking call which will bring your heap data and page table mappings back as they were before you called Evict. You don't need to copy the data back in. -#### Why would I use ```MakeResident``` and ```Evict```? -In return for using ```MakeResident``` and ```Evict```, VidMM promises to return the data and page table mappings back to their original state before you called ```Evict``` as well as try its hardest to not actually evict anything if it nothing else needs that memory. In many cases, this is better than destroying the heap/committed resource in which case you would need to recreate the heap/committed resource, re-copy the data into an upload heap, and execute a GPU copy before making it available again to the renderer. The chance for ```MakeResident``` to be a no-op also improves the average case performance when compared to a destruction/recreation/repopulating technique. +#### Why would I use **MakeResident** and **Evict**? +In return for using **MakeResident** and **Evict**, VidMM promises to return the data and page table mappings back to their original state before you called **Evict** as well as try its hardest to not actually evict anything if it nothing else needs that memory. In many cases, this is better than destroying the heap/committed resource in which case you would need to recreate the heap/committed resource, re-copy the data into an upload heap, and execute a GPU copy before making it available again to the renderer. The chance for **MakeResident** to be a no-op also improves the average case performance when compared to a destruction/recreation/repopulating technique. ### Other Library FAQs -#### What is the ```MaxLatency``` parameter in the ResidencyManager's ```Initialize``` method? -When rendering very quickly, it is possible for the renderer to get too far ahead of the library's worker thread. The ```MaxLatency``` parameter helps to limit how far ahead it can get. The value should essentially be the average ```NumberOfBufferedFrames * NumberOfCommandListSubmissionsPerFrame``` throughout the execution of your app. +#### What is the *MaxLatency* parameter in the ResidencyManager's **Initialize** method? +When rendering very quickly, it is possible for the renderer to get too far ahead of the library's worker thread. The *MaxLatency* parameter helps to limit how far ahead it can get. The value should essentially be the average `NumberOfBufferedFrames * NumberOfCommandListSubmissionsPerFrame` throughout the execution of your app. #### The Visual Studio Graphics Debugging (VSGD) tools crash when capturing an app that uses this library You can work around this bug by using the library's single threaded mode using the line: + ``` #define RESIDENCY_SINGLE_THREADED 0 ``` + 0 is the default; change it to 1 to force single threaded behavior to work around the issue. diff --git a/Samples/Desktop/D3D12SM6WaveIntrinsics/readme.md b/Samples/Desktop/D3D12SM6WaveIntrinsics/readme.md index 2b90f7a74..2d8620223 100644 --- a/Samples/Desktop/D3D12SM6WaveIntrinsics/readme.md +++ b/Samples/Desktop/D3D12SM6WaveIntrinsics/readme.md @@ -1,8 +1,22 @@ -# Shader Model 6 Wave Intrinsics Sample -This sample visualizes how Wave Intrinsics work. Wave intrinsics are a new set of intrinsics for use in HLSL Shader Model 6. They enable operations across lanes in the SIMD processor cores, helping the performance of certain algorithms such as culling and packing sparse data sets. +--- +page_type: sample +languages: +- cpp +products: +- windows-api-win32 +name: Direct3D 12 shader model 6 wave intrinsics sample +urlFragment: d3d12-shader-model-6-wave-intrinsics-sample-win32 +description: This sample visualizes how wave intrinsics work. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 shader model 6 wave intrinsics sample +This sample visualizes how wave intrinsics work. Wave intrinsics are a new set of intrinsics for use in HLSL shader model 6. They enable operations across lanes in the SIMD processor cores, helping the performance of certain algorithms such as culling and packing sparse data sets. Doc and other resources: -*) Wave Intrinsics Wiki: https://github.com/Microsoft/DirectXShaderCompiler/wiki/Wave-Intrinsics +*) Wave intrinsics Wiki: https://github.com/Microsoft/DirectXShaderCompiler/wiki/Wave-Intrinsics *) DirectX MiniEngine: This engine takes advantage of the wave intrinsics to improve the performance of forward plus lighting. https://github.com/Microsoft/DirectX-Graphics-Samples/tree/master/MiniEngine Requirement: diff --git a/Samples/Desktop/D3D12SmallResources/readme.md b/Samples/Desktop/D3D12SmallResources/readme.md index 6a143910a..88ce52406 100644 --- a/Samples/Desktop/D3D12SmallResources/readme.md +++ b/Samples/Desktop/D3D12SmallResources/readme.md @@ -1,4 +1,18 @@ -# Small Resources Sample +--- +page_type: sample +languages: +- cpp +products: +- windows-api-win32 +name: Direct3D 12 small resources sample +urlFragment: d3d12-small-resources-sample-win32 +description: This sample demonstrates the use of small placed resources in Direct3D 12. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 small resources sample ![SmallResources GUI](src/D3D12SmallResources.png) This sample demonstrates the use of small placed resources in Direct3D 12. The sample allocates a number of small textures using 4K resource alignment and shows the potential memory savings gained by using placed resources over committed and reserved resources which use 64K resource alignments. The resource type and current GPU memory usage are displayed in the window's title bar. @@ -6,5 +20,5 @@ This sample demonstrates the use of small placed resources in Direct3D 12. The s ### Controls SPACE bar - toggles between using placed and committed resources. -### Optional Features +### Optional features This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. \ No newline at end of file diff --git a/Samples/Desktop/D3D12VariableRateShading/readme.md b/Samples/Desktop/D3D12VariableRateShading/readme.md index 435c92881..fb64f74cc 100644 --- a/Samples/Desktop/D3D12VariableRateShading/readme.md +++ b/Samples/Desktop/D3D12VariableRateShading/readme.md @@ -1,7 +1,21 @@ -# Variable Rate Shading sample +--- +page_type: sample +languages: +- cpp +products: +- windows-api-win32 +name: Direct3D 12 variable-rate shading sample +urlFragment: d3d12-variable-rate-shading-sample-win32 +description: This sample illustrates how to use variable-rate shading (VRS) to improve application performance. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 variable-rate shading sample ![Variable Rate Shading GUI](src/Screenshot.PNG) -This sample illustrates how to use Variable Rate Shading (VRS) to improve application performance. VRS adds the concept of subsampling, where shading can be computed at a level coarser than a pixel. For example, a group of pixels can be shaded as a single unit and the result is then broadcast to all samples in the group. This is great for areas of the image where extra detail doesn't help - such as those behind HUD elements, transparencies, blurs (depth-of-field, motion, etc.), and optical distortions due to VR optics. +This sample illustrates how to use variable-rate shading (VRS) to improve application performance. VRS adds the concept of subsampling, where shading can be computed at a level coarser than a pixel. For example, a group of pixels can be shaded as a single unit, and the result is then broadcast to all samples in the group. This is great for areas of the image where extra detail doesn't help—such as those behind HUD elements, transparencies, blurs (depth-of-field, motion, etc.), and optical distortions due to VR optics. #### Recommended scenarios to try Hit SPACE to stop the light animating and then use the [F1-F5] keys to toggle between presets for Shading Rates. Can you spot the visual difference between F1 and F2? Try experimenting with the various controls to find an acceptable balance between degraded-visuals and performance. diff --git a/Samples/Desktop/D3D12nBodyGravity/readme.md b/Samples/Desktop/D3D12nBodyGravity/readme.md index eb0d54626..0bcb0bfba 100644 --- a/Samples/Desktop/D3D12nBodyGravity/readme.md +++ b/Samples/Desktop/D3D12nBodyGravity/readme.md @@ -1,7 +1,21 @@ -# n-Body Gravity Sample +--- +page_type: sample +languages: +- cpp +products: +- windows-api-win32 +name: Direct3D 12 n-body gravity sample +urlFragment: d3d12-n-body-gravity-sample-win32 +description: This sample demonstrates the use of asynchronous compute shaders (multi-engine) to simulate an n-body gravity system. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 n-body gravity sample ![nBodyGravity GUI](src/D3D12nBodyGravity.png) -This sample demonstrates the use of asynchronous compute shaders (multi-engine) to simulate an n-body gravity system. Graphics commands and compute commands can be recorded simultaneously and submitted to their respective command queues when the work is ready to begin execution on the GPU. This sample also demonstrates advanced usage of fences to synchronize tasks across command queues. +This sample demonstrates the use of asynchronous compute shaders (multi-engine) to simulate an n-body gravity system. Graphics commands and compute commands can be recorded simultaneously, and submitted to their respective command queues when the work is ready to begin execution on the GPU. This sample also demonstrates advanced usage of fences to synchronize tasks across command queues. -### Optional Features +### Optional features This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. \ No newline at end of file diff --git a/Samples/Desktop/D3D12xGPU/readme.md b/Samples/Desktop/D3D12xGPU/readme.md index f152577ee..fb466e471 100644 --- a/Samples/Desktop/D3D12xGPU/readme.md +++ b/Samples/Desktop/D3D12xGPU/readme.md @@ -1,11 +1,25 @@ -# xGPU sample +--- +page_type: sample +languages: +- cpp +products: +- windows-api-win32 +name: Direct3D 12 xGPU sample +urlFragment: d3d12-xgpu-sample-win32 +description: This sample illustrates how to detect and handle a D3D device removed event. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 xGPU sample ![xGPU GUI](src/Screenshot.PNG) This sample illustrates how to detect and handle a D3D device removed event. Particularly in a case of an external GPU (xGPU) being plugged/unplugged. When a device is removed, any further D3D commands will fail with DXGI_ERROR_DEVICE_REMOVED. The sample detects this, destroys D3D resources and recreates them on the next available adapter. Then it continues rendering the next frame while retaining application and scene state. The adapter is selected based on a GPU sorting mode applied by the application. Note, the application selected sorting mode will be superseded by a global preference for the application if there is one. The global preference for an application can be set by a user on the Advanced graphics settings page which can be found as a link from the Display section of Windows Settings. -Another important event is when a new GPU is plugged into the system. The sample uses IDXGIFactory7::RegisterAdaptersChangedEvent() to register for event notifications when this happens. At that time, the sample re-enumerates adapters and if a better adapter is found according to the GPU sorting mode, the application recreates all D3D resources using the new adapter. +Another important event is when a new GPU is plugged into the system. The sample uses IDXGIFactory7::RegisterAdaptersChangedEvent to register for event notifications when this happens. At that time, the sample re-enumerates adapters and if a better adapter is found according to the GPU sorting mode, the application recreates all D3D resources using the new adapter. -As the sample is able to survive an adapter removal event, it declares that it supports adapter removal via DXGIDeclareAdapterRemovalSupport API. This allows Windows to identify such apps and act accordingly, for example, to allow safe detachment of the xGPU even when this application is rendering on it. This behavior is also successfully tested via [DXGIAdapterRemovalSupportTest.exe](../../../Tools/DXGIAdapterRemovalSupportTest/readme.md). +As the sample is able to survive an adapter removal event, it declares that it supports adapter removal via the DXGIDeclareAdapterRemovalSupport API. This allows Windows to identify such apps and act accordingly, for example, to allow safe detachment of the xGPU even when this application is rendering on it. This behavior is also successfully tested via [DXGIAdapterRemovalSupportTest.exe](https://github.com/microsoft/DirectX-Graphics-Samples/tree/master/Tools/DXGIAdapterRemovalSupportTest). ### Controls * ALT+ENTER - toggles between windowed and fullscreen modes. @@ -14,5 +28,5 @@ As the sample is able to survive an adapter removal event, it declares that it s * [1-9] - adapter selection, when manual override is enabled. ## Requirements -* Windows 10 17655 or higher (available via [Windows Insider Program](https://insider.windows.com/en-us/)) +* Windows 10 17655 or higher (available via [Windows Insider Program](https://insider.windows.com/)) * [Visual Studio 2017](https://www.visualstudio.com/) with the Windows 10 17655 SDK \ No newline at end of file diff --git a/Samples/UWP/D3D1211On12/readme.md b/Samples/UWP/D3D1211On12/readme.md index ceee00fb8..82aaabc0d 100644 --- a/Samples/UWP/D3D1211On12/readme.md +++ b/Samples/UWP/D3D1211On12/readme.md @@ -5,15 +5,15 @@ languages: products: - windows - windows-uwp -name: 11 on 12 Sample -urlFragment: 11-on-12-sample-uwp +name: Direct3D 12 11-on-12 sample +urlFragment: d3d12-11-on-12-sample-uwp description: Demonstrates how to use Direct3D 11-based rendering in combination with Direct3D 12. extendedZipContent: - path: LICENSE target: LICENSE --- -# 11 on 12 Sample +# Direct3D 12 11-on-12 sample ![11On12 GUI](src/D3D1211On12.png) diff --git a/Samples/UWP/D3D12Bundles/readme.md b/Samples/UWP/D3D12Bundles/readme.md index 5e01b2d7a..070fbca8b 100644 --- a/Samples/UWP/D3D12Bundles/readme.md +++ b/Samples/UWP/D3D12Bundles/readme.md @@ -5,21 +5,20 @@ languages: products: - windows - windows-uwp -name: Bundles Sample -urlFragment: bundles-sample-uwp +name: Direct3D 12 bundles sample +urlFragment: d3d12-bundles-sample-uwp description: Demonstrates the use of Direct3D 12 bundles. extendedZipContent: - path: LICENSE target: LICENSE --- - -# Bundles Sample +# Direct3D 12 bundles sample ![Bundles GUI](src/D3D12Bundles.png) -This sample demonstrates the use of Direct3D 12 Bundles. An app can use Bundles to group a small number of API commands together for execution later. When a Bundle is created, the driver will perform as much pre-processing as possible to make it inexpensive to execute the Bundle later. Part of this pre-processing means that there are certain restrictions on what operations can be performed within a Bundle. +This sample demonstrates the use of Direct3D 12 bundles. An app can use bundles to group a small number of API commands together for execution later. When a bundle is created, the driver will perform as much pre-processing as possible to make it inexpensive to execute the bundle later. Part of this pre-processing means that there are certain restrictions on what operations can be performed within a bundle. -## Optional Features +## Optional features This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. diff --git a/Samples/UWP/D3D12DepthBoundsTest/readme.md b/Samples/UWP/D3D12DepthBoundsTest/readme.md index 2af31957a..b76da14b3 100644 --- a/Samples/UWP/D3D12DepthBoundsTest/readme.md +++ b/Samples/UWP/D3D12DepthBoundsTest/readme.md @@ -1,7 +1,22 @@ -# Depth Bounds Test Sample +--- +page_type: sample +languages: +- cpp +products: +- windows +- windows-uwp +name: Direct3D 12 depth bounds test sample +urlFragment: d3d12-depth-bounds-test-sample-uwp +description: Demonstrates the depth bound test in Direct3D 12. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 depth bounds test sample ![DepthBounds GUI](src/D3D12DepthBoundsTest.png) This sample demonstrates the depth bound test in Direct3D 12. Depth-bounds testing allows pixels to be discarded if the currently-stored depth value is outside the range specified by Min and Max, inclusive. -See more detail about depth bounds test in the following page. https://msdn.microsoft.com/en-us/library/windows/desktop/mt492658(v=vs.85).aspx \ No newline at end of file +For more detail about depth bounds test, see [**ID3D12GraphicsCommandList1::OMSetDepthBounds**](https://docs.microsoft.com/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist1-omsetdepthbounds). diff --git a/Samples/UWP/D3D12DynamicIndexing/readme.md b/Samples/UWP/D3D12DynamicIndexing/readme.md index 68496c897..70a9f5148 100644 --- a/Samples/UWP/D3D12DynamicIndexing/readme.md +++ b/Samples/UWP/D3D12DynamicIndexing/readme.md @@ -1,7 +1,22 @@ -# Dynamic Indexing Sample +--- +page_type: sample +languages: +- cpp +products: +- windows +- windows-uwp +name: Direct3D 12 dynamic indexing sample +urlFragment: d3d12-dynamic-indexing-sample-uwp +description: Demonstrates the use of new features available in HLSL's Shader Model 5.1—specifically, dynamic indexing and unbounded descriptor tables. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 dynamic indexing sample ![DynamicIndexing GUI](src/D3D12DynamicIndexing.png) -This sample demonstrates the use of new features available in HLSL's Shader Model 5.1 - specifically dynamic indexing and unbounded descriptor tables. With dynamic indexing, shaders can now index into an array without knowing the value of the index at compile time. When combined with unbounded arrays, this adds another level of indirection and flexibility for shader authors and art pipelines. +This sample demonstrates the use of new features available in HLSL's Shader Model 5.1—specifically, dynamic indexing and unbounded descriptor tables. With dynamic indexing, shaders can now index into an array without knowing the value of the index at compile time. When combined with unbounded arrays, this adds another level of indirection and flexibility for shader authors and art pipelines. -### Optional Features +### Optional features This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. \ No newline at end of file diff --git a/Samples/UWP/D3D12ExecuteIndirect/readme.md b/Samples/UWP/D3D12ExecuteIndirect/readme.md index 31dfc4926..c2481ed73 100644 --- a/Samples/UWP/D3D12ExecuteIndirect/readme.md +++ b/Samples/UWP/D3D12ExecuteIndirect/readme.md @@ -1,10 +1,25 @@ -# Execute Indirect Sample +--- +page_type: sample +languages: +- cpp +products: +- windows +- windows-uwp +name: Direct3D 12 execute indirect sample +urlFragment: d3d12-execute-indirect-sample-uwp +description: Demonstrates how to generate dynamic GPU workloads using the graphics command list's [**ID3D12GraphicsCommandList::ExecuteIndirect**](https://docs.microsoft.com/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist-executeindirect) API. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 execute indirect sample ![ExecuteIndirect GUI](src/D3D12ExecuteIndirect.png) -This sample demostrates how to generate dynamic GPU workloads using the graphics command list's ExecuteIndirect API. In this sample, a large number of triangles animate across the screen and a compute shader is used to determine which triangles are visible. The draw calls for those triangles are then aggregated into a buffer that is processed by the ExecuteIndirect API so that only those triangles are processed by the graphics pipeline. +This sample demonstrates how to generate dynamic GPU workloads using the graphics command list's [**ID3D12GraphicsCommandList::ExecuteIndirect**](https://docs.microsoft.com/windows/win32/api/d3d12/nf-d3d12-id3d12graphicscommandlist-executeindirect) API. In this sample, a large number of triangles animate across the screen, and a compute shader is used to determine which triangles are visible. The draw calls for those triangles are then aggregated into a buffer that is processed by the ExecuteIndirect API so that only those triangles are processed by the graphics pipeline. ### Controls SPACE bar - toggles the compute shader on and off. -### Optional Features -This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. \ No newline at end of file +### Optional features +This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. diff --git a/Samples/UWP/D3D12Fullscreen/readme.md b/Samples/UWP/D3D12Fullscreen/readme.md index 8c36056f2..8d7bfecca 100644 --- a/Samples/UWP/D3D12Fullscreen/readme.md +++ b/Samples/UWP/D3D12Fullscreen/readme.md @@ -1,4 +1,19 @@ -# Fullscreen sample +--- +page_type: sample +languages: +- cpp +products: +- windows +- windows-uwp +name: Direct3D 12 fullscreen sample +urlFragment: d3d12-fullscreen-sample-uwp +description: Illustrates how to handle fullscreen <-> windowed transitions and window resizing in DirectX 12. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 fullscreen sample ![Fullscreen GUI](src/D3D12Fullscreen.png) This sample illustrates how to handle fullscreen <-> windowed transitions and window resizing in DirectX 12. @@ -7,5 +22,5 @@ This sample illustrates how to handle fullscreen <-> windowed transitions and wi SPACE bar - toggles between windowed and fullscreen modes. LEFT/RIGHT arrow keys - changes the resolution of the scene. -### Optional Features +### Optional features This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. \ No newline at end of file diff --git a/Samples/UWP/D3D12HDR/readme.md b/Samples/UWP/D3D12HDR/readme.md index 3f63901e2..9b275eb6f 100644 --- a/Samples/UWP/D3D12HDR/readme.md +++ b/Samples/UWP/D3D12HDR/readme.md @@ -1,7 +1,22 @@ -# HDR sample +--- +page_type: sample +languages: +- cpp +products: +- windows +- windows-uwp +name: Direct3D 12 HDR sample +urlFragment: d3d12-hdr-sample-uwp +description: Illustrates how to render HDR content, and detect whether the current display supports it. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 HDR sample ![HDR GUI](src/D3D12HDR.png) -This sample illustrates how to render HDR content and detect whether the current display supports it. +This sample illustrates how to render HDR content, and detect whether the current display supports it. ### Controls SPACE bar/ALT+ENTER - toggles between windowed and fullscreen modes. diff --git a/Samples/UWP/D3D12HelloWorld/readme.md b/Samples/UWP/D3D12HelloWorld/readme.md index 32c84db96..24b0b9244 100644 --- a/Samples/UWP/D3D12HelloWorld/readme.md +++ b/Samples/UWP/D3D12HelloWorld/readme.md @@ -1,19 +1,46 @@ -# Hello World Samples +--- +page_type: sample +languages: +- cpp +products: +- windows +- windows-uwp +name: Direct3D 12 Hello, World! samples +urlFragment: d3d12-hello-world-samples-uwp +description: This collection of samples act as an introduction to Direct3D 12. Each sample introduces an elementary concept, and lays a foundation for all of the Direct3D 12 samples. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 Hello, World! samples ![HelloWorlds GUI](src/D3D12HelloWorlds.png) -This collection of samples act as an introduction to Direct3D 12. Each sample introduces an elementary concept and lays a foundation for all of the Direct3D 12 samples. -## Hello Window Sample +This collection of samples act as an introduction to Direct3D 12. Each sample introduces an elementary concept, and lays a foundation for all of the Direct3D 12 samples. + +## Hello, window! sample + 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. -## Hello Triangle Sample + +## Hello, triangle! sample + This sample shows you how to draw a static triangle using a vertex buffer. -## Hello Texture Sample + +## Hello, texture! sample + This sample shows you how to apply a Texture2D to triangle. -## Hello Bundles Sample + +## Hello, bundles! sample + This sample shows you how to use Bundles to draw a static triangle more efficiently. -## Hello Constant Buffers Sample + +## Hello, constant buffers! sample + This sample shows you how to animate a triangle using a constant buffer. -## Hello Frame Buffering Sample + +## Hello, frame buffering! sample + This sample shows you how to use fences and multiple allocators to queue up multiple frames to the GPU. -### Optional Features +### Optional features The Texture and Constant Buffer samples have been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. \ No newline at end of file diff --git a/Samples/UWP/D3D12HeterogeneousMultiadapter/readme.md b/Samples/UWP/D3D12HeterogeneousMultiadapter/readme.md index d22c3f71f..ce9725d5f 100644 --- a/Samples/UWP/D3D12HeterogeneousMultiadapter/readme.md +++ b/Samples/UWP/D3D12HeterogeneousMultiadapter/readme.md @@ -1,12 +1,27 @@ -# Heterogeneous Multiadapter Sample +--- +page_type: sample +languages: +- cpp +products: +- windows +- windows-uwp +name: Direct3D 12 heterogeneous multiadapter sample +urlFragment: d3d12-heterogeneous-multiadapter-sample-uwp +description: Demonstrates how to share workloads among multiple heterogeneous GPUs using shared heaps. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 heterogeneous multiadapter sample ![HeterogeneousMultiadapter GUI](src/D3D12HeterogeneousMultiadapter.png) -This sample demostrates how to share workloads amongst multiple heterogeneous GPUs using shared heaps. In this sample, a large number of triangles are rendered to an intermediate render target on one GPU, then a second GPU performs a blur and presents it to the screen. +This sample demonstrates how to share workloads among multiple heterogeneous GPUs using shared heaps. In this sample, a large number of triangles are rendered to an intermediate render target on one GPU, then a second GPU performs a blur, and presents it to the screen. ## Requirements This sample is designed to run on a system with more than one GPU. This sample particularly targets hybrid laptops with a high performance discrete GPU and a lower performance integrated GPU. -For demonstration purposes, this sample will also run on a system with a single GPU and will use the software WARP adapter as the second GPU. You will need to install the "Graphics Tools" feature to make the DirectX 12 WARP rasterizer available. This can be done either by pressing ALT+F5 in Visual Studio (which launches the Graphics Debugger and automatically installs the feature if it is not available), or by navigating to the "Manage Optional Features" page in the Settings app and manually adding it from there. It should be noted, however, that the sample puts the primary workload on the adapter that is not connected to the display - which happens to be the WARP adapter - so it will actually run slower in this configuration than if there was no secondary adapter used at all. +For demonstration purposes, this sample will also run on a system with a single GPU and will use the software WARP adapter as the second GPU. You will need to install the **Graphics tools** feature to make the DirectX 12 WARP rasterizer available. This can be done either by pressing ALT+F5 in Visual Studio (which launches the Graphics Debugger, and automatically installs the feature if it is not available), or by navigating to the **Manage optional features** page in the Windows **Settings** app, and manually adding it from there. It should be noted, however, that the sample puts the primary workload on the adapter that is not connected to the display—which happens to be the WARP adapter—so it will actually run slower in this configuration than if there was no secondary adapter used at all. ### Optional Features -This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. \ No newline at end of file +This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. diff --git a/Samples/UWP/D3D12LinkedGpus/readme.md b/Samples/UWP/D3D12LinkedGpus/readme.md index 3f121264f..651f8e3af 100644 --- a/Samples/UWP/D3D12LinkedGpus/readme.md +++ b/Samples/UWP/D3D12LinkedGpus/readme.md @@ -1,9 +1,24 @@ -# Linked GPU Sample +--- +page_type: sample +languages: +- cpp +products: +- windows +- windows-uwp +name: Direct3D 12 linked GPU sample +urlFragment: d3d12-linked-gpu-sample-uwp +description: This sample demonstrates how to use two linked homogeneous (that is, CrossFire/SLI) GPUs to achieve greater performance than possible with only one GPU. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 linked GPU sample ![LinkedGPus GUI](src/LinkedGpus/D3D12LinkedGpus.png) -This sample demonstrates how to use two linked homogeneous (i.e. CrossFire/SLI) GPUs to achieve greater performance than possible with only one GPU. In particular, this sample shows the usage of a technique called Alternate Frame Rendering (AFR) which essentially allows you to use each GPU to render every other frame allowing a theoretical maximum performance of 2 times that of only one GPU. This is of course only theoretical and in practicality, there are things like inter-frame dependencies (things rendered on one GPU required by the other GPU for rendering the next frame) that add some overhead that doesn't otherwise exist in a single GPU case. Things like this limit the maximum benefit two GPUs can provide you over one. +This sample demonstrates how to use two linked homogeneous (that is, CrossFire/SLI) GPUs to achieve greater performance than possible with only one GPU. In particular, this sample shows the usage of a technique called Alternate Frame Rendering (AFR) which essentially allows you to use each GPU to render every other frame allowing a theoretical maximum performance of 2 times that of only one GPU. This is of course only theoretical and in practicality, there are things like inter-frame dependencies (things rendered on one GPU required by the other GPU for rendering the next frame) that add some overhead that doesn't otherwise exist in a single GPU case. Things like this limit the maximum benefit two GPUs can provide you over one. -Linked GPUs is what most people currently think of when someone mentions 'MultiGPU' and this sample shows how to utilize both GPUs using explicit MultiGPU. Most importantly, it shows how the app has full explicit control over the GPU hardware through the API (eg. work submission, synchronization, memory management, etc. can be controlled explicitly for each GPU independently). +Linked GPUs is what most people currently think of when someone mentions 'MultiGPU' and this sample shows how to utilize both GPUs using explicit MultiGPU. Most importantly, it shows how the app has full explicit control over the GPU hardware through the API (for example, work submission, synchronization, memory management, etc. can be controlled explicitly for each GPU independently). ## Solution structure There are three projects in this sample's Visual Studio solution: @@ -17,7 +32,7 @@ Beginners that want to enable MultiGPU in their apps should start by understandi # The Affinity Layer Library -One important thing to note about this sample is that it also demonstrates the usage of a helper library called the affinity layer. When working with two GPUs, the CPU will need to submit work to each GPU. Certain objects (ie. command lists, command queues, etc) can be 'affinitized' allowing work to be submitted to a specific GPU. The affinity layer also provides a simple way for the app to submit work to multiple GPUs at the same time. The affinity layer adds a thin layer of abstraction to help you enable MultiGPU in your app. +One important thing to note about this sample is that it also demonstrates the usage of a helper library called the affinity layer. When working with two GPUs, the CPU will need to submit work to each GPU. Certain objects (that is, command lists, command queues, etc) can be 'affinitized' allowing work to be submitted to a specific GPU. The affinity layer also provides a simple way for the app to submit work to multiple GPUs at the same time. The affinity layer adds a thin layer of abstraction to help you enable MultiGPU in your app. This library is intended to help apps kick start their MultiGPU implementation. The library itself is called the affinity layer in that execution and resources can be 'affinitized' to one or more GPUs in the system. This library should help developers quickly bring up DirectX 12 MultiGPU in their engines. @@ -32,14 +47,14 @@ Currently, this library tries to help developers implement one of the most commo There are many other possible techniques (other than AFR) for MultiGPU; some that are suitable candidates to be abstracted out into a library like the affinity layer, others that are not. We are looking at other scenarios where the library can fit in as a (almost) drop in solution. ## What is Alternate Frame Rendering (AFR)? -AFR does exactly as the name suggests. Frames are rendered in an alternating (i.e. round-robin) manner on each of the GPUs in the system. If there are two GPUs, the first GPU will render every even frame and the second GPU will render every odd frame. Since both GPUs can render in parallel, the theoretical maximum rendering frequency is twice that of a single GPU system. This is of course assuming both GPUs are identical in power, which, in linked GPU systems, they almost always are. +AFR does exactly as the name suggests. Frames are rendered in an alternating (that is, round-robin) manner on each of the GPUs in the system. If there are two GPUs, the first GPU will render every even frame and the second GPU will render every odd frame. Since both GPUs can render in parallel, the theoretical maximum rendering frequency is twice that of a single GPU system. This is of course assuming both GPUs are identical in power, which, in linked GPU systems, they almost always are. ## How does the library help apps implement AFR? One of the most common methods of achieving dual GPU AFR is to: - * Duplicate all non-system memory resources on both GPUs (i.e. textures, buffers, render targets, etc.) + * Duplicate all non-system memory resources on both GPUs (that is, textures, buffers, render targets, etc.) * Execute the same work on both GPUs * The ideal case being GPU1 starts rendering when GPU0 is 50% through it's rendering pass theoretically doubling the frame rate - * Copy any inter-frame dependencies across the GPUs so that they are available when the next frame (ie. the other GPU) starts rendering + * Copy any inter-frame dependencies across the GPUs so that they are available when the next frame (that is, the other GPU) starts rendering * An example of this might be a temporal AA dependency from frame N-1 needed for frame N Conceptually, it might look something like this: diff --git a/Samples/UWP/D3D12PipelineStateCache/readme.md b/Samples/UWP/D3D12PipelineStateCache/readme.md index 247fbc93f..bfb5ad92b 100644 --- a/Samples/UWP/D3D12PipelineStateCache/readme.md +++ b/Samples/UWP/D3D12PipelineStateCache/readme.md @@ -1,6 +1,21 @@ -# Pipeline State Cache Sample -This sample demonstrates the use of Direct3D 12 Pipeline State Object (PSO) libraries. An app can use PSO libraries to cache compiled PSOs to disk and avoid costly shader compilation during subsequent runs. Using PSO libaries can accelerate app load times and reduce rendering glitches caused by driver shader compilation. +--- +page_type: sample +languages: +- cpp +products: +- windows +- windows-uwp +name: Direct3D 12 pipeline state cache sample +urlFragment: d3d12-pipeline-state-cache-sample-uwp +description: This sample demonstrates the use of binary occlusion queries and predication in Direct3D 12. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 pipeline state cache sample +This sample demonstrates the use of Direct3D 12 pipeline state object (PSO) libraries. An app can use PSO libraries to cache compiled PSOs to disk and avoid costly shader compilation during subsequent runs. Using PSO libaries can accelerate app load times and reduce rendering glitches caused by driver shader compilation. This sample also demonstrates the use of an "uber shader" which is a shader that can perform a variety of effects by taking advantage of dynamic branching on the GPU. The motivation behind an uber shader is to alleviate frame rate glitches caused by an app compiling a PSO it hasn't encountered before. When this happens the app can simply configure the uber shader PSO (which it can compile up front at load time) with the desired effect and use that until the faster and more specialized PSO is done compiling. This results in slightly lower GPU performance for a while but produces more consistent and smoother results. -### Optional Features +### Optional features This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. \ No newline at end of file diff --git a/Samples/UWP/D3D12PredicationQueries/readme.md b/Samples/UWP/D3D12PredicationQueries/readme.md index a7df0f4ea..1dca889f2 100644 --- a/Samples/UWP/D3D12PredicationQueries/readme.md +++ b/Samples/UWP/D3D12PredicationQueries/readme.md @@ -1,7 +1,22 @@ -# Predication and Queries Sample +--- +page_type: sample +languages: +- cpp +products: +- windows +- windows-uwp +name: Direct3D 12 predication and queries sample +urlFragment: d3d12-predication-and-queries-sample-uwp +description: This sample demonstrates the use of binary occlusion queries and predication in Direct3D 12. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 predication and queries sample ![PredicationQueries GUI](src/D3D12PredicationQueries.png) This sample demonstrates the use of binary occlusion queries and predication in Direct3D 12. The sample renders two quads; one of them animates and periodically occludes the other. For each rendered frame, a binary occlusion query is executed and the SetPredication API is used to conditionally draw the potentially occluded quad. A transparency effect is used to illustrate when the query determines that the quad is fully occluded. -### Optional Features +### Optional features This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. \ No newline at end of file diff --git a/Samples/UWP/D3D12ReservedResources/readme.md b/Samples/UWP/D3D12ReservedResources/readme.md index 2affbe76e..73450dd45 100644 --- a/Samples/UWP/D3D12ReservedResources/readme.md +++ b/Samples/UWP/D3D12ReservedResources/readme.md @@ -1,7 +1,22 @@ -# Reserved Resources Sample +--- +page_type: sample +languages: +- cpp +products: +- windows +- windows-uwp +name: Direct3D 12 reserved resources sample +urlFragment: d3d12-reserved-resources-sample-uwp +description: This sample demonstrates the use of reserved resources in DirectX 12. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 reserved resources sample ![ReservedResources GUI](src/D3D12ReservedResources.png) This sample demonstrates the use of reserved resources in DirectX 12. In this sample, a quad is textured with a reserved (aka: tiled) resource containing a full mip chain. The currently visible mip is mapped and unmapped to the reserved resource on demand. By pressing the arrow keys, you can change which mip is visible. The sample also demonstrates that all the tiles in a reserved resource are not required to reside in the same heap. This functionality allows apps to persist heaps containing tiles that are likely to be used again and discard heaps that are no longer needed. -### Optional Features +### Optional features This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. \ No newline at end of file diff --git a/Samples/UWP/D3D12Residency/readme.md b/Samples/UWP/D3D12Residency/readme.md index 036bebc02..2d4a1eb14 100644 --- a/Samples/UWP/D3D12Residency/readme.md +++ b/Samples/UWP/D3D12Residency/readme.md @@ -1,7 +1,22 @@ -# The D3D12 Residency Starter Library +--- +page_type: sample +languages: +- cpp +products: +- windows +- windows-uwp +name: Direct3D 12 residency starter library +urlFragment: d3d12-residency-starter-library-uwp +description: This library is intended to be a low-integration-cost turnkey solution to managing your Direct3D 12 heaps/committed resources. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 residency starter library ## What is this library? -This library is intended to be a low-integration-cost turnkey solution to managing your D3D12 heaps/committed resources to reduce the chance that you will get into an overcommitted video memory situation as well as ensure your performance remains as good as it can be when you do end up in that situation. +This library is intended to be a low-integration-cost turnkey solution to managing your Direct3D 12 heaps/committed resources to reduce the chance that you will get into an overcommitted video memory situation as well as ensure your performance remains as good as it can be when you do end up in that situation. It implements essentially the same memory management behavior that a D3D11 app would get from the layers below the API. In D3D12, the layers below the API cannot do this for you on account of the more flexible API, more direct access to memory, and bindless architecture. That's where this residency library comes in. @@ -33,47 +48,49 @@ From this, you can infer that in order for a D3D12 application to achieve the sa * Synchronize correctly so that rendering cannot happen until these heaps are made resident * Track when heaps are in use on the GPU so that they can be evicted only when the GPU is done with them -The library provides interfaces to indicate when a resource is going to be used for rendering and handles all of the ```MakeResident```/```Evict``` calls as well as all the required synchronization. +The library provides interfaces to indicate when a resource is going to be used for rendering and handles all of the **MakeResident**/**Evict** calls as well as all the required synchronization. ## Alright, how do I use it? Here are the high level steps for using the library: -1. Create a ```D3DX12Residency::ResidencyManager``` -2. Create a ```D3DX12Residency::ManagedObject``` for every heap/committed resource you want the library to manage - 1. The library works by tracking/evicting/making resident the ```ManagedObject's``` underlying heap/committed resource -3. Use ```ResidencyManager::BeginTrackingObject``` to start managing each ```ManagedObject``` -4. Use a ```D3DX12Residency::ResidencySet``` to track which heaps will be used in a particular command list (it will be a 1:1 relationship) - 1. It's essentially a list of ```ManagedObjects``` which will need to be resident when a command list executes -5. Use ```ResidencyManager::ExecuteCommandLists``` to execute the workload which takes a command queue, array of command lists, an array of residency sets, and a count +1. Create a **D3DX12Residency::ResidencyManager** +2. Create a **D3DX12Residency::ManagedObject** for every heap/committed resource you want the library to manage + 1. The library works by tracking/evicting/making resident the **ManagedObject**'s underlying heap/committed resource +3. Use **ResidencyManager::BeginTrackingObject** to start managing each **ManagedObject** +4. Use a **D3DX12Residency::ResidencySet** to track which heaps will be used in a particular command list (it will be a 1:1 relationship) + 1. It's essentially a list of **ManagedObject**s which will need to be resident when a command list executes +5. Use **ResidencyManager::ExecuteCommandLists** to execute the workload which takes a command queue, array of command lists, an array of residency sets, and a count 1. This will execute the command lists and ensure all of the heaps/committed resources that you need to execute are resident at the right times -### Optional Features +### Optional features This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. ### FAQs -#### What exactly is Residency? -Residency correlates to whether a heap is accessible by the GPU or not. If it is not resident, you should not be touching that resource (neither read nor write). A resident resource can be used by the GPU. The ```MakeResident``` and ```Evict``` calls are what controls whether a heap is resident or not. +#### What exactly is residency? +Residency correlates to whether a heap is accessible by the GPU or not. If it is not resident, you should not be touching that resource (neither read nor write). A resident resource can be used by the GPU. The **MakeResident** and **Evict** calls are what controls whether a heap is resident or not. -#### What does calling ```Evict``` do? -```Evict``` is essentially a promise that you will not touch the heap until you call ```MakeResident``` again at which point you also promise to wait until ```MakeResident``` returns to start using that heap. It means that VidMM (Video Memory Manager) can repurpose that memory (eg. for another app) if the system is under memory pressure and it needs it. +#### What does calling **Evict** do? +**Evict** is essentially a promise that you will not touch the heap until you call **MakeResident** again at which point you also promise to wait until **MakeResident** returns to start using that heap. It means that VidMM (Video Memory Manager) can repurpose that memory (eg. for another app) if the system is under memory pressure and it needs it. -Note that when you call ```Evict```, the heap is only marked for eviction. VidMM will try really hard not to evict it if it doesn't need to thereby making the subsequent ```MakeResident``` call (when you call it) a no-op (ie. nothing needs to happen and your heap is ready for use almost immediately). +Note that when you call **Evict**, the heap is only marked for eviction. VidMM will try really hard not to evict it if it doesn't need to thereby making the subsequent **MakeResident** call (when you call it) a no-op (ie. nothing needs to happen and your heap is ready for use almost immediately). -#### What does calling ```MakeResident``` do? -```MakeResident``` is a blocking call which will bring your heap data and page table mappings back as they were before you called Evict. You don't need to copy the data back in. +#### What does calling **MakeResident** do? +**MakeResident** is a blocking call which will bring your heap data and page table mappings back as they were before you called Evict. You don't need to copy the data back in. -#### Why would I use ```MakeResident``` and ```Evict```? -In return for using ```MakeResident``` and ```Evict```, VidMM promises to return the data and page table mappings back to their original state before you called ```Evict``` as well as try its hardest to not actually evict anything if it nothing else needs that memory. In many cases, this is better than destroying the heap/committed resource in which case you would need to recreate the heap/committed resource, re-copy the data into an upload heap, and execute a GPU copy before making it available again to the renderer. The chance for ```MakeResident``` to be a no-op also improves the average case performance when compared to a destruction/recreation/repopulating technique. +#### Why would I use **MakeResident** and **Evict**? +In return for using **MakeResident** and **Evict**, VidMM promises to return the data and page table mappings back to their original state before you called **Evict** as well as try its hardest to not actually evict anything if it nothing else needs that memory. In many cases, this is better than destroying the heap/committed resource in which case you would need to recreate the heap/committed resource, re-copy the data into an upload heap, and execute a GPU copy before making it available again to the renderer. The chance for **MakeResident** to be a no-op also improves the average case performance when compared to a destruction/recreation/repopulating technique. ### Other Library FAQs -#### What is the ```MaxLatency``` parameter in the ResidencyManager's ```Initialize``` method? -When rendering very quickly, it is possible for the renderer to get too far ahead of the library's worker thread. The ```MaxLatency``` parameter helps to limit how far ahead it can get. The value should essentially be the average ```NumberOfBufferedFrames * NumberOfCommandListSubmissionsPerFrame``` throughout the execution of your app. +#### What is the *MaxLatency* parameter in the ResidencyManager's **Initialize** method? +When rendering very quickly, it is possible for the renderer to get too far ahead of the library's worker thread. The *MaxLatency* parameter helps to limit how far ahead it can get. The value should essentially be the average `NumberOfBufferedFrames * NumberOfCommandListSubmissionsPerFrame` throughout the execution of your app. #### The Visual Studio Graphics Debugging (VSGD) tools crash when capturing an app that uses this library You can work around this bug by using the library's single threaded mode using the line: + ``` #define RESIDENCY_SINGLE_THREADED 0 ``` + 0 is the default; change it to 1 to force single threaded behavior to work around the issue. diff --git a/Samples/UWP/D3D12SM6WaveIntrinsics/readme.md b/Samples/UWP/D3D12SM6WaveIntrinsics/readme.md index 2b90f7a74..169ebb50e 100644 --- a/Samples/UWP/D3D12SM6WaveIntrinsics/readme.md +++ b/Samples/UWP/D3D12SM6WaveIntrinsics/readme.md @@ -1,8 +1,23 @@ -# Shader Model 6 Wave Intrinsics Sample -This sample visualizes how Wave Intrinsics work. Wave intrinsics are a new set of intrinsics for use in HLSL Shader Model 6. They enable operations across lanes in the SIMD processor cores, helping the performance of certain algorithms such as culling and packing sparse data sets. +--- +page_type: sample +languages: +- cpp +products: +- windows +- windows-uwp +name: Direct3D 12 shader model 6 wave intrinsics sample +urlFragment: d3d12-shader-model-6-wave-intrinsics-sample-uwp +description: This sample visualizes how wave intrinsics work. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 shader model 6 wave intrinsics sample +This sample visualizes how wave intrinsics work. Wave intrinsics are a new set of intrinsics for use in HLSL shader model 6. They enable operations across lanes in the SIMD processor cores, helping the performance of certain algorithms such as culling and packing sparse data sets. Doc and other resources: -*) Wave Intrinsics Wiki: https://github.com/Microsoft/DirectXShaderCompiler/wiki/Wave-Intrinsics +*) Wave intrinsics Wiki: https://github.com/Microsoft/DirectXShaderCompiler/wiki/Wave-Intrinsics *) DirectX MiniEngine: This engine takes advantage of the wave intrinsics to improve the performance of forward plus lighting. https://github.com/Microsoft/DirectX-Graphics-Samples/tree/master/MiniEngine Requirement: diff --git a/Samples/UWP/D3D12SmallResources/readme.md b/Samples/UWP/D3D12SmallResources/readme.md index 6a143910a..8045037f0 100644 --- a/Samples/UWP/D3D12SmallResources/readme.md +++ b/Samples/UWP/D3D12SmallResources/readme.md @@ -1,4 +1,19 @@ -# Small Resources Sample +--- +page_type: sample +languages: +- cpp +products: +- windows +- windows-uwp +name: Direct3D 12 small resources sample +urlFragment: d3d12-small-resources-sample-uwp +description: This sample demonstrates the use of small placed resources in Direct3D 12. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 small resources sample ![SmallResources GUI](src/D3D12SmallResources.png) This sample demonstrates the use of small placed resources in Direct3D 12. The sample allocates a number of small textures using 4K resource alignment and shows the potential memory savings gained by using placed resources over committed and reserved resources which use 64K resource alignments. The resource type and current GPU memory usage are displayed in the window's title bar. @@ -6,5 +21,5 @@ This sample demonstrates the use of small placed resources in Direct3D 12. The s ### Controls SPACE bar - toggles between using placed and committed resources. -### Optional Features +### Optional features This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. \ No newline at end of file diff --git a/Samples/UWP/D3D12VariableRateShading/readme.md b/Samples/UWP/D3D12VariableRateShading/readme.md index 435c92881..9a3d92e35 100644 --- a/Samples/UWP/D3D12VariableRateShading/readme.md +++ b/Samples/UWP/D3D12VariableRateShading/readme.md @@ -1,7 +1,22 @@ -# Variable Rate Shading sample +--- +page_type: sample +languages: +- cpp +products: +- windows +- windows-uwp +name: Direct3D 12 variable-rate shading sample +urlFragment: d3d12-variable-rate-shading-sample-uwp +description: This sample illustrates how to use variable-rate shading (VRS) to improve application performance. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 variable-rate shading sample ![Variable Rate Shading GUI](src/Screenshot.PNG) -This sample illustrates how to use Variable Rate Shading (VRS) to improve application performance. VRS adds the concept of subsampling, where shading can be computed at a level coarser than a pixel. For example, a group of pixels can be shaded as a single unit and the result is then broadcast to all samples in the group. This is great for areas of the image where extra detail doesn't help - such as those behind HUD elements, transparencies, blurs (depth-of-field, motion, etc.), and optical distortions due to VR optics. +This sample illustrates how to use variable-rate shading (VRS) to improve application performance. VRS adds the concept of subsampling, where shading can be computed at a level coarser than a pixel. For example, a group of pixels can be shaded as a single unit, and the result is then broadcast to all samples in the group. This is great for areas of the image where extra detail doesn't help—such as those behind HUD elements, transparencies, blurs (depth-of-field, motion, etc.), and optical distortions due to VR optics. #### Recommended scenarios to try Hit SPACE to stop the light animating and then use the [F1-F5] keys to toggle between presets for Shading Rates. Can you spot the visual difference between F1 and F2? Try experimenting with the various controls to find an acceptable balance between degraded-visuals and performance. diff --git a/Samples/UWP/D3D12nBodyGravity/readme.md b/Samples/UWP/D3D12nBodyGravity/readme.md index eb0d54626..0d7b8539d 100644 --- a/Samples/UWP/D3D12nBodyGravity/readme.md +++ b/Samples/UWP/D3D12nBodyGravity/readme.md @@ -1,7 +1,22 @@ -# n-Body Gravity Sample +--- +page_type: sample +languages: +- cpp +products: +- windows +- windows-uwp +name: Direct3D 12 n-body gravity sample +urlFragment: d3d12-n-body-gravity-sample-uwp +description: This sample demonstrates the use of asynchronous compute shaders (multi-engine) to simulate an n-body gravity system. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 n-body gravity sample ![nBodyGravity GUI](src/D3D12nBodyGravity.png) -This sample demonstrates the use of asynchronous compute shaders (multi-engine) to simulate an n-body gravity system. Graphics commands and compute commands can be recorded simultaneously and submitted to their respective command queues when the work is ready to begin execution on the GPU. This sample also demonstrates advanced usage of fences to synchronize tasks across command queues. +This sample demonstrates the use of asynchronous compute shaders (multi-engine) to simulate an n-body gravity system. Graphics commands and compute commands can be recorded simultaneously, and submitted to their respective command queues when the work is ready to begin execution on the GPU. This sample also demonstrates advanced usage of fences to synchronize tasks across command queues. -### Optional Features +### Optional features This sample has been updated to build against the Windows 10 Anniversary Update SDK. In this SDK a new revision of Root Signatures is available for Direct3D 12 apps to use. Root Signature 1.1 allows for apps to declare when descriptors in a descriptor heap won't change or the data descriptors point to won't change. This allows the option for drivers to make optimizations that might be possible knowing that something (like a descriptor or the memory it points to) is static for some period of time. \ No newline at end of file diff --git a/Samples/UWP/D3D12xGPU/readme.md b/Samples/UWP/D3D12xGPU/readme.md index f152577ee..308fc5f6e 100644 --- a/Samples/UWP/D3D12xGPU/readme.md +++ b/Samples/UWP/D3D12xGPU/readme.md @@ -1,11 +1,26 @@ -# xGPU sample +--- +page_type: sample +languages: +- cpp +products: +- windows +- windows-uwp +name: Direct3D 12 xGPU sample +urlFragment: d3d12-xgpu-sample-uwp +description: This sample illustrates how to detect and handle a D3D device removed event. +extendedZipContent: +- path: LICENSE + target: LICENSE +--- + +# Direct3D 12 xGPU sample ![xGPU GUI](src/Screenshot.PNG) This sample illustrates how to detect and handle a D3D device removed event. Particularly in a case of an external GPU (xGPU) being plugged/unplugged. When a device is removed, any further D3D commands will fail with DXGI_ERROR_DEVICE_REMOVED. The sample detects this, destroys D3D resources and recreates them on the next available adapter. Then it continues rendering the next frame while retaining application and scene state. The adapter is selected based on a GPU sorting mode applied by the application. Note, the application selected sorting mode will be superseded by a global preference for the application if there is one. The global preference for an application can be set by a user on the Advanced graphics settings page which can be found as a link from the Display section of Windows Settings. -Another important event is when a new GPU is plugged into the system. The sample uses IDXGIFactory7::RegisterAdaptersChangedEvent() to register for event notifications when this happens. At that time, the sample re-enumerates adapters and if a better adapter is found according to the GPU sorting mode, the application recreates all D3D resources using the new adapter. +Another important event is when a new GPU is plugged into the system. The sample uses IDXGIFactory7::RegisterAdaptersChangedEvent to register for event notifications when this happens. At that time, the sample re-enumerates adapters and if a better adapter is found according to the GPU sorting mode, the application recreates all D3D resources using the new adapter. -As the sample is able to survive an adapter removal event, it declares that it supports adapter removal via DXGIDeclareAdapterRemovalSupport API. This allows Windows to identify such apps and act accordingly, for example, to allow safe detachment of the xGPU even when this application is rendering on it. This behavior is also successfully tested via [DXGIAdapterRemovalSupportTest.exe](../../../Tools/DXGIAdapterRemovalSupportTest/readme.md). +As the sample is able to survive an adapter removal event, it declares that it supports adapter removal via the DXGIDeclareAdapterRemovalSupport API. This allows Windows to identify such apps and act accordingly, for example, to allow safe detachment of the xGPU even when this application is rendering on it. This behavior is also successfully tested via [DXGIAdapterRemovalSupportTest.exe](https://github.com/microsoft/DirectX-Graphics-Samples/tree/master/Tools/DXGIAdapterRemovalSupportTest). ### Controls * ALT+ENTER - toggles between windowed and fullscreen modes. @@ -14,5 +29,5 @@ As the sample is able to survive an adapter removal event, it declares that it s * [1-9] - adapter selection, when manual override is enabled. ## Requirements -* Windows 10 17655 or higher (available via [Windows Insider Program](https://insider.windows.com/en-us/)) +* Windows 10 17655 or higher (available via [Windows Insider Program](https://insider.windows.com/)) * [Visual Studio 2017](https://www.visualstudio.com/) with the Windows 10 17655 SDK \ No newline at end of file