class DisplayImplementation : public Display
{
public:
- DisplayImplementation(void *nativeDisplay) : Display(nativeDisplay) {}
+ DisplayImplementation(EGLDisplay dpy, void *nativeDisplay) : Display(dpy, nativeDisplay) {}
~DisplayImplementation() override {}
Image *getSharedImage(EGLImageKHR name) override
}
#endif
- static DisplayImplementation display(nativeDisplay);
+ static DisplayImplementation display(dpy, nativeDisplay);
return &display;
}
-Display::Display(void *nativeDisplay) : nativeDisplay(nativeDisplay)
+Display::Display(EGLDisplay eglDisplay, void *nativeDisplay) : eglDisplay(eglDisplay), nativeDisplay(nativeDisplay)
{
mMinSwapInterval = 1;
mMaxSwapInterval = 1;
return mMaxSwapInterval;
}
+EGLDisplay Display::getEGLDisplay() const
+{
+ return eglDisplay;
+}
+
void *Display::getNativeDisplay() const
{
return nativeDisplay;
class [[clang::lto_visibility_public]] Display
{
protected:
- explicit Display(void *nativeDisplay);
+ explicit Display(EGLDisplay eglDisplay, void *nativeDisplay);
virtual ~Display() = 0;
public:
EGLint getMinSwapInterval() const;
EGLint getMaxSwapInterval() const;
+ EGLDisplay getEGLDisplay() const;
void *getNativeDisplay() const;
EGLImageKHR createSharedImage(Image *image);
private:
sw::Format getDisplayFormat() const;
+ const EGLDisplay eglDisplay;
void *const nativeDisplay;
EGLint mMaxSwapInterval;
return success(EGL_NO_DISPLAY);
}
- return success(context->getDisplay());
+ egl::Display *display = context->getDisplay();
+
+ if(!display)
+ {
+ return error(EGL_BAD_ACCESS, EGL_NO_DISPLAY);
+ }
+
+ return success(display->getEGLDisplay());
}
EGLBoolean QueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
EGLContext context = eglCreateContext(display, config, NULL, contextAttributes);
EXPECT_EQ(EGL_SUCCESS, eglGetError());
- EXPECT_NE(EGL_NO_SURFACE, surface);
+ EXPECT_NE(EGL_NO_CONTEXT, context);
success = eglMakeCurrent(display, surface, surface, context);
EXPECT_EQ(EGL_SUCCESS, eglGetError());
EGLDisplay currentDisplay = eglGetCurrentDisplay();
EXPECT_EQ(EGL_SUCCESS, eglGetError());
- EXPECT_NE(EGL_NO_DISPLAY, currentDisplay);
+ EXPECT_EQ(display, currentDisplay);
EGLSurface currentDrawSurface = eglGetCurrentSurface(EGL_DRAW);
EXPECT_EQ(EGL_SUCCESS, eglGetError());
- EXPECT_NE(EGL_NO_SURFACE, currentDrawSurface);
+ EXPECT_EQ(surface, currentDrawSurface);
EGLSurface currentReadSurface = eglGetCurrentSurface(EGL_READ);
EXPECT_EQ(EGL_SUCCESS, eglGetError());
- EXPECT_NE(EGL_NO_SURFACE, currentReadSurface);
+ EXPECT_EQ(surface, currentReadSurface);
EGLContext currentContext = eglGetCurrentContext();
EXPECT_EQ(EGL_SUCCESS, eglGetError());
- EXPECT_NE(EGL_NO_CONTEXT, currentContext);
+ EXPECT_EQ(context, currentContext);
EXPECT_EQ((GLenum)GL_NO_ERROR, glGetError());