2018-03-24 11:44:53 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-10-04 21:24:14 +00:00
|
|
|
#include "Common/GPU/OpenGL/GLCommon.h"
|
2018-03-24 11:44:53 +00:00
|
|
|
#include "libretro/LibretroGraphicsContext.h"
|
2020-10-04 21:24:14 +00:00
|
|
|
#include "Common/GPU/OpenGL/GLRenderManager.h"
|
2018-03-24 11:44:53 +00:00
|
|
|
|
|
|
|
class LibretroGLContext : public LibretroHWRenderContext {
|
2018-03-26 16:37:34 +00:00
|
|
|
public:
|
2018-03-24 11:44:53 +00:00
|
|
|
LibretroGLContext()
|
|
|
|
#ifdef USING_GLES2
|
2018-03-28 19:15:39 +00:00
|
|
|
: LibretroHWRenderContext(RETRO_HW_CONTEXT_OPENGLES2)
|
2018-03-24 11:44:53 +00:00
|
|
|
#else
|
2018-03-26 16:37:34 +00:00
|
|
|
: LibretroHWRenderContext(RETRO_HW_CONTEXT_OPENGL)
|
2018-03-24 11:44:53 +00:00
|
|
|
#endif
|
|
|
|
{
|
|
|
|
hw_render_.bottom_left_origin = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Init() override;
|
|
|
|
void CreateDrawContext() override;
|
|
|
|
void DestroyDrawContext() override;
|
2018-03-26 16:37:34 +00:00
|
|
|
void SetRenderTarget() override {
|
2018-03-24 11:44:53 +00:00
|
|
|
extern GLuint g_defaultFBO;
|
|
|
|
g_defaultFBO = hw_render_.get_current_framebuffer();
|
|
|
|
}
|
|
|
|
|
2018-12-23 20:46:48 +00:00
|
|
|
void ThreadStart() override { renderManager_->ThreadStart(draw_); }
|
2018-03-24 11:44:53 +00:00
|
|
|
bool ThreadFrame() override { return renderManager_->ThreadFrame(); }
|
|
|
|
void ThreadEnd() override { renderManager_->ThreadEnd(); }
|
2018-03-26 16:37:34 +00:00
|
|
|
void StopThread() override {
|
2018-03-24 11:44:53 +00:00
|
|
|
renderManager_->StopThread();
|
|
|
|
}
|
|
|
|
|
|
|
|
GPUCore GetGPUCore() override { return GPUCORE_GLES; }
|
|
|
|
const char *Ident() override { return "OpenGL"; }
|
|
|
|
|
2018-03-26 16:37:34 +00:00
|
|
|
private:
|
2018-03-24 11:44:53 +00:00
|
|
|
GLRenderManager *renderManager_ = nullptr;
|
|
|
|
bool glewInitDone = false;
|
|
|
|
};
|