Skip to content
Permalink
Browse files

[Graphics] Removed PreferredGraphicsPlatform from RenderingSettings

  • Loading branch information
xen2 committed Dec 7, 2018
1 parent a006a76 commit fa1acae4e5ebc8eae7342d51b0880c1a29409dd4
Showing with 2 additions and 155 deletions.
  1. +0 −1 samples/Audio/SimpleAudio/Assets/Shared/GameSettings.xkgamesettings
  2. +0 −1 samples/Games/JumpyJet/Assets/Shared/GameSettings.xkgamesettings
  3. +0 −1 samples/Games/SpaceEscape/Assets/Shared/GameSettings.xkgamesettings
  4. +0 −1 samples/Graphics/AnimatedModel/Assets/Shared/GameSettings.xkgamesettings
  5. +0 −1 samples/Graphics/CustomEffect/Assets/Shared/GameSettings.xkgamesettings
  6. +0 −1 samples/Graphics/MaterialShader/Assets/Shared/GameSettings.xkgamesettings
  7. +0 −1 samples/Graphics/SpriteFonts/Assets/Shared/GameSettings.xkgamesettings
  8. +0 −1 samples/Graphics/SpriteStudioDemo/Assets/Shared/GameSettings.xkgamesettings
  9. +0 −1 samples/Input/GravitySensor/Assets/Shared/GameSettings.xkgamesettings
  10. +0 −1 samples/Input/TouchInputs/Assets/Shared/GameSettings.xkgamesettings
  11. +0 −1 samples/Particles/ParticlesSample/Assets/Shared/GameSettings.xkgamesettings
  12. +0 −1 samples/Physics/PhysicsSample/Assets/Shared/GameSettings.xkgamesettings
  13. +0 −1 samples/Templates/FirstPersonShooter/FirstPersonShooter/Assets/GameSettings.xkgamesettings
  14. +0 −1 samples/Templates/ThirdPersonPlatformer/ThirdPersonPlatformer/Assets/GameSettings.xkgamesettings
  15. +0 −1 samples/Templates/TopDownRPG/TopDownRPG/Assets/GameSettings.xkgamesettings
  16. +0 −1 samples/Templates/VRSandbox/VRSandbox/Assets/GameSettings.xkgamesettings
  17. +0 −1 samples/UI/GameMenu/Assets/Shared/GameSettings.xkgamesettings
  18. +0 −1 samples/UI/UIElementLink/Assets/Shared/GameSettings.xkgamesettings
  19. +0 −1 samples/UI/UIParticles/Assets/Shared/GameSettings.xkgamesettings
  20. +0 −27 sources/assets/Xenko.Core.Assets.CompilerApp/PackageBuilder.cs
  21. +0 −1 sources/editor/Xenko.Assets.Presentation/EditorPackage/Assets/GameSettings.xkgamesettings
  22. +0 −1 sources/engine/Xenko.Assets.Tests2/GameAssets/GameSettings.xkgamesettings
  23. +2 −3 sources/engine/Xenko.Assets/AssetCompilerContextExtensions.cs
  24. +0 −1 sources/engine/Xenko.Audio.Tests/AudioAssets/GameSettings.xkgamesettings
  25. +0 −1 sources/engine/Xenko.Engine.Tests/GameAssets/GameSettings.xkgamesettings
  26. +0 −1 sources/engine/Xenko.Graphics.Tests.10_0/Assets/GameSettings.xkgamesettings
  27. +0 −1 sources/engine/Xenko.Graphics.Tests.11_0/Assets/GameSettings.xkgamesettings
  28. +0 −1 sources/engine/Xenko.Graphics.Tests/Assets/Shared/GameSettings.xkgamesettings
  29. +0 −93 sources/engine/Xenko.Graphics/RenderingSettings.cs
  30. +0 −1 sources/engine/Xenko.Input.Tests/GameAssets/GameSettings.xkgamesettings
  31. +0 −1 sources/engine/Xenko.Navigation.Tests/Assets/Shared/GameSettings.xkgamesettings
  32. +0 −1 sources/engine/Xenko.Particles.Tests/GameAssets/GameSettings.xkgamesettings
  33. +0 −1 sources/engine/Xenko.Physics.Tests/GameAssets/GameSettings.xkgamesettings
  34. +0 −1 sources/engine/Xenko.Shaders.Tests/GameAssets/GameSettings.xkgamesettings
  35. +0 −1 sources/engine/Xenko.UI.Tests/Assets/GameSettings.xkgamesettings
