We are currently trying to eliminate the need for manually recording PSOs and for this purpose we would like to enable automatic precaching for all global shaders. We have found this console variable, which supposedly should do just that:
I think this code should check whether the given shader is a compute shader or something else and call FPrecacheGraphicsPipelineCache::PrecacheGraphicsPipelineState instead for non-compute shaders, but I am not sure how or even if it is possible to get the necessary information to fill the FGraphicsPipelineStateInitializer required for calling this function.
Do you think there is an easy fix for this or will we just have to live with having to record PSOs to avoid stutters from these global shaders?
Hi David, I was able to reproduce this issue as well, and I have not seen that we added a fix for this issue in our latest development stream. I assume we added the option solely for compute shaders, since they have historically taken way longer to compile; however, that does not explain why we have a choice also to precompile non-compute shaders. I have created a Jira so we can properly resolve this: https://issues.unrealengine.com/issue/UE\-366678\. In the meantime, you might need to run without that option to avoid the crash. How soon do you need a fix for this issue?
Ok, thanks for letting me know. If collecting a PSO bundle covers is acceptable to you right now, then we at least have a workaround in place for the time being. I will close out the case then, but do let me know if you find any other similar issues.
It’s not urgent for us, since we can simply record PSOs the old fashioned way to work around this. Would just have been nice to have as this is one of the last remaining places where we haven’t found a way to asynchronously precache PSOs on demand.