Hack to fix MSAA GL -> Vk transition on Windows Viewer
Bug: skia: Change-Id: I49417789ab43734a1cbb4010281482970579971d Reviewed-on: https://skia-review.googlesource.com/20505 Reviewed-by: Greg Daniel <egdaniel@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
80ce804f3e
commit
2ac96dc82c
@ -684,7 +684,13 @@ void Viewer::setBackend(sk_app::Window::BackendType backendType) {
|
||||
fWindow->registerMouseWheelFunc(on_mouse_wheel_handler, this);
|
||||
fWindow->registerKeyFunc(on_key_handler, this);
|
||||
fWindow->registerCharFunc(on_char_handler, this);
|
||||
fWindow->setRequestedDisplayParams(params);
|
||||
// Don't allow the window to re-attach. If we're in MSAA mode, the params we grabbed above
|
||||
// will still include our correct sample count. But the re-created fWindow will lose that
|
||||
// information. On Windows, we need to re-create the window when changing sample count,
|
||||
// so we'll incorrectly detect that situation, then re-initialize the window in GL mode,
|
||||
// rendering this tear-down step pointless (and causing the Vulkan window context to fail
|
||||
// as if we had never changed windows at all).
|
||||
fWindow->setRequestedDisplayParams(params, false);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -128,7 +128,7 @@ int Window::height() {
|
||||
return fWindowContext->height();
|
||||
}
|
||||
|
||||
void Window::setRequestedDisplayParams(const DisplayParams& params) {
|
||||
void Window::setRequestedDisplayParams(const DisplayParams& params, bool /* allowReattach */) {
|
||||
fRequestedDisplayParams = params;
|
||||
if (fWindowContext) {
|
||||
fWindowContext->setDisplayParams(fRequestedDisplayParams);
|
||||
|
@ -191,7 +191,7 @@ public:
|
||||
int height();
|
||||
|
||||
virtual const DisplayParams& getRequestedDisplayParams() { return fRequestedDisplayParams; }
|
||||
virtual void setRequestedDisplayParams(const DisplayParams&);
|
||||
virtual void setRequestedDisplayParams(const DisplayParams&, bool allowReattach = true);
|
||||
|
||||
// Actual parameters in effect, obtained from the native window.
|
||||
int sampleCount() const;
|
||||
|
@ -369,9 +369,10 @@ void Window_win::onInval() {
|
||||
InvalidateRect(fHWnd, nullptr, false);
|
||||
}
|
||||
|
||||
void Window_win::setRequestedDisplayParams(const DisplayParams& params) {
|
||||
void Window_win::setRequestedDisplayParams(const DisplayParams& params, bool allowReattach) {
|
||||
// GL on Windows doesn't let us change MSAA after the window is created
|
||||
if (params.fMSAASampleCount != this->getRequestedDisplayParams().fMSAASampleCount) {
|
||||
if (params.fMSAASampleCount != this->getRequestedDisplayParams().fMSAASampleCount
|
||||
&& allowReattach) {
|
||||
// Need to change these early, so attach() creates the window context correctly
|
||||
fRequestedDisplayParams = params;
|
||||
|
||||
@ -381,7 +382,7 @@ void Window_win::setRequestedDisplayParams(const DisplayParams& params) {
|
||||
this->attach(fBackend);
|
||||
}
|
||||
|
||||
INHERITED::setRequestedDisplayParams(params);
|
||||
INHERITED::setRequestedDisplayParams(params, allowReattach);
|
||||
}
|
||||
|
||||
} // namespace sk_app
|
||||
|
@ -27,7 +27,7 @@ public:
|
||||
|
||||
void onInval() override;
|
||||
|
||||
void setRequestedDisplayParams(const DisplayParams&) override;
|
||||
void setRequestedDisplayParams(const DisplayParams&, bool allowReattach) override;
|
||||
|
||||
private:
|
||||
void closeWindow();
|
||||
|
Loading…
Reference in New Issue
Block a user