This repository was archived by the owner on Feb 25, 2025. It is now read-only.
File tree 1 file changed +19
-0
lines changed
impeller/renderer/backend/metal
1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -166,9 +166,28 @@ static bool LogMTLCommandBufferErrorIfPresent(id<MTLCommandBuffer> buffer) {
166
166
}
167
167
168
168
[buffer_ commit ];
169
+
169
170
#if (FML_OS_MACOSX || FML_OS_IOS_SIMULATOR)
171
+ // We're using waitUntilScheduled on macOS and iOS simulator to force a hard
172
+ // barrier between the execution of different command buffers. This forces all
173
+ // renderable texture access to be synchronous (i.e. a write from a previous
174
+ // command buffer will not get scheduled to happen at the same time as a read
175
+ // in a future command buffer).
176
+ //
177
+ // Metal hazard tracks shared memory resources by default, and we don't need
178
+ // to do any additional work to synchronize access to MTLTextures and
179
+ // MTLBuffers on iOS devices with UMA. However, shared textures are disallowed
180
+ // on macOS according to the documentation:
181
+ // https://developer.apple.com/documentation/metal/mtlstoragemode/shared
182
+ // And so this is a stopgap solution that has been present in Impeller since
183
+ // the playgrounds were first set up.
184
+ //
185
+ // TODO(bdero): Remove this for all targets once a solution for resource
186
+ // tracking that works everywhere is established:
187
+ // https://github.com/flutter/flutter/issues/120406
170
188
[buffer_ waitUntilScheduled ];
171
189
#endif
190
+
172
191
buffer_ = nil ;
173
192
return true ;
174
193
}
You can’t perform that action at this time.
0 commit comments