Non-racing render context, rast state priority

This commit is contained in:
tfarley 2015-05-18 14:10:12 -07:00
parent 4171d6e7b1
commit 18b7bab98f
4 changed files with 4 additions and 8 deletions

View File

@ -28,11 +28,11 @@
EmuThread::EmuThread(GRenderWindow* render_window) : EmuThread::EmuThread(GRenderWindow* render_window) :
exec_step(false), running(false), stop_run(false), render_window(render_window) { exec_step(false), running(false), stop_run(false), render_window(render_window) {
connect(this, SIGNAL(started()), render_window, SLOT(moveContext()));
} }
void EmuThread::run() { void EmuThread::run() {
render_window->MakeCurrent();
stop_run = false; stop_run = false;
// holds whether the cpu was running during the last iteration, // holds whether the cpu was running during the last iteration,

View File

@ -210,6 +210,7 @@ void GMainWindow::BootGame(std::string filename) {
// Create and start the emulation thread // Create and start the emulation thread
emu_thread = Common::make_unique<EmuThread>(render_window); emu_thread = Common::make_unique<EmuThread>(render_window);
emit EmulationStarting(emu_thread.get()); emit EmulationStarting(emu_thread.get());
render_window->moveContext();
emu_thread->start(); emu_thread->start();
// BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views before the CPU continues // BlockingQueuedConnection is important here, it makes sure we've finished refreshing our views before the CPU continues

View File

@ -75,10 +75,6 @@ void RasterizerOpenGL::InitObjects() {
state.draw.vertex_buffer = vertex_buffer.GetHandle(); state.draw.vertex_buffer = vertex_buffer.GetHandle();
state.draw.shader_program = shader.GetHandle(); state.draw.shader_program = shader.GetHandle();
for (auto& texture_unit : state.texture_units) {
texture_unit.enabled_2d = true;
}
state.Apply(); state.Apply();
// Set the texture samplers to correspond to different texture units // Set the texture samplers to correspond to different texture units

View File

@ -65,8 +65,7 @@ RendererOpenGL::~RendererOpenGL() {
/// Swap buffers (render frame) /// Swap buffers (render frame)
void RendererOpenGL::SwapBuffers() { void RendererOpenGL::SwapBuffers() {
render_window->MakeCurrent(); // Maintain the rasterizer's state as a priority
OpenGLState prev_state = OpenGLState::GetCurState(); OpenGLState prev_state = OpenGLState::GetCurState();
state.Apply(); state.Apply();