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
; RenderCPUMorphedDraws Example ; ----------------------------- ; Requires Extended mode. Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,0,-6 light=CreateLight() RotateEntity light,30,20,0 ; A morphing sphere: one real stretched target base=CreateSphere(16) EntityColor base,80,180,240 pose=CopyMesh(base) ScaleMesh pose,1,1.5,0.7 UpdateNormals pose target=AddMorphTarget(base,pose,"Stretch",3) FreeEntity pose ; 32 extra zero-offset targets; activating them all exceeds the 32-target ; GPU limit, so the renderer falls back to the complete CPU morph path For n=1 To 32 AddMorphTarget base,base,"Zero "+n,1 Next fallback=False phase#=0 gpu_draws=0 cpu_draws=0 While Not KeyDown(1) ; Space toggles between one and 33 active targets If KeyHit(57) Then fallback=Not fallback phase=phase+2 SetMorphWeight base,0,0.5+Sin(phase)*0.4 For n=1 To 32 SetMorphWeight base,n,fallback*0.1 Next ; 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 Text 0,0,"Arrow keys: move camera Space: 1 / 33 active targets Esc: exit" Text 0,20,"RenderCPUMorphedDraws() = "+cpu_draws+" RenderGPUMorphedDraws() = "+gpu_draws Text 0,40,"33 active targets forces the CPU fallback path: "+fallback Flip ; Counters describe the frame the Flip above completed gpu_draws=RenderGPUMorphedDraws() cpu_draws=RenderCPUMorphedDraws() Wend End
Index