{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/Win2D/issues/216","labels_url":"https://api.github.com/repos/Microsoft/Win2D/issues/216/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/Win2D/issues/216/comments","events_url":"https://api.github.com/repos/Microsoft/Win2D/issues/216/events","html_url":"https://github.com/Microsoft/Win2D/issues/216","id":124278936,"number":216,"title":"Lumia 950 XL (Windows 10) - Performance","user":{"login":"BrianBergh","id":16006094,"avatar_url":"https://avatars.githubusercontent.com/u/16006094?v=3","gravatar_id":"","url":"https://api.github.com/users/BrianBergh","html_url":"https://github.com/BrianBergh","followers_url":"https://api.github.com/users/BrianBergh/followers","following_url":"https://api.github.com/users/BrianBergh/following{/other_user}","gists_url":"https://api.github.com/users/BrianBergh/gists{/gist_id}","starred_url":"https://api.github.com/users/BrianBergh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BrianBergh/subscriptions","organizations_url":"https://api.github.com/users/BrianBergh/orgs","repos_url":"https://api.github.com/users/BrianBergh/repos","events_url":"https://api.github.com/users/BrianBergh/events{/privacy}","received_events_url":"https://api.github.com/users/BrianBergh/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/Win2D/labels/question","name":"question","color":"009800"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-12-29T22:45:02Z","updated_at":"2015-12-30T20:33:42Z","closed_at":null,"body":"I'm an old fan of XNA, and i have developed a few games for Windows, and Windows Phone (7.5 and 8/8.1). I was sad to discover that XNA was being discontinued. Then I just came across Win2D, WOW, a new api (new to me) that seems just as easy to manage as XNA :) I decided to create a simple test project, a blank page with just a CanvasAnimatedControl, showing a simple text scroller. In the update method i update the position, and in the draw method i draw the text. Simple and straight forward.\r\n\r\nHowever, i noticed that the performance (when using the canvas with default options) was kind of lagging. Every few seconds the FPS drops from 60fps to 45..then 30. After yet a few seconds it rises to 60 again. The text choops as a result looking very ugly. I've tried to set IsFixedTimeStep to false, i've tried to make the canvas smaller and i've also tried to use Pixels unit instead of DPI. When using pixles instead of DPI the scroller seems to run more smooth, but no matter what i do, the FPS seems to top at 60 fps. (even with IsFixedTimeStep=\"False\"), and the really strange thing is, that when i set the ForceSoftwareRenderer=\"True\" it seems to run even smoother!?\r\n\r\nI have rebooted the device, still it lags.\r\n\r\nIs this because of a bug in the Windows 10 Mobile (im running 10586.36), or is it a bug in the Win2D api? Or is this really the performance we can expect from a Lumia 950XL?\r\n\r\n\r\n\r\nhere's the code:\r\nUWP (Blank project):\r\n\r\n&lt;Page\r\n    x:Class=&quot;win2dTest.MainPage&quot;\r\n    xmlns=&quot;http://schemas.microsoft.com/winfx/2006/xaml/presentation&quot;\r\n    xmlns:x=&quot;http://schemas.microsoft.com/winfx/2006/xaml&quot;\r\n    xmlns:local=&quot;using:win2dTest&quot;\r\n    xmlns:d=&quot;http://schemas.microsoft.com/expression/blend/2008&quot;\r\n    xmlns:mc=&quot;http://schemas.openxmlformats.org/markup-compatibility/2006&quot;\r\n    xmlns:canvas=&quot;using:Microsoft.Graphics.Canvas.UI.Xaml&quot;\r\n    mc:Ignorable=&quot;d&quot;&gt;\r\n    &lt;canvas:CanvasAnimatedControl Update=&quot;canvas_Update&quot;  Draw=&quot;canvas_Draw&quot; Loaded=&quot;canvas_Loaded&quot; ClearColor=&quot;Black&quot; Name=&quot;canvas&quot; CreateResources=&quot;canvas_CreateResources&quot; SizeChanged=&quot;canvas_SizeChanged&quot;  /&gt;\r\n&lt;/Page&gt;\r\n  public sealed partial class MainPage : Page\r\n  {\r\n    public MainPage()\r\n    {\r\n      this.InitializeComponent();\r\n    }\r\n    Vector2 scrollPos = new Vector2();\r\n    float speed = 100f;\r\n    float tw = 0;\r\n    private void canvas_Update(Microsoft.Graphics.Canvas.UI.Xaml.ICanvasAnimatedControl sender, Microsoft.Graphics.Canvas.UI.Xaml.CanvasAnimatedUpdateEventArgs args)\r\n    {\r\n      float elapsed = (float)args.Timing.ElapsedTime.TotalSeconds; // calc once, for speed.\r\n      scrollPos.X -= (elapsed * speed);\r\n      if (scrollPos.X < -scroller_layout.DrawBounds.Width)\r\n      {\r\n        scrollPos.X = tw;\r\n      }\r\n    }\r\n    string about = \"This is just a scrolling demo with a very long text to see how it works on Windows Phone (Lumia 950 XL).\";\r\n    CanvasTextFormat scroller_format = new CanvasTextFormat { FontSize = 100.0f, WordWrapping = CanvasWordWrapping.NoWrap };\r\n    CanvasTextLayout scroller_layout = null;\r\n    //FPSCounter fpsCounter = new FPSCounter();\r\n    private void canvas_Draw(Microsoft.Graphics.Canvas.UI.Xaml.ICanvasAnimatedControl sender, Microsoft.Graphics.Canvas.UI.Xaml.CanvasAnimatedDrawEventArgs args)\r\n    {\r\n      args.DrawingSession.Units = CanvasUnits.Pixels;\r\n      args.DrawingSession.DrawTextLayout(scroller_layout, scrollPos, Colors.White);\r\n      //fpsCounter.Draw(args.DrawingSession);\r\n    }\r\n    private void canvas_Loaded(object sender, RoutedEventArgs e)\r\n    {\r\n    }\r\n    private void canvas_CreateResources(Microsoft.Graphics.Canvas.UI.Xaml.CanvasAnimatedControl sender, Microsoft.Graphics.Canvas.UI.CanvasCreateResourcesEventArgs args)\r\n    {\r\n      scroller_layout = new CanvasTextLayout(canvas, about, scroller_format, 0.0f, 0.0f);\r\n      scrollPos = new Vector2((float)canvas.ActualWidth, ((float)canvas.ActualHeight / 2) - ((float)scroller_layout.DrawBounds.Height / 2));\r\n      tw = (float)canvas.ActualWidth;\r\n    }\r\n    private void canvas_SizeChanged(object sender, SizeChangedEventArgs e)\r\n    {\r\n      tw = (float)canvas.ActualWidth;\r\n    }\r\n  }\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/Microsoft/Win2D/issues/comments/168069410","html_url":"https://github.com/Microsoft/Win2D/issues/216#issuecomment-168069410","issue_url":"https://api.github.com/repos/Microsoft/Win2D/issues/216","id":168069410,"user":{"login":"damyanp","id":8118402,"avatar_url":"https://avatars.githubusercontent.com/u/8118402?v=3","gravatar_id":"","url":"https://api.github.com/users/damyanp","html_url":"https://github.com/damyanp","followers_url":"https://api.github.com/users/damyanp/followers","following_url":"https://api.github.com/users/damyanp/following{/other_user}","gists_url":"https://api.github.com/users/damyanp/gists{/gist_id}","starred_url":"https://api.github.com/users/damyanp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/damyanp/subscriptions","organizations_url":"https://api.github.com/users/damyanp/orgs","repos_url":"https://api.github.com/users/damyanp/repos","events_url":"https://api.github.com/users/damyanp/events{/privacy}","received_events_url":"https://api.github.com/users/damyanp/received_events","type":"User","site_admin":false},"created_at":"2015-12-30T20:33:42Z","updated_at":"2015-12-30T20:33:42Z","body":"On XNA you were most likely drawing the text using a SpriteFont - where all the work to translate the font data into rasterized glyphs happens offline before the app runs.\r\n\r\nIn Win2D the text you are drawing is rasterized using DWrite & Direct2D at runtime.  This will load font data, convert to curves and rasterize (with antialiasing) in the middle of your draw call.\r\n\r\nThe Win2D version has the benefit that the DrawText call will always give you high quality font rendering at any size, supporting the same full range of characters as the OS (eg for all languages and character sets).  Compare this with XNA sprite fonts where you have a much more limited set of characters (essentially just ASCII) for a fixed size.\r\n\r\nThere's a tradeoff here.  The XNA approach allows for consistent rendering performance.  The Win2D approach allows for more complete and rich text rendering functionality.\r\n\r\nThe differences in behavior that you are seeing between desktop and phone are likely related to how much memory and what the display DPI is.  Your PC is likely to be set to 96 DPI (aka 100% scaling), while the 950 XL is set to something like 432 DPI (or 450% scaling) -- I don't have a 950 XL handy to confirm the exact scaling here.\r\n\r\nThis DPI difference means that your 100 high text is 100 pixels high on PC, but more like 450 pixels high on the phone - so the phone has to work harder than the PC in this case as well.\r\n"}}