aboutsummaryrefslogtreecommitdiffstats
path: root/emulator/opengl/host/libs/libOpenglRender
diff options
context:
space:
mode:
Diffstat (limited to 'emulator/opengl/host/libs/libOpenglRender')
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp19
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/FrameBuffer.h10
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/render_api.cpp10
3 files changed, 35 insertions, 4 deletions
diff --git a/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp b/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp
index b7599ce..fde82a1 100644
--- a/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp
@@ -345,6 +345,14 @@ bool FrameBuffer::initialize(int width, int height, OnPostFn onPost, void* onPos
}
}
+ //
+ // Cache the GL strings so we don't have to think about threading or
+ // current-context when asked for them.
+ //
+ fb->m_glVendor = (const char*)s_gl.glGetString(GL_VENDOR);
+ fb->m_glRenderer = (const char*)s_gl.glGetString(GL_RENDERER);
+ fb->m_glVersion = (const char*)s_gl.glGetString(GL_VERSION);
+
// release the FB context
fb->unbind_locked();
@@ -366,7 +374,7 @@ FrameBuffer::FrameBuffer(int p_width, int p_height,
m_prevContext(EGL_NO_CONTEXT),
m_prevReadSurf(EGL_NO_SURFACE),
m_prevDrawSurf(EGL_NO_SURFACE),
- m_subWin(NULL),
+ m_subWin((EGLNativeWindowType)0),
m_subWinDisplay(NULL),
m_lastPostedColorBuffer(0),
m_zRot(0.0f),
@@ -375,7 +383,10 @@ FrameBuffer::FrameBuffer(int p_width, int p_height,
m_statsStartTime(0LL),
m_onPost(onPost),
m_onPostContext(onPostContext),
- m_fbImage(NULL)
+ m_fbImage(NULL),
+ m_glVendor(NULL),
+ m_glRenderer(NULL),
+ m_glVersion(NULL)
{
m_fpsStats = getenv("SHOW_FPS_STATS") != NULL;
}
@@ -412,7 +423,7 @@ bool FrameBuffer::setupSubWindow(FBNativeWindowType p_window,
if (fb->m_eglSurface == EGL_NO_SURFACE) {
ERR("Failed to create surface\n");
destroySubWindow(fb->m_subWinDisplay, fb->m_subWin);
- fb->m_subWin = NULL;
+ fb->m_subWin = (EGLNativeWindowType)0;
}
else if (fb->bindSubwin_locked()) {
// Subwin creation was successfull,
@@ -445,7 +456,7 @@ bool FrameBuffer::removeSubWindow()
s_theFrameBuffer->m_subWin);
s_theFrameBuffer->m_eglSurface = EGL_NO_SURFACE;
- s_theFrameBuffer->m_subWin = NULL;
+ s_theFrameBuffer->m_subWin = (EGLNativeWindowType)0;
removed = true;
}
s_theFrameBuffer->m_lock.unlock();
diff --git a/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.h b/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.h
index 343f384..89a708b 100644
--- a/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.h
+++ b/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.h
@@ -59,6 +59,12 @@ public:
int getWidth() const { return m_width; }
int getHeight() const { return m_height; }
+ void getGLStrings(const char** vendor, const char** renderer, const char** version) const {
+ *vendor = m_glVendor;
+ *renderer = m_glRenderer;
+ *version = m_glVersion;
+ }
+
HandleType createRenderContext(int p_config, HandleType p_share, bool p_isGL2 = false);
HandleType createWindowSurface(int p_config, int p_width, int p_height);
HandleType createColorBuffer(int p_width, int p_height, GLenum p_internalFormat);
@@ -133,5 +139,9 @@ private:
OnPostFn m_onPost;
void* m_onPostContext;
unsigned char* m_fbImage;
+
+ const char* m_glVendor;
+ const char* m_glRenderer;
+ const char* m_glVersion;
};
#endif
diff --git a/emulator/opengl/host/libs/libOpenglRender/render_api.cpp b/emulator/opengl/host/libs/libOpenglRender/render_api.cpp
index 00dcd75..7d7a981 100644
--- a/emulator/opengl/host/libs/libOpenglRender/render_api.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/render_api.cpp
@@ -191,6 +191,16 @@ int initOpenGLRenderer(int width, int height, int portNum,
return true;
}
+void getHardwareStrings(const char** vendor, const char** renderer, const char** version)
+{
+ FrameBuffer* fb = FrameBuffer::getFB();
+ if (fb) {
+ fb->getGLStrings(vendor, renderer, version);
+ } else {
+ *vendor = *renderer = *version = NULL;
+ }
+}
+
int stopOpenGLRenderer(void)
{
bool ret = false;