Git Product home page Git Product logo

render-timing-for-unity's Introduction

RenderTiming plugin for Unity

This plugin employs the OpenGL timer query extension (GL_EXT_disjoint_timer_query) to provide accurate GPU time measurements in real-time to apps made with the Unity game engine. Notably this works on mobile devices and has virtually no overhead.

Typical use cases include:

  • adding GPU frame time to an app's real-time debug overlay
  • getting instant, in-app feedback on coding changes which affect rendering, as well as visibility into performance regressions and problematic views
  • automated performance testing

Caveats

  • only Android is supported (adding other GL platforms is straightforward)
  • quality varies among mobile implementations of GL_EXT_disjoint_timer_query. Notably, some GPU's (e.g. Mali) don't provide a useful measurement at all.
  • only GLES3 graphics API is supported, not GLES2 or Vulkan (adding GLES2 support is straightforward)
  • plugin does not verify GL_EXT_disjoint_timer_query existence yet

Unity versions tested: 5.4 and 5.6

GPU's tested: Snapdragon 821 (Adreno 530), Snapdragon 835 (Adreno 540)

Quick start

  1. download the latest RenderTiming Unity package and import it into your Unity project
  2. add the RenderTiming component to a suitable singleton object in your scene
  3. reference RenderTiming.instance.deltaTime from your in-app debug overlay, etc.

By default it will log GPU time to console once per second. Disable via component's "Log Timing" field in the inspector.

It will measure GPU time from the end of Update until the end of frame rendering. (I.e. encompassing both eyes for VR stereo case.) See RenderTiming.cs source for additional caveats.

Directory

Disclaimer

This project is not an official Google project. It is not supported by Google and Google specifically disclaims all warranties as to its quality, merchantability, or fitness for a particular purpose.

render-timing-for-unity's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

render-timing-for-unity's Issues

Security Policy violation Binary Artifacts

This issue was automatically created by Allstar.

Security Policy Violation
Project is out of compliance with Binary Artifacts policy: binaries present in source code

Rule Description
Binary Artifacts are an increased security risk in your repository. Binary artifacts cannot be reviewed, allowing the introduction of possibly obsolete or maliciously subverted executables. For more information see the Security Scorecards Documentation for Binary Artifacts.

Remediation Steps
To remediate, remove the generated executable artifacts from the repository.

Artifacts Found

  • RenderTiming/Assets/RenderTiming/Plugins/Android/libRenderTimingPlugin.so

Additional Information
This policy is drawn from Security Scorecards, which is a tool that scores a project's adherence to security best practices. You may wish to run a Scorecards scan directly on this repository for more details.


Allstar has been installed on all Google managed GitHub orgs. Policies are gradually being rolled out and enforced by the GOSST and OSPO teams. Learn more at http://go/allstar

This issue will auto resolve when the policy is in compliance.

Issue created by Allstar. See https://github.com/ossf/allstar/ for more information. For questions specific to the repository, please contact the owner or maintainer.

Plugin error

I just added few printf() in RenderTimingPlugin.cpp and compile it again using ndk-build which compiled and .so file generated properly. But when I put that into RenderTiming/Plugin/Android/ in RenderTiming unity asset. After generating the apk while running it, it's showing this error

DllNotFoundException: RenderTimingPlugin
E Unity : at (wrapper managed-to-native) RenderTiming:GetStartTimingFunc ()
E Unity : at RenderTiming.LateUpdate () [0x00000] in :0

Can you tell me why this is showing and how to get rid of this?

Few Queries regarding rendering time calculation

First of all, thanks for this great project. I want to know if we consider GL_EXT_disjoint_timer_query, what additional influence it has.

What I have seen glBeginQuery and glEndQuery blocking commands. You used those to get the rendering time whereas using GL_EXT_disjoint_timer_query we can get the time without stalling the rendering pipeline. Is that means here we can have measured rendering time >= actual rendering time?
If you have any idea how to use GL_EXT_disjoint_timer_query, please tell me.

One another question, this time is obtained from the GPU timer (not same as CPU time). Is there any way to get the CPU time elapsed during rendering?
Just want to know is there any way to include the time taken for CPU to send draw calls to GPU before the glBeginQuery()?

Why you choose initial buffer-size to be 4?

From my understanding, you are calculating the time taken by each query object if the buffer is non-empty. But while rendering each frame, we can have numerous query objects (draw calls). Just to clarify, are you taking the cumulative elapsed time until the command buffer size is zero?

Again this project is really very helpful.

Asking help for one possible extension

First of all great work done. Just from general curiosity, from best of my knowledge, the CPU is dumping commands inside the GPU driver (command buffer) and GPU is taking instructions for rendering from the driver.

Is it possible to know (using this plugin or modifying the RenderTimingPlugin?cpp whats the frequency of reading out commands by GPU from the buffer and the frequency of CPU writing inside the buffer?

Any sort of hints or help regarding this will be highly helpful.

a question

every frame the script call startevent and endevent, that mean every frame we store a time that GPU use in buffer,but we get the time just every second, we may lost lots of frames time and what we get
is the latest frame.
if this project just want to get one frame time that GPU use,i think you should use bigger buffer to store,
i suggest we get one second GPU use time, every startevent,we add the before time, when call gettimeEvent,return the total time and reset it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.