Fix crash on windows viewer when starting in vulkan.
setRequestedDisplayParams is called when setting up viewer before we've inited the Window. On windows this tries to attach the Window for a given backend. However, we haven't set fBackend yet. Later on we will directly call attach. Change-Id: I4bd6586478f2b040e5913314c4e47e92fc893a60 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/344756 Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Greg Daniel <egdaniel@google.com>
This commit is contained in:
parent
15f51848df
commit
fcd68167a2
@ -52,6 +52,7 @@ public:
|
|||||||
virtual bool scaleContentToFit() const { return false; }
|
virtual bool scaleContentToFit() const { return false; }
|
||||||
|
|
||||||
enum BackendType {
|
enum BackendType {
|
||||||
|
kUnknown_BackendType,
|
||||||
#ifdef SK_GL
|
#ifdef SK_GL
|
||||||
kNativeGL_BackendType,
|
kNativeGL_BackendType,
|
||||||
#endif
|
#endif
|
||||||
|
@ -66,6 +66,8 @@ void Window_android::initDisplay(ANativeWindow* window) {
|
|||||||
window_context_factory::MakeVulkanForAndroid(window, fRequestedDisplayParams);
|
window_context_factory::MakeVulkanForAndroid(window, fRequestedDisplayParams);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
case kUnknown_BackendType:
|
||||||
|
SkUNREACHABLE;
|
||||||
}
|
}
|
||||||
this->onBackendCreated();
|
this->onBackendCreated();
|
||||||
}
|
}
|
||||||
|
@ -100,6 +100,8 @@ bool Window_ios::attach(BackendType attachType) {
|
|||||||
case kRaster_BackendType:
|
case kRaster_BackendType:
|
||||||
fWindowContext = MakeRasterForIOS(info, fRequestedDisplayParams);
|
fWindowContext = MakeRasterForIOS(info, fRequestedDisplayParams);
|
||||||
break;
|
break;
|
||||||
|
case kUnknown_BackendType:
|
||||||
|
SkUNREACHABLE;
|
||||||
}
|
}
|
||||||
this->onBackendCreated();
|
this->onBackendCreated();
|
||||||
|
|
||||||
|
@ -148,6 +148,8 @@ bool Window_mac::attach(BackendType attachType) {
|
|||||||
case kRaster_BackendType:
|
case kRaster_BackendType:
|
||||||
fWindowContext = MakeRasterForMac(info, fRequestedDisplayParams);
|
fWindowContext = MakeRasterForMac(info, fRequestedDisplayParams);
|
||||||
break;
|
break;
|
||||||
|
case kUnknown_BackendType:
|
||||||
|
SkUNREACHABLE;
|
||||||
}
|
}
|
||||||
this->onBackendCreated();
|
this->onBackendCreated();
|
||||||
|
|
||||||
|
@ -418,6 +418,8 @@ bool Window_unix::attach(BackendType attachType) {
|
|||||||
fWindowContext =
|
fWindowContext =
|
||||||
window_context_factory::MakeRasterForXlib(winInfo, fRequestedDisplayParams);
|
window_context_factory::MakeRasterForXlib(winInfo, fRequestedDisplayParams);
|
||||||
break;
|
break;
|
||||||
|
case kUnknown_BackendType:
|
||||||
|
SkUNREACHABLE;
|
||||||
}
|
}
|
||||||
this->onBackendCreated();
|
this->onBackendCreated();
|
||||||
|
|
||||||
|
@ -383,6 +383,8 @@ bool Window_win::attach(BackendType attachType) {
|
|||||||
window_context_factory::MakeD3D12ForWin(fHWnd, fRequestedDisplayParams);
|
window_context_factory::MakeD3D12ForWin(fHWnd, fRequestedDisplayParams);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
case kUnknown_BackendType:
|
||||||
|
SkUNREACHABLE;
|
||||||
}
|
}
|
||||||
this->onBackendCreated();
|
this->onBackendCreated();
|
||||||
|
|
||||||
@ -403,7 +405,9 @@ void Window_win::setRequestedDisplayParams(const DisplayParams& params, bool all
|
|||||||
fWindowContext = nullptr;
|
fWindowContext = nullptr;
|
||||||
this->closeWindow();
|
this->closeWindow();
|
||||||
this->init(fHInstance);
|
this->init(fHInstance);
|
||||||
this->attach(fBackend);
|
if (fBackend != kUnknown_BackendType) {
|
||||||
|
this->attach(fBackend);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
INHERITED::setRequestedDisplayParams(params, allowReattach);
|
INHERITED::setRequestedDisplayParams(params, allowReattach);
|
||||||
|
@ -35,7 +35,7 @@ private:
|
|||||||
|
|
||||||
HINSTANCE fHInstance;
|
HINSTANCE fHInstance;
|
||||||
HWND fHWnd;
|
HWND fHWnd;
|
||||||
BackendType fBackend;
|
BackendType fBackend = kUnknown_BackendType;
|
||||||
|
|
||||||
using INHERITED = Window;
|
using INHERITED = Window;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user