Fix MakeCurrent and shader issues with AMD 22.7 driver
This commit is contained in:
parent
6764264488
commit
ff81fb04b4
6 changed files with 35 additions and 2 deletions
|
@ -30,7 +30,6 @@ SharedContext_SDL2::SharedContext_SDL2() {
|
|||
}
|
||||
|
||||
SharedContext_SDL2::~SharedContext_SDL2() {
|
||||
DoneCurrent();
|
||||
SDL_GL_DeleteContext(context);
|
||||
SDL_DestroyWindow(window);
|
||||
}
|
||||
|
@ -185,6 +184,7 @@ EmuWindow_SDL2::EmuWindow_SDL2(bool fullscreen) {
|
|||
|
||||
window_context = SDL_GL_CreateContext(render_window);
|
||||
core_context = CreateSharedContext();
|
||||
last_saved_context = nullptr;
|
||||
|
||||
if (window_context == nullptr) {
|
||||
LOG_CRITICAL(Frontend, "Failed to create SDL2 GL context: {}", SDL_GetError());
|
||||
|
@ -222,6 +222,14 @@ std::unique_ptr<Frontend::GraphicsContext> EmuWindow_SDL2::CreateSharedContext()
|
|||
return std::make_unique<SharedContext_SDL2>();
|
||||
}
|
||||
|
||||
void EmuWindow_SDL2::SaveContext() {
|
||||
last_saved_context = SDL_GL_GetCurrentContext();
|
||||
}
|
||||
|
||||
void EmuWindow_SDL2::RestoreContext() {
|
||||
SDL_GL_MakeCurrent(render_window, last_saved_context);
|
||||
}
|
||||
|
||||
void EmuWindow_SDL2::Present() {
|
||||
SDL_GL_MakeCurrent(render_window, window_context);
|
||||
SDL_GL_SetSwapInterval(1);
|
||||
|
|
|
@ -49,6 +49,11 @@ public:
|
|||
/// Creates a new context that is shared with the current context
|
||||
std::unique_ptr<GraphicsContext> CreateSharedContext() const override;
|
||||
|
||||
/// Saves the current context, for the purpose of e.g. creating new shared contexts
|
||||
void SaveContext() override;
|
||||
/// Restores the context previously saved
|
||||
void RestoreContext() override;
|
||||
|
||||
private:
|
||||
/// Called by PollEvents when a key is pressed or released.
|
||||
void OnKeyEvent(int key, u8 state);
|
||||
|
@ -94,6 +99,9 @@ private:
|
|||
/// The OpenGL context associated with the window
|
||||
SDL_GLContext window_context;
|
||||
|
||||
/// Used by SaveContext and RestoreContext
|
||||
SDL_GLContext last_saved_context;
|
||||
|
||||
/// The OpenGL context associated with the core
|
||||
std::unique_ptr<Frontend::GraphicsContext> core_context;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue