We are pleased to announce the retail release of AgilitySDK 1.618, available on Agility SDK Downloads today! This release promotes our 1.716 features out of preview and also introduces support for the recently announced advanced shader delivery feature.
Advanced Shader Delivery
Advanced shader delivery is a new feature that distributes precompiled shaders when downloading a game, eliminating in-game shader compilation stutter and long load times. This solves one of the biggest pain points in PC gaming today, making it easier than ever to deliver a console-quality experience on Windows.
Advanced shader delivery is coming on October 16th to the new ROG Xbox Ally handhelds and we’re happy to share some of the tooling that allowed us to enable this first step towards solving long load times and stutter in games for players. Gamers who own these devices receive precompiled shaders at download time on select titles to start gaming faster. In today’s blog, we will focus on the other side of the equation: game development.
Our vision is for game developers to programmatically capture and generate a new type of asset from pipeline state object inputs, called a State Object Database (SODB), in their game engine during the development process. This is better than our temporary solution of manual capture because game engines can collect the full set of shaders in a title, nearing a 100% shader cache hit rate. Studios will then take this more complete SODB and package it with their game, Downloadable Content (DLC), or updates. This will ultimately result in future titles having support for advanced shader delivery on day one for the fastest and smoothest gaming experience on Windows. This also allows Windows to support console-like load times across the hardware ecosystem.
Today Xbox is leading the industry with support in the Xbox app, but in the future, any storefront can compile the SODBs to Precompiled Shader Databases (PSDBs) and distribute them. All of the functionality to support this is built into Windows 11 with DirectX and anybody delivering games on the platform is empowered to enable this scenario for their customers.
Today’s Agility SDK release unveils the first important step in that long term vision by giving game studios the opportunity to begin using the same tools that we used to enable advanced shader delivery for the ROG Xbox Ally and Xbox Ally X.
This release introduces 3 important pieces related to advanced shader delivery:
- State Object Database (SODB) Authoring and Collection Tools
- Offline compilers from our hardware partners
- Game Installer Registration APIs
Together, these enable game developers to create a SODB that can be compiled into a PSDB locally for testing.
SODB Authoring and Collection
The state object database (SODB) is a new standardized format for pipeline state objects (PSOs) and state objects (SOs, e.g., for raytracing) that are the inputs for precompiled shaders. An SODB is a SQLite3 database containing the shaders, as well as the structure for how to group them together into PSOs and SOs. In the latest Agility SDK, game developers now can collect SODBs from their titles during development, which are the input for previewing how precompiled shaders will appear on players’ devices.
To enable SODB collection, use the d3dconfig.exe command line tool.
- Add the application to d3dconfig to apply settings.
d3dconfig.exe apps –add <exefilename>
Notes:
-
- Full path may also be used, but be aware that applications launched through hard links or other references that may not match this path.
- Settings are applied to all instances of the matching exe.
- Set the path for the SODB file output.
d3dconfig.exe device enable-pso-path=<filepath>.sodb
Notes:
-
- All matching d3dconfig apps write to this db. Use exe apps to see the currently configured applications.
- Enable SODB collection.
d3dconfig.exe device enable-pso-db=true
- Play through the game and exit. Pipeline State Objects and State Objects created by the D3D12 API are recorded to the database specified in step 2.
Note: Recording state objects in the current implementation adds significant overhead, especially since state object creation is commonly multithreaded, and those threads will be serialized for file I/O.
An existing SODB may be specified so only new state objects are written, reducing overhead.
Offline Compilers
After collecting SODBs, the next step is to use the offline compilers to precompile shaders. These are “offline” in the sense that the compilation happens outside of the target game process and does not use or require a GPU. In other words, the offline compilers convert the SODB input into a precompiled shader output that can target a wide range of hardware from a single plugin, without needing that physical hardware present in your PC.
The Agility SDK contains the D3D12 state object compiler which can load compiler plugins provided by GPU vendors. The state object compiler has an API hosted by D3D12StateObjectCompiler.dll, and a command line harness in D3D12StateObjectCompiler.exe, for convenience. The command line tool requires SODB files, while the API operates on one PSO or SO at a time. The output of these tools is a precompiled shader database (PSDB), which can then be registered for your application to facilitate cache lookups.
Some Independent Hardware Vendors (IHVs) have an offline compiler game developers can start testing with today to compile shaders, while others will be coming soon. Here’s what our partners have to say.
AMD:
AMD compiler plugin support is available in the AMD Software: AgilitySDK Developer Preview Edition 25.10.07.01 Sept 25 Update: https://www.amd.com/en/resources/support-articles/release-notes/RN-RAD-MS-AGILITY-SDK-25-10-07-01.html
Intel:
Intel is excited to partner with Microsoft in providing a console-like shader compilation experience to gamers on PC. Game developers can look for our offline compiler and driver support in November later this year.
Qualcomm:
The advanced shader delivery feature marks a significant breakthrough in elevating the gaming experience. We’re excited about its potential and are actively collaborating with our ecosystem partners to bring this capability to Adreno GPUs. Stay tuned as we work to bring this innovation to life.
Nvidia:
“By collaborating with Microsoft to implement support for advanced shader delivery, NVIDIA is equipping game developers with tools to improve game load times and deliver a stutter-free experience for gamers.” – Henry Lin, Director of Product Management, Gaming & AI at NVIDIA.
Game Installer Registration APIs:
The Agility SDK also includes a new set of APIs for registering PSDBs on a Windows system. This registration enables D3D to find your PSDBs with no code changes on the title side. These APIs are currently supported by the Xbox PC app. In the future, they are intended to be used by other game storefronts on client devices to find precompiled shaders on a gamer’s machine after download. It can also be used by game developers to test ahead-of-time compilation in development environments. For example, as part of a nightly build process, game developers might want to precompile shaders to target the most common GPUs present in developer, artist, or QA devices. These APIs enable game developers to test that build of the game without waiting for shaders to compile, increasing development efficiency.
To learn more about these APIs, click here.
“Load times are high on the list of things PC gamers and developers want to see us improve. ASD and the Agility SDK have helped us deliver massive launch time improvements on ROG Xbox Ally and Ally X. We look forward to bringing this feature to more games and devices through the Xbox PC App.”
– Team Xbox
What’s next?
The ROG Xbox Ally and Xbox Ally X will be the first devices to take advantage of these new capabilities, resulting in getting players into the game up to 10x faster, smoother, more consistent gameplay performance, and improved battery life. Our partners in Team Xbox have collected SODBs for a select set of popular titles, compiled them for these new handheld devices, and will deliver the precompiled shaders alongside the game package when a player downloads and installs a game from the Xbox on PC app. When players using these devices download games or install a new driver, Xbox will update the precompiled shaders to ensure you are always taking full advantage of the latest improvements.
Call to Action
With these tools, if you are a developer publishing to the Xbox Store on PC and want to support advanced shader delivery, please reach out to your Microsoft contact or give us feedback on the DirectX Discord.
All developers should start thinking about how to integrate SODBs into your build flows. This will prepare you and your pipeline to scale up advanced shader delivery support in the future. Stay tuned for new APIs that enable closer cooperation with this infrastructure, coming soon.
Leading PC game stores can now enable compiling SODBs and registering PSDBs on Windows – please provide any feedback on this process or requests to our Discord.
Appendix: A brief history of shader compilation and caching in D3D
In older versions of D3D, shaders were bound to the graphics pipeline independently from each other, as well as independently from fixed-function pipeline states. That meant that often times, final compilation to GPU instructions needed to be deferred until draw time, when all shaders and state could be resolved together, meaning apps had no visibility or control over the compilation process.
D3D12 changed things here in two major ways in line with the paradigm shift towards everything becoming more explicitly under application control:
- Grouping together state into pipeline state objects (PSOs) meant that final compilation to GPU instructions could happen at a time that the app controlled.
- The compiled result could be retrieved and persisted by the app, at first by doing one PSO at a time, and then in a second iteration by grouping them together into a library to avoid storing redundant data. In either case, these caches were not portable and could not be shared from one PC to another.
As it turns out, the explicit caching had a huge problem: not everybody did it, and nobody told the driver whether the app was going to do it. That meant that drivers all implicitly cached shaders anyway, since they didn’t know if the app would do it, so when an app did use these APIs, you just ended up with 2 copies of shaders on disk.
Advanced shader delivery is the latest iteration of D3D12’s shader caching APIs. In this first phase, we’re effectively taking advantage of the fact that all drivers have an implicit shader cache. D3D12 has long provided interfaces to the driver to leverage an OS shader cache component, as mentioned in the Shader Cache spec. Now, those same interfaces can return shaders compiled ahead-of-time and registered for your app as a Precompiled Shader Database (PSDB). With a PSDB registered for your app, the driver’s implicit caching strategies get an additional data source, and if all the app’s shaders are present in the PSDB, you can get a 100% cache hit rate on the game’s first run.
0 comments
Be the first to start the discussion.