Commit 582173d9 by Corentin Wallez

FunctionsGLX: make most functions take the display implicitly

In later CLs FunctionsGLX will need to store the X display so we take advantage of it to reduce the verbosity of the other GLX files slightly. BUG=angleproject:892 Change-Id: I42ea00d0a37055e5e0752a860978b8ef5afb7a0b Reviewed-on: https://chromium-review.googlesource.com/271163Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Tested-by: 's avatarCorentin Wallez <cwallez@chromium.org>
parent b8e3a568
......@@ -49,8 +49,7 @@ DisplayGLX::DisplayGLX()
mFunctionsGL(nullptr),
mContext(nullptr),
mDummyPbuffer(0),
mEGLDisplay(nullptr),
mXDisplay(nullptr)
mEGLDisplay(nullptr)
{
}
......@@ -61,21 +60,21 @@ DisplayGLX::~DisplayGLX()
egl::Error DisplayGLX::initialize(egl::Display *display)
{
mEGLDisplay = display;
mXDisplay = display->getNativeDisplayId();
Display *xDisplay = display->getNativeDisplayId();
// ANGLE_platform_angle allows the creation of a default display
// using EGL_DEFAULT_DISPLAY (= nullptr). In this case just open
// the display specified by the DISPLAY environment variable.
if (mXDisplay == EGL_DEFAULT_DISPLAY)
if (xDisplay == EGL_DEFAULT_DISPLAY)
{
mXDisplay = XOpenDisplay(NULL);
if (!mXDisplay)
xDisplay = XOpenDisplay(NULL);
if (!xDisplay)
{
return egl::Error(EGL_NOT_INITIALIZED, "Could not open the default X display.");
}
}
egl::Error glxInitResult = mGLX.initialize(mXDisplay);
egl::Error glxInitResult = mGLX.initialize(xDisplay, DefaultScreen(xDisplay));
if (glxInitResult.isError())
{
return glxInitResult;
......@@ -124,7 +123,7 @@ egl::Error DisplayGLX::initialize(egl::Display *display)
GLX_CONFIG_CAVEAT, GLX_NONE,
None
};
GLXFBConfig* candidates = mGLX.chooseFBConfig(mXDisplay, DefaultScreen(mXDisplay), attribList, &nConfigs);
GLXFBConfig* candidates = mGLX.chooseFBConfig(attribList, &nConfigs);
if (nConfigs == 0)
{
XFree(candidates);
......@@ -135,7 +134,7 @@ egl::Error DisplayGLX::initialize(egl::Display *display)
}
mContextVisualId = getGLXFBConfigAttrib(contextConfig, GLX_VISUAL_ID);
mContext = mGLX.createContextAttribsARB(mXDisplay, contextConfig, nullptr, True, nullptr);
mContext = mGLX.createContextAttribsARB(contextConfig, nullptr, True, nullptr);
if (!mContext)
{
return egl::Error(EGL_NOT_INITIALIZED, "Could not create GL context.");
......@@ -150,8 +149,8 @@ egl::Error DisplayGLX::initialize(egl::Display *display)
// TODO(cwallez) during the initialization of ANGLE we need a gl context current
// to query things like limits. Ideally we would want to unset the current context
// and destroy the pbuffer before going back to the application but this is TODO
mDummyPbuffer = mGLX.createPbuffer(mXDisplay, contextConfig, nullptr);
mGLX.makeCurrent(mXDisplay, mDummyPbuffer, mContext);
mDummyPbuffer = mGLX.createPbuffer(contextConfig, nullptr);
mGLX.makeCurrent(mDummyPbuffer, mContext);
mFunctionsGL = new FunctionsGLGLX(mGLX.getProc);
mFunctionsGL->initialize();
......@@ -165,13 +164,13 @@ void DisplayGLX::terminate()
if (mDummyPbuffer)
{
mGLX.destroyPbuffer(mXDisplay, mDummyPbuffer);
mGLX.destroyPbuffer(mDummyPbuffer);
mDummyPbuffer = 0;
}
if (mContext)
{
mGLX.destroyContext(mXDisplay, mContext);
mGLX.destroyContext(mContext);
mContext = nullptr;
}
......@@ -187,7 +186,7 @@ SurfaceImpl *DisplayGLX::createWindowSurface(const egl::Config *configuration,
ASSERT(configIdToGLXConfig.count(configuration->configID) > 0);
GLXFBConfig fbConfig = configIdToGLXConfig[configuration->configID];
return new WindowSurfaceGLX(mGLX, window, mXDisplay, mContext, fbConfig);
return new WindowSurfaceGLX(mGLX, window, mGLX.getDisplay(), mContext, fbConfig);
}
SurfaceImpl *DisplayGLX::createPbufferSurface(const egl::Config *configuration,
......@@ -200,7 +199,7 @@ SurfaceImpl *DisplayGLX::createPbufferSurface(const egl::Config *configuration,
EGLint height = attribs.get(EGL_HEIGHT, 0);
bool largest = (attribs.get(EGL_LARGEST_PBUFFER, EGL_FALSE) == EGL_TRUE);
return new PbufferSurfaceGLX(width, height, largest, mGLX, mXDisplay, mContext, fbConfig);
return new PbufferSurfaceGLX(width, height, largest, mGLX, mContext, fbConfig);
}
SurfaceImpl* DisplayGLX::createPbufferFromClientBuffer(const egl::Config *configuration,
......@@ -234,7 +233,7 @@ egl::ConfigSet DisplayGLX::generateConfigs() const
bool hasTextureFromPixmap = mGLX.hasExtension("GLX_EXT_texture_from_pixmap");
int glxConfigCount;
GLXFBConfig *glxConfigs = mGLX.getFBConfigs(mXDisplay, DefaultScreen(mXDisplay), &glxConfigCount);
GLXFBConfig *glxConfigs = mGLX.getFBConfigs(&glxConfigCount);
for (int i = 0; i < glxConfigCount; i++)
{
......@@ -366,7 +365,7 @@ bool DisplayGLX::isValidNativeWindow(EGLNativeWindowType window) const
Window parent;
Window *children = nullptr;
unsigned nChildren;
int status = XQueryTree(mXDisplay, window, &root, &parent, &children, &nChildren);
int status = XQueryTree(mGLX.getDisplay(), window, &root, &parent, &children, &nChildren);
if (children)
{
XFree(children);
......@@ -399,7 +398,7 @@ void DisplayGLX::generateCaps(egl::Caps *outCaps) const
int DisplayGLX::getGLXFBConfigAttrib(GLXFBConfig config, int attrib) const
{
int result;
mGLX.getFBConfigAttrib(mXDisplay, config, attrib, &result);
mGLX.getFBConfigAttrib(config, attrib, &result);
return result;
}
......
......@@ -74,7 +74,6 @@ class DisplayGLX : public DisplayGL
FunctionsGLX mGLX;
egl::Display *mEGLDisplay;
Display *mXDisplay;
};
}
......
......@@ -27,24 +27,25 @@ static bool GetProc(PFNGLXGETPROCADDRESSPROC getProc, T *member, const char *nam
FunctionsGLX::FunctionsGLX()
: majorVersion(0),
minorVersion(0),
getProc(nullptr),
destroyContext(nullptr),
makeCurrent(nullptr),
swapBuffers(nullptr),
queryExtension(nullptr),
queryVersion(nullptr),
queryExtensionsString(nullptr),
getFBConfigs(nullptr),
chooseFBConfig(nullptr),
getFBConfigAttrib(nullptr),
getVisualFromFBConfig(nullptr),
createWindow(nullptr),
destroyWindow(nullptr),
createPbuffer(nullptr),
destroyPbuffer(nullptr),
queryDrawable(nullptr),
createContextAttribsARB(nullptr),
mLibHandle(nullptr)
mLibHandle(nullptr),
mXDisplay(nullptr),
mXScreen(-1),
mDestroyContextPtr(nullptr),
mMakeCurrentPtr(nullptr),
mSwapBuffersPtr(nullptr),
mQueryExtensionPtr(nullptr),
mQueryVersionPtr(nullptr),
mQueryExtensionsStringPtr(nullptr),
mGetFBConfigsPtr(nullptr),
mChooseFBConfigPtr(nullptr),
mGetFBConfigAttribPtr(nullptr),
mGetVisualFromFBConfigPtr(nullptr),
mCreateWindowPtr(nullptr),
mDestroyWindowPtr(nullptr),
mCreatePbufferPtr(nullptr),
mDestroyPbufferPtr(nullptr),
mQueryDrawablePtr(nullptr),
mCreateContextAttribsARBPtr(nullptr)
{
}
......@@ -53,9 +54,11 @@ FunctionsGLX::~FunctionsGLX()
terminate();
}
egl::Error FunctionsGLX::initialize(Display *xDisplay)
egl::Error FunctionsGLX::initialize(Display *xDisplay, int screen)
{
terminate();
mXDisplay = xDisplay;
mXScreen = screen;
mLibHandle = dlopen("libGL.so.1", RTLD_NOW);
if (!mLibHandle)
......@@ -80,27 +83,27 @@ egl::Error FunctionsGLX::initialize(Display *xDisplay)
}
// GLX 1.0
GET_PROC_OR_ERROR(&destroyContext, "glXDestroyContext");
GET_PROC_OR_ERROR(&makeCurrent, "glXMakeCurrent");
GET_PROC_OR_ERROR(&swapBuffers, "glXSwapBuffers");
GET_PROC_OR_ERROR(&queryExtension, "glXQueryExtension");
GET_PROC_OR_ERROR(&queryVersion, "glXQueryVersion");
GET_PROC_OR_ERROR(&mDestroyContextPtr, "glXDestroyContext");
GET_PROC_OR_ERROR(&mMakeCurrentPtr, "glXMakeCurrent");
GET_PROC_OR_ERROR(&mSwapBuffersPtr, "glXSwapBuffers");
GET_PROC_OR_ERROR(&mQueryExtensionPtr, "glXQueryExtension");
GET_PROC_OR_ERROR(&mQueryVersionPtr, "glXQueryVersion");
// GLX 1.1
GET_PROC_OR_ERROR(&queryExtensionsString, "glXQueryExtensionsString");
GET_PROC_OR_ERROR(&mQueryExtensionsStringPtr, "glXQueryExtensionsString");
// Check we have a working GLX
{
int errorBase;
int eventBase;
if (!queryExtension(xDisplay, &errorBase, &eventBase))
if (!queryExtension(&errorBase, &eventBase))
{
return egl::Error(EGL_NOT_INITIALIZED, "GLX is not present.");
}
}
// Check we have a supported version of GLX
if (!queryVersion(xDisplay, &majorVersion, &minorVersion))
if (!queryVersion(&majorVersion, &minorVersion))
{
return egl::Error(EGL_NOT_INITIALIZED, "Could not query the GLX version.");
}
......@@ -109,7 +112,7 @@ egl::Error FunctionsGLX::initialize(Display *xDisplay)
return egl::Error(EGL_NOT_INITIALIZED, "Unsupported GLX version (requires at least 1.3).");
}
const char *extensions = queryExtensionsString(xDisplay, DefaultScreen(xDisplay));
const char *extensions = queryExtensionsString();
if (!extensions)
{
return egl::Error(EGL_NOT_INITIALIZED, "glXQueryExtensionsString returned NULL");
......@@ -117,24 +120,24 @@ egl::Error FunctionsGLX::initialize(Display *xDisplay)
mExtensions = TokenizeExtensionsString(extensions);
// GLX 1.3
GET_PROC_OR_ERROR(&getFBConfigs, "glXGetFBConfigs");
GET_PROC_OR_ERROR(&chooseFBConfig, "glXChooseFBConfig");
GET_PROC_OR_ERROR(&getFBConfigAttrib, "glXGetFBConfigAttrib");
GET_PROC_OR_ERROR(&getVisualFromFBConfig, "glXGetVisualFromFBConfig");
GET_PROC_OR_ERROR(&createWindow, "glXCreateWindow");
GET_PROC_OR_ERROR(&destroyWindow, "glXDestroyWindow");
GET_PROC_OR_ERROR(&createPbuffer, "glXCreatePbuffer");
GET_PROC_OR_ERROR(&destroyPbuffer, "glXDestroyPbuffer");
GET_PROC_OR_ERROR(&queryDrawable, "glXQueryDrawable");
GET_PROC_OR_ERROR(&mGetFBConfigsPtr, "glXGetFBConfigs");
GET_PROC_OR_ERROR(&mChooseFBConfigPtr, "glXChooseFBConfig");
GET_PROC_OR_ERROR(&mGetFBConfigAttribPtr, "glXGetFBConfigAttrib");
GET_PROC_OR_ERROR(&mGetVisualFromFBConfigPtr, "glXGetVisualFromFBConfig");
GET_PROC_OR_ERROR(&mCreateWindowPtr, "glXCreateWindow");
GET_PROC_OR_ERROR(&mDestroyWindowPtr, "glXDestroyWindow");
GET_PROC_OR_ERROR(&mCreatePbufferPtr, "glXCreatePbuffer");
GET_PROC_OR_ERROR(&mDestroyPbufferPtr, "glXDestroyPbuffer");
GET_PROC_OR_ERROR(&mQueryDrawablePtr, "glXQueryDrawable");
// Extensions
if (hasExtension("GLX_ARB_create_context"))
{
GET_PROC_OR_ERROR(&createContextAttribsARB, "glXCreateContextAttribsARB");
GET_PROC_OR_ERROR(&mCreateContextAttribsARBPtr, "glXCreateContextAttribsARB");
}
else
{
createContextAttribsARB = nullptr;
mCreateContextAttribsARBPtr = nullptr;
}
#undef GET_PROC_OR_ERROR
......@@ -156,4 +159,88 @@ bool FunctionsGLX::hasExtension(const char *extension) const
return std::find(mExtensions.begin(), mExtensions.end(), extension) != mExtensions.end();
}
Display *FunctionsGLX::getDisplay() const
{
return mXDisplay;
}
int FunctionsGLX::getScreen() const
{
return mXScreen;
}
// GLX functions
// GLX 1.0
void FunctionsGLX::destroyContext(GLXContext context) const
{
mDestroyContextPtr(mXDisplay, context);
}
Bool FunctionsGLX::makeCurrent(GLXDrawable drawable, GLXContext context) const
{
return mMakeCurrentPtr(mXDisplay, drawable, context);
}
void FunctionsGLX::swapBuffers(GLXDrawable drawable) const
{
mSwapBuffersPtr(mXDisplay, drawable);
}
Bool FunctionsGLX::queryExtension(int *errorBase, int *event) const
{
return mQueryExtensionPtr(mXDisplay, errorBase, event);
}
Bool FunctionsGLX::queryVersion(int *major, int *minor) const
{
return mQueryVersionPtr(mXDisplay, major, minor);
}
// GLX 1.1
const char *FunctionsGLX::queryExtensionsString() const
{
return mQueryExtensionsStringPtr(mXDisplay, mXScreen);
}
// GLX 1.4
GLXFBConfig *FunctionsGLX::getFBConfigs(int *nElements) const
{
return mGetFBConfigsPtr(mXDisplay, mXScreen, nElements);
}
GLXFBConfig *FunctionsGLX::chooseFBConfig(const int *attribList, int *nElements) const
{
return mChooseFBConfigPtr(mXDisplay, mXScreen, attribList, nElements);
}
int FunctionsGLX::getFBConfigAttrib(GLXFBConfig config, int attribute, int *value) const
{
return mGetFBConfigAttribPtr(mXDisplay, config, attribute, value);
}
XVisualInfo *FunctionsGLX::getVisualFromFBConfig(GLXFBConfig config) const
{
return mGetVisualFromFBConfigPtr(mXDisplay, config);
}
GLXWindow FunctionsGLX::createWindow(GLXFBConfig config, Window window, const int *attribList) const
{
return mCreateWindowPtr(mXDisplay, config, window, attribList);
}
void FunctionsGLX::destroyWindow(GLXWindow window) const
{
mDestroyWindowPtr(mXDisplay, window);
}
GLXPbuffer FunctionsGLX::createPbuffer(GLXFBConfig config, const int *attribList) const
{
return mCreatePbufferPtr(mXDisplay, config, attribList);
}
void FunctionsGLX::destroyPbuffer(GLXPbuffer pbuffer) const
{
mDestroyPbufferPtr(mXDisplay, pbuffer);
}
void FunctionsGLX::queryDrawable(GLXDrawable drawable, int attribute, unsigned int *value) const
{
mQueryDrawablePtr(mXDisplay, drawable, attribute, value);
}
// GLX_ARB_create_context
GLXContext FunctionsGLX::createContextAttribsARB(GLXFBConfig config, GLXContext shareContext, Bool direct, const int *attribList) const
{
return mCreateContextAttribsARBPtr(mXDisplay, config, shareContext, direct, attribList);
}
}
......@@ -26,7 +26,7 @@ class FunctionsGLX : angle::NonCopyable
~FunctionsGLX();
// Load data from GLX, can be called multiple times
egl::Error initialize(Display *xDisplay);
egl::Error initialize(Display *xDisplay, int screen);
void terminate();
bool hasExtension(const char *extension) const;
......@@ -34,35 +34,65 @@ class FunctionsGLX : angle::NonCopyable
int majorVersion;
int minorVersion;
Display *getDisplay() const;
int getScreen() const;
PFNGLXGETPROCADDRESSPROC getProc;
// GLX 1.0
PFNGLXDESTROYCONTEXTPROC destroyContext;
PFNGLXMAKECURRENTPROC makeCurrent;
PFNGLXSWAPBUFFERSPROC swapBuffers;
PFNGLXQUERYEXTENSIONPROC queryExtension;
PFNGLXQUERYVERSIONPROC queryVersion;
void destroyContext(GLXContext context) const;
Bool makeCurrent(GLXDrawable drawable, GLXContext context) const;
void swapBuffers(GLXDrawable drawable) const;
Bool queryExtension(int *errorBase, int *event) const;
Bool queryVersion(int *major, int *minor) const;
// GLX 1.1
PFNGLXQUERYEXTENSIONSSTRINGPROC queryExtensionsString;
//GLX 1.3
PFNGLXGETFBCONFIGSPROC getFBConfigs;
PFNGLXCHOOSEFBCONFIGPROC chooseFBConfig;
PFNGLXGETFBCONFIGATTRIBPROC getFBConfigAttrib;
PFNGLXGETVISUALFROMFBCONFIGPROC getVisualFromFBConfig;
PFNGLXCREATEWINDOWPROC createWindow;
PFNGLXDESTROYWINDOWPROC destroyWindow;
PFNGLXCREATEPBUFFERPROC createPbuffer;
PFNGLXDESTROYPBUFFERPROC destroyPbuffer;
PFNGLXQUERYDRAWABLEPROC queryDrawable;
const char *queryExtensionsString() const;
// GLX 1.3
GLXFBConfig *getFBConfigs(int *nElements) const;
GLXFBConfig *chooseFBConfig(const int *attribList, int *nElements) const;
int getFBConfigAttrib(GLXFBConfig config, int attribute, int *value) const;
XVisualInfo *getVisualFromFBConfig(GLXFBConfig config) const;
GLXWindow createWindow(GLXFBConfig config, Window window, const int *attribList) const;
void destroyWindow(GLXWindow window) const;
GLXPbuffer createPbuffer(GLXFBConfig config, const int *attribList) const;
void destroyPbuffer(GLXPbuffer pbuffer) const;
void queryDrawable(GLXDrawable drawable, int attribute, unsigned int *value) const;
// GLX_ARB_create_context
PFNGLXCREATECONTEXTATTRIBSARBPROC createContextAttribsARB;
GLXContext createContextAttribsARB(GLXFBConfig config, GLXContext shareContext, Bool direct, const int *attribList) const;
private:
void *mLibHandle;
Display *mXDisplay;
int mXScreen;
std::vector<std::string> mExtensions;
// GLX 1.0
PFNGLXDESTROYCONTEXTPROC mDestroyContextPtr;
PFNGLXMAKECURRENTPROC mMakeCurrentPtr;
PFNGLXSWAPBUFFERSPROC mSwapBuffersPtr;
PFNGLXQUERYEXTENSIONPROC mQueryExtensionPtr;
PFNGLXQUERYVERSIONPROC mQueryVersionPtr;
// GLX 1.1
PFNGLXQUERYEXTENSIONSSTRINGPROC mQueryExtensionsStringPtr;
//GLX 1.3
PFNGLXGETFBCONFIGSPROC mGetFBConfigsPtr;
PFNGLXCHOOSEFBCONFIGPROC mChooseFBConfigPtr;
PFNGLXGETFBCONFIGATTRIBPROC mGetFBConfigAttribPtr;
PFNGLXGETVISUALFROMFBCONFIGPROC mGetVisualFromFBConfigPtr;
PFNGLXCREATEWINDOWPROC mCreateWindowPtr;
PFNGLXDESTROYWINDOWPROC mDestroyWindowPtr;
PFNGLXCREATEPBUFFERPROC mCreatePbufferPtr;
PFNGLXDESTROYPBUFFERPROC mDestroyPbufferPtr;
PFNGLXQUERYDRAWABLEPROC mQueryDrawablePtr;
// GLX_ARB_create_context
PFNGLXCREATECONTEXTATTRIBSARBPROC mCreateContextAttribsARBPtr;
};
}
......
......@@ -15,13 +15,12 @@ namespace rx
{
PbufferSurfaceGLX::PbufferSurfaceGLX(EGLint width, EGLint height, bool largest, const FunctionsGLX &glx,
Display *display, GLXContext context, GLXFBConfig fbConfig)
GLXContext context, GLXFBConfig fbConfig)
: SurfaceGL(),
mWidth(width),
mHeight(height),
mLargest(largest),
mGLX(glx),
mDisplay(display),
mContext(context),
mFBConfig(fbConfig),
mPbuffer(0)
......@@ -32,7 +31,7 @@ PbufferSurfaceGLX::~PbufferSurfaceGLX()
{
if (mPbuffer)
{
mGLX.destroyPbuffer(mDisplay, mPbuffer);
mGLX.destroyPbuffer(mPbuffer);
}
}
......@@ -46,7 +45,7 @@ egl::Error PbufferSurfaceGLX::initialize()
None
};
mPbuffer = mGLX.createPbuffer(mDisplay, mFBConfig, attribs);
mPbuffer = mGLX.createPbuffer(mFBConfig, attribs);
if (!mPbuffer)
{
return egl::Error(EGL_BAD_ALLOC, "Failed to create a native GLX pbuffer.");
......@@ -54,8 +53,8 @@ egl::Error PbufferSurfaceGLX::initialize()
if (mLargest)
{
mGLX.queryDrawable(mDisplay, mPbuffer, GLX_WIDTH, &mWidth);
mGLX.queryDrawable(mDisplay, mPbuffer, GLX_HEIGHT, &mHeight);
mGLX.queryDrawable(mPbuffer, GLX_WIDTH, &mWidth);
mGLX.queryDrawable(mPbuffer, GLX_HEIGHT, &mHeight);
}
return egl::Error(EGL_SUCCESS);
......@@ -63,7 +62,7 @@ egl::Error PbufferSurfaceGLX::initialize()
egl::Error PbufferSurfaceGLX::makeCurrent()
{
if (mGLX.makeCurrent(mDisplay, mPbuffer, mContext) != True)
if (mGLX.makeCurrent(mPbuffer, mContext) != True)
{
return egl::Error(EGL_BAD_DISPLAY);
}
......
......@@ -23,7 +23,7 @@ class PbufferSurfaceGLX : public SurfaceGL
{
public:
PbufferSurfaceGLX(EGLint width, EGLint height, bool largest, const FunctionsGLX &glx,
Display *display, GLXContext context, GLXFBConfig fbConfig);
GLXContext context, GLXFBConfig fbConfig);
~PbufferSurfaceGLX() override;
egl::Error initialize();
......@@ -47,7 +47,6 @@ class PbufferSurfaceGLX : public SurfaceGL
bool mLargest;
const FunctionsGLX &mGLX;
Display *mDisplay;
GLXContext mContext;
GLXFBConfig mFBConfig;
GLXPbuffer mPbuffer;
......
......@@ -29,14 +29,14 @@ WindowSurfaceGLX::WindowSurfaceGLX(const FunctionsGLX &glx, EGLNativeWindowType
WindowSurfaceGLX::~WindowSurfaceGLX()
{
if (mWindow)
if (mGLXWindow)
{
XDestroyWindow(mDisplay, mWindow);
mGLX.destroyWindow(mGLXWindow);
}
if (mGLXWindow)
if (mWindow)
{
mGLX.destroyWindow(mDisplay, mGLXWindow);
XDestroyWindow(mDisplay, mWindow);
}
}
......@@ -48,7 +48,7 @@ egl::Error WindowSurfaceGLX::initialize()
// create a child window with the right visual that covers all of its
// parent.
XVisualInfo* visualInfo = mGLX.getVisualFromFBConfig(mDisplay, mFBConfig);
XVisualInfo *visualInfo = mGLX.getVisualFromFBConfig(mFBConfig);
if (!visualInfo)
{
return egl::Error(EGL_BAD_NATIVE_WINDOW, "Failed to get the XVisualInfo for the child window.");
......@@ -76,7 +76,7 @@ egl::Error WindowSurfaceGLX::initialize()
//TODO(cwallez) set up our own error handler to see if the call failed
mWindow = XCreateWindow(mDisplay, mParent, 0, 0, parentAttribs.width, parentAttribs.height,
0, visualInfo->depth, InputOutput, visual, attributeMask, &attributes);
mGLXWindow = mGLX.createWindow(mDisplay, mFBConfig, mWindow, nullptr);
mGLXWindow = mGLX.createWindow(mFBConfig, mWindow, nullptr);
XMapWindow(mDisplay, mWindow);
XFlush(mDisplay);
......@@ -89,7 +89,7 @@ egl::Error WindowSurfaceGLX::initialize()
egl::Error WindowSurfaceGLX::makeCurrent()
{
if (mGLX.makeCurrent(mDisplay, mGLXWindow, mContext) != True)
if (mGLX.makeCurrent(mGLXWindow, mContext) != True)
{
return egl::Error(EGL_BAD_DISPLAY);
}
......@@ -100,7 +100,7 @@ egl::Error WindowSurfaceGLX::swap()
{
//TODO(cwallez) resize support
//TODO(cwallez) set up our own error handler to see if the call failed
mGLX.swapBuffers(mDisplay, mGLXWindow);
mGLX.swapBuffers(mGLXWindow);
return egl::Error(EGL_SUCCESS);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment