sultim-t / RayTracedGL1

MIT License
135 stars 31 forks source link

Add missing transfer->read barrier for autobuffers #14

Closed kd-11 closed 2 years ago

kd-11 commented 2 years ago

This caused a data hazard with bizzare side-effects. Basically the results of the traceRay operation yielded different results that calculating the hit manually using barycentric coordinates because the vertex lookup relies on uniform buffers which were not yet initialized with the current frame data. This would lead to the access returning values from the previous frame(s) - sometimes several frames old - which in turn corrupted the motion vectors and created the hallucinated artifacts in the denoiser. This fix completely solves https://github.com/sultim-t/prboom-plus-rt/issues/38 for me. The crashing is also gone, I played most of episode one in a single sitting with no crashes observed. Hopefully it is fixed for others as well.

kd-11 commented 2 years ago

PS. I made the dst access/stage more general because the autobuffers can be used for different purposes. If they are guaranteed to only be used as uniform data for RT I can change that.

jp-bennett commented 2 years ago

Tested and seems to fix as described. See https://github.com/sultim-t/prboom-plus-rt/issues/38#issuecomment-1101518354