@@ -12,7 +12,6 @@ Defaults:
DefaultGraphicsProfile: Level_9_3
ColorSpace: Linear
DisplayOrientation: LandscapeRight
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -12,7 +12,6 @@ Defaults:
DefaultGraphicsProfile: Level_9_3
ColorSpace: Linear
DisplayOrientation: Portrait
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -12,7 +12,6 @@ Defaults:
DefaultGraphicsProfile: Level_9_3
ColorSpace: Linear
DisplayOrientation: Portrait
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -12,7 +12,6 @@ Defaults:
DefaultGraphicsProfile: Level_9_3
ColorSpace: Linear
DisplayOrientation: Portrait
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -12,7 +12,6 @@ Defaults:
DefaultGraphicsProfile: Level_9_3
ColorSpace: Linear
DisplayOrientation: LandscapeRight
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -12,7 +12,6 @@ Defaults:
DefaultGraphicsProfile: Level_10_0
ColorSpace: Linear
DisplayOrientation: LandscapeRight
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -12,7 +12,6 @@ Defaults:
DefaultGraphicsProfile: Level_9_3
ColorSpace: Linear
DisplayOrientation: LandscapeRight
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -12,7 +12,6 @@ Defaults:
DefaultGraphicsProfile: Level_9_3
ColorSpace: Linear
DisplayOrientation: LandscapeRight
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -12,7 +12,6 @@ Defaults:
DefaultGraphicsProfile: Level_9_3
ColorSpace: Linear
DisplayOrientation: Default
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -12,7 +12,6 @@ Defaults:
DefaultGraphicsProfile: Level_9_3
ColorSpace: Linear
DisplayOrientation: LandscapeRight
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -12,7 +12,6 @@ Defaults:
DefaultGraphicsProfile: Level_9_3
ColorSpace: Linear
DisplayOrientation: LandscapeRight
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -12,7 +12,6 @@ Defaults:
DefaultGraphicsProfile: Level_9_3
ColorSpace: Linear
DisplayOrientation: LandscapeRight
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -12,7 +12,6 @@ Defaults:
DefaultGraphicsProfile: Level_10_0
ColorSpace: Linear
DisplayOrientation: LandscapeRight
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -12,7 +12,6 @@ Defaults:
DefaultGraphicsProfile: Level_10_0
ColorSpace: Linear
DisplayOrientation: LandscapeRight
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -12,7 +12,6 @@ Defaults:
DefaultGraphicsProfile: Level_10_0
ColorSpace: Linear
DisplayOrientation: LandscapeRight
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -12,7 +12,6 @@ Defaults:
DefaultGraphicsProfile: Level_11_0
ColorSpace: Linear
DisplayOrientation: LandscapeRight
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -12,7 +12,6 @@ Defaults:
DefaultGraphicsProfile: Level_9_3
ColorSpace: Linear
DisplayOrientation: Portrait
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -12,7 +12,6 @@ Defaults:
DefaultGraphicsProfile: Level_10_0
ColorSpace: Linear
DisplayOrientation: Portrait
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -12,7 +12,6 @@ Defaults:
DefaultGraphicsProfile: Level_9_3
ColorSpace: Linear
DisplayOrientation: Portrait
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -167,33 +167,6 @@ private BuildResultCode BuildMaster()
}
}

