File tree Expand file tree Collapse file tree 4 files changed +21
-0
lines changed
Expand file tree Collapse file tree 4 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -149,6 +149,13 @@ class UTILS_PUBLIC Platform {
149149 * - PlatformEGLAndroid
150150 */
151151 bool assertNativeWindowIsValid = false ;
152+
153+ /* *
154+ * The action to take if a Drawable cannot be acquired. If true, the
155+ * frame is aborted instead of panic. This is only supported for:
156+ * - PlatformMetal
157+ */
158+ bool metalDisablePanicOnDrawableFailure = false ;
152159 };
153160
154161 Platform () noexcept ;
Original file line number Diff line number Diff line change 5353}
5454
5555Driver* PlatformMetal::createDriver (void * /* sharedContext*/ , const Platform::DriverConfig& driverConfig) noexcept {
56+ pImpl->mDrawableFailureBehavior = driverConfig.metalDisablePanicOnDrawableFailure
57+ ? DrawableFailureBehavior::ABORT_FRAME
58+ : DrawableFailureBehavior::PANIC;
5659 return MetalDriverFactory::create (this , driverConfig);
5760}
5861
Original file line number Diff line number Diff line change @@ -317,6 +317,15 @@ class UTILS_PUBLIC Engine {
317317 */
318318 size_t metalUploadBufferSizeBytes = 512 * 1024 ;
319319
320+ /* *
321+ * The action to take if a Drawable cannot be acquired.
322+ *
323+ * Each frame rendered requires a CAMetalDrawable texture, which is
324+ * presented on-screen at the completion of each frame. These are
325+ * limited and provided round-robin style by the system.
326+ */
327+ bool metalDisablePanicOnDrawableFailure = false ;
328+
320329 /* *
321330 * Set to `true` to forcibly disable parallel shader compilation in the backend.
322331 * Currently only honored by the GL and Metal backends.
Original file line number Diff line number Diff line change @@ -140,6 +140,7 @@ Engine* FEngine::create(Builder const& builder) {
140140 .forceGLES2Context = instance->getConfig ().forceGLES2Context ,
141141 .stereoscopicType = instance->getConfig ().stereoscopicType ,
142142 .assertNativeWindowIsValid = instance->features .backend .opengl .assert_native_window_is_valid ,
143+ .metalDisablePanicOnDrawableFailure = instance->getConfig ().metalDisablePanicOnDrawableFailure ,
143144 };
144145 instance->mDriver = platform->createDriver (sharedContext, driverConfig);
145146
@@ -759,6 +760,7 @@ int FEngine::loop() {
759760 .forceGLES2Context = mConfig .forceGLES2Context ,
760761 .stereoscopicType = mConfig .stereoscopicType ,
761762 .assertNativeWindowIsValid = features.backend .opengl .assert_native_window_is_valid ,
763+ .metalDisablePanicOnDrawableFailure = mConfig .metalDisablePanicOnDrawableFailure ,
762764 };
763765 mDriver = mPlatform ->createDriver (mSharedGLContext , driverConfig);
764766
You can’t perform that action at this time.
0 commit comments