emulator: opengl: Fix Mac build
This fixes several issues when building the host libraris on Darwin. Note that there is still not proper implementation of backend functions. Change-Id: I3ba4120df6545a8c2aa62fdfcaadaf5ff4972456
This commit is contained in:
@@ -10,7 +10,7 @@ OS_SRCS:=
|
||||
|
||||
ifeq ($(HOST_OS),linux)
|
||||
OS_SRCS = EglX11Api.cpp
|
||||
LOCAL_LDLIBS := -lX11 -lGL -ldl
|
||||
LOCAL_LDLIBS := -lX11 -lGL -ldl -lpthread
|
||||
endif
|
||||
|
||||
ifeq ($(HOST_OS),darwin)
|
||||
|
||||
@@ -34,14 +34,15 @@
|
||||
#define MINOR 1
|
||||
#define MAJOR 4
|
||||
|
||||
//declerations
|
||||
//declarations
|
||||
|
||||
EglImage *attachEGLImage(unsigned int imageId);
|
||||
void detachEGLImage(unsigned int imageId);
|
||||
|
||||
#define tls_thread EglThreadInfo::get()
|
||||
|
||||
EglGlobalInfo* g_eglInfo = EglGlobalInfo::getInstance();
|
||||
|
||||
__thread EglThreadInfo* tls_thread = NULL;
|
||||
static EGLiface s_eglIface = {
|
||||
getThreadInfo : getThreadInfo, // implemented in ThreadInfo.cpp
|
||||
eglAttachEGLImage:attachEGLImage,
|
||||
@@ -71,10 +72,7 @@ static EglExtentionDescriptor s_extentions[] = {
|
||||
/****************************************************************************************************************************************/
|
||||
//macros for accessing global egl info & tls objects
|
||||
|
||||
#define CURRENT_THREAD() \
|
||||
if(!tls_thread) { \
|
||||
tls_thread = new EglThreadInfo(); \
|
||||
}
|
||||
#define CURRENT_THREAD() do {} while (0);
|
||||
|
||||
#define RETURN_ERROR(ret,err) \
|
||||
CURRENT_THREAD() \
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
//TODO: implementation for mac for all funcs
|
||||
namespace EglOS {
|
||||
|
||||
EGLNativeDisplayType getDefaultDisplay() {return NULL}
|
||||
EGLNativeDisplayType getDefaultDisplay() {return NULL;}
|
||||
|
||||
bool releaseDisplay(EGLNativeDisplayType dpy) {
|
||||
return false;
|
||||
@@ -53,6 +53,10 @@ EGLNativePbufferType createPbuffer(EGLNativeDisplayType dpy,EglConfig* cfg,EglPb
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool releasePbuffer(EGLNativeDisplayType dis,EGLNativePbufferType pb) {
|
||||
return true;
|
||||
}
|
||||
|
||||
EGLNativeContextType createContext(EGLNativeDisplayType dpy,EglConfig* cfg,EGLNativeContextType sharedContext) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,11 @@
|
||||
#define EGL_OS_API_H
|
||||
|
||||
#include <EGL/egl.h>
|
||||
#ifdef __APPLE__
|
||||
#include <OpenGL/gl.h>
|
||||
#else
|
||||
#include <GL/gl.h>
|
||||
#endif
|
||||
#include "EglConfig.h"
|
||||
#include "EglDisplay.h"
|
||||
#include "EglPbufferSurface.h"
|
||||
|
||||
@@ -17,3 +17,26 @@
|
||||
#include "EglOsApi.h"
|
||||
|
||||
EglThreadInfo::EglThreadInfo():m_err(EGL_SUCCESS),m_api(EGL_OPENGL_ES_API) {}
|
||||
|
||||
#include <cutils/threads.h>
|
||||
|
||||
static thread_store_t s_tls = THREAD_STORE_INITIALIZER;
|
||||
|
||||
static void tlsDestruct(void *ptr)
|
||||
{
|
||||
if (ptr) {
|
||||
EglThreadInfo *ti = (EglThreadInfo *)ptr;
|
||||
delete ti;
|
||||
}
|
||||
}
|
||||
|
||||
EglThreadInfo* EglThreadInfo::get(void)
|
||||
{
|
||||
EglThreadInfo *ti = (EglThreadInfo *)thread_store_get(&s_tls);
|
||||
if (!ti) {
|
||||
ti = new EglThreadInfo();
|
||||
thread_store_set(&s_tls, ti, tlsDestruct);
|
||||
}
|
||||
return ti;
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,8 @@ public:
|
||||
void setApi(EGLenum api){m_api = api;}
|
||||
EGLenum getApi(){return m_api;}
|
||||
|
||||
static EglThreadInfo* get(void) __attribute__((const));
|
||||
|
||||
private:
|
||||
EglDisplay* m_currentDisplay;
|
||||
EGLint m_err;
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
|
||||
#include <GLcommon/ThreadInfo.h>
|
||||
|
||||
__thread ThreadInfo* thread = NULL;
|
||||
|
||||
void ThreadInfo::updateInfo(void* eglCtx,void* dpy,void* glesCtx,ShareGroupPtr share,ObjectNameManager* manager) {
|
||||
eglContext = eglCtx;
|
||||
@@ -27,6 +26,9 @@ void ThreadInfo::updateInfo(void* eglCtx,void* dpy,void* glesCtx,ShareGroupPtr s
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
__thread ThreadInfo* thread = NULL;
|
||||
|
||||
ThreadInfo* getThreadInfo(){
|
||||
if(!thread) {
|
||||
thread = new ThreadInfo();
|
||||
@@ -35,6 +37,7 @@ ThreadInfo* getThreadInfo(){
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#include <cutils/threads.h>
|
||||
static thread_store_t s_tls = THREAD_STORE_INITIALIZER;
|
||||
|
||||
@@ -46,13 +49,14 @@ static void tlsDestruct(void *ptr)
|
||||
}
|
||||
}
|
||||
|
||||
RenderThreadInfo *getRenderThreadInfo()
|
||||
ThreadInfo *getThreadInfo()
|
||||
{
|
||||
ThreadInfo *ti = (ThreadInfo *)thread_store_get(&s_tls);
|
||||
if (!ti) {
|
||||
ti = new RenderThreadInfo();
|
||||
ti = new ThreadInfo();
|
||||
thread_store_set(&s_tls, ti, tlsDestruct);
|
||||
}
|
||||
return ti;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -73,6 +73,16 @@ typedef HDC EGLNativeDisplayType;
|
||||
typedef HBITMAP EGLNativePixmapType;
|
||||
typedef HWND EGLNativeWindowType;
|
||||
|
||||
#elif defined(__APPLE__)
|
||||
|
||||
typedef int EGLNativePixelFormatType;
|
||||
|
||||
typedef struct _EGLNativeContextType* EGLNativeContextType;
|
||||
typedef struct _EGLNativePbufferType* EGLNativePbufferType;
|
||||
typedef struct _EGLNativeDisplayType* EGLNativeDisplayType;
|
||||
typedef int EGLNativePixmapType;
|
||||
typedef int EGLNativeWindowType;
|
||||
|
||||
#elif defined(__unix__)
|
||||
|
||||
/* X11 (tentative) */
|
||||
|
||||
Reference in New Issue
Block a user