destroy gles surfaces resources
This commit is contained in:
parent
2dccfa5547
commit
64d7b31e5c
|
@ -124,7 +124,8 @@ f.write("void mg_gl_load_gl43(mg_gl_api* api, mg_gl_load_proc loadProc);\n")
|
||||||
f.write("void mg_gl_load_gles31(mg_gl_api* api, mg_gl_load_proc loadProc);\n")
|
f.write("void mg_gl_load_gles31(mg_gl_api* api, mg_gl_load_proc loadProc);\n")
|
||||||
f.write("void mg_gl_load_gles32(mg_gl_api* api, mg_gl_load_proc loadProc);\n\n")
|
f.write("void mg_gl_load_gles32(mg_gl_api* api, mg_gl_load_proc loadProc);\n\n")
|
||||||
|
|
||||||
f.write("void mg_gl_select_api(mg_gl_api* api);\n\n")
|
f.write("void mg_gl_select_api(mg_gl_api* api);\n")
|
||||||
|
f.write("mg_gl_api* mg_gl_get_api(void);\n\n")
|
||||||
|
|
||||||
emit_end_guard(f, loaderName)
|
emit_end_guard(f, loaderName)
|
||||||
f.close()
|
f.close()
|
||||||
|
@ -153,6 +154,7 @@ emit_loader(f, 'gl43', gl43)
|
||||||
emit_loader(f, 'gles31', gles31)
|
emit_loader(f, 'gles31', gles31)
|
||||||
emit_loader(f, 'gles32', gles32)
|
emit_loader(f, 'gles32', gles32)
|
||||||
|
|
||||||
f.write("void mg_gl_select_api(mg_gl_api* api){ __mgGLAPI = api; }\n\n")
|
f.write("void mg_gl_select_api(mg_gl_api* api){ __mgGLAPI = api; }\n")
|
||||||
|
f.write("mg_gl_api* mg_gl_get_api(void) { return(__mgGLAPI); }\n\n")
|
||||||
|
|
||||||
f.close()
|
f.close()
|
||||||
|
|
2208
src/gl_api.h
2208
src/gl_api.h
File diff suppressed because it is too large
Load Diff
3445
src/gl_loader.c
3445
src/gl_loader.c
File diff suppressed because it is too large
Load Diff
|
@ -1,22 +1,23 @@
|
||||||
/********************************************************
|
/********************************************************
|
||||||
*
|
*
|
||||||
* @file: gl_loader.h
|
* @file: gl_loader.h
|
||||||
* @note: auto-generated by glapi.py from gl.xml
|
* @note: auto-generated by glapi.py from gl.xml
|
||||||
* @date: 20/022023
|
* @date: 20/022023
|
||||||
*
|
*
|
||||||
*********************************************************/
|
*********************************************************/
|
||||||
#ifndef __GL_LOADER_H__
|
#ifndef __GL_LOADER_H__
|
||||||
#define __GL_LOADER_H__
|
#define __GL_LOADER_H__
|
||||||
|
|
||||||
#include"gl_api.h"
|
#include"gl_api.h"
|
||||||
|
|
||||||
typedef void*(*mg_gl_load_proc)(const char* name);
|
typedef void*(*mg_gl_load_proc)(const char* name);
|
||||||
|
|
||||||
void mg_gl_load_gl41(mg_gl_api* api, mg_gl_load_proc loadProc);
|
void mg_gl_load_gl41(mg_gl_api* api, mg_gl_load_proc loadProc);
|
||||||
void mg_gl_load_gl43(mg_gl_api* api, mg_gl_load_proc loadProc);
|
void mg_gl_load_gl43(mg_gl_api* api, mg_gl_load_proc loadProc);
|
||||||
void mg_gl_load_gles31(mg_gl_api* api, mg_gl_load_proc loadProc);
|
void mg_gl_load_gles31(mg_gl_api* api, mg_gl_load_proc loadProc);
|
||||||
void mg_gl_load_gles32(mg_gl_api* api, mg_gl_load_proc loadProc);
|
void mg_gl_load_gles32(mg_gl_api* api, mg_gl_load_proc loadProc);
|
||||||
|
|
||||||
void mg_gl_select_api(mg_gl_api* api);
|
void mg_gl_select_api(mg_gl_api* api);
|
||||||
|
mg_gl_api* mg_gl_get_api(void);
|
||||||
#endif // __GL_LOADER_H__
|
|
||||||
|
#endif // __GL_LOADER_H__
|
||||||
|
|
|
@ -33,13 +33,22 @@ typedef struct mg_egl_surface
|
||||||
void mg_egl_surface_destroy(mg_surface_data* interface)
|
void mg_egl_surface_destroy(mg_surface_data* interface)
|
||||||
{
|
{
|
||||||
mg_egl_surface* surface = (mg_egl_surface*)interface;
|
mg_egl_surface* surface = (mg_egl_surface*)interface;
|
||||||
|
|
||||||
|
if(&surface->api == mg_gl_get_api())
|
||||||
|
{
|
||||||
|
mg_gl_select_api(0);
|
||||||
|
}
|
||||||
|
if(eglGetCurrentContext() == surface->eglContext)
|
||||||
|
{
|
||||||
|
eglMakeCurrent(surface->eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
|
}
|
||||||
|
eglDestroyContext(surface->eglDisplay, surface->eglContext);
|
||||||
|
eglDestroySurface(surface->eglDisplay, surface->eglSurface);
|
||||||
|
|
||||||
@autoreleasepool
|
@autoreleasepool
|
||||||
{
|
{
|
||||||
[surface->layer release];
|
[surface->layer release];
|
||||||
}
|
}
|
||||||
//////////////////////////////////////////////////
|
|
||||||
//TODO
|
|
||||||
//////////////////////////////////////////////////
|
|
||||||
|
|
||||||
free(surface);
|
free(surface);
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,9 +35,17 @@ void mg_egl_surface_destroy(mg_surface_data* interface)
|
||||||
{
|
{
|
||||||
mg_egl_surface* surface = (mg_egl_surface*)interface;
|
mg_egl_surface* surface = (mg_egl_surface*)interface;
|
||||||
|
|
||||||
//////////////////////////////////////////////////
|
if(&surface->api == mg_gl_get_api())
|
||||||
//TODO
|
{
|
||||||
//////////////////////////////////////////////////
|
mg_gl_select_api(0);
|
||||||
|
}
|
||||||
|
if(eglGetCurrentContext() == surface->eglContext)
|
||||||
|
{
|
||||||
|
eglMakeCurrent(surface->eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||||
|
}
|
||||||
|
eglDestroyContext(surface->eglDisplay, surface->eglContext);
|
||||||
|
eglDestroySurface(surface->eglDisplay, surface->eglSurface);
|
||||||
|
|
||||||
DestroyWindow(surface->hWnd);
|
DestroyWindow(surface->hWnd);
|
||||||
free(surface);
|
free(surface);
|
||||||
}
|
}
|
||||||
|
|
1
todo.txt
1
todo.txt
|
@ -25,7 +25,6 @@ Overview
|
||||||
[/] Keep dummy window/dummy context around for gl context creation, and don't reload wgl functions every time
|
[/] Keep dummy window/dummy context around for gl context creation, and don't reload wgl functions every time
|
||||||
|
|
||||||
[!] Sort out gles contents scaling for high dpi on osx
|
[!] Sort out gles contents scaling for high dpi on osx
|
||||||
[!] Properly destroy egl surfaces
|
|
||||||
[!] win32 surfaces: only register surface child window once?
|
[!] win32 surfaces: only register surface child window once?
|
||||||
[!] Make linking with libEGL optional, even if EGL backend is compiled in milepost?
|
[!] Make linking with libEGL optional, even if EGL backend is compiled in milepost?
|
||||||
[!] Bundle examples with their own resources?? (e.g. avoiding clashes in metal libs files in bin directory)
|
[!] Bundle examples with their own resources?? (e.g. avoiding clashes in metal libs files in bin directory)
|
||||||
|
|
Loading…
Reference in New Issue