Uninomicon

Documenting the dark corners of the Unity Engine.

User Tools

Site Tools


asyncgpureadback

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
asyncgpureadback [2021/12/25 01:00]
archo created
asyncgpureadback [2022/01/28 17:47] (current)
73.217.35.3
Line 5: Line 5:
 In at least 2018.2 and possibly other versions there appears to be an undocumented bug that readback requests mess with the command buffer: In at least 2018.2 and possibly other versions there appears to be an undocumented bug that readback requests mess with the command buffer:
  
-  * readback requests inserted in the middle will split the command buffer (which is fine) however the second part will have LoadAction=Clear which effectively destroys everything rendered before the request +  * Readback requests inserted in the middle will split the command buffer((this is reasonable)), however the second part will have LoadAction=Clear which destroys everything rendered before the request 
-  * readback requests inserted at the end will make Unity skip ''presentDrawable'' which results in the screen not being updated, and the behavior may differ between devices: +  * Readback requests inserted at the end will make Unity skip ''presentDrawable'' which results in the screen not being updated, and the behavior differs between devices: 
-    * those configured for debugging or at least currently debugging - can't see anything happening in the game but input is accepted and things continue to work +    * Those configured for debugging or currently debugging: nothing renders but input is accepted and the game continues to run. 
-    * others - crash caused by an OS timeout+    * Others: crash caused by an OS timeout
  
 The workaround is to move the readback request to the beginning of the next frame. The workaround is to move the readback request to the beginning of the next frame.
Line 16: Line 16:
 ==== Random failures ==== ==== Random failures ====
  
-In some cases<sup>[//[[:wiki:tag:research-needed|research needed]]//]</sup> (observed at least on 2018.2.21 when exiting play mode and sometimes while paused in editor), the callback will be called but when attempting to call [[https://docs.unity3d.com/ScriptReference/Rendering.AsyncGPUReadbackRequest.GetData.html|GetData]], it will throw an exception.+In some cases<sup>[//[[:wiki:tag:research-needed|research needed]]//]</sup>, the callback will be called but when attempting to call [[https://docs.unity3d.com/ScriptReference/Rendering.AsyncGPUReadbackRequest.GetData.html|GetData]], it will throw an exception.((observed at least on 2018.2.21 when exiting play mode and sometimes while paused in editor))
  
-The cause is unknown, it does not appear to be detectable beforehand (all [[https://docs.unity3d.com/ScriptReference/Rendering.AsyncGPUReadbackRequest.html|AsyncGPUReadbackRequest]] properties indicate that it's a valid completed request) but it seems to be safe to catch and ignore this exception.+The cause is unknown, it does not appear to be detectable beforehand. All [[https://docs.unity3d.com/ScriptReference/Rendering.AsyncGPUReadbackRequest.html|AsyncGPUReadbackRequest]] properties indicate that it's a valid completed request. It seems to be safe to catch and ignore this exception.
  
asyncgpureadback.1640394055.txt.gz · Last modified: 2021/12/25 01:00 by archo