| None. |
|
Returns how many surface draws were submitted before automatic instancing last frame. This is the "before" number in the instancing story. Every visible surface the renderer was asked to draw counts once here, so a scene of 500 single-surface rocks submits 500 and a scene of 500 three-surface trees submits 1,500. Compare it with RenderDrawCalls, which is the "after" number: the gap between them is exactly what automatic instancing saved you. Because it counts what your scene asked for rather than what the hardware did, it is the honest measure of scene complexity. If this number is enormous, no amount of instancing will rescue you - the fix is fewer entities, better culling with EntityCullRange, or fewer surfaces per model. Grouping only happens between entities that share the same mesh data, so the way you build the scene decides whether the two numbers diverge. Copies made with CopyEntity share their mesh and collapse into one draw; entities that each own unique geometry - a separate LoadMesh or CreateCube per object, or a CopyMesh so the vertices can be edited independently - cannot be grouped, and submitted and executed draws stay equal. Gotcha: this describes the most recently completed frame, so read it after Flip. Reading it between RenderWorld and Flip gives you the previous frame's figure. It covers the main colour pass only - shadow passes are batched separately, and 2D and debug drawing are not counted at all. See also: RenderDrawCalls, RenderInstances, RenderInstancedDraws, RenderInstanceGroups, DrawRenderStats. |
; RenderSubmittedDraws Example
; ----------------------------
Graphics3D 640,480,0,2
SetBuffer BackBuffer()
camera=CreateCamera()
PositionEntity camera,0,6,-20
CameraClsColor camera,20,30,50
light=CreateLight()
RotateEntity light,45,45,0
ground=CreatePlane()
EntityColor ground,60,80,55
; 200 CopyEntity crystals share one mesh, so every visible copy submits a
; draw, then automatic instancing collapses them into very few real draws
crystal=CreateSphere(8)
ScaleMesh crystal,0.5,1,0.5
PositionMesh crystal,0,1,0
EntityColor crystal,80,200,255
Dim crystals(199)
For n=0 To 199
crystals(n)=CopyEntity(crystal)
PositionEntity crystals(n),(n Mod 20)*2-19,0,(n/20)*2+4
Next
HideEntity crystal
crowd_on=True
While Not KeyDown(1)
; Space hides or shows the crystal field - watch submitted draws jump
If KeyHit(57)
crowd_on=Not crowd_on
For n=0 To 199
If crowd_on
ShowEntity crystals(n)
Else
HideEntity crystals(n)
EndIf
Next
EndIf
; Arrow keys move the camera
If KeyDown(200) Then MoveEntity camera,0,0,0.1
If KeyDown(208) Then MoveEntity camera,0,0,-0.1
If KeyDown(203) Then TurnEntity camera,0,1,0
If KeyDown(205) Then TurnEntity camera,0,-1,0
RenderWorld
; Surface draws submitted BEFORE instancing vs draws actually executed
Text 0,0,"Arrow keys: move camera Space: toggle 200 crystals Esc: exit"
Text 0,20,"RenderSubmittedDraws() = "+RenderSubmittedDraws()
Text 0,40,"RenderDrawCalls() = "+RenderDrawCalls()+" after auto-instancing"
Flip
Wend
End