mirror of
https://github.com/yuzu-emu/yuzu.git
synced 2024-07-04 23:31:19 +01:00
Merge pull request #6412 from clementgallet/yuzu-cmd-window-gl
yuzu-cmd: Fix OpenGL rendering
This commit is contained in:
commit
3b5673daca
2 changed files with 6 additions and 12 deletions
|
@ -32,17 +32,17 @@
|
||||||
|
|
||||||
class SDLGLContext : public Core::Frontend::GraphicsContext {
|
class SDLGLContext : public Core::Frontend::GraphicsContext {
|
||||||
public:
|
public:
|
||||||
explicit SDLGLContext() {
|
explicit SDLGLContext(SDL_Window* window_) : window{window_} {
|
||||||
// create a hidden window to make the shared context against
|
|
||||||
window = SDL_CreateWindow(NULL, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 0, 0,
|
|
||||||
SDL_WINDOW_HIDDEN | SDL_WINDOW_OPENGL);
|
|
||||||
context = SDL_GL_CreateContext(window);
|
context = SDL_GL_CreateContext(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
~SDLGLContext() {
|
~SDLGLContext() {
|
||||||
DoneCurrent();
|
DoneCurrent();
|
||||||
SDL_GL_DeleteContext(context);
|
SDL_GL_DeleteContext(context);
|
||||||
SDL_DestroyWindow(window);
|
}
|
||||||
|
|
||||||
|
void SwapBuffers() override {
|
||||||
|
SDL_GL_SwapWindow(window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MakeCurrent() override {
|
void MakeCurrent() override {
|
||||||
|
@ -114,9 +114,6 @@ EmuWindow_SDL2_GL::EmuWindow_SDL2_GL(InputCommon::InputSubsystem* input_subsyste
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
dummy_window = SDL_CreateWindow(NULL, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 0, 0,
|
|
||||||
SDL_WINDOW_HIDDEN | SDL_WINDOW_OPENGL);
|
|
||||||
|
|
||||||
SetWindowIcon();
|
SetWindowIcon();
|
||||||
|
|
||||||
if (fullscreen) {
|
if (fullscreen) {
|
||||||
|
@ -159,5 +156,5 @@ EmuWindow_SDL2_GL::~EmuWindow_SDL2_GL() {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<Core::Frontend::GraphicsContext> EmuWindow_SDL2_GL::CreateSharedContext() const {
|
std::unique_ptr<Core::Frontend::GraphicsContext> EmuWindow_SDL2_GL::CreateSharedContext() const {
|
||||||
return std::make_unique<SDLGLContext>();
|
return std::make_unique<SDLGLContext>(render_window);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,6 @@ public:
|
||||||
std::unique_ptr<Core::Frontend::GraphicsContext> CreateSharedContext() const override;
|
std::unique_ptr<Core::Frontend::GraphicsContext> CreateSharedContext() const override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Fake hidden window for the core context
|
|
||||||
SDL_Window* dummy_window{};
|
|
||||||
|
|
||||||
/// Whether the GPU and driver supports the OpenGL extension required
|
/// Whether the GPU and driver supports the OpenGL extension required
|
||||||
bool SupportsRequiredGLExtensions();
|
bool SupportsRequiredGLExtensions();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue