Pass:getStats

Edit

Returns statistics for the Pass.

stats = Pass:getStats()

Arguments

None

Returns

NameTypeDescription
statstable A table with statistics.
.drawsnumber The number of draws added to the Pass.
.computesnumber The number of compute calls added to the Pass.
.drawsCullednumber The number of draw calls that were culled the last time the Pass was submitted.
.cpuMemoryReservednumber The amount of CPU memory the Pass has reserved, in bytes.
.cpuMemoryUsednumber The amount of CPU memory the Pass is currently using, in bytes.
.submitTimenumber The amount of time taken on the CPU to submit the Pass the last time it was submitted, in seconds. Only updates when timing stats have been enabled with lovr.graphics.setTimingEnabled, and has a few frames of delay.
.gpuTimenumber The amount of time taken on the GPU to process the Pass, in seconds. Only updates when timing stats have been enabled with lovr.graphics.setTimingEnabled, and has a few frames of delay.

Example

See how long it takes the GPU to render a cube.

lovr.graphics.setTimingEnabled(true)

function lovr.draw(pass)
  pass:cube(0, 1.7, -1, .5, lovr.timer.getTime() * .2, 0, 1, 0)

  local stats = pass:getStats()
  print(('Rendering a cube takes %f microseconds'):format(stats.gpuTime * 1e6))
end

See also