Massive refactoring of xenia::ui and GL swap behavior.

This seems to dramatically improve most games (especially with
--vsync=false), though it may cause swap issues with others.
New code should be easier to port, and enables elemental-forms to be
drawn for any emulator UI.
This commit is contained in:
Ben Vanik
2015-07-12 22:03:47 -07:00
parent e69c7b00a8
commit 15c17459be
61 changed files with 1994 additions and 2623 deletions

View File

@@ -23,7 +23,6 @@
#include "xenia/kernel/kernel_state.h"
#include "xenia/kernel/modules.h"
#include "xenia/memory.h"
#include "xenia/ui/main_window.h"
#include "xenia/vfs/virtual_file_system.h"
#include "xenia/vfs/devices/disc_image_device.h"
#include "xenia/vfs/devices/host_path_device.h"
@@ -68,14 +67,13 @@ Emulator::~Emulator() {
debugger_.reset();
export_resolver_.reset();
// Kill the window last, as until the graphics system/etc is dead it's needed.
display_window_.reset();
}
X_STATUS Emulator::Setup() {
X_STATUS Emulator::Setup(ui::Window* display_window) {
X_STATUS result = X_STATUS_UNSUCCESSFUL;
display_window_ = display_window;
// Initialize clock.
// 360 uses a 50MHz clock.
Clock::set_guest_tick_frequency(50000000);
@@ -93,9 +91,6 @@ X_STATUS Emulator::Setup() {
&system_affinity_mask);
SetProcessAffinityMask(process_handle, system_affinity_mask);
// Create the main window. Other parts will hook into this.
display_window_ = ui::MainWindow::Create(this);
// Create memory system first, as it is required for other systems.
memory_ = std::make_unique<Memory>();
result = memory_->Initialize();
@@ -129,6 +124,10 @@ X_STATUS Emulator::Setup() {
if (!graphics_system_) {
return X_STATUS_NOT_IMPLEMENTED;
}
display_window_->loop()->PostSynchronous([this]() {
display_window_->set_context(
graphics_system_->CreateContext(display_window_));
});
// Initialize the HID.
input_system_ = std::move(xe::hid::InputSystem::Create(this));
@@ -152,7 +151,7 @@ X_STATUS Emulator::Setup() {
return result;
}
result = graphics_system_->Setup(processor_.get(), display_window_->loop(),
display_window_.get());
display_window_);
if (result) {
return result;
}
@@ -171,6 +170,17 @@ X_STATUS Emulator::Setup() {
kernel_state_->LoadKernelModule<kernel::XboxkrnlModule>();
kernel_state_->LoadKernelModule<kernel::XamModule>();
// Finish initializing the display.
display_window_->loop()->PostSynchronous([this]() {
{
xe::ui::GraphicsContextLock context_lock(display_window_->context());
auto profiler_display =
display_window_->context()->CreateProfilerDisplay();
Profiler::set_display(std::move(profiler_display));
}
display_window_->MakeReady();
});
return result;
}