Skip to content

Commit

Permalink
Implement async shader compilation in ANGLE
Browse files Browse the repository at this point in the history
  • Loading branch information
EIREXE committed Dec 14, 2021
1 parent 6edad44 commit 7c9f9fa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
16 changes: 16 additions & 0 deletions platform/windows/context_gl_windows_angle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,18 @@ void ContextGL_Windows::make_current() {
eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext);
}

bool ContextGL_Windows::is_offscreen_available() const {
return mEglContext_offscreen != EGL_NO_CONTEXT;
}

void ContextGL_Windows::make_offscreen_current() {
ERR_FAIL_COND(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext_offscreen) != EGL_TRUE);
}

void ContextGL_Windows::release_offscreen_current() {
ERR_FAIL_COND(eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT) != EGL_TRUE);
}

HDC ContextGL_Windows::get_hdc() {
return hDC;
}
Expand Down Expand Up @@ -141,6 +153,9 @@ void ContextGL_Windows::cleanup() {
if (mEglDisplay != EGL_NO_DISPLAY && mEglContext != EGL_NO_CONTEXT) {
eglDestroyContext(mEglDisplay, mEglContext);
mEglContext = EGL_NO_CONTEXT;
if (mEglContext_offscreen != EGL_NO_CONTEXT) {
eglDestroyContext(mEglDisplay, mEglContext_offscreen);
}
}

if (mEglDisplay != EGL_NO_DISPLAY) {
Expand Down Expand Up @@ -317,6 +332,7 @@ ContextGL_Windows::ContextGL_Windows(HWND hwnd, bool p_opengl_3_context) {
opengl_3_context = p_opengl_3_context;
hWnd = hwnd;
use_vsync = false;
mEglContext_offscreen = EGL_NO_CONTEXT;
vsync_via_compositor = false;
}

Expand Down
5 changes: 5 additions & 0 deletions platform/windows/context_gl_windows_angle.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ class ContextGL_Windows {

void make_current();

bool is_offscreen_available() const;
void make_offscreen_current();
void release_offscreen_current();

HDC get_hdc();
HGLRC get_hglrc();

Expand All @@ -85,6 +89,7 @@ class ContextGL_Windows {
private:
EGLDisplay mEglDisplay;
EGLContext mEglContext;
EGLContext mEglContext_offscreen;
EGLSurface mEglSurface;

EGLint width;
Expand Down

0 comments on commit 7c9f9fa

Please sign in to comment.