Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

ScalableBufferManager

Discussion in '2017.3 Beta' started by Claytonious, Oct 2, 2017.

  1. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    904
    I'm currently trying this out by just controlling the scaling by sampling Time.smoothDeltaTime periodically. Has the engine exposed some better views into whether or not the game is GPU bound to do this more intelligently yet?
     
  2. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    904
    Also, is ScalableBufferManager.ResizeBuffers() supposed to have any effect in the editor's game view? Or is this only "real" on player/device builds?
     
  3. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    904
    And can anyone confirm if this is the correct usage for the simplest kind of scenario?

    * Turn on "Allow Dynamic Resolution" on my main camera
    * Call ScalableBufferManager.ResizeBuffers(0.5f, 0.5f)
    * Enjoy 1/4 the pixels

    Or is there any more "hooking up" that needs to be happen for this to actually take effect?

    Thanks!
     
  4. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    904
    Also, does anyone know if this whole ScalableBufferManager plays nicely with VR?
     
  5. timothyh_unity

    timothyh_unity

    Unity Technologies

    Joined:
    May 24, 2016
    Posts:
    19
    Hi Claytonious
    Lets see if I can help.

    First of all its important to stress that at this moment Dynamic Resolution is only available on XboxOne, however support for other platforms is in the works and for some could arrive in the very near future. So there is no harm in getting up to speed with the principle and the API's ready for its arrival on other platforms. As a result it does not currenly scale in the editor view and is not currently supported on VR but as I said other platform supports is well in the works so it is coming.

    "Has the engine exposed some better views into whether or not the game is GPU bound to do this more intelligently yet?"
    Yes it has. FrameTimingManager is the cross platform API for accessing timing data for previous frames, containing GPU and CPU timings. This is one of the areas where various platforms can differ the most, in what measurements they allow, so some platforms may provide additional platform specific API's that allow more detailed data.

    "And can anyone confirm if this is the correct usage for the simplest kind of scenario"... Yep, looks good.

    Hopefully that helps, Unity will release a sample for it in the near future showing various uses, and implementation options with it, but hopefully this helps for now.
     
  6. Peter77

    Peter77

    QA Jesus

    Joined:
    Jun 12, 2013
    Posts:
    6,620
    Excellent, I always missed such functionality!

    Is this API new in 2017.3? I'm not able to find anything about it in the 2017.1 and 2017.2 scripting documentation and the 2017.3 docs don't seem to be online yet.
     
  7. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    904
    Thank you so much, @timothyh_unity - that detailed explanation was super useful.
     
  8. Claytonious

    Claytonious

    Joined:
    Feb 16, 2009
    Posts:
    904
    What is the basic contract for working with FrameTimingManager? I see that it exposes a public method called " CaptureFrameTimings()". Do we call this periodically? Or do we call this only once to make it start sampling?

    It also exposes a public method called " GetLatestTimings()" that gives us an array of FrameTimings. Do we call this as often as we want - whenever we want to do some logic based on captured timings? What is the overhead of calling this? Should we strive to truly minimize calls to this or is it somewhat harmless in terms of overhead?

    Thanks again - hopefully these are the last questions before being able to put something together that can be used once platform support is in place.
     
  9. timothyh_unity

    timothyh_unity

    Unity Technologies

    Joined:
    May 24, 2016
    Posts:
    19
    Hey Claytonious

    You are mostly right with your assuptions but here are some clarifications:

    CaptureFrameTimings() - This should be called once per frame(presuming you want timing data that frame). Basically this function captures a user facing collection of timing data. As for overhead of this function, obviously it will vary depending on the platform, once more platform implementations arrive, they are in the works. This function will not be stunningly heavy but it does have to secure a lock on the timing data to create a safe user-facing copy, but as it is meant to be called once per frame, it will be negligible but if you call it a lot against our recomendations, it will make a difference. If you don't call this once a frame you will not have up-to-date frame timings.

    GetLatestTimings() - yes you can call it as often as you want, you shouldn't need to call it much more than once or twice per frame but if you want the data from multiple scripts and don't want to have a shared script that holds it you can call it multiple times. It's overhead will be low, all it does is fill out your array with timing data from its local copy.

    Finally yes this is new in 2017.3 and will not be backported any further. It is also launching just on Xbox One but other platform support is coming soon.

    Hope that helps!
     
    palex-nx, jashan, nzhangaudio and 4 others like this.