Blitz3D+ Command Reference

RenderGPUMorphedDraws ( )

Parameters

None.

Description

Returns the number of draw calls that used GPU morph deformation in the last completed frame.

Read the counter after Flip; submitting RenderWorld alone does not execute the frame. It reports main-colour draw calls only.

This counts draw calls, not entities, vertices or targets. Compatible copies may share one instanced draw even with different expressions. Draws with no active morph weights do not contribute. The count is replaced each completed frame, not accumulated. Shadow and auxiliary view draws are excluded.

Use with RenderCPUMorphedDraws to observe automatic path selection. GPU morphing requires a compatible morph_v1 material and at most 32 active targets. Combined morph-plus-skin draws blend mesh-space deltas before applying skinning. CPU animation sampling and base-geometry queries remain unchanged.

Requires Extended mode.

See also: RenderCPUMorphedDraws, RenderGPUSkinnedDraws, RenderDrawCalls, AddMorphTarget.

Example

; Extended mode. Space toggles one/33 active targets; Escape exits.
; Counters describe executed main-colour draw calls from the last Flip.
Graphics3D 800,500,0,2
SetBuffer BackBuffer()
camera=CreateCamera()
PositionEntity camera,0,0,-6
light=CreateLight()
RotateEntity light,30,20,0
base=CreateSphere(16)
pose=CopyMesh(base)
ScaleMesh pose,1,1.5,.7
UpdateNormals pose
target=AddMorphTarget(base,pose,"Stretch",3)
FreeEntity pose
; The additional targets capture zero offsets but still have active weights.
For n=1 To 32
    AddMorphTarget base,base,"Zero "+n,1
Next
EntityColor base,80,180,240
fallback=False
phase#=0
gpuDraws=0
cpuDraws=0
timer=CreateTimer(60)
While Not KeyHit(1)
    WaitTimer timer
    If KeyHit(57) Then fallback=Not fallback
    phase=phase+2
    SetMorphWeight base,0,.5+Sin(phase)*.4
    For n=1 To 32
        SetMorphWeight base,n,fallback*.1
    Next
    RenderWorld
    Text 10,10,"Space: one / 33 active targets    Escape: exit"
    Text 10,35,"33 active targets: "+fallback+"    GPU draws: "+gpuDraws+"    CPU draws: "+cpuDraws
    Text 10,455,"One active target uses GPU where supported. More than 32 uses the complete CPU path."
    Flip
    gpuDraws=RenderGPUMorphedDraws()
    cpuDraws=RenderCPUMorphedDraws()
Wend
FreeTimer timer
FreeEntity base
FreeEntity light
FreeEntity camera
EndGraphics
End

Index