regal/scripts/EmuInit.py
Nigel Stewart 5ab0a9b488 Squeeze the footprint of Loader and Missing dispatch for Regal-wrangler purposes, in particular.
More array bounds checking for Emu::Ppa
REGAL_WRANGLER mode for loader-only Regal - initial groundwork.
2013-09-25 15:25:16 -05:00

94 lines
2.5 KiB
Python

#!/usr/bin/python -B
#
# Selectively initialize Regal for known initialization calls
# in addition to Regal API entry points.
#
# CGLGetCurrentContext is needed for Mac OS X/GLUT
# eglGetDisplay is needed for apitrace eglretrace tool.
# glXGetProcAddress is needed for Linux chromium
# glXQueryExtension is needed for freeglut X11
# glXGetProcAddressARB is needed for Linux Minecraft 1.6.1
# glXChooseVisual is needed for Linux eihort Minecraft world viewer
# wglCreateContext, wglGetCurrentContext, wglGetProcAddress for a start
formulae = {
'EmuInit' : {
'entries' : [
'CGLChoosePixelFormat', 'CGLGetCurrentContext',
'eglGetDisplay', 'eglGetCurrentContext',
'glXChooseVisual', 'glXGetProcAddress', 'glXQueryExtension', 'glXGetProcAddressARB',
'wglCreateContext', 'wglGetCurrentContext', 'wglGetProcAddress'
],
'prefix' : [ 'Init::init();' ]
}
}
#
# Hook into the MakeCurrent and DestroyContext functions in
# order to manage Regal contexts.
#
formulaeGlobal = {
# WGL
'wglMakeCurrent' : {
'entries' : [ 'wglMakeCurrent' ],
'init' : [ 'if (ret)',
' Init::makeCurrent(RegalSystemContext(hglrc));' ]
},
'wglDeleteContext' : {
'entries' : [ 'wglDeleteContext' ],
'init' : [ 'Init::destroyContext(RegalSystemContext(hglrc));' ]
},
# GLX
'glXMakeCurrent' : {
'entries' : [ 'glXMakeCurrent' ],
'init' : [ 'if (ret)',
' Init::makeCurrent(RegalSystemContext(ctx));' ]
},
'glXMakeContextCurrent' : {
'entries' : [ 'glXMakeContextCurrent' ],
'init' : [ 'if (ret)',
' Init::makeCurrent(RegalSystemContext(ctx));' ]
},
'glXDestroyContext' : {
'entries' : [ 'glXDestroyContext' ],
'init' : [ 'Init::destroyContext(RegalSystemContext(ctx));' ]
},
# EGL
'eglMakeCurrent' : {
'entries' : [ 'eglMakeCurrent' ],
'init' : '''
#if !REGAL_SYS_PPAPI
if (ret)
Init::makeCurrent(ctx);
#endif'''
},
'eglDestroyContext' : {
'entries' : [ 'eglDestroyContext' ],
'init' : [ 'Init::destroyContext(RegalSystemContext(ctx));' ]
},
# CGL
'CGLSetCurrentContext' : {
'entries' : [ 'CGLSetCurrentContext' ],
'init' : [ 'if (ret == 0)',
' Init::makeCurrent(ctx);' ]
},
'CGLDestroyContext' : {
'entries' : [ 'CGLDestroyContext' ],
'init' : [ 'Init::destroyContext(RegalSystemContext(ctx));' ]
},
}