oryol icon indicating copy to clipboard operation
oryol copied to clipboard

GPUParticles demo looking wrong on iOS Metal

Open floooh opened this issue 10 years ago • 2 comments

Only the first particle is positioned correctly, all the others are simply 'falling down' (looks like there's no initial velocity?)

floooh avatar Oct 17 '15 17:10 floooh

  • it's not a shader precision problem, no difference between -ffast-math and -fno-fast-math
  • it's not a scissor-rect problem
  • it looks like the velocities from the particle initialization render pass is lost, but it's not a render-pass StoreAction problem

floooh avatar Oct 18 '15 13:10 floooh

Meh ok, found the problem: the whole thing only works when the content of a render target that is not touched by fragment shader is preserved between frames. On Metal, this is only the case with MTLLoadActionLoad, but we're currently using MTLLoadActionDontCare. Using the MTLLoadActionLoad fixes the problem (apart from a single stray particle that has a wrong starting position, don't know yet what's up with this).

Potential solutions:

  • add an explicit LoadActionLoad-like ClearAction to the ClearState
  • or: rewrite the GPUParticles sample

I guess both makes sense...

floooh avatar Oct 18 '15 14:10 floooh