Jump to content
  • Advertisement
Sign in to follow this  
Funkymunky

[D3D12] Shader Blob and PSO

This topic is 523 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

When I create a Pipeline State Object, I pass it a pipeline state descriptor that contains D3D12_SHADER_BYTECODE structures that have been derived from ID3DBlobs.  Currently, those blobs are local to the function; I don't keep track of them beyond the call to CreateGraphicsPipelineState.  Is the bytecode associated with that blob released at this point?  I ask because I would like to create a system that caches the shaders used in the pipeline states.  If you use the same vertex shader twice, it seems unnecessary to re-compile it every time.  However, this is not going to be the common case, and I don't want to hold on to those blobs if doing so is going to keep data in RAM that I don't generally need.

Share this post


Link to post
Share on other sites
Advertisement

If you want to save memory, the real game changer is ID3D12PipelineLibrary.

 

You should always precompile your shader, then at runtime, there is two things, caching the cached blob from Pipeline creations for later run, it is a performance optimisation as you skip the bytecode to microcode compilation, and then the new interface, the library that allow sharing of inner parts of the pipelines. It is hard to measure the gains, but they can be substantial.

Share this post


Link to post
Share on other sites

sharing of inner parts of the pipelines
 

 

Is that something I can manually direct it to do, or is that managed by the driver?

Share this post


Link to post
Share on other sites

 

sharing of inner parts of the pipelines
 

 

Is that something I can manually direct it to do, or is that managed by the driver?

 

 

It is a Microsoft and driver layer collaboration. You don't know what can be shared, it is an implementation details. But it can definitely make a difference with thousands of PSO.

Share this post


Link to post
Share on other sites

You should always precompile your shader
^^This too. You can save a hell of a lot of work at runtime if you precompile all your blobs and save the bytecode to a file. 

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!