Browse Source

Add note about timers feature;

bjorn 6 years ago
parent
commit
a32331c9c7
3 changed files with 8 additions and 2 deletions
  1. 2 2
      api/init.lua
  2. 3 0
      api/lovr/graphics/tick.lua
  3. 3 0
      api/lovr/graphics/tock.lua

+ 2 - 2
api/init.lua

@@ -10785,7 +10785,7 @@ return {
               code = "function lovr.draw()\n  lovr.graphics.tick('mytimer')\n\n  -- Draw a bunch of cubes\n  for x = -4, 4 do\n    for y = -4, 4 do\n      for z = -4, 4 do\n        lovr.graphics.cube('fill', x, y, z, .2)\n      end\n    end\n  end\n\n  lovr.graphics.tock('mytimer')\n\n  local stats = lovr.graphics.getStats()\n  if stats.timers.mytimer then\n    print('rendering took ' .. stats.timers.mytimer .. ' seconds')\n  end\nend"
             }
           },
-          notes = "The timer can be stopped by calling `lovr.graphics.tock` using the same name.  All drawing commands between the tick and the tock will be timed.  It is not possible to nest calls to tick and tock.\n\nThe amount of time elapsed can be accessed from the `timers` field of `lovr.graphics.getStats`. Note that the results are delayed (because the GPU runs asynchronously), and may be `nil` if they are unavailable.",
+          notes = "The timer can be stopped by calling `lovr.graphics.tock` using the same name.  All drawing commands between the tick and the tock will be timed.  It is not possible to nest calls to tick and tock.\n\nThe amount of time elapsed can be accessed from the `timers` field of `lovr.graphics.getStats`. Note that the results are delayed (because the GPU runs asynchronously), and may be `nil` if they are unavailable.\n\nGPU timers are not supported on all systems.  Check the `timers` feature using `lovr.graphics.getFeatures` to see if it is supported on the current system.",
           variants = {
             {
               arguments = {
@@ -10815,7 +10815,7 @@ return {
               code = "function lovr.draw()\n  lovr.graphics.tick('mytimer')\n\n  -- Draw a bunch of cubes\n  for x = -4, 4 do\n    for y = -4, 4 do\n      for z = -4, 4 do\n        lovr.graphics.cube('fill', x, y, z, .2)\n      end\n    end\n  end\n\n  lovr.graphics.tock('mytimer')\n\n  local stats = lovr.graphics.getStats()\n  if stats.timers.mytimer then\n    print('rendering took ' .. stats.timers.mytimer .. ' seconds')\n  end\nend"
             }
           },
-          notes = "All drawing commands between the tick and the tock will be timed.  It is not possible to nest calls to tick and tock.\n\nThe amount of time elapsed can be accessed from the `timers` field of `lovr.graphics.getStats`. Note that the results are delayed (because the GPU runs asynchronously), and may be `nil` if they are unavailable.",
+          notes = "All drawing commands between the tick and the tock will be timed.  It is not possible to nest calls to tick and tock.\n\nThe amount of time elapsed can be accessed from the `timers` field of `lovr.graphics.getStats`. Note that the results are delayed (because the GPU runs asynchronously), and may be `nil` if they are unavailable.\n\nGPU timers are not supported on all systems.  Check the `timers` feature using `lovr.graphics.getFeatures` to see if it is supported on the current system.",
           variants = {
             {
               arguments = {

+ 3 - 0
api/lovr/graphics/tick.lua

@@ -18,6 +18,9 @@ return {
     The amount of time elapsed can be accessed from the `timers` field of `lovr.graphics.getStats`.
     Note that the results are delayed (because the GPU runs asynchronously), and may be `nil` if
     they are unavailable.
+
+    GPU timers are not supported on all systems.  Check the `timers` feature using
+    `lovr.graphics.getFeatures` to see if it is supported on the current system.
   ]],
   example = [[
     function lovr.draw()

+ 3 - 0
api/lovr/graphics/tock.lua

@@ -17,6 +17,9 @@ return {
     The amount of time elapsed can be accessed from the `timers` field of `lovr.graphics.getStats`.
     Note that the results are delayed (because the GPU runs asynchronously), and may be `nil` if
     they are unavailable.
+
+    GPU timers are not supported on all systems.  Check the `timers` feature using
+    `lovr.graphics.getFeatures` to see if it is supported on the current system.
   ]],
   example = [[
     function lovr.draw()