private BuildResultCode BuildGetGraphicsPlatform()
{
var loadParameters = new PackageLoadParameters
{
AutoLoadTemporaryAssets = true,
LoadAssemblyReferences = false,
AutoCompileProjects = false,
TemporaryAssetFilter = (asset) => asset.AssetLocation == GameSettingsAsset.GameSettingsLocation,
TemporaryAssetsInMsbuild = false,
};
var sessionResult = PackageSession.Load(builderOptions.PackageFile, loadParameters);
var simplePackage = sessionResult.Session.Packages.First();
sessionResult.Session.LoadMissingReferences(sessionResult, loadParameters);

if (simplePackage == null || sessionResult.HasErrors)
{
sessionResult.CopyTo(builderOptions.Logger);
return BuildResultCode.BuildError;
}

var settings = simplePackage.GetGameSettingsAsset();
var renderingSettings = settings.GetOrCreate<RenderingSettings>();

Console.WriteLine(RenderingSettings.GetGraphicsPlatform(builderOptions.Platform, renderingSettings.PreferredGraphicsPlatform));
return BuildResultCode.Successful;
}

private void RegisterBuildStepProcessedHandler(object sender, AssetCompiledArgs e)
{
if (e.Result.BuildSteps == null)
@@ -12,7 +12,6 @@ Defaults:
DefaultGraphicsProfile: Level_11_0
ColorSpace: Linear
DisplayOrientation: Default
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -14,7 +14,6 @@ Defaults:
DefaultGraphicsProfile: Level_9_1
ColorSpace: Gamma
DisplayOrientation: Default
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -36,9 +36,8 @@ public static GraphicsPlatform GetGraphicsPlatform(this AssetCompilerContext con
if (context.OptionProperties.TryGetValue("XenkoGraphicsApi", out graphicsApi))
return (GraphicsPlatform)Enum.Parse(typeof(GraphicsPlatform), graphicsApi);

// Ohterwise, use game settings, or default as fallback
var settings = package.GetGameSettingsAsset();
return settings == null ? context.Platform.GetDefaultGraphicsPlatform() : RenderingSettings.GetGraphicsPlatform(context.Platform, settings.GetOrCreate<RenderingSettings>().PreferredGraphicsPlatform);
// Ohterwise, use default as fallback
return context.Platform.GetDefaultGraphicsPlatform();
}

public static GraphicsPlatform GetDefaultGraphicsPlatform(this PlatformType platformType)
@@ -14,7 +14,6 @@ Defaults:
DefaultGraphicsProfile: Level_9_1
ColorSpace: Linear
DisplayOrientation: Default
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -14,7 +14,6 @@ Defaults:
DefaultGraphicsProfile: Level_9_3
ColorSpace: Linear
DisplayOrientation: Default
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -14,7 +14,6 @@ Defaults:
DefaultGraphicsProfile: Level_10_0
ColorSpace: Linear
DisplayOrientation: Default
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -14,7 +14,6 @@ Defaults:
DefaultGraphicsProfile: Level_11_0
ColorSpace: Linear
DisplayOrientation: Default
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -14,7 +14,6 @@ Defaults:
DefaultGraphicsProfile: Level_9_1
ColorSpace: Linear
DisplayOrientation: Default
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -120,98 +120,5 @@ public class RenderingSettings : Configuration
/// <userdoc>The display orientations this game support.</userdoc>
[DataMember(40)]
public RequiredDisplayOrientation DisplayOrientation = RequiredDisplayOrientation.Default;

/// <summary>
/// Gets or sets the target graphics platform.
/// </summary>
/// <userdoc>
/// The project will be built for the specified graphics platform.
/// Leave as Default to let the engine choose the most appropriate platform depending on the hardware.
/// </userdoc>
[DataMember(50)]
[Display("Target graphics platform")]
public PreferredGraphicsPlatform PreferredGraphicsPlatform = PreferredGraphicsPlatform.Default;

private static GraphicsPlatform GetDefaultGraphicsPlatform(PlatformType platformType)
{
switch (platformType)
{
case PlatformType.Windows:
case PlatformType.UWP:
return GraphicsPlatform.Direct3D11;
case PlatformType.Android:
case PlatformType.iOS:
return GraphicsPlatform.OpenGLES;
case PlatformType.Linux:
case PlatformType.macOS:
return GraphicsPlatform.OpenGL;
default:
throw new ArgumentOutOfRangeException();
}
}

private static bool CheckGraphicsPlatform(PlatformType platform, PreferredGraphicsPlatform preferredGraphicsPlatform)
{
switch (platform)
{
case PlatformType.Shared:
return false;
case PlatformType.UWP:
return preferredGraphicsPlatform == PreferredGraphicsPlatform.Direct3D11;
case PlatformType.Windows:
return preferredGraphicsPlatform == PreferredGraphicsPlatform.Direct3D11
|| preferredGraphicsPlatform == PreferredGraphicsPlatform.Direct3D12
|| preferredGraphicsPlatform == PreferredGraphicsPlatform.OpenGL
|| preferredGraphicsPlatform == PreferredGraphicsPlatform.OpenGLES
|| preferredGraphicsPlatform == PreferredGraphicsPlatform.Vulkan;
case PlatformType.Android:
return preferredGraphicsPlatform == PreferredGraphicsPlatform.OpenGLES
|| preferredGraphicsPlatform == PreferredGraphicsPlatform.Vulkan;
case PlatformType.iOS:
return preferredGraphicsPlatform == PreferredGraphicsPlatform.OpenGLES;
case PlatformType.macOS:
return preferredGraphicsPlatform == PreferredGraphicsPlatform.OpenGL;
case PlatformType.Linux:
return preferredGraphicsPlatform == PreferredGraphicsPlatform.OpenGL
|| preferredGraphicsPlatform == PreferredGraphicsPlatform.Vulkan;
default:
throw new ArgumentOutOfRangeException(nameof(platform), platform, null);
}
}

public static GraphicsPlatform GetGraphicsPlatform(PlatformType platform, PreferredGraphicsPlatform preferredGraphicsPlatform)
{
//revert to default if platforms are not compatible
if (!CheckGraphicsPlatform(platform, preferredGraphicsPlatform))
{
return GetDefaultGraphicsPlatform(platform);
}

GraphicsPlatform graphicsPlatform;
switch (preferredGraphicsPlatform)
{
case PreferredGraphicsPlatform.Default:
graphicsPlatform = GetDefaultGraphicsPlatform(platform);
break;
case PreferredGraphicsPlatform.Direct3D11:
graphicsPlatform = GraphicsPlatform.Direct3D11;
break;
case PreferredGraphicsPlatform.Direct3D12:
graphicsPlatform = GraphicsPlatform.Direct3D12;
break;
case PreferredGraphicsPlatform.OpenGL:
graphicsPlatform = GraphicsPlatform.OpenGL;
break;
case PreferredGraphicsPlatform.OpenGLES:
graphicsPlatform = GraphicsPlatform.OpenGLES;
break;
case PreferredGraphicsPlatform.Vulkan:
graphicsPlatform = GraphicsPlatform.Vulkan;
break;
default:
throw new ArgumentOutOfRangeException();
}
return graphicsPlatform;
}
}
}
@@ -14,7 +14,6 @@ Defaults:
DefaultGraphicsProfile: Level_9_1
ColorSpace: Linear
DisplayOrientation: Default
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -14,7 +14,6 @@ Defaults:
DefaultGraphicsProfile: Level_10_0
ColorSpace: Linear
DisplayOrientation: Default
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -14,7 +14,6 @@ Defaults:
DefaultGraphicsProfile: Level_9_1
ColorSpace: Linear
DisplayOrientation: Default
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -14,7 +14,6 @@ Defaults:
DefaultGraphicsProfile: Level_9_3
ColorSpace: Linear
DisplayOrientation: Default
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets
@@ -14,7 +14,6 @@ Defaults:
DefaultGraphicsProfile: Level_9_1
ColorSpace: Linear
DisplayOrientation: Default
PreferredGraphicsPlatform: Default
- !Xenko.Assets.EditorSettings,Xenko.Assets
RenderingMode: HDR
- !Xenko.Assets.Textures.TextureSettings,Xenko.Assets

0 comments on commit fa1acae

Please sign in to comment.
You can’t perform that action at this time.