Files
ppsspp/libretro/LibretroGLContext.cpp
T
libretroadmin 329f30a0c9 Create the libretro GL presets once and run frametests on arm64
The GL contexts' CreateDrawContext made the thin3d presets and ContextReset made them again,
leaking the first set on every context reset. Only ContextReset makes them now.

The software renderer draws the same frame dumps on arm64 as on x86-64, so the frametests run
on the arm64 runner too. b.sh --aarch64 and setup-cross.sh aarch64 give a headless build to run
them under qemu locally.
2026-10-09 09:12:45 +02:00

48 lines
1.4 KiB
C++

#include "Common/Log.h"
#include "Core/Config.h"
#include "Core/ConfigValues.h"
#include "Core/System.h"
#include "Common/GPU/OpenGL/GLFeatures.h"
#include "libretro/LibretroGLContext.h"
bool LibretroGLContext::InitAPI(void *wnd, std::string *deviceName, std::string *error_message) {
if (!LibretroHWRenderContext::InitHW(false))
return false;
g_Config.iGPUBackend = (int)GPUBackend::OPENGL;
return true;
}
void LibretroGLContext::CreateDrawContext() {
#ifndef USING_GLES2
// Some core profile drivers elide certain extensions from GL_EXTENSIONS/etc.
// glewExperimental allows us to force GLEW to search for the pointers anyway.
if (gl_extensions.IsCoreContext)
glewExperimental = true;
if (GLEW_OK != glewInit()) {
printf("Failed to initialize glew!\n");
}
// Unfortunately, glew will generate an invalid enum error, ignore.
if (gl_extensions.IsCoreContext)
glGetError();
#endif
CheckGLExtensions();
draw_ = Draw::T3DCreateGLContext(false);
renderManager_ = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);
renderManager_->SetInflightFrames(g_Config.iInflightFrames);
SetGPUBackend(GPUBackend::OPENGL);
}
void LibretroGLContext::DestroyDrawContext() {
LibretroHWRenderContext::DestroyDrawContext();
renderManager_ = nullptr;
}
void LibretroGLContext::NotifyEmuThreadExit() {
renderManager_->NotifyEmuThreadExit();
}