diff options
| -rw-r--r-- | src/audio_core/device/audio_buffers.h | 8 | ||||
| -rw-r--r-- | src/audio_core/device/device_session.cpp | 6 | ||||
| -rw-r--r-- | src/audio_core/device/device_session.h | 5 | ||||
| -rw-r--r-- | src/audio_core/in/audio_in_system.cpp | 7 | ||||
| -rw-r--r-- | src/audio_core/out/audio_out_system.cpp | 7 | ||||
| -rw-r--r-- | src/core/hle/kernel/hle_ipc.cpp | 14 | ||||
| -rw-r--r-- | src/input_common/drivers/camera.cpp | 2 | ||||
| -rw-r--r-- | src/input_common/drivers/camera.h | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_rasterizer.cpp | 3 | ||||
| -rw-r--r-- | src/yuzu/bootmanager.cpp | 19 | ||||
| -rw-r--r-- | src/yuzu/bootmanager.h | 3 | ||||
| -rw-r--r-- | src/yuzu/main.cpp | 3 |
12 files changed, 52 insertions, 29 deletions
diff --git a/src/audio_core/device/audio_buffers.h b/src/audio_core/device/audio_buffers.h index 3dae1a3b7..15082f6c6 100644 --- a/src/audio_core/device/audio_buffers.h +++ b/src/audio_core/device/audio_buffers.h | |||
| @@ -91,9 +91,10 @@ public: | |||
| 91 | * @param core_timing - The CoreTiming instance | 91 | * @param core_timing - The CoreTiming instance |
| 92 | * @param session - The device session | 92 | * @param session - The device session |
| 93 | * | 93 | * |
| 94 | * @return Is the buffer was released. | 94 | * @return If any buffer was released. |
| 95 | */ | 95 | */ |
| 96 | bool ReleaseBuffers(const Core::Timing::CoreTiming& core_timing, const DeviceSession& session) { | 96 | bool ReleaseBuffers(const Core::Timing::CoreTiming& core_timing, const DeviceSession& session, |
| 97 | bool force) { | ||
| 97 | std::scoped_lock l{lock}; | 98 | std::scoped_lock l{lock}; |
| 98 | bool buffer_released{false}; | 99 | bool buffer_released{false}; |
| 99 | while (registered_count > 0) { | 100 | while (registered_count > 0) { |
| @@ -103,7 +104,8 @@ public: | |||
| 103 | } | 104 | } |
| 104 | 105 | ||
| 105 | // Check with the backend if this buffer can be released yet. | 106 | // Check with the backend if this buffer can be released yet. |
| 106 | if (!session.IsBufferConsumed(buffers[index])) { | 107 | // If we're shutting down, we don't care if it's been played or not. |
| 108 | if (!force && !session.IsBufferConsumed(buffers[index])) { | ||
| 107 | break; | 109 | break; |
| 108 | } | 110 | } |
| 109 | 111 | ||
diff --git a/src/audio_core/device/device_session.cpp b/src/audio_core/device/device_session.cpp index 995060414..5a327a606 100644 --- a/src/audio_core/device/device_session.cpp +++ b/src/audio_core/device/device_session.cpp | |||
| @@ -73,6 +73,12 @@ void DeviceSession::Stop() { | |||
| 73 | } | 73 | } |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | void DeviceSession::ClearBuffers() { | ||
| 77 | if (stream) { | ||
| 78 | stream->ClearQueue(); | ||
| 79 | } | ||
| 80 | } | ||
| 81 | |||
| 76 | void DeviceSession::AppendBuffers(std::span<const AudioBuffer> buffers) const { | 82 | void DeviceSession::AppendBuffers(std::span<const AudioBuffer> buffers) const { |
| 77 | for (const auto& buffer : buffers) { | 83 | for (const auto& buffer : buffers) { |
| 78 | Sink::SinkBuffer new_buffer{ | 84 | Sink::SinkBuffer new_buffer{ |
diff --git a/src/audio_core/device/device_session.h b/src/audio_core/device/device_session.h index 74f4dc085..75f766c68 100644 --- a/src/audio_core/device/device_session.h +++ b/src/audio_core/device/device_session.h | |||
| @@ -91,6 +91,11 @@ public: | |||
| 91 | void Stop(); | 91 | void Stop(); |
| 92 | 92 | ||
| 93 | /** | 93 | /** |
| 94 | * Clear out the underlying audio buffers in the backend stream. | ||
| 95 | */ | ||
| 96 | void ClearBuffers(); | ||
| 97 | |||
| 98 | /** | ||
| 94 | * Set this device session's volume. | 99 | * Set this device session's volume. |
| 95 | * | 100 | * |
| 96 | * @param volume - New volume for this session. | 101 | * @param volume - New volume for this session. |
diff --git a/src/audio_core/in/audio_in_system.cpp b/src/audio_core/in/audio_in_system.cpp index 4324cafd8..934ef8c1c 100644 --- a/src/audio_core/in/audio_in_system.cpp +++ b/src/audio_core/in/audio_in_system.cpp | |||
| @@ -23,7 +23,6 @@ System::~System() { | |||
| 23 | void System::Finalize() { | 23 | void System::Finalize() { |
| 24 | Stop(); | 24 | Stop(); |
| 25 | session->Finalize(); | 25 | session->Finalize(); |
| 26 | buffer_event->Signal(); | ||
| 27 | } | 26 | } |
| 28 | 27 | ||
| 29 | void System::StartSession() { | 28 | void System::StartSession() { |
| @@ -102,6 +101,10 @@ Result System::Stop() { | |||
| 102 | if (state == State::Started) { | 101 | if (state == State::Started) { |
| 103 | session->Stop(); | 102 | session->Stop(); |
| 104 | session->SetVolume(0.0f); | 103 | session->SetVolume(0.0f); |
| 104 | session->ClearBuffers(); | ||
| 105 | if (buffers.ReleaseBuffers(system.CoreTiming(), *session, true)) { | ||
| 106 | buffer_event->Signal(); | ||
| 107 | } | ||
| 105 | state = State::Stopped; | 108 | state = State::Stopped; |
| 106 | } | 109 | } |
| 107 | 110 | ||
| @@ -138,7 +141,7 @@ void System::RegisterBuffers() { | |||
| 138 | } | 141 | } |
| 139 | 142 | ||
| 140 | void System::ReleaseBuffers() { | 143 | void System::ReleaseBuffers() { |
| 141 | bool signal{buffers.ReleaseBuffers(system.CoreTiming(), *session)}; | 144 | bool signal{buffers.ReleaseBuffers(system.CoreTiming(), *session, false)}; |
| 142 | 145 | ||
| 143 | if (signal) { | 146 | if (signal) { |
| 144 | // Signal if any buffer was released, or if none are registered, we need more. | 147 | // Signal if any buffer was released, or if none are registered, we need more. |
diff --git a/src/audio_core/out/audio_out_system.cpp b/src/audio_core/out/audio_out_system.cpp index a66208ed9..e096a1dac 100644 --- a/src/audio_core/out/audio_out_system.cpp +++ b/src/audio_core/out/audio_out_system.cpp | |||
| @@ -24,7 +24,6 @@ System::~System() { | |||
| 24 | void System::Finalize() { | 24 | void System::Finalize() { |
| 25 | Stop(); | 25 | Stop(); |
| 26 | session->Finalize(); | 26 | session->Finalize(); |
| 27 | buffer_event->Signal(); | ||
| 28 | } | 27 | } |
| 29 | 28 | ||
| 30 | std::string_view System::GetDefaultOutputDeviceName() const { | 29 | std::string_view System::GetDefaultOutputDeviceName() const { |
| @@ -102,6 +101,10 @@ Result System::Stop() { | |||
| 102 | if (state == State::Started) { | 101 | if (state == State::Started) { |
| 103 | session->Stop(); | 102 | session->Stop(); |
| 104 | session->SetVolume(0.0f); | 103 | session->SetVolume(0.0f); |
| 104 | session->ClearBuffers(); | ||
| 105 | if (buffers.ReleaseBuffers(system.CoreTiming(), *session, true)) { | ||
| 106 | buffer_event->Signal(); | ||
| 107 | } | ||
| 105 | state = State::Stopped; | 108 | state = State::Stopped; |
| 106 | } | 109 | } |
| 107 | 110 | ||
| @@ -138,7 +141,7 @@ void System::RegisterBuffers() { | |||
| 138 | } | 141 | } |
| 139 | 142 | ||
| 140 | void System::ReleaseBuffers() { | 143 | void System::ReleaseBuffers() { |
| 141 | bool signal{buffers.ReleaseBuffers(system.CoreTiming(), *session)}; | 144 | bool signal{buffers.ReleaseBuffers(system.CoreTiming(), *session, false)}; |
| 142 | if (signal) { | 145 | if (signal) { |
| 143 | // Signal if any buffer was released, or if none are registered, we need more. | 146 | // Signal if any buffer was released, or if none are registered, we need more. |
| 144 | buffer_event->Signal(); | 147 | buffer_event->Signal(); |
diff --git a/src/core/hle/kernel/hle_ipc.cpp b/src/core/hle/kernel/hle_ipc.cpp index e6479c131..738b6d0f1 100644 --- a/src/core/hle/kernel/hle_ipc.cpp +++ b/src/core/hle/kernel/hle_ipc.cpp | |||
| @@ -326,25 +326,23 @@ Result HLERequestContext::WriteToOutgoingCommandBuffer(KThread& requesting_threa | |||
| 326 | } | 326 | } |
| 327 | 327 | ||
| 328 | std::vector<u8> HLERequestContext::ReadBuffer(std::size_t buffer_index) const { | 328 | std::vector<u8> HLERequestContext::ReadBuffer(std::size_t buffer_index) const { |
| 329 | std::vector<u8> buffer{}; | ||
| 330 | const bool is_buffer_a{BufferDescriptorA().size() > buffer_index && | 329 | const bool is_buffer_a{BufferDescriptorA().size() > buffer_index && |
| 331 | BufferDescriptorA()[buffer_index].Size()}; | 330 | BufferDescriptorA()[buffer_index].Size()}; |
| 332 | |||
| 333 | if (is_buffer_a) { | 331 | if (is_buffer_a) { |
| 334 | ASSERT_OR_EXECUTE_MSG( | 332 | ASSERT_OR_EXECUTE_MSG( |
| 335 | BufferDescriptorA().size() > buffer_index, { return buffer; }, | 333 | BufferDescriptorA().size() > buffer_index, { return {}; }, |
| 336 | "BufferDescriptorA invalid buffer_index {}", buffer_index); | 334 | "BufferDescriptorA invalid buffer_index {}", buffer_index); |
| 337 | buffer.resize(BufferDescriptorA()[buffer_index].Size()); | 335 | std::vector<u8> buffer(BufferDescriptorA()[buffer_index].Size()); |
| 338 | memory.ReadBlock(BufferDescriptorA()[buffer_index].Address(), buffer.data(), buffer.size()); | 336 | memory.ReadBlock(BufferDescriptorA()[buffer_index].Address(), buffer.data(), buffer.size()); |
| 337 | return buffer; | ||
| 339 | } else { | 338 | } else { |
| 340 | ASSERT_OR_EXECUTE_MSG( | 339 | ASSERT_OR_EXECUTE_MSG( |
| 341 | BufferDescriptorX().size() > buffer_index, { return buffer; }, | 340 | BufferDescriptorX().size() > buffer_index, { return {}; }, |
| 342 | "BufferDescriptorX invalid buffer_index {}", buffer_index); | 341 | "BufferDescriptorX invalid buffer_index {}", buffer_index); |
| 343 | buffer.resize(BufferDescriptorX()[buffer_index].Size()); | 342 | std::vector<u8> buffer(BufferDescriptorX()[buffer_index].Size()); |
| 344 | memory.ReadBlock(BufferDescriptorX()[buffer_index].Address(), buffer.data(), buffer.size()); | 343 | memory.ReadBlock(BufferDescriptorX()[buffer_index].Address(), buffer.data(), buffer.size()); |
| 344 | return buffer; | ||
| 345 | } | 345 | } |
| 346 | |||
| 347 | return buffer; | ||
| 348 | } | 346 | } |
| 349 | 347 | ||
| 350 | std::size_t HLERequestContext::WriteBuffer(const void* buffer, std::size_t size, | 348 | std::size_t HLERequestContext::WriteBuffer(const void* buffer, std::size_t size, |
diff --git a/src/input_common/drivers/camera.cpp b/src/input_common/drivers/camera.cpp index dceea67e0..fad9177dc 100644 --- a/src/input_common/drivers/camera.cpp +++ b/src/input_common/drivers/camera.cpp | |||
| @@ -17,7 +17,7 @@ Camera::Camera(std::string input_engine_) : InputEngine(std::move(input_engine_) | |||
| 17 | PreSetController(identifier); | 17 | PreSetController(identifier); |
| 18 | } | 18 | } |
| 19 | 19 | ||
| 20 | void Camera::SetCameraData(std::size_t width, std::size_t height, std::vector<u32> data) { | 20 | void Camera::SetCameraData(std::size_t width, std::size_t height, std::span<const u32> data) { |
| 21 | const std::size_t desired_width = getImageWidth(); | 21 | const std::size_t desired_width = getImageWidth(); |
| 22 | const std::size_t desired_height = getImageHeight(); | 22 | const std::size_t desired_height = getImageHeight(); |
| 23 | status.data.resize(desired_width * desired_height); | 23 | status.data.resize(desired_width * desired_height); |
diff --git a/src/input_common/drivers/camera.h b/src/input_common/drivers/camera.h index b8a7c75e5..38fb1ae4c 100644 --- a/src/input_common/drivers/camera.h +++ b/src/input_common/drivers/camera.h | |||
| @@ -3,6 +3,8 @@ | |||
| 3 | 3 | ||
| 4 | #pragma once | 4 | #pragma once |
| 5 | 5 | ||
| 6 | #include <span> | ||
| 7 | |||
| 6 | #include "input_common/input_engine.h" | 8 | #include "input_common/input_engine.h" |
| 7 | 9 | ||
| 8 | namespace InputCommon { | 10 | namespace InputCommon { |
| @@ -15,7 +17,7 @@ class Camera final : public InputEngine { | |||
| 15 | public: | 17 | public: |
| 16 | explicit Camera(std::string input_engine_); | 18 | explicit Camera(std::string input_engine_); |
| 17 | 19 | ||
| 18 | void SetCameraData(std::size_t width, std::size_t height, std::vector<u32> data); | 20 | void SetCameraData(std::size_t width, std::size_t height, std::span<const u32> data); |
| 19 | 21 | ||
| 20 | std::size_t getImageWidth() const; | 22 | std::size_t getImageWidth() const; |
| 21 | std::size_t getImageHeight() const; | 23 | std::size_t getImageHeight() const; |
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index a8b82abae..4b7126c30 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp | |||
| @@ -658,8 +658,7 @@ void RasterizerVulkan::BeginTransformFeedback() { | |||
| 658 | return; | 658 | return; |
| 659 | } | 659 | } |
| 660 | UNIMPLEMENTED_IF(regs.IsShaderConfigEnabled(Maxwell::ShaderType::TessellationInit) || | 660 | UNIMPLEMENTED_IF(regs.IsShaderConfigEnabled(Maxwell::ShaderType::TessellationInit) || |
| 661 | regs.IsShaderConfigEnabled(Maxwell::ShaderType::Tessellation) || | 661 | regs.IsShaderConfigEnabled(Maxwell::ShaderType::Tessellation)); |
| 662 | regs.IsShaderConfigEnabled(Maxwell::ShaderType::Geometry)); | ||
| 663 | scheduler.Record( | 662 | scheduler.Record( |
| 664 | [](vk::CommandBuffer cmdbuf) { cmdbuf.BeginTransformFeedbackEXT(0, 0, nullptr, nullptr); }); | 663 | [](vk::CommandBuffer cmdbuf) { cmdbuf.BeginTransformFeedbackEXT(0, 0, nullptr, nullptr); }); |
| 665 | } | 664 | } |
diff --git a/src/yuzu/bootmanager.cpp b/src/yuzu/bootmanager.cpp index 7147c6aaa..682b37f47 100644 --- a/src/yuzu/bootmanager.cpp +++ b/src/yuzu/bootmanager.cpp | |||
| @@ -278,12 +278,14 @@ static Core::Frontend::WindowSystemType GetWindowSystemType() { | |||
| 278 | return Core::Frontend::WindowSystemType::X11; | 278 | return Core::Frontend::WindowSystemType::X11; |
| 279 | else if (platform_name == QStringLiteral("wayland")) | 279 | else if (platform_name == QStringLiteral("wayland")) |
| 280 | return Core::Frontend::WindowSystemType::Wayland; | 280 | return Core::Frontend::WindowSystemType::Wayland; |
| 281 | else if (platform_name == QStringLiteral("wayland-egl")) | ||
| 282 | return Core::Frontend::WindowSystemType::Wayland; | ||
| 281 | else if (platform_name == QStringLiteral("cocoa")) | 283 | else if (platform_name == QStringLiteral("cocoa")) |
| 282 | return Core::Frontend::WindowSystemType::Cocoa; | 284 | return Core::Frontend::WindowSystemType::Cocoa; |
| 283 | else if (platform_name == QStringLiteral("android")) | 285 | else if (platform_name == QStringLiteral("android")) |
| 284 | return Core::Frontend::WindowSystemType::Android; | 286 | return Core::Frontend::WindowSystemType::Android; |
| 285 | 287 | ||
| 286 | LOG_CRITICAL(Frontend, "Unknown Qt platform!"); | 288 | LOG_CRITICAL(Frontend, "Unknown Qt platform {}!", platform_name.toStdString()); |
| 287 | return Core::Frontend::WindowSystemType::Windows; | 289 | return Core::Frontend::WindowSystemType::Windows; |
| 288 | } | 290 | } |
| 289 | 291 | ||
| @@ -323,7 +325,8 @@ GRenderWindow::GRenderWindow(GMainWindow* parent, EmuThread* emu_thread_, | |||
| 323 | input_subsystem->Initialize(); | 325 | input_subsystem->Initialize(); |
| 324 | this->setMouseTracking(true); | 326 | this->setMouseTracking(true); |
| 325 | 327 | ||
| 326 | strict_context_required = QGuiApplication::platformName() == QStringLiteral("wayland"); | 328 | strict_context_required = QGuiApplication::platformName() == QStringLiteral("wayland") || |
| 329 | QGuiApplication::platformName() == QStringLiteral("wayland-egl"); | ||
| 327 | 330 | ||
| 328 | connect(this, &GRenderWindow::FirstFrameDisplayed, parent, &GMainWindow::OnLoadComplete); | 331 | connect(this, &GRenderWindow::FirstFrameDisplayed, parent, &GMainWindow::OnLoadComplete); |
| 329 | connect(this, &GRenderWindow::ExecuteProgramSignal, parent, &GMainWindow::OnExecuteProgram, | 332 | connect(this, &GRenderWindow::ExecuteProgramSignal, parent, &GMainWindow::OnExecuteProgram, |
| @@ -761,6 +764,7 @@ void GRenderWindow::InitializeCamera() { | |||
| 761 | return; | 764 | return; |
| 762 | } | 765 | } |
| 763 | 766 | ||
| 767 | camera_data.resize(CAMERA_WIDTH * CAMERA_HEIGHT); | ||
| 764 | camera_capture->setCaptureDestination(QCameraImageCapture::CaptureDestination::CaptureToBuffer); | 768 | camera_capture->setCaptureDestination(QCameraImageCapture::CaptureDestination::CaptureToBuffer); |
| 765 | connect(camera_capture.get(), &QCameraImageCapture::imageCaptured, this, | 769 | connect(camera_capture.get(), &QCameraImageCapture::imageCaptured, this, |
| 766 | &GRenderWindow::OnCameraCapture); | 770 | &GRenderWindow::OnCameraCapture); |
| @@ -816,16 +820,13 @@ void GRenderWindow::RequestCameraCapture() { | |||
| 816 | } | 820 | } |
| 817 | 821 | ||
| 818 | void GRenderWindow::OnCameraCapture(int requestId, const QImage& img) { | 822 | void GRenderWindow::OnCameraCapture(int requestId, const QImage& img) { |
| 819 | constexpr std::size_t camera_width = 320; | 823 | // TODO: Capture directly in the format and resolution needed |
| 820 | constexpr std::size_t camera_height = 240; | ||
| 821 | const auto converted = | 824 | const auto converted = |
| 822 | img.scaled(camera_width, camera_height, Qt::AspectRatioMode::IgnoreAspectRatio, | 825 | img.scaled(CAMERA_WIDTH, CAMERA_HEIGHT, Qt::AspectRatioMode::IgnoreAspectRatio, |
| 823 | Qt::TransformationMode::SmoothTransformation) | 826 | Qt::TransformationMode::SmoothTransformation) |
| 824 | .mirrored(false, true); | 827 | .mirrored(false, true); |
| 825 | std::vector<u32> camera_data{}; | 828 | std::memcpy(camera_data.data(), converted.bits(), CAMERA_WIDTH * CAMERA_HEIGHT * sizeof(u32)); |
| 826 | camera_data.resize(camera_width * camera_height); | 829 | input_subsystem->GetCamera()->SetCameraData(CAMERA_WIDTH, CAMERA_HEIGHT, camera_data); |
| 827 | std::memcpy(camera_data.data(), converted.bits(), camera_width * camera_height * sizeof(u32)); | ||
| 828 | input_subsystem->GetCamera()->SetCameraData(camera_width, camera_height, camera_data); | ||
| 829 | pending_camera_snapshots = 0; | 830 | pending_camera_snapshots = 0; |
| 830 | } | 831 | } |
| 831 | 832 | ||
diff --git a/src/yuzu/bootmanager.h b/src/yuzu/bootmanager.h index f0edad6e4..5bbcf61f7 100644 --- a/src/yuzu/bootmanager.h +++ b/src/yuzu/bootmanager.h | |||
| @@ -247,6 +247,9 @@ private: | |||
| 247 | #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && YUZU_USE_QT_MULTIMEDIA | 247 | #if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0)) && YUZU_USE_QT_MULTIMEDIA |
| 248 | std::unique_ptr<QCamera> camera; | 248 | std::unique_ptr<QCamera> camera; |
| 249 | std::unique_ptr<QCameraImageCapture> camera_capture; | 249 | std::unique_ptr<QCameraImageCapture> camera_capture; |
| 250 | static constexpr std::size_t CAMERA_WIDTH = 320; | ||
| 251 | static constexpr std::size_t CAMERA_HEIGHT = 240; | ||
| 252 | std::vector<u32> camera_data; | ||
| 250 | #endif | 253 | #endif |
| 251 | std::unique_ptr<QTimer> camera_timer; | 254 | std::unique_ptr<QTimer> camera_timer; |
| 252 | 255 | ||
diff --git a/src/yuzu/main.cpp b/src/yuzu/main.cpp index 70552bdb8..2e6c2311a 100644 --- a/src/yuzu/main.cpp +++ b/src/yuzu/main.cpp | |||
| @@ -3067,7 +3067,8 @@ static QScreen* GuessCurrentScreen(QWidget* window) { | |||
| 3067 | 3067 | ||
| 3068 | bool GMainWindow::UsingExclusiveFullscreen() { | 3068 | bool GMainWindow::UsingExclusiveFullscreen() { |
| 3069 | return Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive || | 3069 | return Settings::values.fullscreen_mode.GetValue() == Settings::FullscreenMode::Exclusive || |
| 3070 | QGuiApplication::platformName() == QStringLiteral("wayland"); | 3070 | QGuiApplication::platformName() == QStringLiteral("wayland") || |
| 3071 | QGuiApplication::platformName() == QStringLiteral("wayland-egl"); | ||
| 3071 | } | 3072 | } |
| 3072 | 3073 | ||
| 3073 | void GMainWindow::ShowFullscreen() { | 3074 | void GMainWindow::ShowFullscreen() { |