Blitz3D+ Command Reference

RenderCPUMorphedDraws ( )

Parameters

None.

Description

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

Read the counter after Flip. It reports main-colour draw calls only; counts are replaced each completed frame, and shadow and auxiliary views are excluded.

This counts executed draw calls with active morph weights, not entities, targets or time. Zero may mean GPU deformation or no visible morph work; compare RenderGPUMorphedDraws.

CPU fallback preserves the pose when a shader lacks the required morph capability, more than 32 targets are active, target resources exceed their budget, or GPU resources are unavailable. Set the environment variable BLITZ3D_FORCE_CPU_MORPHING=1 before launching a program to compare paths. On combined morph-plus-skin draws either forced CPU morphing or forced CPU skinning selects the complete CPU deformation path; the result is not skinned twice.

Requires Extended mode.

See also: RenderGPUMorphedDraws, RenderCPUSkinnedDraws, AddMorphTarget, DiagnosticMessage.

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