OpenGL is working on surface change, vulkan still no

This commit is contained in:
David Griswold 2025-03-05 08:10:50 -03:00 committed by OpenSauce04
parent dc885ca674
commit 37f73070a9
4 changed files with 27 additions and 17 deletions

View File

@ -317,7 +317,7 @@ void Java_org_citra_citra_1emu_NativeLibrary_surfaceChanged(JNIEnv* env,
auto& system = Core::System::GetInstance();
if (notify && system.IsPoweredOn()) {
system.GPU().Renderer().NotifySurfaceChanged();
system.GPU().Renderer().NotifySurfaceChanged(false);
}
LOG_INFO(Frontend, "Surface changed");
@ -325,16 +325,16 @@ void Java_org_citra_citra_1emu_NativeLibrary_surfaceChanged(JNIEnv* env,
void Java_org_citra_citra_1emu_NativeLibrary_enableSecondWindow(JNIEnv* env,
[[maybe_unused]] jobject obj,jobject surf) {
s_secondary_surface = ANativeWindow_fromSurface(env, surf);
secondary_enabled = true;
bool notify = false;
if (second_window) {
notify = second_window->OnSurfaceChanged(s_secondary_surface);
}
auto& system = Core::System::GetInstance();
if (notify && system.IsPoweredOn()) {
system.GPU().Renderer().NotifySurfaceChanged();
}
s_secondary_surface = ANativeWindow_fromSurface(env, surf);
secondary_enabled = true;
bool notify = false;
if (second_window) {
notify = second_window->OnSurfaceChanged(s_secondary_surface);
}
auto& system = Core::System::GetInstance();
if (notify && system.IsPoweredOn()) {
system.GPU().Renderer().NotifySurfaceChanged(true);
}
LOG_INFO(Frontend, "Secondary Surface changed");
}
@ -345,7 +345,13 @@ void Java_org_citra_citra_1emu_NativeLibrary_disableSecondWindow(JNIEnv* env,
[[maybe_unused]] jobject obj) {
secondary_enabled = false;
// how do I delete the window? TODO
if (s_secondary_surface != nullptr) {
ANativeWindow_release(s_secondary_surface);
s_secondary_surface = nullptr;
if (second_window) {
second_window->OnSurfaceChanged(s_secondary_surface);
}
}
LOG_INFO(Frontend, "Secondary Surface Disabled");
}

View File

@ -64,7 +64,8 @@ public:
virtual void Sync() {}
/// This is called to notify the rendering backend of a surface change
virtual void NotifySurfaceChanged() {}
// if second == true then it is the second screen
virtual void NotifySurfaceChanged(bool second) {}
/// Returns the resolution scale factor relative to the native 3DS screen resolution
u32 GetResolutionScaleFactor();

View File

@ -1129,4 +1129,10 @@ bool RendererVulkan::TryRenderScreenshotWithHostMemory() {
return true;
}
void RendererVulkan::NotifySurfaceChanged(bool second) {
if (second && second_window) second_window->NotifySurfaceChanged();
if (!second) main_window.NotifySurfaceChanged();
}
} // namespace Vulkan

View File

@ -74,10 +74,7 @@ public:
return &rasterizer;
}
void NotifySurfaceChanged() override {
main_window.NotifySurfaceChanged();
if (second_window) second_window->NotifySurfaceChanged();
}
void NotifySurfaceChanged(bool second) override;
void SwapBuffers() override;
void TryPresent(int timeout_ms, bool is_secondary) override {}