Right now, if someone tried to run my game or demo without having appropriate hardware, the game will eventually hit an exception about the hardware not being supported. One example of this is a message like “Platform windows 7 (6.1.0) 64bit with device Direct3D11 is not supported, no rendering will occur.”, which will occur if the user is running an old graphics card that doesn’t support shader model 5.0.
What I’d ideally like to so is detect, early on, whether the user’s hardware is reasonable to run the game. The only way I can think to do something like that is to run a scene that has all possible graphics features enables, and see if some exception occurs while doing so. Is there some better approach? Is there something I can run to determine whether the player’s current hardware is sufficient to ruin an HDRP game?
Not that i know of, BUT documentation can help, meaning: if you plan to publicly release the game, you should have the min and recommended specs (like on Steam page, example), posted/known before they buy or use. HDRP is only for high end PC and consoles.
Just make sure to note it on any releases, no need to go through the headache of a detection/notification system.
The thing is, despite listing specs (which I’m doing) that stop people from trying to run the game/demo with hardware that isn’t supported. This then results in exceptions, which get reported to me, and I have to spend some time going through the error report and determining that this is just another case of insufficient hardware. Ideally I’d alert the user to the problem right away, rather than basically crash later, and save myself the error report. This would be good for users as well, who would get a clear message that their hardware isn’t sufficient, rather than the current state, where they just see some complicated error showing up.
So, I’d still like to come up with a clear way to inform users that their hardware isn’t up to the task.
I have not tried this, but you can check UnityEngine.Rendering.HighDefinition.HDRenderPipeline.IsSupportedPlatform* and see if you can replicate the tests they do in there. Some of the methods they call are internal, and others private, but in the end they just check the platform, the OSX version, and some system information and shaders.
If you get a negative result, you can display a message on the UI informing the player of the issue. The “no rendering will occur” does not include UI, so you at least can present a nice box with the problem explained.
In Library\PackageCache\com.unity.render-pipelines.high-definition@..*\Runtime\RenderPipeline\HDRenderPipeline.cs
I took a look at what was available in HDUtils. It’s a bit difficult to use, both because most of the methods are internal, but also because a fair bit of the code it uses UnityEditor classes, which aren’t available in a build. In general, it seems I can answer some of the questions I want, but to know for sure I probably need to build a mini test harness into the game to be sure. Or just let the game crash, which is much less desirable.
, plus a check on one shader.isSupported and SystemInfo.SupportsCustomShaders in HDRenderPipeline.
Those methods execute some basic checks and nothing more. The problem is that, being internal and private, you’d need to replicate their behaviour and maintain it, as you move to new HDRP versions.
I’ll do just that for my project, and also will try to submit a pull request to the HDRP project to expose the check.
But two of those methods (AreGraphicsAPIsSupported and IsSupportedBuildTarget) accept arguments in the UnityEditor namespace, and won’t work in a build. Looking deeper into those methods, they mostly contain more editor code. Finally, even if I could use those methods as-is, I’m not sure they reasonably answer the question of whether the current system will support HDRP. As a recent example, I had a Windows 7 user, using Direct3D11, crash due to his GPU not supporting Shader Model 5.0. It seems that using the above methods, it would have told me his system supported HDRP, but I believe it does not.
Another tricky thing about this is whether enabling certain HDPR features at runtime can affect whether a system supports the game. I’m not using Ray Tracing, but clearly that kind of feature is only supported by certain hardware.I wonder if the same is true for other features, like tessellation, motion vectors, etc, such that if I give players the option to enable certain features, I first need to verify they can use those features, or the game will crash.
It feels more and more like I’d want some kind of benchmark tool, deployable with a game, that verifies which features are supported on the current hardware, informing which graphics features I can enable.