Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The read-only needsRedraw
property of the XRCompositionLayer
interface is a boolean signaling that the layer should be re-rendered in the next frame.
The need for redrawing can occur when the underlying resources of a layer are lost due to textures that might have been freed by the compositor under the hood. This might happen when the device falls asleep or when the browser switches context (to an operating system dialog or similar) and then comes back.
Redrawing is not a problem for layers which are updated with every frame. However, for layers updated infrequently, or for static layers (where you can only draw once after creation or after a redraw
event), the layer's content might be lost and need to be redrawn. If the layer's resources are lost, the needsRedraw
property will be true
and a redraw
event is fired on the layer.