decouple imgui from gles renderer
This commit is contained in:
parent
ca4753cf7c
commit
2a89874812
|
@ -22,11 +22,11 @@
|
|||
//#define IMGUI_API __declspec( dllimport )
|
||||
|
||||
//---- Don't define obsolete functions/enums names. Consider enabling from time to time after updating to avoid using soon-to-be obsolete function/names.
|
||||
//#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
#define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
|
||||
|
||||
//---- Don't implement demo windows functionality (ShowDemoWindow()/ShowStyleEditor()/ShowUserGuide() methods will be empty)
|
||||
//---- It is very strongly recommended to NOT disable the demo windows during development. Please read the comments in imgui_demo.cpp.
|
||||
//#define IMGUI_DISABLE_DEMO_WINDOWS
|
||||
#define IMGUI_DISABLE_DEMO_WINDOWS
|
||||
|
||||
//---- Don't implement some functions to reduce linkage requirements.
|
||||
//#define IMGUI_DISABLE_WIN32_DEFAULT_CLIPBOARD_FUNCTIONS // [Win32] Don't implement default clipboard handler. Won't use and link with OpenClipboard/GetClipboardData/CloseClipboard etc.
|
||||
|
|
|
@ -280,8 +280,7 @@ bool rend_single_frame()
|
|||
if (renderer_changed != settings.pvr.rend)
|
||||
{
|
||||
rend_term_renderer();
|
||||
settings.pvr.rend = renderer_changed;
|
||||
SwitchRenderApi();
|
||||
SwitchRenderApi(renderer_changed);
|
||||
rend_create_renderer();
|
||||
rend_init_renderer();
|
||||
}
|
||||
|
@ -401,7 +400,6 @@ void rend_init_renderer()
|
|||
|
||||
void rend_term_renderer()
|
||||
{
|
||||
gui_term();
|
||||
renderer->Term();
|
||||
delete renderer;
|
||||
renderer = NULL;
|
||||
|
|
|
@ -78,6 +78,6 @@ void dispmanx_window_create()
|
|||
|
||||
theGLContext.SetNativeWindow((EGLNativeWindowType)&native_window);
|
||||
theGLContext.SetNativeDisplay((EGLNativeDisplayType)dispman_display);
|
||||
SwitchRenderApi();
|
||||
InitRenderApi();
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -437,7 +437,7 @@ void x11_window_create()
|
|||
#ifdef USE_VULKAN
|
||||
theVulkanContext.SetWindow((void *)x11_win, (void *)x11_disp);
|
||||
#endif
|
||||
SwitchRenderApi();
|
||||
InitRenderApi();
|
||||
|
||||
XFlush(x11_disp);
|
||||
|
||||
|
|
|
@ -545,8 +545,6 @@ static bool gl_create_resources()
|
|||
|
||||
gl_load_osd_resources();
|
||||
|
||||
gui_init();
|
||||
|
||||
// Create the buffer for Translucent poly params
|
||||
glGenBuffers(1, &gl4.vbo.tr_poly_params);
|
||||
// Bind it
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
#include <map>
|
||||
#include "gles.h"
|
||||
#include "wsi/gl_context.h"
|
||||
|
||||
#define TEXTURE_ID_CACHE_SIZE 32
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "glcache.h"
|
||||
#include "gles.h"
|
||||
#include "rend/rend.h"
|
||||
#include "rend/sorter.h"
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include <cmath>
|
||||
#include "glcache.h"
|
||||
#include "gles.h"
|
||||
#include "rend/TexCache.h"
|
||||
#include "rend/gui.h"
|
||||
#include "wsi/gl_context.h"
|
||||
|
@ -500,18 +501,10 @@ static void gles_term()
|
|||
void findGLVersion()
|
||||
{
|
||||
gl.index_type = GL_UNSIGNED_INT;
|
||||
|
||||
while (true)
|
||||
if (glGetError() == GL_NO_ERROR)
|
||||
break;
|
||||
glGetIntegerv(GL_MAJOR_VERSION, &gl.gl_major);
|
||||
if (glGetError() == GL_INVALID_ENUM)
|
||||
gl.gl_major = 2;
|
||||
const char *version = (const char *)glGetString(GL_VERSION);
|
||||
INFO_LOG(RENDERER, "OpenGL version: %s", version);
|
||||
if (!strncmp(version, "OpenGL ES", 9))
|
||||
gl.gl_major = theGLContext.GetMajorVersion();
|
||||
gl.is_gles = theGLContext.IsGLES();
|
||||
if (gl.is_gles)
|
||||
{
|
||||
gl.is_gles = true;
|
||||
if (gl.gl_major >= 3)
|
||||
{
|
||||
gl.gl_version = "GLES3";
|
||||
|
@ -534,7 +527,6 @@ void findGLVersion()
|
|||
}
|
||||
else
|
||||
{
|
||||
gl.is_gles = false;
|
||||
if (gl.gl_major >= 3)
|
||||
{
|
||||
gl.gl_version = "GL3";
|
||||
|
@ -830,8 +822,6 @@ bool gl_create_resources()
|
|||
|
||||
gl_load_osd_resources();
|
||||
|
||||
gui_init();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include <algorithm>
|
||||
#include "glcache.h"
|
||||
#include "gles.h"
|
||||
#include "rend/TexCache.h"
|
||||
#include "hw/pvr/pvr_mem.h"
|
||||
#include "hw/mem/_vmem.h"
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
#include "TargetConditionals.h"
|
||||
#endif
|
||||
|
||||
#include "gles.h"
|
||||
#include "wsi/gl_context.h"
|
||||
#include "glcache.h"
|
||||
|
||||
// OpenGL Data
|
||||
|
@ -87,7 +87,7 @@ bool ImGui_ImplOpenGL3_Init(const char* glsl_version)
|
|||
// Store GLSL version string so we can refer to it later in case we recreate shaders. Note: GLSL version is NOT the same as GL version. Leave this to NULL if unsure.
|
||||
if (glsl_version == NULL)
|
||||
{
|
||||
if (gl.is_gles)
|
||||
if (theGLContext.IsGLES())
|
||||
glsl_version = "#version 100"; // OpenGL ES 2.0
|
||||
else
|
||||
#if HOST_OS == OS_DARWIN
|
||||
|
@ -131,7 +131,7 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data, bool save_backgr
|
|||
glActiveTexture(GL_TEXTURE0);
|
||||
bool clip_origin_lower_left = true;
|
||||
#ifdef GL_CLIP_ORIGIN
|
||||
if (gl.gl_major >= 4 && glClipControl != NULL)
|
||||
if (theGLContext.GetMajorVersion() >= 4 && glClipControl != NULL)
|
||||
{
|
||||
GLenum last_clip_origin = 0; glGetIntegerv(GL_CLIP_ORIGIN, (GLint*)&last_clip_origin); // Support for GL 4.5's glClipControl(GL_UPPER_LEFT)
|
||||
if (last_clip_origin == GL_UPPER_LEFT)
|
||||
|
@ -142,7 +142,7 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data, bool save_backgr
|
|||
if (save_background)
|
||||
{
|
||||
#ifndef GLES2
|
||||
if (!gl.is_gles && glReadBuffer != NULL)
|
||||
if (!theGLContext.IsGLES() && glReadBuffer != NULL)
|
||||
glReadBuffer(GL_FRONT);
|
||||
|
||||
// (Re-)create the background texture and reserve space for it
|
||||
|
@ -192,12 +192,12 @@ void ImGui_ImplOpenGL3_RenderDrawData(ImDrawData* draw_data, bool save_backgr
|
|||
glUniform1i(g_AttribLocationTex, 0);
|
||||
glUniformMatrix4fv(g_AttribLocationProjMtx, 1, GL_FALSE, &ortho_projection[0][0]);
|
||||
#ifndef GLES2
|
||||
if (gl.gl_major >= 3 && glBindSampler != NULL)
|
||||
if (theGLContext.GetMajorVersion() >= 3 && glBindSampler != NULL)
|
||||
glBindSampler(0, 0); // We use combined texture/sampler state. Applications using GL 3.3 may set that otherwise.
|
||||
#endif
|
||||
GLuint vao_handle = 0;
|
||||
#ifndef GLES2
|
||||
if (gl.gl_major >= 3)
|
||||
if (theGLContext.GetMajorVersion() >= 3)
|
||||
{
|
||||
// Recreate the VAO every time
|
||||
// (This is to easily allow multiple GL contexts. VAO are not shared among GL contexts, and we don't track creation/deletion of windows so we don't have an obvious key to use to cache them.)
|
||||
|
@ -272,7 +272,7 @@ bool ImGui_ImplOpenGL3_CreateFontsTexture()
|
|||
glcache.BindTexture(GL_TEXTURE_2D, g_FontTexture);
|
||||
glcache.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glcache.TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
if (gl.gl_major >= 3)
|
||||
if (theGLContext.GetMajorVersion() >= 3)
|
||||
glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
|
||||
|
||||
|
|
|
@ -34,9 +34,6 @@
|
|||
#include "linux-dist/main.h" // FIXME for kcode[]
|
||||
#include "gui_util.h"
|
||||
#include "gui_android.h"
|
||||
#ifdef USE_VULKAN
|
||||
#include "rend/vulkan/vulkan.h"
|
||||
#endif
|
||||
#include "version.h"
|
||||
#include "oslib/audiostream.h"
|
||||
|
||||
|
@ -957,7 +954,7 @@ static void gui_display_settings()
|
|||
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, normal_padding);
|
||||
int renderer = settings.pvr.rend == 3 ? 2 : settings.rend.PerStripSorting ? 1 : 0;
|
||||
#if HOST_OS != OS_DARWIN
|
||||
bool has_per_pixel = !gl.is_gles && gl.gl_major >= 4 && !vulkan;
|
||||
bool has_per_pixel = !theGLContext.IsGLES() && theGLContext.GetMajorVersion() >= 4 && !vulkan;
|
||||
#else
|
||||
bool has_per_pixel = false;
|
||||
#endif
|
||||
|
@ -1672,11 +1669,14 @@ void gui_open_onboarding()
|
|||
|
||||
void gui_term()
|
||||
{
|
||||
inited = false;
|
||||
term_vmus();
|
||||
if (settings.pvr.IsOpenGL())
|
||||
ImGui_ImplOpenGL3_Shutdown();
|
||||
ImGui::DestroyContext();
|
||||
if (inited)
|
||||
{
|
||||
inited = false;
|
||||
term_vmus();
|
||||
if (settings.pvr.IsOpenGL())
|
||||
ImGui_ImplOpenGL3_Shutdown();
|
||||
ImGui::DestroyContext();
|
||||
}
|
||||
}
|
||||
|
||||
int msgboxf(const wchar* text, unsigned int type, ...) {
|
||||
|
|
|
@ -682,6 +682,7 @@ void VulkanContext::Present()
|
|||
void VulkanContext::Term()
|
||||
{
|
||||
ImGui_ImplVulkan_Shutdown();
|
||||
gui_term();
|
||||
if (device && pipelineCache)
|
||||
{
|
||||
std::vector<u8> cacheData = device->getPipelineCacheData(*pipelineCache);
|
||||
|
|
|
@ -107,7 +107,7 @@ void input_sdl_handle(u32 port)
|
|||
if (port == 0) // FIXME hack
|
||||
SDLGamepadDevice::UpdateRumble();
|
||||
|
||||
#define SET_FLAG(field, mask, expr) field =((expr) ? (field & ~mask) : (field | mask))
|
||||
#define SET_FLAG(field, mask, expr) (field) = ((expr) ? ((field) & ~(mask)) : ((field) | (mask)))
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event))
|
||||
{
|
||||
|
@ -238,7 +238,7 @@ void sdl_window_create()
|
|||
die("error initializing SDL Joystick subsystem");
|
||||
}
|
||||
}
|
||||
SwitchRenderApi();
|
||||
InitRenderApi();
|
||||
}
|
||||
|
||||
void sdl_window_destroy()
|
||||
|
|
|
@ -717,7 +717,7 @@ int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLi
|
|||
#endif
|
||||
theGLContext.SetWindow(hWnd);
|
||||
theGLContext.SetDeviceContext(GetDC(hWnd));
|
||||
SwitchRenderApi();
|
||||
InitRenderApi();
|
||||
|
||||
rend_thread(NULL);
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
extern VulkanContext theVulkanContext;
|
||||
#endif
|
||||
void SwitchRenderApi();
|
||||
void InitRenderApi();
|
||||
void SwitchRenderApi(int newApi);
|
||||
void TermRenderApi();
|
||||
|
||||
|
|
|
@ -193,12 +193,15 @@ bool EGLGraphicsContext::Init()
|
|||
eglSwapInterval(display, 1);
|
||||
#endif
|
||||
|
||||
PostInit();
|
||||
|
||||
INFO_LOG(RENDERER, "EGL config: %p, %p, %p %dx%d", context, display, surface, w, h);
|
||||
return true;
|
||||
}
|
||||
|
||||
void EGLGraphicsContext::Term()
|
||||
{
|
||||
PreTerm();
|
||||
eglMakeCurrent(display, NULL, NULL, EGL_NO_CONTEXT);
|
||||
if (context != EGL_NO_CONTEXT)
|
||||
eglDestroyContext(display, context);
|
||||
|
|
|
@ -18,17 +18,19 @@
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with Flycast. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <GLES32/gl32.h>
|
||||
#include <GLES32/gl2ext.h>
|
||||
#ifndef GLES2
|
||||
#include "gl32funcs.h"
|
||||
#endif
|
||||
#include "gl_context.h"
|
||||
|
||||
#define USE_EGL
|
||||
#include <EGL/egl.h>
|
||||
#include <EGL/eglext.h>
|
||||
|
||||
class EGLGraphicsContext
|
||||
class EGLGraphicsContext : public GLGraphicsContext
|
||||
{
|
||||
public:
|
||||
~EGLGraphicsContext() { Term(); }
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
Created on: Oct 19, 2019
|
||||
|
||||
Copyright 2019 flyinghead
|
||||
|
||||
This file is part of Flycast.
|
||||
|
||||
Flycast is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
Flycast is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with Flycast. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "gl_context.h"
|
||||
#include "rend/gui.h"
|
||||
|
||||
void GLGraphicsContext::findGLVersion()
|
||||
{
|
||||
while (true)
|
||||
if (glGetError() == GL_NO_ERROR)
|
||||
break;
|
||||
glGetIntegerv(GL_MAJOR_VERSION, &majorVersion);
|
||||
if (glGetError() == GL_INVALID_ENUM)
|
||||
majorVersion = 2;
|
||||
const char *version = (const char *)glGetString(GL_VERSION);
|
||||
isGLES = !strncmp(version, "OpenGL ES", 9);
|
||||
INFO_LOG(RENDERER, "OpenGL version: %s", version);
|
||||
}
|
||||
|
||||
void GLGraphicsContext::PostInit()
|
||||
{
|
||||
findGLVersion();
|
||||
gui_init();
|
||||
}
|
||||
|
||||
void GLGraphicsContext::PreTerm()
|
||||
{
|
||||
gui_term();
|
||||
}
|
|
@ -25,6 +25,22 @@ void do_swap_automation();
|
|||
// FIXME
|
||||
extern int screen_width, screen_height;
|
||||
|
||||
class GLGraphicsContext
|
||||
{
|
||||
public:
|
||||
int GetMajorVersion() const { return majorVersion; }
|
||||
bool IsGLES() const { return isGLES; }
|
||||
|
||||
protected:
|
||||
void PostInit();
|
||||
void PreTerm();
|
||||
void findGLVersion();
|
||||
|
||||
private:
|
||||
int majorVersion = 0;
|
||||
bool isGLES = false;
|
||||
};
|
||||
|
||||
#if HOST_OS == OS_DARWIN
|
||||
|
||||
#include "osx.h"
|
||||
|
|
|
@ -18,18 +18,20 @@
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with Flycast. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#if defined(TARGET_IPHONE) //apple-specific ogles2 headers
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
#include <OpenGLES/ES2/glext.h>
|
||||
#else
|
||||
#include <OpenGL/gl3.h>
|
||||
#endif
|
||||
#include "gl_context.h"
|
||||
|
||||
class OSXGraphicsContext
|
||||
class OSXGraphicsContext : public GLGraphicsContext
|
||||
{
|
||||
public:
|
||||
bool Init() { return true; }
|
||||
void Term() {}
|
||||
bool Init() { PostInit(); return true; }
|
||||
void Term() { PreTerm(); }
|
||||
void Swap();
|
||||
bool IsSwapBufferPreserved() const { return true; }
|
||||
};
|
||||
|
|
|
@ -68,11 +68,13 @@ bool SDLGLGraphicsContext::Init()
|
|||
|
||||
SDL_GL_MakeCurrent(window, glcontext);
|
||||
|
||||
#ifdef GLES
|
||||
return true;
|
||||
#else
|
||||
return gl3wInit() != -1 && gl3wIsSupported(3, 1);
|
||||
#ifndef GLES
|
||||
if (gl3wInit() == -1 || !gl3wIsSupported(3, 1))
|
||||
return false;
|
||||
#endif
|
||||
PostInit();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SDLGLGraphicsContext::Swap()
|
||||
|
@ -85,6 +87,7 @@ void SDLGLGraphicsContext::Swap()
|
|||
|
||||
void SDLGLGraphicsContext::Term()
|
||||
{
|
||||
PreTerm();
|
||||
if (glcontext != nullptr)
|
||||
{
|
||||
SDL_GL_DeleteContext(glcontext);
|
||||
|
|
|
@ -18,11 +18,13 @@
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with Flycast. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <SDL2/SDL.h>
|
||||
#include "types.h"
|
||||
#include <GL4/gl3w.h>
|
||||
#include "gl_context.h"
|
||||
|
||||
class SDLGLGraphicsContext
|
||||
class SDLGLGraphicsContext : public GLGraphicsContext
|
||||
{
|
||||
public:
|
||||
bool Init();
|
||||
|
|
|
@ -19,27 +19,33 @@
|
|||
along with Flycast. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include "context.h"
|
||||
#include "rend/gui.h"
|
||||
|
||||
#ifdef USE_VULKAN
|
||||
VulkanContext theVulkanContext;
|
||||
#endif
|
||||
|
||||
void SwitchRenderApi()
|
||||
void InitRenderApi()
|
||||
{
|
||||
#ifdef USE_VULKAN
|
||||
if (settings.pvr.rend == 4)
|
||||
{
|
||||
theGLContext.Term();
|
||||
if (theVulkanContext.Init())
|
||||
return;
|
||||
// Fall back to Open GL
|
||||
}
|
||||
theVulkanContext.Term();
|
||||
#endif
|
||||
if (!theGLContext.Init())
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void SwitchRenderApi(int newApi)
|
||||
{
|
||||
TermRenderApi();
|
||||
settings.pvr.rend = newApi;
|
||||
InitRenderApi();
|
||||
}
|
||||
|
||||
void TermRenderApi()
|
||||
{
|
||||
#ifdef USE_VULKAN
|
|
@ -112,6 +112,9 @@ bool WGLGraphicsContext::Init()
|
|||
screen_width = r.right - r.left;
|
||||
screen_height = r.bottom - r.top;
|
||||
|
||||
if (rv)
|
||||
PostInit();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -125,6 +128,7 @@ void WGLGraphicsContext::Swap()
|
|||
|
||||
void WGLGraphicsContext::Term()
|
||||
{
|
||||
PreTerm();
|
||||
if (ourOpenGLRenderingContext != NULL)
|
||||
{
|
||||
wglDeleteContext(ourOpenGLRenderingContext);
|
||||
|
|
|
@ -18,8 +18,10 @@
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with Flycast. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <windows.h>
|
||||
#include <GL4/gl3w.h>
|
||||
#include "gl_context.h"
|
||||
|
||||
#define WGL_DRAW_TO_WINDOW_ARB 0x2001
|
||||
#define WGL_ACCELERATION_ARB 0x2003
|
||||
|
@ -53,7 +55,7 @@ typedef HGLRC (WINAPI * PFNWGLCREATECONTEXTATTRIBSARBPROC) (HDC hDC, HGLRC hShar
|
|||
typedef BOOL (WINAPI * PFNWGLSWAPINTERVALEXTPROC) (int interval);
|
||||
|
||||
|
||||
class WGLGraphicsContext
|
||||
class WGLGraphicsContext : public GLGraphicsContext
|
||||
{
|
||||
public:
|
||||
~WGLGraphicsContext() { Term(); }
|
||||
|
|
|
@ -76,7 +76,12 @@ bool XGLGraphicsContext::Init()
|
|||
|
||||
screen_width = 640;
|
||||
screen_height = 480;
|
||||
return gl3wInit() != -1 && gl3wIsSupported(3, 1);
|
||||
if (gl3wInit() == -1 || !gl3wIsSupported(3, 1))
|
||||
return false;
|
||||
|
||||
PostInit();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool XGLGraphicsContext::ChooseVisual(Display* x11Display, XVisualInfo** visual, int* depth)
|
||||
|
@ -164,6 +169,7 @@ void XGLGraphicsContext::Swap()
|
|||
|
||||
void XGLGraphicsContext::Term()
|
||||
{
|
||||
PreTerm();
|
||||
if (context)
|
||||
{
|
||||
glXMakeCurrent(display, None, NULL);
|
||||
|
|
|
@ -18,12 +18,14 @@
|
|||
You should have received a copy of the GNU General Public License
|
||||
along with Flycast. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#pragma once
|
||||
#include <GL4/gl3w.h>
|
||||
#include <X11/X.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <GL/glx.h>
|
||||
#include "gl_context.h"
|
||||
|
||||
class XGLGraphicsContext
|
||||
class XGLGraphicsContext : public GLGraphicsContext
|
||||
{
|
||||
public:
|
||||
~XGLGraphicsContext() { Term(); XFree(framebufferConfigs); }
|
||||
|
|
|
@ -397,10 +397,11 @@ static void *render_thread_func(void *)
|
|||
theVulkanContext.SetWindow((void *)g_window, nullptr);
|
||||
#endif
|
||||
theGLContext.SetNativeWindow((EGLNativeWindowType)g_window);
|
||||
SwitchRenderApi();
|
||||
InitRenderApi();
|
||||
|
||||
rend_thread(NULL);
|
||||
|
||||
TermRenderApi();
|
||||
ANativeWindow_release(g_window);
|
||||
g_window = NULL;
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#if defined(USE_SDL)
|
||||
#include "sdl/sdl.h"
|
||||
#endif
|
||||
#include "wsi/context.h"
|
||||
|
||||
OSXKeyboardDevice keyboard(0);
|
||||
static std::shared_ptr<OSXKbGamepadDevice> kb_gamepad(0);
|
||||
|
@ -138,6 +139,7 @@ extern "C" void emu_gles_init(int width, int height) {
|
|||
screen_width = width;
|
||||
screen_height = height;
|
||||
|
||||
InitRenderApi();
|
||||
rend_init_renderer();
|
||||
}
|
||||
|
||||
|
|
|
@ -248,7 +248,7 @@
|
|||
AE7B904F23565B4200145C6A /* allocator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AE7B904D23565B4100145C6A /* allocator.cpp */; };
|
||||
AE7B907C235A53D800145C6A /* gl4funcs.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AE7B906F235A53D800145C6A /* gl4funcs.cpp */; };
|
||||
AE7B907D235A53D800145C6A /* osx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AE7B9071235A53D800145C6A /* osx.cpp */; };
|
||||
AE7B907F235A53D800145C6A /* swicher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AE7B9075235A53D800145C6A /* swicher.cpp */; };
|
||||
AE7B907F235A53D800145C6A /* switcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AE7B9075235A53D800145C6A /* switcher.cpp */; };
|
||||
AE80EDB72157D4D500F7800F /* serialize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AE80EDB62157D4D500F7800F /* serialize.cpp */; };
|
||||
AE80EDBE2157D4E600F7800F /* naomi.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AE80EDB92157D4E600F7800F /* naomi.cpp */; };
|
||||
AE80EDBF2157D4E600F7800F /* naomi_cart.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AE80EDBB2157D4E600F7800F /* naomi_cart.cpp */; };
|
||||
|
@ -257,6 +257,7 @@
|
|||
AE8C274121122E2500D4D8F4 /* Changelog.txt in Resources */ = {isa = PBXBuildFile; fileRef = AE8C273B21122E2500D4D8F4 /* Changelog.txt */; };
|
||||
AE8C274221122E2500D4D8F4 /* License.txt in Resources */ = {isa = PBXBuildFile; fileRef = AE8C273C21122E2500D4D8F4 /* License.txt */; };
|
||||
AE8C274321122E2500D4D8F4 /* xbrz.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AE8C273D21122E2500D4D8F4 /* xbrz.cpp */; };
|
||||
AE90679B235B6F6400CE473C /* gl_context.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AE90679A235B6F6400CE473C /* gl_context.cpp */; };
|
||||
AED73BAE22FC0E9600ECDB64 /* README.md in Resources */ = {isa = PBXBuildFile; fileRef = AED73BAD22FC0E9600ECDB64 /* README.md */; };
|
||||
AED73DC42303E19200ECDB64 /* sdl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AED73DC02303E19100ECDB64 /* sdl.cpp */; };
|
||||
AED73DC72303E57C00ECDB64 /* libSDL2.a in Frameworks */ = {isa = PBXBuildFile; fileRef = AED73DC62303E57C00ECDB64 /* libSDL2.a */; };
|
||||
|
@ -833,7 +834,7 @@
|
|||
AE7B9070235A53D800145C6A /* gl_context.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gl_context.h; sourceTree = "<group>"; };
|
||||
AE7B9071235A53D800145C6A /* osx.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = osx.cpp; sourceTree = "<group>"; };
|
||||
AE7B9072235A53D800145C6A /* osx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = osx.h; sourceTree = "<group>"; };
|
||||
AE7B9075235A53D800145C6A /* swicher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = swicher.cpp; sourceTree = "<group>"; };
|
||||
AE7B9075235A53D800145C6A /* switcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = switcher.cpp; sourceTree = "<group>"; };
|
||||
AE80EDB62157D4D500F7800F /* serialize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = serialize.cpp; path = ../../../core/serialize.cpp; sourceTree = "<group>"; };
|
||||
AE80EDB92157D4E600F7800F /* naomi.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = naomi.cpp; sourceTree = "<group>"; };
|
||||
AE80EDBA2157D4E600F7800F /* naomi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = naomi.h; sourceTree = "<group>"; };
|
||||
|
@ -848,6 +849,7 @@
|
|||
AE8C273E21122E2500D4D8F4 /* xbrz.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xbrz.h; sourceTree = "<group>"; };
|
||||
AE8C273F21122E2500D4D8F4 /* xbrz_config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xbrz_config.h; sourceTree = "<group>"; };
|
||||
AE8C274021122E2500D4D8F4 /* xbrz_tools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xbrz_tools.h; sourceTree = "<group>"; };
|
||||
AE90679A235B6F6400CE473C /* gl_context.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = gl_context.cpp; sourceTree = "<group>"; };
|
||||
AED73BAD22FC0E9600ECDB64 /* README.md */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = net.daringfireball.markdown; name = README.md; path = ../../../core/README.md; sourceTree = "<group>"; };
|
||||
AED73DC02303E19100ECDB64 /* sdl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sdl.cpp; sourceTree = "<group>"; };
|
||||
AED73DC12303E19100ECDB64 /* sdl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sdl.h; sourceTree = "<group>"; };
|
||||
|
@ -2117,9 +2119,10 @@
|
|||
AE7B906A235A53D800145C6A /* context.h */,
|
||||
AE7B906F235A53D800145C6A /* gl4funcs.cpp */,
|
||||
AE7B9070235A53D800145C6A /* gl_context.h */,
|
||||
AE90679A235B6F6400CE473C /* gl_context.cpp */,
|
||||
AE7B9071235A53D800145C6A /* osx.cpp */,
|
||||
AE7B9072235A53D800145C6A /* osx.h */,
|
||||
AE7B9075235A53D800145C6A /* swicher.cpp */,
|
||||
AE7B9075235A53D800145C6A /* switcher.cpp */,
|
||||
);
|
||||
name = wsi;
|
||||
path = ../../../core/wsi;
|
||||
|
@ -2720,7 +2723,7 @@
|
|||
84B7BEB31B72720200F9733F /* coreio.cpp in Sources */,
|
||||
AED73ECA234E827400ECDB64 /* drawer.cpp in Sources */,
|
||||
84B7BF281B72720200F9733F /* dsp.cpp in Sources */,
|
||||
AE7B907F235A53D800145C6A /* swicher.cpp in Sources */,
|
||||
AE7B907F235A53D800145C6A /* switcher.cpp in Sources */,
|
||||
84B7BF3D1B72720200F9733F /* Renderer_if.cpp in Sources */,
|
||||
AED73E6F2348E45000ECDB64 /* PpAtom.cpp in Sources */,
|
||||
84B7BF191B72720200F9733F /* deflate.c in Sources */,
|
||||
|
@ -2809,6 +2812,7 @@
|
|||
84B7BEB91B72720200F9733F /* elf.cpp in Sources */,
|
||||
84B7BF2B1B72720200F9733F /* arm_mem.cpp in Sources */,
|
||||
84B7BF4F1B72720200F9733F /* rtc.cpp in Sources */,
|
||||
AE90679B235B6F6400CE473C /* gl_context.cpp in Sources */,
|
||||
AED73EC12348E49900ECDB64 /* imgui_impl_vulkan.cpp in Sources */,
|
||||
AED73E612348E45000ECDB64 /* InfoSink.cpp in Sources */,
|
||||
84B7BF361B72720200F9733F /* maple_helper.cpp in Sources */,
|
||||
|
|
Loading…
Reference in New Issue