Skip to content

[HDRP] Fix rendering when adding an incompatible platform to the project #6495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 16, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fixed rendering when an incompatible api is added in the editor (case…
… 1384634)
  • Loading branch information
alelievr committed Dec 6, 2021
commit d53c8f527aa3994650a8f3f3e1135d879df30396
Original file line number Diff line number Diff line change
Expand Up @@ -754,12 +754,24 @@ internal static bool IsSupportedBuildTarget(UnityEditor.BuildTarget buildTarget)

internal static bool AreGraphicsAPIsSupported(UnityEditor.BuildTarget target, ref GraphicsDeviceType unsupportedGraphicDevice)
{
foreach (var graphicAPI in UnityEditor.PlayerSettings.GetGraphicsAPIs(target))
bool editor = false;
#if UNITY_EDITOR
editor = !UnityEditor.BuildPipeline.isBuildingPlayer;
#endif

if (editor) // In the editor we use the current graphics device instead of the list to avoid blocking the rendering if an invalid API is added but not enabled.
{
if (!HDUtils.IsSupportedGraphicDevice(graphicAPI))
return HDUtils.IsSupportedGraphicDevice(SystemInfo.graphicsDeviceType);
}
else
{
foreach (var graphicAPI in UnityEditor.PlayerSettings.GetGraphicsAPIs(target))
{
unsupportedGraphicDevice = graphicAPI;
return false;
if (!HDUtils.IsSupportedGraphicDevice(graphicAPI))
{
unsupportedGraphicDevice = graphicAPI;
return false;
}
}
}
return true;
Expand Down