GPUParticlesSupported ( )
Parameters
| None. |
Description
|
Returns 1 when the active graphics device supports the GPU particle path. The result is 0 before Graphics3D, after graphics shutdown, or when the DX12 device is unavailable. This query does not allocate an emitter or particle pool and does not clear ParticleError. Support does not guarantee that a requested capacity fits the current memory budget: always check the result of CreateGPUParticleEmitter as well. The example displays capability before and after graphics initialization. Requires Extended mode. See also: CreateGPUParticleEmitter, ParticleError, ParticleBackend. |
Example
; GPUParticlesSupported - Extended mode, DX12. before_graphics=GPUParticlesSupported() Graphics3D 800,600,0,2 SetBuffer BackBuffer() If GPUParticlesSupported()=0 Then RuntimeError "GPU particles are unavailable." VSync 0 FrameLimit 60 camera=CreateCamera() PositionEntity camera,0,1,-5 CameraClsColor camera,10,15,30 emitter=CreateGPUParticleEmitter(10000) If emitter=0 Then RuntimeError ParticleError$() ParticlePreset emitter,1 timer=CreateTimer(60) paused=False While Not KeyHit(1) If KeyHit(25) paused=Not paused PauseParticles emitter,paused EndIf If KeyHit(57) Then EmitParticles emitter,100 If KeyHit(19) Then ClearParticles emitter ticks=WaitTimer(timer) If ticks>15 Then ticks=15 For tick=1 To ticks UpdateWorld Next RenderWorld live=CountParticlesAsync(emitter) live_text$="pending" If live>=0 Then live_text$=Str$(live) Color 255,255,255 Text 16,16,"GPUParticlesSupported | P Pause | Space Burst | R Clear | Esc Exit" Text 16,38,"Latest GPU count: "+live_text$+" Paused: "+paused Text 16,60,"Supported before Graphics3D: "+before_graphics+" Now: "+GPUParticlesSupported() Flip Wend FreeTimer timer FreeEntity emitter End
Index