Jump to content
  • Advertisement
Sign in to follow this  
CodeBoyCjy

PSO cache

This topic is 1087 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anyone knows how to cache a PSO in D3D12?

 

It provides an interface called GetCachedBlob returning serialized data which can be used to regenerate the same PSO later, so that developers can cook a PSO cache for accelerating the creation of PSOs.

 

My question is how to use the cached blob to regenerate the exact same PSO?

D3D12_GRAPHICS_PIPELINE_STATE_DESC includes an description called D3D12_CACHED_PIPELINE_STATE, however it failed to create the PSO if only the cached fields are filled. It still needs full description with the extra PSO cached state to regenerate the PSO.

 

Thanks

Share this post


Link to post
Share on other sites
Advertisement
You'll likely have to wait until the final DX12 is officially released with final docs and samples.

Right now the people who know this cannot answer you without probably breaking NDAs; unless you're lucky enough to find someone who figured it out on his own (which is probably not a good idea because the information would be half-cooked).

Share this post


Link to post
Share on other sites


Right now the people who know this cannot answer you without probably breaking NDAs; unless you're lucky enough to find someone who figured it out on his own (which is probably not a good idea because the information would be half-cooked).

 

This is pretty accurate. I know some EAP people have been very willing to help out with DX12 stuff around here, but generally speaking I'd assume that a lot of the people who are in the EAP or who got DX12 access through other means are sort of in a grey area when it comes to giving out information now the API is in this weird "available to the public, but not really" state; I feel that this is true for me at least, can't speak for anyone else.

 

Once it's released and once the people under NDA get a green light for speaking about it more openly you'll see a lot more info appear.

Share this post


Link to post
Share on other sites

Now that the flood gates are being opened, I can answer.

The source code provided by the post above pretty much covers it. A couple of notes:

 

  1. You still need to fill all the values from the D3D12_GRAPHICS_PIPELINE_STATE_DESC, not just the blob pointer. The DX API is likely unable to read the blob, only the driver, thus it needs you to still fill this data.
  2. The cache is unique to a driver & GPU model.
  3. Because of the above, you have to check whether PSO creation out of cache succeeded. It can fail if the user updated his drivers or changed his GPU. You can see that the source code provided by MS is doing exactly this.
  4. Most of the time is spent compiling HLSL shaders to D3D bytecode ASM, which is an intermediary representation. You should cache this (which is GPU/driver agnostic) and that has been possible since DX11. PSOs go one step further by allowing you to cache the D3D bytecode -> ISA translation, which is usually fast, but still a nice bonus.

Share this post


Link to post
Share on other sites

Note also that debug VS release build should also invalided the PSO cache, at least the due the Root Layout which should be different...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!