mirror of
				https://git.suyu.dev/suyu/suyu
				synced 2025-11-04 00:49:02 -06:00 
			
		
		
		
	android: vulkan: Recreate surface after suspension & adapt to async. presentation.
This commit is contained in:
		@@ -217,6 +217,7 @@ void Config::ReadValues() {
 | 
			
		||||
    ReadSetting("Renderer", Settings::values.accelerate_astc);
 | 
			
		||||
    ReadSetting("Renderer", Settings::values.use_fast_gpu_time);
 | 
			
		||||
    ReadSetting("Renderer", Settings::values.use_vulkan_driver_pipeline_cache);
 | 
			
		||||
    ReadSetting("Renderer", Settings::values.async_presentation);
 | 
			
		||||
 | 
			
		||||
    // Use GPU accuracy normal by default on Android
 | 
			
		||||
    Settings::values.gpu_accuracy = static_cast<Settings::GPUAccuracy>(config->GetInteger(
 | 
			
		||||
@@ -230,10 +231,6 @@ void Config::ReadValues() {
 | 
			
		||||
    Settings::values.renderer_force_max_clock =
 | 
			
		||||
        config->GetBoolean("Renderer", "force_max_clock", true);
 | 
			
		||||
 | 
			
		||||
    // Enable asynchronous presentation by default on Android
 | 
			
		||||
    Settings::values.async_presentation =
 | 
			
		||||
        config->GetBoolean("Renderer", "async_presentation", true);
 | 
			
		||||
 | 
			
		||||
    // Audio
 | 
			
		||||
    ReadSetting("Audio", Settings::values.sink_id);
 | 
			
		||||
    ReadSetting("Audio", Settings::values.audio_output_device_id);
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@
 | 
			
		||||
#include "jni/emu_window/emu_window.h"
 | 
			
		||||
 | 
			
		||||
void EmuWindow_Android::OnSurfaceChanged(ANativeWindow* surface) {
 | 
			
		||||
    m_render_window = surface;
 | 
			
		||||
    window_info.render_surface = reinterpret_cast<void*>(surface);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void EmuWindow_Android::OnTouchPressed(int id, float x, float y) {
 | 
			
		||||
@@ -37,7 +37,7 @@ void EmuWindow_Android::OnGamepadMotionEvent(int player_index, u64 delta_timesta
 | 
			
		||||
                                             float gyro_y, float gyro_z, float accel_x,
 | 
			
		||||
                                             float accel_y, float accel_z) {
 | 
			
		||||
    m_input_subsystem->GetVirtualGamepad()->SetMotionState(
 | 
			
		||||
            player_index, delta_timestamp, gyro_x, gyro_y, gyro_z, accel_x, accel_y, accel_z);
 | 
			
		||||
        player_index, delta_timestamp, gyro_x, gyro_y, gyro_z, accel_x, accel_y, accel_z);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void EmuWindow_Android::OnReadNfcTag(std::span<u8> data) {
 | 
			
		||||
@@ -65,9 +65,8 @@ EmuWindow_Android::EmuWindow_Android(InputCommon::InputSubsystem* input_subsyste
 | 
			
		||||
    // Ensures that we emulate with the correct aspect ratio.
 | 
			
		||||
    UpdateCurrentFramebufferLayout(m_window_width, m_window_height);
 | 
			
		||||
 | 
			
		||||
    m_host_window = surface;
 | 
			
		||||
    window_info.type = Core::Frontend::WindowSystemType::Android;
 | 
			
		||||
    window_info.render_surface = reinterpret_cast<void*>(m_host_window);
 | 
			
		||||
    window_info.render_surface = reinterpret_cast<void*>(surface);
 | 
			
		||||
 | 
			
		||||
    m_input_subsystem->Initialize();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -54,9 +54,6 @@ public:
 | 
			
		||||
private:
 | 
			
		||||
    InputCommon::InputSubsystem* m_input_subsystem{};
 | 
			
		||||
 | 
			
		||||
    ANativeWindow* m_render_window{};
 | 
			
		||||
    ANativeWindow* m_host_window{};
 | 
			
		||||
 | 
			
		||||
    float m_window_width{};
 | 
			
		||||
    float m_window_height{};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user