@@ -82,22 +82,26 @@ function createDeckInstance<ViewsT extends ViewOrViews>(
82
82
// The Deck's animation loop is independent from React's render cycle, causing potential
83
83
// synchronization issues. We provide this custom render function to make sure that React
84
84
// and Deck update on the same schedule.
85
- _customRender : redrawReason => {
86
- // Save the dirty flag for later
87
- thisRef . redrawReason = redrawReason ;
88
-
89
- // Viewport/view state is passed to child components as props.
90
- // If they have changed, we need to trigger a React rerender to update children props.
91
- const viewports = deck . getViewports ( ) ;
92
- if ( thisRef . lastRenderedViewports !== viewports ) {
93
- // Viewports have changed, update children props first.
94
- // This will delay the Deck canvas redraw till after React update (in useLayoutEffect)
95
- // so that the canvas does not get rendered before the child components update.
96
- thisRef . forceUpdate ( ) ;
97
- } else {
98
- redrawDeck ( thisRef ) ;
99
- }
100
- }
85
+ // TODO(ibgreen) - Hack to enable WebGPU as it needs to render quickly to avoid CanvasContext texture from going stale
86
+ _customRender :
87
+ props . deviceProps ?. adapters ?. [ 0 ] ?. type === 'webgpu'
88
+ ? undefined
89
+ : redrawReason => {
90
+ // Save the dirty flag for later
91
+ thisRef . redrawReason = redrawReason ;
92
+
93
+ // Viewport/view state is passed to child components as props.
94
+ // If they have changed, we need to trigger a React rerender to update children props.
95
+ const viewports = deck . getViewports ( ) ;
96
+ if ( thisRef . lastRenderedViewports !== viewports ) {
97
+ // Viewports have changed, update children props first.
98
+ // This will delay the Deck canvas redraw till after React update (in useLayoutEffect)
99
+ // so that the canvas does not get rendered before the child components update.
100
+ thisRef . forceUpdate ( ) ;
101
+ } else {
102
+ redrawDeck ( thisRef ) ;
103
+ }
104
+ }
101
105
} ) ;
102
106
return deck ;
103
107
}
0 commit comments