Split library_gl.js into library_webgl.js and library_webgl2.js. (#8059)
* Split library_gl.js into library_webgl.js and library_webgl2.js. * Build GL library once for WebGL 1 and once for WebGL 2 because of missing symbols otherwise. * Update GL emulation function pointer fetching to drop nonexisting GL functions
This commit is contained in:
Родитель
bacd5ef353
Коммит
ef230f5577
|
@ -21,7 +21,7 @@ SET(OPENGL_XMESA_FOUND FALSE)
|
|||
# This is the path where <GL/gl.h> is found
|
||||
SET(OPENGL_INCLUDE_DIR "${EMSCRIPTEN_ROOT_PATH}/system/include")
|
||||
|
||||
# No library to link against for OpenGL, since Emscripten picks it up automatically from library_gl.js,
|
||||
# No library to link against for OpenGL, since Emscripten picks it up automatically from library_webgl.js,
|
||||
# but need to report something, or CMake thinks we failed in the search.
|
||||
SET(OPENGL_LIBRARIES "nul")
|
||||
SET(OPENGL_gl_LIBRARY "nul")
|
||||
|
|
27
embuilder.py
27
embuilder.py
|
@ -53,6 +53,12 @@ Available operations and tasks:
|
|||
libc++abi
|
||||
gl
|
||||
gl-mt
|
||||
gl-emu
|
||||
gl-mt-emu
|
||||
gl-webgl2
|
||||
gl-mt-webgl2
|
||||
gl-emu-webgl2
|
||||
gl-mt-emu-webgl2
|
||||
native_optimizer
|
||||
binaryen
|
||||
bullet
|
||||
|
@ -110,7 +116,8 @@ CXX_WITH_STDLIB = '''
|
|||
'''
|
||||
|
||||
SYSTEM_TASKS = [
|
||||
'al', 'compiler-rt', 'gl', 'gl-mt', 'libc', 'libc-mt', 'libc-extras',
|
||||
'al', 'compiler-rt', 'gl', 'gl-mt', 'gl-emu', 'gl-mt-emu', 'gl-webgl2',
|
||||
'gl-mt-webgl2', 'gl-emu-webgl2', 'gl-mt-emu-webgl2', 'libc', 'libc-mt', 'libc-extras',
|
||||
'emmalloc', 'emmalloc_debug', 'dlmalloc', 'dlmalloc_threadsafe', 'pthreads',
|
||||
'pthreads_stub', 'dlmalloc_debug', 'dlmalloc_threadsafe_debug', 'libc++',
|
||||
'libc++_noexcept', 'dlmalloc_debug_noerrno', 'dlmalloc_threadsafe_debug_noerrno',
|
||||
|
@ -239,20 +246,20 @@ def main():
|
|||
return y->y;
|
||||
}
|
||||
''', [static_library_name('libc++abi')])
|
||||
elif what == 'gl':
|
||||
elif what == 'gl' or what.startswith('gl-'):
|
||||
opts = []
|
||||
if '-mt' in what:
|
||||
opts += ['-s', 'USE_PTHREADS=1']
|
||||
if '-emu' in what:
|
||||
opts += ['-s', 'LEGACY_GL_EMULATION=1']
|
||||
if '-webgl2' in what:
|
||||
opts += ['-s', 'USE_WEBGL2=1']
|
||||
build('''
|
||||
extern "C" { extern void* emscripten_GetProcAddress(const char *x); }
|
||||
int main() {
|
||||
return int(emscripten_GetProcAddress("waka waka"));
|
||||
}
|
||||
''', [static_library_name('libgl')])
|
||||
elif what == 'gl-mt':
|
||||
build('''
|
||||
extern "C" { extern void* emscripten_GetProcAddress(const char *x); }
|
||||
int main() {
|
||||
return int(emscripten_GetProcAddress("waka waka"));
|
||||
}
|
||||
''', [static_library_name('libgl-mt')], ['-s', 'USE_PTHREADS=1'])
|
||||
''', [static_library_name('lib%s' % what)], opts)
|
||||
elif what == 'native_optimizer':
|
||||
build(C_BARE, ['optimizer.2.exe'], ['-O2', '-s', 'WASM=0'])
|
||||
elif what == 'compiler_rt_wasm':
|
||||
|
|
|
@ -580,7 +580,7 @@ See the `library_*.js`_ files for other examples.
|
|||
``autoAddDeps(myLibrary, name)`` where myLibrary is the object with
|
||||
all your methods, and ``name`` is the thing they all depend upon.
|
||||
This is useful when all the implemented methods use a JavaScript
|
||||
singleton containing helper methods. See ``library_gl.js`` for
|
||||
singleton containing helper methods. See ``library_webgl.js`` for
|
||||
an example.
|
||||
- If a JavaScript library depends on a compiled C library (like most
|
||||
of *libc*), you must edit `src/deps_info.json`_. Search for
|
||||
|
|
|
@ -2879,7 +2879,9 @@ var LibraryGLEmulation = {
|
|||
#endif
|
||||
}
|
||||
},
|
||||
|
||||
glColor4d: 'glColor4f',
|
||||
|
||||
glColor4ub__deps: ['glColor4f'],
|
||||
glColor4ub: function(r, g, b, a) {
|
||||
_glColor4f((r&255)/255, (g&255)/255, (b&255)/255, (a&255)/255);
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -162,7 +162,7 @@ var LibraryManager = {
|
|||
// Additional JS libraries (in strict mode, link to these explicitly via -lxxx.js)
|
||||
if (!STRICT) {
|
||||
libraries = libraries.concat([
|
||||
'library_gl.js',
|
||||
'library_webgl.js',
|
||||
'library_openal.js',
|
||||
'library_vr.js'
|
||||
]);
|
||||
|
@ -182,6 +182,10 @@ var LibraryManager = {
|
|||
}
|
||||
}
|
||||
|
||||
if (USE_WEBGL2) {
|
||||
libraries.push('library_webgl2.js');
|
||||
}
|
||||
|
||||
if (LEGACY_GL_EMULATION) {
|
||||
libraries.push('library_glemu.js');
|
||||
}
|
||||
|
|
|
@ -486,6 +486,19 @@ extern EMSCRIPTEN_RESULT emscripten_webgl_commit_frame(void);
|
|||
|
||||
extern EM_BOOL emscripten_supports_offscreencanvas(void);
|
||||
|
||||
// Returns function pointers to WebGL 1 functions. Please avoid using this function ever - all WebGL1/GLES2 functions, even those for WebGL1 extensions, are available to user code via static linking. Calling GL functions
|
||||
// via function pointers obtained here is slow, and using this function can greatly increase resulting compiled program size. This functionality is available only for easier program code porting purposes, but be aware
|
||||
// that calling this is causing a noticeable performance and compiled code size hit.
|
||||
extern void *emscripten_webgl1_get_proc_address(const char *name);
|
||||
|
||||
// Returns function pointers to WebGL 2 functions. Please avoid using this function ever - all WebGL2/GLES3 functions, even those for WebGL2 extensions, are available to user code via static linking. Calling GL functions
|
||||
// via function pointers obtained here is slow, and using this function can greatly increase resulting compiled program size. This functionality is available only for easier program code porting purposes, but be aware
|
||||
// that calling this is causing a noticeable performance and compiled code size hit.
|
||||
extern void *emscripten_webgl2_get_proc_address(const char *name);
|
||||
|
||||
// Combines emscripten_webgl1_get_proc_address() and emscripten_webgl2_get_proc_address() to return function pointers to both WebGL1 and WebGL2 functions. Same drawbacks apply.
|
||||
extern void *emscripten_webgl_get_proc_address(const char *name);
|
||||
|
||||
extern EMSCRIPTEN_RESULT emscripten_set_canvas_element_size(const char *target, int width, int height);
|
||||
extern EMSCRIPTEN_RESULT emscripten_get_canvas_element_size(const char *target, int *width, int *height);
|
||||
|
||||
|
|
|
@ -1,36 +1,62 @@
|
|||
-------- t ImageSize
|
||||
-------- t InitWebGLTls
|
||||
-------- C currentActiveWebGLContext
|
||||
-------- C currentThreadOwnsItsWebGLContext
|
||||
-------- T emscripten_GetProcAddress
|
||||
U emscripten_asm_const_int
|
||||
U emscripten_async_queue_on_thread_
|
||||
U emscripten_async_run_in_main_runtime_thread_
|
||||
U emscripten_glActiveTexture
|
||||
U emscripten_glAttachShader
|
||||
U emscripten_glBeginConditionalRender
|
||||
U emscripten_glBeginQuery
|
||||
U emscripten_glBeginQueryEXT
|
||||
U emscripten_glBeginTransformFeedback
|
||||
U emscripten_glBindAttribLocation
|
||||
U emscripten_glBindBuffer
|
||||
U emscripten_glBindBufferBase
|
||||
U emscripten_glBindBufferRange
|
||||
U emscripten_glBindFragDataLocation
|
||||
U emscripten_glBindFramebuffer
|
||||
U emscripten_glBindProgramARB
|
||||
U emscripten_glBindRenderbuffer
|
||||
U emscripten_glBindSampler
|
||||
U emscripten_glBindTexture
|
||||
U emscripten_glBindTransformFeedback
|
||||
U emscripten_glBindVertexArray
|
||||
U emscripten_glBlendColor
|
||||
U emscripten_glBlendEquation
|
||||
U emscripten_glBlendEquationSeparate
|
||||
U emscripten_glBlendFunc
|
||||
U emscripten_glBlendFuncSeparate
|
||||
U emscripten_glBlitFramebuffer
|
||||
U emscripten_glBufferData
|
||||
U emscripten_glBufferSubData
|
||||
U emscripten_glCheckFramebufferStatus
|
||||
U emscripten_glClampColor
|
||||
U emscripten_glClear
|
||||
U emscripten_glClearBufferfi
|
||||
U emscripten_glClearBufferfv
|
||||
U emscripten_glClearBufferiv
|
||||
U emscripten_glClearBufferuiv
|
||||
U emscripten_glClearColor
|
||||
U emscripten_glClearDepth
|
||||
U emscripten_glClearDepthf
|
||||
U emscripten_glClearStencil
|
||||
U emscripten_glClientActiveTexture
|
||||
U emscripten_glClientWaitSync
|
||||
U emscripten_glColorMask
|
||||
U emscripten_glColorMaski
|
||||
U emscripten_glColorPointer
|
||||
U emscripten_glCompileShader
|
||||
U emscripten_glCompressedTexImage2D
|
||||
U emscripten_glCompressedTexImage3D
|
||||
U emscripten_glCompressedTexSubImage2D
|
||||
U emscripten_glCompressedTexSubImage3D
|
||||
U emscripten_glCopyBufferSubData
|
||||
U emscripten_glCopyTexImage2D
|
||||
U emscripten_glCopyTexSubImage2D
|
||||
U emscripten_glCopyTexSubImage3D
|
||||
U emscripten_glCreateProgram
|
||||
U emscripten_glCreateShader
|
||||
U emscripten_glCullFace
|
||||
|
@ -38,9 +64,14 @@
|
|||
U emscripten_glDeleteFramebuffers
|
||||
U emscripten_glDeleteObjectARB
|
||||
U emscripten_glDeleteProgram
|
||||
U emscripten_glDeleteQueries
|
||||
U emscripten_glDeleteQueriesEXT
|
||||
U emscripten_glDeleteRenderbuffers
|
||||
U emscripten_glDeleteSamplers
|
||||
U emscripten_glDeleteShader
|
||||
U emscripten_glDeleteSync
|
||||
U emscripten_glDeleteTextures
|
||||
U emscripten_glDeleteTransformFeedbacks
|
||||
U emscripten_glDeleteVertexArrays
|
||||
U emscripten_glDepthFunc
|
||||
U emscripten_glDepthMask
|
||||
|
@ -49,6 +80,7 @@
|
|||
U emscripten_glDetachShader
|
||||
U emscripten_glDisable
|
||||
U emscripten_glDisableVertexAttribArray
|
||||
U emscripten_glDisablei
|
||||
U emscripten_glDrawArrays
|
||||
U emscripten_glDrawArraysInstanced
|
||||
U emscripten_glDrawBuffers
|
||||
|
@ -58,68 +90,133 @@
|
|||
U emscripten_glEnable
|
||||
U emscripten_glEnableClientState
|
||||
U emscripten_glEnableVertexAttribArray
|
||||
U emscripten_glEnablei
|
||||
U emscripten_glEndConditionalRender
|
||||
U emscripten_glEndQuery
|
||||
U emscripten_glEndQueryEXT
|
||||
U emscripten_glEndTransformFeedback
|
||||
U emscripten_glFenceSync
|
||||
U emscripten_glFinish
|
||||
U emscripten_glFlush
|
||||
U emscripten_glFlushMappedBufferRange
|
||||
U emscripten_glFramebufferRenderbuffer
|
||||
U emscripten_glFramebufferTexture2D
|
||||
U emscripten_glFramebufferTextureLayer
|
||||
U emscripten_glFrontFace
|
||||
U emscripten_glFrustum
|
||||
U emscripten_glGenBuffers
|
||||
U emscripten_glGenFramebuffers
|
||||
U emscripten_glGenQueries
|
||||
U emscripten_glGenQueriesEXT
|
||||
U emscripten_glGenRenderbuffers
|
||||
U emscripten_glGenSamplers
|
||||
U emscripten_glGenTextures
|
||||
U emscripten_glGenTransformFeedbacks
|
||||
U emscripten_glGenVertexArrays
|
||||
U emscripten_glGenerateMipmap
|
||||
U emscripten_glGetActiveAttrib
|
||||
U emscripten_glGetActiveUniform
|
||||
U emscripten_glGetActiveUniformBlockName
|
||||
U emscripten_glGetActiveUniformBlockiv
|
||||
U emscripten_glGetActiveUniformName
|
||||
U emscripten_glGetActiveUniformsiv
|
||||
U emscripten_glGetAttachedShaders
|
||||
U emscripten_glGetAttribLocation
|
||||
U emscripten_glGetBooleani_v
|
||||
U emscripten_glGetBooleanv
|
||||
U emscripten_glGetBufferParameteri64v
|
||||
U emscripten_glGetBufferParameteriv
|
||||
U emscripten_glGetBufferPointerv
|
||||
U emscripten_glGetError
|
||||
U emscripten_glGetFloatv
|
||||
U emscripten_glGetFragDataLocation
|
||||
U emscripten_glGetFramebufferAttachmentParameteriv
|
||||
U emscripten_glGetInfoLogARB
|
||||
U emscripten_glGetInteger64i_v
|
||||
U emscripten_glGetInteger64v
|
||||
U emscripten_glGetIntegeri_v
|
||||
U emscripten_glGetIntegerv
|
||||
U emscripten_glGetInternalformativ
|
||||
U emscripten_glGetObjectParameterivARB
|
||||
U emscripten_glGetPointerv
|
||||
U emscripten_glGetProgramBinary
|
||||
U emscripten_glGetProgramInfoLog
|
||||
U emscripten_glGetProgramiv
|
||||
U emscripten_glGetQueryObjecti64vEXT
|
||||
U emscripten_glGetQueryObjectivEXT
|
||||
U emscripten_glGetQueryObjectui64vEXT
|
||||
U emscripten_glGetQueryObjectuiv
|
||||
U emscripten_glGetQueryObjectuivEXT
|
||||
U emscripten_glGetQueryiv
|
||||
U emscripten_glGetQueryivEXT
|
||||
U emscripten_glGetRenderbufferParameteriv
|
||||
U emscripten_glGetSamplerParameterfv
|
||||
U emscripten_glGetSamplerParameteriv
|
||||
U emscripten_glGetShaderInfoLog
|
||||
U emscripten_glGetShaderPrecisionFormat
|
||||
U emscripten_glGetShaderSource
|
||||
U emscripten_glGetShaderiv
|
||||
U emscripten_glGetString
|
||||
U emscripten_glGetStringi
|
||||
U emscripten_glGetSynciv
|
||||
U emscripten_glGetTexParameterIiv
|
||||
U emscripten_glGetTexParameterIuiv
|
||||
U emscripten_glGetTexParameterfv
|
||||
U emscripten_glGetTexParameteriv
|
||||
U emscripten_glGetTransformFeedbackVarying
|
||||
U emscripten_glGetUniformBlockIndex
|
||||
U emscripten_glGetUniformIndices
|
||||
U emscripten_glGetUniformLocation
|
||||
U emscripten_glGetUniformfv
|
||||
U emscripten_glGetUniformiv
|
||||
U emscripten_glGetUniformuiv
|
||||
U emscripten_glGetVertexAttribIiv
|
||||
U emscripten_glGetVertexAttribIuiv
|
||||
U emscripten_glGetVertexAttribPointerv
|
||||
U emscripten_glGetVertexAttribfv
|
||||
U emscripten_glGetVertexAttribiv
|
||||
U emscripten_glHint
|
||||
U emscripten_glInvalidateFramebuffer
|
||||
U emscripten_glInvalidateSubFramebuffer
|
||||
U emscripten_glIsBuffer
|
||||
U emscripten_glIsEnabled
|
||||
U emscripten_glIsEnabledi
|
||||
U emscripten_glIsFramebuffer
|
||||
U emscripten_glIsProgram
|
||||
U emscripten_glIsQuery
|
||||
U emscripten_glIsQueryEXT
|
||||
U emscripten_glIsRenderbuffer
|
||||
U emscripten_glIsSampler
|
||||
U emscripten_glIsShader
|
||||
U emscripten_glIsSync
|
||||
U emscripten_glIsTexture
|
||||
U emscripten_glIsTransformFeedback
|
||||
U emscripten_glIsVertexArray
|
||||
U emscripten_glLineWidth
|
||||
U emscripten_glLinkProgram
|
||||
U emscripten_glLoadIdentity
|
||||
U emscripten_glLoadMatrixf
|
||||
U emscripten_glMapBufferRange
|
||||
U emscripten_glMatrixMode
|
||||
U emscripten_glNormalPointer
|
||||
U emscripten_glPauseTransformFeedback
|
||||
U emscripten_glPixelStorei
|
||||
U emscripten_glPolygonOffset
|
||||
U emscripten_glProgramBinary
|
||||
U emscripten_glProgramParameteri
|
||||
U emscripten_glQueryCounterEXT
|
||||
U emscripten_glReadBuffer
|
||||
U emscripten_glReadPixels
|
||||
U emscripten_glReleaseShaderCompiler
|
||||
U emscripten_glRenderbufferStorage
|
||||
U emscripten_glRenderbufferStorageMultisample
|
||||
U emscripten_glResumeTransformFeedback
|
||||
U emscripten_glRotatef
|
||||
U emscripten_glSampleCoverage
|
||||
U emscripten_glSamplerParameterf
|
||||
U emscripten_glSamplerParameterfv
|
||||
U emscripten_glSamplerParameteri
|
||||
U emscripten_glSamplerParameteriv
|
||||
U emscripten_glScissor
|
||||
U emscripten_glShaderBinary
|
||||
U emscripten_glShaderSource
|
||||
|
@ -131,30 +228,53 @@
|
|||
U emscripten_glStencilOpSeparate
|
||||
U emscripten_glTexCoordPointer
|
||||
U emscripten_glTexImage2D
|
||||
U emscripten_glTexImage3D
|
||||
U emscripten_glTexParameterIiv
|
||||
U emscripten_glTexParameterIuiv
|
||||
U emscripten_glTexParameterf
|
||||
U emscripten_glTexParameterfv
|
||||
U emscripten_glTexParameteri
|
||||
U emscripten_glTexParameteriv
|
||||
U emscripten_glTexStorage2D
|
||||
U emscripten_glTexStorage3D
|
||||
U emscripten_glTexSubImage2D
|
||||
U emscripten_glTexSubImage3D
|
||||
U emscripten_glTransformFeedbackVaryings
|
||||
U emscripten_glUniform1f
|
||||
U emscripten_glUniform1fv
|
||||
U emscripten_glUniform1i
|
||||
U emscripten_glUniform1iv
|
||||
U emscripten_glUniform1ui
|
||||
U emscripten_glUniform1uiv
|
||||
U emscripten_glUniform2f
|
||||
U emscripten_glUniform2fv
|
||||
U emscripten_glUniform2i
|
||||
U emscripten_glUniform2iv
|
||||
U emscripten_glUniform2ui
|
||||
U emscripten_glUniform2uiv
|
||||
U emscripten_glUniform3f
|
||||
U emscripten_glUniform3fv
|
||||
U emscripten_glUniform3i
|
||||
U emscripten_glUniform3iv
|
||||
U emscripten_glUniform3ui
|
||||
U emscripten_glUniform3uiv
|
||||
U emscripten_glUniform4f
|
||||
U emscripten_glUniform4fv
|
||||
U emscripten_glUniform4i
|
||||
U emscripten_glUniform4iv
|
||||
U emscripten_glUniform4ui
|
||||
U emscripten_glUniform4uiv
|
||||
U emscripten_glUniformBlockBinding
|
||||
U emscripten_glUniformMatrix2fv
|
||||
U emscripten_glUniformMatrix2x3fv
|
||||
U emscripten_glUniformMatrix2x4fv
|
||||
U emscripten_glUniformMatrix3fv
|
||||
U emscripten_glUniformMatrix3x2fv
|
||||
U emscripten_glUniformMatrix3x4fv
|
||||
U emscripten_glUniformMatrix4fv
|
||||
U emscripten_glUniformMatrix4x2fv
|
||||
U emscripten_glUniformMatrix4x3fv
|
||||
U emscripten_glUnmapBuffer
|
||||
U emscripten_glUseProgram
|
||||
U emscripten_glValidateProgram
|
||||
U emscripten_glVertexAttrib1f
|
||||
|
@ -166,52 +286,100 @@
|
|||
U emscripten_glVertexAttrib4f
|
||||
U emscripten_glVertexAttrib4fv
|
||||
U emscripten_glVertexAttribDivisor
|
||||
U emscripten_glVertexAttribI1i
|
||||
U emscripten_glVertexAttribI1iv
|
||||
U emscripten_glVertexAttribI1ui
|
||||
U emscripten_glVertexAttribI1uiv
|
||||
U emscripten_glVertexAttribI2i
|
||||
U emscripten_glVertexAttribI2iv
|
||||
U emscripten_glVertexAttribI2ui
|
||||
U emscripten_glVertexAttribI2uiv
|
||||
U emscripten_glVertexAttribI3i
|
||||
U emscripten_glVertexAttribI3iv
|
||||
U emscripten_glVertexAttribI3ui
|
||||
U emscripten_glVertexAttribI3uiv
|
||||
U emscripten_glVertexAttribI4bv
|
||||
U emscripten_glVertexAttribI4i
|
||||
U emscripten_glVertexAttribI4iv
|
||||
U emscripten_glVertexAttribI4sv
|
||||
U emscripten_glVertexAttribI4ubv
|
||||
U emscripten_glVertexAttribI4ui
|
||||
U emscripten_glVertexAttribI4uiv
|
||||
U emscripten_glVertexAttribI4usv
|
||||
U emscripten_glVertexAttribIPointer
|
||||
U emscripten_glVertexAttribPointer
|
||||
U emscripten_glVertexPointer
|
||||
U emscripten_glViewport
|
||||
U emscripten_glWaitSync
|
||||
U emscripten_supports_offscreencanvas
|
||||
U emscripten_sync_run_in_main_runtime_thread_
|
||||
-------- T emscripten_webgl_commit_frame
|
||||
-------- T emscripten_webgl_create_context
|
||||
U emscripten_webgl_do_commit_frame
|
||||
U emscripten_webgl_do_create_context
|
||||
U emscripten_webgl_do_get_current_context
|
||||
U emscripten_webgl_make_context_current_calling_thread
|
||||
-------- T emscripten_webgl_get_current_context
|
||||
-------- T emscripten_webgl_make_context_current
|
||||
-------- T glActiveTexture
|
||||
-------- T glAttachShader
|
||||
-------- T glBeginQuery
|
||||
-------- T glBeginQueryEXT
|
||||
-------- T glBeginTransformFeedback
|
||||
-------- T glBindAttribLocation
|
||||
-------- T glBindBuffer
|
||||
-------- T glBindBufferBase
|
||||
-------- T glBindBufferRange
|
||||
-------- T glBindFramebuffer
|
||||
-------- T glBindRenderbuffer
|
||||
-------- T glBindSampler
|
||||
-------- T glBindTexture
|
||||
-------- T glBindTransformFeedback
|
||||
-------- T glBindVertexArray
|
||||
-------- T glBindVertexArrayOES
|
||||
-------- T glBlendColor
|
||||
-------- T glBlendEquation
|
||||
-------- T glBlendEquationSeparate
|
||||
-------- T glBlendFunc
|
||||
-------- T glBlendFuncSeparate
|
||||
-------- T glBlitFramebuffer
|
||||
-------- T glBufferData
|
||||
-------- T glBufferSubData
|
||||
-------- T glCheckFramebufferStatus
|
||||
-------- T glClear
|
||||
-------- T glClearBufferfi
|
||||
-------- T glClearBufferfv
|
||||
-------- T glClearBufferiv
|
||||
-------- T glClearBufferuiv
|
||||
-------- T glClearColor
|
||||
-------- T glClearDepthf
|
||||
-------- T glClearStencil
|
||||
-------- T glClientWaitSync
|
||||
-------- T glColorMask
|
||||
-------- T glCompileShader
|
||||
-------- T glCompressedTexImage2D
|
||||
-------- T glCompressedTexImage3D
|
||||
-------- T glCompressedTexSubImage2D
|
||||
-------- T glCompressedTexSubImage3D
|
||||
-------- T glCopyBufferSubData
|
||||
-------- T glCopyTexImage2D
|
||||
-------- T glCopyTexSubImage2D
|
||||
-------- T glCopyTexSubImage3D
|
||||
-------- T glCreateProgram
|
||||
-------- T glCreateShader
|
||||
-------- T glCullFace
|
||||
-------- T glDeleteBuffers
|
||||
-------- T glDeleteFramebuffers
|
||||
-------- T glDeleteProgram
|
||||
-------- T glDeleteQueries
|
||||
-------- T glDeleteQueriesEXT
|
||||
-------- T glDeleteRenderbuffers
|
||||
-------- T glDeleteSamplers
|
||||
-------- T glDeleteShader
|
||||
-------- T glDeleteSync
|
||||
-------- T glDeleteTextures
|
||||
-------- T glDeleteTransformFeedbacks
|
||||
-------- T glDeleteVertexArrays
|
||||
-------- T glDeleteVertexArraysOES
|
||||
-------- T glDepthFunc
|
||||
-------- T glDepthMask
|
||||
-------- T glDepthRangef
|
||||
|
@ -219,61 +387,136 @@
|
|||
-------- T glDisable
|
||||
-------- T glDisableVertexAttribArray
|
||||
-------- T glDrawArrays
|
||||
-------- T glDrawArraysInstanced
|
||||
-------- T glDrawArraysInstancedANGLE
|
||||
-------- T glDrawArraysInstancedARB
|
||||
-------- T glDrawArraysInstancedEXT
|
||||
-------- T glDrawArraysInstancedNV
|
||||
-------- T glDrawBuffers
|
||||
-------- T glDrawBuffersEXT
|
||||
-------- T glDrawBuffersWEBGL
|
||||
-------- T glDrawElements
|
||||
-------- T glDrawElementsInstanced
|
||||
-------- T glDrawElementsInstancedANGLE
|
||||
-------- T glDrawElementsInstancedARB
|
||||
-------- T glDrawElementsInstancedEXT
|
||||
-------- T glDrawElementsInstancedNV
|
||||
-------- T glDrawRangeElements
|
||||
-------- T glEnable
|
||||
-------- T glEnableVertexAttribArray
|
||||
-------- T glEndQuery
|
||||
-------- T glEndQueryEXT
|
||||
-------- T glEndTransformFeedback
|
||||
-------- T glFenceSync
|
||||
-------- T glFinish
|
||||
-------- T glFlush
|
||||
-------- T glFlushMappedBufferRange
|
||||
-------- T glFramebufferRenderbuffer
|
||||
-------- T glFramebufferTexture2D
|
||||
-------- T glFramebufferTextureLayer
|
||||
-------- T glFrontFace
|
||||
-------- T glGenBuffers
|
||||
-------- T glGenFramebuffers
|
||||
-------- T glGenQueries
|
||||
-------- T glGenQueriesEXT
|
||||
-------- T glGenRenderbuffers
|
||||
-------- T glGenSamplers
|
||||
-------- T glGenTextures
|
||||
-------- T glGenTransformFeedbacks
|
||||
-------- T glGenVertexArrays
|
||||
-------- T glGenVertexArraysOES
|
||||
-------- T glGenerateMipmap
|
||||
-------- T glGetActiveAttrib
|
||||
-------- T glGetActiveUniform
|
||||
-------- T glGetActiveUniformBlockName
|
||||
-------- T glGetActiveUniformBlockiv
|
||||
-------- T glGetActiveUniformsiv
|
||||
-------- T glGetAttachedShaders
|
||||
-------- T glGetAttribLocation
|
||||
-------- T glGetBooleanv
|
||||
-------- T glGetBufferParameteri64v
|
||||
-------- T glGetBufferParameteriv
|
||||
-------- T glGetBufferPointerv
|
||||
-------- T glGetError
|
||||
-------- T glGetFloatv
|
||||
-------- T glGetFragDataLocation
|
||||
-------- T glGetFramebufferAttachmentParameteriv
|
||||
-------- T glGetInteger64i_v
|
||||
-------- T glGetInteger64v
|
||||
-------- T glGetIntegeri_v
|
||||
-------- T glGetIntegerv
|
||||
-------- T glGetInternalformativ
|
||||
-------- T glGetProgramBinary
|
||||
-------- T glGetProgramInfoLog
|
||||
-------- T glGetProgramiv
|
||||
-------- T glGetQueryObjecti64vEXT
|
||||
-------- T glGetQueryObjectivEXT
|
||||
-------- T glGetQueryObjectui64vEXT
|
||||
-------- T glGetQueryObjectuiv
|
||||
-------- T glGetQueryObjectuivEXT
|
||||
-------- T glGetQueryiv
|
||||
-------- T glGetQueryivEXT
|
||||
-------- T glGetRenderbufferParameteriv
|
||||
-------- T glGetSamplerParameterfv
|
||||
-------- T glGetSamplerParameteriv
|
||||
-------- T glGetShaderInfoLog
|
||||
-------- T glGetShaderPrecisionFormat
|
||||
-------- T glGetShaderSource
|
||||
-------- T glGetShaderiv
|
||||
-------- T glGetString
|
||||
-------- T glGetStringi
|
||||
-------- T glGetSynciv
|
||||
-------- T glGetTexParameterfv
|
||||
-------- T glGetTexParameteriv
|
||||
-------- T glGetTransformFeedbackVarying
|
||||
-------- T glGetUniformBlockIndex
|
||||
-------- T glGetUniformIndices
|
||||
-------- T glGetUniformLocation
|
||||
-------- T glGetUniformfv
|
||||
-------- T glGetUniformiv
|
||||
-------- T glGetUniformuiv
|
||||
-------- T glGetVertexAttribIiv
|
||||
-------- T glGetVertexAttribIuiv
|
||||
-------- T glGetVertexAttribPointerv
|
||||
-------- T glGetVertexAttribfv
|
||||
-------- T glGetVertexAttribiv
|
||||
-------- T glHint
|
||||
-------- T glInvalidateFramebuffer
|
||||
-------- T glInvalidateSubFramebuffer
|
||||
-------- T glIsBuffer
|
||||
-------- T glIsEnabled
|
||||
-------- T glIsFramebuffer
|
||||
-------- T glIsProgram
|
||||
-------- T glIsQuery
|
||||
-------- T glIsQueryEXT
|
||||
-------- T glIsRenderbuffer
|
||||
-------- T glIsSampler
|
||||
-------- T glIsShader
|
||||
-------- T glIsSync
|
||||
-------- T glIsTexture
|
||||
-------- T glIsTransformFeedback
|
||||
-------- T glIsVertexArray
|
||||
-------- T glIsVertexArrayOES
|
||||
-------- T glLineWidth
|
||||
-------- T glLinkProgram
|
||||
-------- T glMapBufferRange
|
||||
-------- T glPauseTransformFeedback
|
||||
-------- T glPixelStorei
|
||||
-------- T glPolygonOffset
|
||||
-------- T glProgramBinary
|
||||
-------- T glProgramParameteri
|
||||
-------- T glQueryCounterEXT
|
||||
-------- T glReadBuffer
|
||||
-------- T glReadPixels
|
||||
-------- T glReleaseShaderCompiler
|
||||
-------- T glRenderbufferStorage
|
||||
-------- T glRenderbufferStorageMultisample
|
||||
-------- T glResumeTransformFeedback
|
||||
-------- T glSampleCoverage
|
||||
-------- T glSamplerParameterf
|
||||
-------- T glSamplerParameterfv
|
||||
-------- T glSamplerParameteri
|
||||
-------- T glSamplerParameteriv
|
||||
-------- T glScissor
|
||||
-------- T glShaderBinary
|
||||
-------- T glShaderSource
|
||||
|
@ -284,30 +527,51 @@
|
|||
-------- T glStencilOp
|
||||
-------- T glStencilOpSeparate
|
||||
-------- T glTexImage2D
|
||||
-------- T glTexImage3D
|
||||
-------- T glTexParameterf
|
||||
-------- T glTexParameterfv
|
||||
-------- T glTexParameteri
|
||||
-------- T glTexParameteriv
|
||||
-------- T glTexStorage2D
|
||||
-------- T glTexStorage3D
|
||||
-------- T glTexSubImage2D
|
||||
-------- T glTexSubImage3D
|
||||
-------- T glTransformFeedbackVaryings
|
||||
-------- T glUniform1f
|
||||
-------- T glUniform1fv
|
||||
-------- T glUniform1i
|
||||
-------- T glUniform1iv
|
||||
-------- T glUniform1ui
|
||||
-------- T glUniform1uiv
|
||||
-------- T glUniform2f
|
||||
-------- T glUniform2fv
|
||||
-------- T glUniform2i
|
||||
-------- T glUniform2iv
|
||||
-------- T glUniform2ui
|
||||
-------- T glUniform2uiv
|
||||
-------- T glUniform3f
|
||||
-------- T glUniform3fv
|
||||
-------- T glUniform3i
|
||||
-------- T glUniform3iv
|
||||
-------- T glUniform3ui
|
||||
-------- T glUniform3uiv
|
||||
-------- T glUniform4f
|
||||
-------- T glUniform4fv
|
||||
-------- T glUniform4i
|
||||
-------- T glUniform4iv
|
||||
-------- T glUniform4ui
|
||||
-------- T glUniform4uiv
|
||||
-------- T glUniformBlockBinding
|
||||
-------- T glUniformMatrix2fv
|
||||
-------- T glUniformMatrix2x3fv
|
||||
-------- T glUniformMatrix2x4fv
|
||||
-------- T glUniformMatrix3fv
|
||||
-------- T glUniformMatrix3x2fv
|
||||
-------- T glUniformMatrix3x4fv
|
||||
-------- T glUniformMatrix4fv
|
||||
-------- T glUniformMatrix4x2fv
|
||||
-------- T glUniformMatrix4x3fv
|
||||
-------- T glUnmapBuffer
|
||||
-------- T glUseProgram
|
||||
-------- T glValidateProgram
|
||||
-------- T glVertexAttrib1f
|
||||
|
@ -318,10 +582,28 @@
|
|||
-------- T glVertexAttrib3fv
|
||||
-------- T glVertexAttrib4f
|
||||
-------- T glVertexAttrib4fv
|
||||
-------- T glVertexAttribDivisor
|
||||
-------- T glVertexAttribDivisorANGLE
|
||||
-------- T glVertexAttribDivisorARB
|
||||
-------- T glVertexAttribDivisorEXT
|
||||
-------- T glVertexAttribDivisorNV
|
||||
-------- T glVertexAttribI4i
|
||||
-------- T glVertexAttribI4iv
|
||||
-------- T glVertexAttribI4ui
|
||||
-------- T glVertexAttribI4uiv
|
||||
-------- T glVertexAttribIPointer
|
||||
-------- T glVertexAttribPointer
|
||||
-------- T glViewport
|
||||
-------- T glWaitSync
|
||||
U malloc
|
||||
-------- t memdup
|
||||
U pthread_getspecific
|
||||
U pthread_key_create
|
||||
U pthread_once
|
||||
U pthread_self
|
||||
U pthread_setspecific
|
||||
U strcmp
|
||||
U strcpy
|
||||
U strlen
|
||||
U strstr
|
||||
-------- d tlsInit
|
||||
|
|
1247
system/lib/gl/gl.c
1247
system/lib/gl/gl.c
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1,5 +1,3 @@
|
|||
#ifdef __EMSCRIPTEN_PTHREADS__
|
||||
|
||||
#include <emscripten/threading.h>
|
||||
#include <emscripten.h>
|
||||
#include <string.h>
|
||||
|
@ -9,6 +7,8 @@
|
|||
#include "webgl1_ext.h"
|
||||
#include "webgl2.h"
|
||||
|
||||
#ifdef __EMSCRIPTEN_PTHREADS__
|
||||
|
||||
extern EMSCRIPTEN_WEBGL_CONTEXT_HANDLE emscripten_webgl_do_create_context(const char *target, const EmscriptenWebGLContextAttributes *attributes);
|
||||
extern EMSCRIPTEN_RESULT emscripten_webgl_make_context_current_calling_thread(EMSCRIPTEN_WEBGL_CONTEXT_HANDLE context);
|
||||
extern EMSCRIPTEN_RESULT emscripten_webgl_do_commit_frame(void);
|
||||
|
@ -625,3 +625,183 @@ RET_SYNC_GL_FUNCTION_3(EM_FUNC_SIG_VIII, void, glGetQueryObjecti64vEXT, GLenum,
|
|||
RET_SYNC_GL_FUNCTION_3(EM_FUNC_SIG_VIII, void, glGetQueryObjectui64vEXT, GLenum, GLenum, GLuint64 *);
|
||||
|
||||
#endif // ~__EMSCRIPTEN_PTHREADS__
|
||||
|
||||
void *emscripten_webgl1_get_proc_address(const char *name)
|
||||
{
|
||||
RETURN_FN(glActiveTexture);
|
||||
RETURN_FN(glAttachShader);
|
||||
RETURN_FN(glBindAttribLocation);
|
||||
RETURN_FN(glBindBuffer);
|
||||
RETURN_FN(glBindFramebuffer);
|
||||
RETURN_FN(glBindRenderbuffer);
|
||||
RETURN_FN(glBindTexture);
|
||||
RETURN_FN(glBlendColor);
|
||||
RETURN_FN(glBlendEquation);
|
||||
RETURN_FN(glBlendEquationSeparate);
|
||||
RETURN_FN(glBlendFunc);
|
||||
RETURN_FN(glBlendFuncSeparate);
|
||||
RETURN_FN(glBufferData);
|
||||
RETURN_FN(glBufferSubData);
|
||||
RETURN_FN(glCheckFramebufferStatus);
|
||||
RETURN_FN(glClear);
|
||||
RETURN_FN(glClearColor);
|
||||
RETURN_FN(glClearDepthf);
|
||||
RETURN_FN(glClearStencil);
|
||||
RETURN_FN(glColorMask);
|
||||
RETURN_FN(glCompileShader);
|
||||
RETURN_FN(glCompressedTexImage2D);
|
||||
RETURN_FN(glCompressedTexSubImage2D);
|
||||
RETURN_FN(glCopyTexImage2D);
|
||||
RETURN_FN(glCopyTexSubImage2D);
|
||||
RETURN_FN(glCreateProgram);
|
||||
RETURN_FN(glCreateShader);
|
||||
RETURN_FN(glCullFace);
|
||||
RETURN_FN(glDeleteBuffers);
|
||||
RETURN_FN(glDeleteFramebuffers);
|
||||
RETURN_FN(glDeleteProgram);
|
||||
RETURN_FN(glDeleteRenderbuffers);
|
||||
RETURN_FN(glDeleteShader);
|
||||
RETURN_FN(glDeleteTextures);
|
||||
RETURN_FN(glDepthFunc);
|
||||
RETURN_FN(glDepthMask);
|
||||
RETURN_FN(glDepthRangef);
|
||||
RETURN_FN(glDetachShader);
|
||||
RETURN_FN(glDisable);
|
||||
RETURN_FN(glDisableVertexAttribArray);
|
||||
RETURN_FN(glDrawArrays);
|
||||
RETURN_FN(glDrawElements);
|
||||
RETURN_FN(glEnable);
|
||||
RETURN_FN(glEnableVertexAttribArray);
|
||||
RETURN_FN(glFinish);
|
||||
RETURN_FN(glFlush);
|
||||
RETURN_FN(glFramebufferRenderbuffer);
|
||||
RETURN_FN(glFramebufferTexture2D);
|
||||
RETURN_FN(glFrontFace);
|
||||
RETURN_FN(glGenBuffers);
|
||||
RETURN_FN(glGenerateMipmap);
|
||||
RETURN_FN(glGenFramebuffers);
|
||||
RETURN_FN(glGenRenderbuffers);
|
||||
RETURN_FN(glGenTextures);
|
||||
RETURN_FN(glGetActiveAttrib);
|
||||
RETURN_FN(glGetActiveUniform);
|
||||
RETURN_FN(glGetAttachedShaders);
|
||||
RETURN_FN(glGetAttribLocation);
|
||||
RETURN_FN(glGetBooleanv);
|
||||
RETURN_FN(glGetBufferParameteriv);
|
||||
RETURN_FN(glGetError);
|
||||
RETURN_FN(glGetFloatv);
|
||||
RETURN_FN(glGetFramebufferAttachmentParameteriv);
|
||||
RETURN_FN(glGetIntegerv);
|
||||
RETURN_FN(glGetProgramiv);
|
||||
RETURN_FN(glGetProgramInfoLog);
|
||||
RETURN_FN(glGetRenderbufferParameteriv);
|
||||
RETURN_FN(glGetShaderiv);
|
||||
RETURN_FN(glGetShaderInfoLog);
|
||||
RETURN_FN(glGetShaderPrecisionFormat);
|
||||
RETURN_FN(glGetShaderSource);
|
||||
RETURN_FN(glGetString);
|
||||
RETURN_FN(glGetTexParameterfv);
|
||||
RETURN_FN(glGetTexParameteriv);
|
||||
RETURN_FN(glGetUniformfv);
|
||||
RETURN_FN(glGetUniformiv);
|
||||
RETURN_FN(glGetUniformLocation);
|
||||
RETURN_FN(glGetVertexAttribfv);
|
||||
RETURN_FN(glGetVertexAttribiv);
|
||||
RETURN_FN(glGetVertexAttribPointerv);
|
||||
RETURN_FN(glHint);
|
||||
RETURN_FN(glIsBuffer);
|
||||
RETURN_FN(glIsEnabled);
|
||||
RETURN_FN(glIsFramebuffer);
|
||||
RETURN_FN(glIsProgram);
|
||||
RETURN_FN(glIsRenderbuffer);
|
||||
RETURN_FN(glIsShader);
|
||||
RETURN_FN(glIsTexture);
|
||||
RETURN_FN(glLineWidth);
|
||||
RETURN_FN(glLinkProgram);
|
||||
RETURN_FN(glPixelStorei);
|
||||
RETURN_FN(glPolygonOffset);
|
||||
RETURN_FN(glReadPixels);
|
||||
RETURN_FN(glReleaseShaderCompiler);
|
||||
RETURN_FN(glRenderbufferStorage);
|
||||
RETURN_FN(glSampleCoverage);
|
||||
RETURN_FN(glScissor);
|
||||
RETURN_FN(glShaderBinary);
|
||||
RETURN_FN(glShaderSource);
|
||||
RETURN_FN(glStencilFunc);
|
||||
RETURN_FN(glStencilFuncSeparate);
|
||||
RETURN_FN(glStencilMask);
|
||||
RETURN_FN(glStencilMaskSeparate);
|
||||
RETURN_FN(glStencilOp);
|
||||
RETURN_FN(glStencilOpSeparate);
|
||||
RETURN_FN(glTexImage2D);
|
||||
RETURN_FN(glTexParameterf);
|
||||
RETURN_FN(glTexParameterfv);
|
||||
RETURN_FN(glTexParameteri);
|
||||
RETURN_FN(glTexParameteriv);
|
||||
RETURN_FN(glTexSubImage2D);
|
||||
RETURN_FN(glUniform1f);
|
||||
RETURN_FN(glUniform1fv);
|
||||
RETURN_FN(glUniform1i);
|
||||
RETURN_FN(glUniform1iv);
|
||||
RETURN_FN(glUniform2f);
|
||||
RETURN_FN(glUniform2fv);
|
||||
RETURN_FN(glUniform2i);
|
||||
RETURN_FN(glUniform2iv);
|
||||
RETURN_FN(glUniform3f);
|
||||
RETURN_FN(glUniform3fv);
|
||||
RETURN_FN(glUniform3i);
|
||||
RETURN_FN(glUniform3iv);
|
||||
RETURN_FN(glUniform4f);
|
||||
RETURN_FN(glUniform4fv);
|
||||
RETURN_FN(glUniform4i);
|
||||
RETURN_FN(glUniform4iv);
|
||||
RETURN_FN(glUniformMatrix2fv);
|
||||
RETURN_FN(glUniformMatrix3fv);
|
||||
RETURN_FN(glUniformMatrix4fv);
|
||||
RETURN_FN(glUseProgram);
|
||||
RETURN_FN(glValidateProgram);
|
||||
RETURN_FN(glVertexAttrib1f);
|
||||
RETURN_FN(glVertexAttrib1fv);
|
||||
RETURN_FN(glVertexAttrib2f);
|
||||
RETURN_FN(glVertexAttrib2fv);
|
||||
RETURN_FN(glVertexAttrib3f);
|
||||
RETURN_FN(glVertexAttrib3fv);
|
||||
RETURN_FN(glVertexAttrib4f);
|
||||
RETURN_FN(glVertexAttrib4fv);
|
||||
RETURN_FN(glVertexAttribPointer);
|
||||
RETURN_FN(glViewport);
|
||||
RETURN_FN(glGenQueriesEXT);
|
||||
RETURN_FN(glDeleteQueriesEXT);
|
||||
RETURN_FN(glIsQueryEXT);
|
||||
RETURN_FN(glBeginQueryEXT);
|
||||
RETURN_FN(glEndQueryEXT);
|
||||
RETURN_FN(glQueryCounterEXT);
|
||||
RETURN_FN(glGetQueryivEXT);
|
||||
RETURN_FN(glGetQueryObjectivEXT);
|
||||
RETURN_FN(glGetQueryObjectuivEXT);
|
||||
RETURN_FN(glGetQueryObjecti64vEXT);
|
||||
RETURN_FN(glGetQueryObjectui64vEXT);
|
||||
|
||||
// WebGL 1 Extensions
|
||||
RETURN_FN(glBindVertexArrayOES);
|
||||
RETURN_FN(glDeleteVertexArraysOES);
|
||||
RETURN_FN(glGenVertexArraysOES);
|
||||
RETURN_FN(glIsVertexArrayOES);
|
||||
RETURN_FN(glDrawBuffersWEBGL);
|
||||
RETURN_FN(glDrawArraysInstancedANGLE);
|
||||
RETURN_FN(glDrawElementsInstancedANGLE);
|
||||
RETURN_FN(glVertexAttribDivisorANGLE);
|
||||
RETURN_FN(glGenQueriesEXT);
|
||||
RETURN_FN(glDeleteQueriesEXT);
|
||||
RETURN_FN(glIsQueryEXT);
|
||||
RETURN_FN(glBeginQueryEXT);
|
||||
RETURN_FN(glEndQueryEXT);
|
||||
RETURN_FN(glQueryCounterEXT);
|
||||
RETURN_FN(glGetQueryivEXT);
|
||||
RETURN_FN(glGetQueryObjectivEXT);
|
||||
RETURN_FN(glGetQueryObjectuivEXT);
|
||||
RETURN_FN(glGetQueryObjecti64vEXT);
|
||||
RETURN_FN(glGetQueryObjectui64vEXT);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -190,5 +190,20 @@ GL_APICALL void GL_APIENTRY emscripten_glViewport (GLint x, GLint y, GLsizei wid
|
|||
#define VOID_SYNC_GL_FUNCTION_10(sig, ret, functionName, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9) ret functionName(t0 p0, t1 p1, t2 p2, t3 p3, t4 p4, t5 p5, t6 p6, t7 p7, t8 p8, t9 p9) { GL_FUNCTION_TRACE(functionName); if (pthread_getspecific(currentThreadOwnsItsWebGLContext)) emscripten_##functionName(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); else emscripten_sync_run_in_main_runtime_thread(sig, &emscripten_##functionName, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9); }
|
||||
#define VOID_SYNC_GL_FUNCTION_11(sig, ret, functionName, t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10) ret functionName(t0 p0, t1 p1, t2 p2, t3 p3, t4 p4, t5 p5, t6 p6, t7 p7, t8 p8, t9 p9, t10 p10) { GL_FUNCTION_TRACE(functionName); if (pthread_getspecific(currentThreadOwnsItsWebGLContext)) emscripten_##functionName(p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); else emscripten_sync_run_in_main_runtime_thread(sig, &emscripten_##functionName, p0, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10); }
|
||||
|
||||
#ifdef __EMSCRIPTEN_PTHREADS__
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
extern pthread_key_t currentActiveWebGLContext;
|
||||
extern pthread_key_t currentThreadOwnsItsWebGLContext;
|
||||
|
||||
// When building with multithreading, return pointers to C functions that can perform proxying.
|
||||
#define RETURN_FN(functionName) if (!strcmp(name, #functionName)) return functionName;
|
||||
|
||||
#else
|
||||
|
||||
// When building with singlethreading, return pointers to JS library layer so that C code (Regal library)
|
||||
// can override them.
|
||||
#define RETURN_FN(functionName) if (!strcmp(name, #functionName)) return emscripten_##functionName;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "webgl2.h"
|
||||
#include "webgl1.h"
|
||||
#include <emscripten/html5.h>
|
||||
|
||||
// 1. https://www.khronos.org/registry/webgl/extensions/OES_texture_float/
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#ifdef __EMSCRIPTEN_PTHREADS__
|
||||
|
||||
#include <emscripten/threading.h>
|
||||
#include <emscripten.h>
|
||||
#include <string.h>
|
||||
|
@ -8,6 +6,8 @@
|
|||
#include "webgl1.h"
|
||||
#include "webgl2.h"
|
||||
|
||||
#ifdef __EMSCRIPTEN_PTHREADS__
|
||||
|
||||
ASYNC_GL_FUNCTION_1(EM_FUNC_SIG_VI, void, glReadBuffer, GLenum);
|
||||
ASYNC_GL_FUNCTION_6(EM_FUNC_SIG_VIIIIII, void, glDrawRangeElements, GLenum, GLuint, GLuint, GLsizei, GLenum, const void *); // TODO: Not async if rendering from client side memory
|
||||
VOID_SYNC_GL_FUNCTION_10(EM_FUNC_SIG_VIIIIIIIIII, void, glTexImage3D, GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const void *);
|
||||
|
@ -113,6 +113,8 @@ ASYNC_GL_FUNCTION_5(EM_FUNC_SIG_VIIIII, void, glTexStorage2D, GLenum, GLsizei, G
|
|||
ASYNC_GL_FUNCTION_6(EM_FUNC_SIG_VIIIIII, void, glTexStorage3D, GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei);
|
||||
VOID_SYNC_GL_FUNCTION_5(EM_FUNC_SIG_VIIIII, void, glGetInternalformativ, GLenum, GLenum, GLenum, GLsizei, GLint *);
|
||||
|
||||
#endif // ~__EMSCRIPTEN_PTHREADS__
|
||||
|
||||
// Extensions:
|
||||
GL_APICALL void GL_APIENTRY glVertexAttribDivisorNV(GLuint index, GLuint divisor) { glVertexAttribDivisor(index, divisor); }
|
||||
GL_APICALL void GL_APIENTRY glVertexAttribDivisorEXT(GLuint index, GLuint divisor) { glVertexAttribDivisor(index, divisor); }
|
||||
|
@ -133,4 +135,133 @@ GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES(GLuint array) { return glIsV
|
|||
GL_APICALL void GL_APIENTRY glDrawBuffersEXT(GLsizei n, const GLenum *bufs) { glDrawBuffers(n, bufs); }
|
||||
GL_APICALL void GL_APIENTRY glDrawBuffersWEBGL(GLsizei n, const GLenum *bufs) { glDrawBuffers(n, bufs); }
|
||||
|
||||
#endif // ~__EMSCRIPTEN_PTHREADS__
|
||||
void *emscripten_webgl2_get_proc_address(const char *name)
|
||||
{
|
||||
RETURN_FN(glReadBuffer);
|
||||
RETURN_FN(glDrawRangeElements);
|
||||
RETURN_FN(glTexImage3D);
|
||||
RETURN_FN(glTexSubImage3D);
|
||||
RETURN_FN(glCopyTexSubImage3D);
|
||||
RETURN_FN(glCompressedTexImage3D);
|
||||
RETURN_FN(glCompressedTexSubImage3D);
|
||||
RETURN_FN(glGenQueries);
|
||||
RETURN_FN(glDeleteQueries);
|
||||
RETURN_FN(glIsQuery);
|
||||
RETURN_FN(glBeginQuery);
|
||||
RETURN_FN(glEndQuery);
|
||||
RETURN_FN(glGetQueryiv);
|
||||
RETURN_FN(glGetQueryObjectuiv);
|
||||
RETURN_FN(glUnmapBuffer);
|
||||
RETURN_FN(glGetBufferPointerv);
|
||||
RETURN_FN(glDrawBuffers);
|
||||
RETURN_FN(glUniformMatrix2x3fv);
|
||||
RETURN_FN(glUniformMatrix3x2fv);
|
||||
RETURN_FN(glUniformMatrix2x4fv);
|
||||
RETURN_FN(glUniformMatrix4x2fv);
|
||||
RETURN_FN(glUniformMatrix3x4fv);
|
||||
RETURN_FN(glUniformMatrix4x3fv);
|
||||
RETURN_FN(glBlitFramebuffer);
|
||||
RETURN_FN(glRenderbufferStorageMultisample);
|
||||
RETURN_FN(glFramebufferTextureLayer);
|
||||
RETURN_FN(glMapBufferRange);
|
||||
RETURN_FN(glFlushMappedBufferRange);
|
||||
RETURN_FN(glBindVertexArray);
|
||||
RETURN_FN(glDeleteVertexArrays);
|
||||
RETURN_FN(glGenVertexArrays);
|
||||
RETURN_FN(glIsVertexArray);
|
||||
RETURN_FN(glGetIntegeri_v);
|
||||
RETURN_FN(glBeginTransformFeedback);
|
||||
RETURN_FN(glEndTransformFeedback);
|
||||
RETURN_FN(glBindBufferRange);
|
||||
RETURN_FN(glBindBufferBase);
|
||||
RETURN_FN(glTransformFeedbackVaryings);
|
||||
RETURN_FN(glGetTransformFeedbackVarying);
|
||||
RETURN_FN(glVertexAttribIPointer);
|
||||
RETURN_FN(glGetVertexAttribIiv);
|
||||
RETURN_FN(glGetVertexAttribIuiv);
|
||||
RETURN_FN(glVertexAttribI4i);
|
||||
RETURN_FN(glVertexAttribI4ui);
|
||||
RETURN_FN(glVertexAttribI4iv);
|
||||
RETURN_FN(glVertexAttribI4uiv);
|
||||
RETURN_FN(glGetUniformuiv);
|
||||
RETURN_FN(glGetFragDataLocation);
|
||||
RETURN_FN(glUniform1ui);
|
||||
RETURN_FN(glUniform2ui);
|
||||
RETURN_FN(glUniform3ui);
|
||||
RETURN_FN(glUniform4ui);
|
||||
RETURN_FN(glUniform1uiv);
|
||||
RETURN_FN(glUniform2uiv);
|
||||
RETURN_FN(glUniform3uiv);
|
||||
RETURN_FN(glUniform4uiv);
|
||||
RETURN_FN(glClearBufferiv);
|
||||
RETURN_FN(glClearBufferuiv);
|
||||
RETURN_FN(glClearBufferfv);
|
||||
RETURN_FN(glClearBufferfi);
|
||||
RETURN_FN(glGetStringi);
|
||||
RETURN_FN(glCopyBufferSubData);
|
||||
RETURN_FN(glGetUniformIndices);
|
||||
RETURN_FN(glGetActiveUniformsiv);
|
||||
RETURN_FN(glGetUniformBlockIndex);
|
||||
RETURN_FN(glGetActiveUniformBlockiv);
|
||||
RETURN_FN(glGetActiveUniformBlockName);
|
||||
RETURN_FN(glUniformBlockBinding);
|
||||
RETURN_FN(glDrawArraysInstanced);
|
||||
RETURN_FN(glDrawElementsInstanced);
|
||||
RETURN_FN(glFenceSync);
|
||||
RETURN_FN(glIsSync);
|
||||
RETURN_FN(glDeleteSync);
|
||||
RETURN_FN(glClientWaitSync);
|
||||
RETURN_FN(glWaitSync);
|
||||
RETURN_FN(glGetInteger64v);
|
||||
RETURN_FN(glGetSynciv);
|
||||
RETURN_FN(glGetInteger64i_v);
|
||||
RETURN_FN(glGetBufferParameteri64v);
|
||||
RETURN_FN(glGenSamplers);
|
||||
RETURN_FN(glDeleteSamplers);
|
||||
RETURN_FN(glIsSampler);
|
||||
RETURN_FN(glBindSampler);
|
||||
RETURN_FN(glSamplerParameteri);
|
||||
RETURN_FN(glSamplerParameteriv);
|
||||
RETURN_FN(glSamplerParameterf);
|
||||
RETURN_FN(glSamplerParameterfv);
|
||||
RETURN_FN(glGetSamplerParameteriv);
|
||||
RETURN_FN(glGetSamplerParameterfv);
|
||||
RETURN_FN(glVertexAttribDivisor);
|
||||
RETURN_FN(glBindTransformFeedback);
|
||||
RETURN_FN(glDeleteTransformFeedbacks);
|
||||
RETURN_FN(glGenTransformFeedbacks);
|
||||
RETURN_FN(glIsTransformFeedback);
|
||||
RETURN_FN(glPauseTransformFeedback);
|
||||
RETURN_FN(glResumeTransformFeedback);
|
||||
RETURN_FN(glGetProgramBinary);
|
||||
RETURN_FN(glProgramBinary);
|
||||
RETURN_FN(glProgramParameteri);
|
||||
RETURN_FN(glInvalidateFramebuffer);
|
||||
RETURN_FN(glInvalidateSubFramebuffer);
|
||||
RETURN_FN(glTexStorage2D);
|
||||
RETURN_FN(glTexStorage3D);
|
||||
RETURN_FN(glGetInternalformativ);
|
||||
RETURN_FN(glVertexAttribDivisorNV);
|
||||
RETURN_FN(glVertexAttribDivisorEXT);
|
||||
RETURN_FN(glVertexAttribDivisorARB);
|
||||
RETURN_FN(glVertexAttribDivisorANGLE);
|
||||
RETURN_FN(glDrawArraysInstancedNV);
|
||||
RETURN_FN(glDrawArraysInstancedEXT);
|
||||
RETURN_FN(glDrawArraysInstancedARB);
|
||||
RETURN_FN(glDrawArraysInstancedANGLE);
|
||||
RETURN_FN(glDrawElementsInstancedNV);
|
||||
RETURN_FN(glDrawElementsInstancedEXT);
|
||||
RETURN_FN(glDrawElementsInstancedARB);
|
||||
RETURN_FN(glDrawElementsInstancedANGLE);
|
||||
RETURN_FN(glBindVertexArrayOES);
|
||||
RETURN_FN(glDeleteVertexArraysOES);
|
||||
RETURN_FN(glGenVertexArraysOES);
|
||||
RETURN_FN(glIsVertexArrayOES);
|
||||
RETURN_FN(glDrawBuffersEXT);
|
||||
RETURN_FN(glDrawBuffersWEBGL);
|
||||
|
||||
// WebGL 2 extensions:
|
||||
// (currently none)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -106,3 +106,23 @@ GL_APICALL void GL_APIENTRY emscripten_glInvalidateSubFramebuffer (GLenum target
|
|||
GL_APICALL void GL_APIENTRY emscripten_glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
|
||||
GL_APICALL void GL_APIENTRY emscripten_glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
|
||||
GL_APICALL void GL_APIENTRY emscripten_glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params);
|
||||
|
||||
// Extensions:
|
||||
GL_APICALL void GL_APIENTRY emscripten_glVertexAttribDivisorNV(GLuint index, GLuint divisor);
|
||||
GL_APICALL void GL_APIENTRY emscripten_glVertexAttribDivisorEXT(GLuint index, GLuint divisor);
|
||||
GL_APICALL void GL_APIENTRY emscripten_glVertexAttribDivisorARB(GLuint index, GLuint divisor);
|
||||
GL_APICALL void GL_APIENTRY emscripten_glVertexAttribDivisorANGLE(GLuint index, GLuint divisor);
|
||||
GL_APICALL void GL_APIENTRY emscripten_glDrawArraysInstancedNV(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
|
||||
GL_APICALL void GL_APIENTRY emscripten_glDrawArraysInstancedEXT(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
|
||||
GL_APICALL void GL_APIENTRY emscripten_glDrawArraysInstancedARB(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
|
||||
GL_APICALL void GL_APIENTRY emscripten_glDrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei instancecount);
|
||||
GL_APICALL void GL_APIENTRY emscripten_glDrawElementsInstancedNV(GLenum mode, GLsizei count, GLenum type, GLintptr indices, GLsizei instancecount);
|
||||
GL_APICALL void GL_APIENTRY emscripten_glDrawElementsInstancedEXT(GLenum mode, GLsizei count, GLenum type, GLintptr indices, GLsizei instancecount);
|
||||
GL_APICALL void GL_APIENTRY emscripten_glDrawElementsInstancedARB(GLenum mode, GLsizei count, GLenum type, GLintptr indices, GLsizei instancecount);
|
||||
GL_APICALL void GL_APIENTRY emscripten_glDrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, GLintptr indices, GLsizei instancecount);
|
||||
GL_APICALL void GL_APIENTRY emscripten_glBindVertexArrayOES(GLuint array);
|
||||
GL_APICALL void GL_APIENTRY emscripten_glDeleteVertexArraysOES(GLsizei n, const GLuint *arrays);
|
||||
GL_APICALL void GL_APIENTRY emscripten_glGenVertexArraysOES(GLsizei n, GLuint *arrays);
|
||||
GL_APICALL GLboolean GL_APIENTRY emscripten_glIsVertexArrayOES(GLuint array);
|
||||
GL_APICALL void GL_APIENTRY emscripten_glDrawBuffersEXT(GLsizei n, const GLenum *bufs);
|
||||
GL_APICALL void GL_APIENTRY emscripten_glDrawBuffersWEBGL(GLsizei n, const GLenum *bufs);
|
||||
|
|
|
@ -733,7 +733,6 @@ fi
|
|||
([PYTHON, EMBUILDER, 'build', 'libc++'], ['success'], True, ['libc++.a']),
|
||||
([PYTHON, EMBUILDER, 'build', 'libc++_noexcept'], ['success'], True, ['libc++_noexcept.a']),
|
||||
([PYTHON, EMBUILDER, 'build', 'libc++abi'], ['success'], True, ['libc++abi.bc']),
|
||||
([PYTHON, EMBUILDER, 'build', 'gl'], ['success'], True, ['libgl.bc']),
|
||||
([PYTHON, EMBUILDER, 'build', 'native_optimizer'], ['success'], True, ['optimizer.2.exe']),
|
||||
([PYTHON, EMBUILDER, 'build', 'zlib'], ['building and verifying zlib', 'success'], True, ['zlib.bc']),
|
||||
([PYTHON, EMBUILDER, 'build', 'libpng'], ['building and verifying libpng', 'success'], True, ['libpng.bc']),
|
||||
|
@ -754,6 +753,13 @@ fi
|
|||
([PYTHON, EMBUILDER, 'build', 'libc-wasm'], ['building and verifying libc-wasm', 'success'], True, ['libc-wasm.bc']),
|
||||
([PYTHON, EMBUILDER, 'build', 'regal'], ['building and verifying regal', 'success'], True, ['regal.bc']),
|
||||
]
|
||||
for mt in ['', '-mt']:
|
||||
for emu in ['', '-emu']:
|
||||
for webgl2 in ['', '-webgl2']:
|
||||
case = 'gl' + mt + emu + webgl2
|
||||
lib = 'lib' + case + '.bc'
|
||||
tests += [([PYTHON, EMBUILDER, 'build', case], ['success'], True, [lib])]
|
||||
|
||||
if Settings.WASM_BACKEND:
|
||||
tests.append(([PYTHON, EMBUILDER, 'build', 'libcompiler_rt_wasm'], ['building and verifying libcompiler_rt_wasm', 'success'], True, ['libcompiler_rt_wasm.a']),)
|
||||
|
||||
|
|
|
@ -2734,8 +2734,8 @@ class Building(object):
|
|||
'c': '',
|
||||
'dl': '',
|
||||
'EGL': 'library_egl.js',
|
||||
'GL': 'library_gl.js',
|
||||
'GLESv2': 'library_gl.js',
|
||||
'GL': 'library_webgl.js',
|
||||
'GLESv2': 'library_webgl.js',
|
||||
'GLEW': 'library_glew.js',
|
||||
'glfw': 'library_glfw.js',
|
||||
'glfw3': 'library_glfw.js',
|
||||
|
@ -2753,7 +2753,7 @@ class Building(object):
|
|||
library_files = []
|
||||
if library_name in js_system_libraries:
|
||||
if len(js_system_libraries[library_name]):
|
||||
library_files += [js_system_libraries[library_name]]
|
||||
library_files += js_system_libraries[library_name] if isinstance(js_system_libraries[library_name], list) else [js_system_libraries[library_name]]
|
||||
|
||||
elif library_name.endswith('.js') and os.path.isfile(path_from_root('src', 'library_' + library_name)):
|
||||
library_files += ['library_' + library_name]
|
||||
|
@ -2779,7 +2779,9 @@ class Building(object):
|
|||
if 'USE_SDL=1' in link_settings:
|
||||
system_js_libraries += ['library_sdl.js']
|
||||
if 'USE_SDL=2' in link_settings:
|
||||
system_js_libraries += ['library_egl.js', 'library_gl.js']
|
||||
system_js_libraries += ['library_egl.js', 'library_webgl.js']
|
||||
if 'USE_WEBGL2=1' in link_settings:
|
||||
system_js_libraries += ['library_webgl2.js']
|
||||
return [path_from_root('src', x) for x in system_js_libraries]
|
||||
|
||||
@staticmethod
|
||||
|
|
|
@ -167,6 +167,14 @@ def calculate(temp_files, in_temp, stdout_, stderr_, forced=[]):
|
|||
assert '-emu' not in libname
|
||||
return []
|
||||
|
||||
def gl_version_flags(libname):
|
||||
if shared.Settings.USE_WEBGL2:
|
||||
assert '-webgl2' in libname
|
||||
return ['-DUSE_WEBGL2=1']
|
||||
else:
|
||||
assert '-webgl2' not in libname
|
||||
return []
|
||||
|
||||
# libc
|
||||
def create_libc(libname):
|
||||
logging.debug(' building libc for cache')
|
||||
|
@ -378,9 +386,10 @@ def calculate(temp_files, in_temp, stdout_, stderr_, forced=[]):
|
|||
for dirpath, dirnames, filenames in os.walk(src_dir):
|
||||
filenames = filter(lambda f: f.endswith('.c'), filenames)
|
||||
files += map(lambda f: os.path.join(src_dir, f), filenames)
|
||||
flags = ['-Oz']
|
||||
flags = ['-Oz', '-s', 'USE_WEBGL2=1']
|
||||
flags += threading_flags(libname)
|
||||
flags += legacy_gl_emulation_flags(libname)
|
||||
flags += gl_version_flags(libname)
|
||||
return build_libc(libname, files, flags)
|
||||
|
||||
# al
|
||||
|
@ -635,22 +644,23 @@ def calculate(temp_files, in_temp, stdout_, stderr_, forced=[]):
|
|||
Library('libcompiler_rt','a', create_compiler_rt, compiler_rt_symbols, [libc_name], False), # noqa
|
||||
Library(malloc_name(), ext, create_malloc, [], [], False)] # noqa
|
||||
|
||||
gl_name = 'libgl'
|
||||
if shared.Settings.USE_PTHREADS:
|
||||
gl_name += '-mt'
|
||||
if shared.Settings.LEGACY_GL_EMULATION:
|
||||
gl_name += '-emu'
|
||||
if shared.Settings.USE_WEBGL2:
|
||||
gl_name += '-webgl2'
|
||||
system_libs += [Library(gl_name, ext, create_gl, gl_symbols, [libc_name], False)] # noqa
|
||||
|
||||
if shared.Settings.USE_PTHREADS:
|
||||
system_libs += [Library('libpthreads', ext, create_pthreads, pthreads_symbols, [libc_name], False)] # noqa
|
||||
if not shared.Settings.WASM_BACKEND:
|
||||
system_libs += [Library('libpthreads_asmjs', ext, create_pthreads_asmjs, asmjs_pthreads_symbols, [libc_name], False)] # noqa
|
||||
else:
|
||||
system_libs += [Library('libpthreads_wasm', ext, create_pthreads_wasm, [], [libc_name], False)] # noqa
|
||||
if shared.Settings.LEGACY_GL_EMULATION:
|
||||
system_libs += [Library('libgl-emu-mt', ext, create_gl, gl_symbols, [libc_name], False)] # noqa
|
||||
else:
|
||||
system_libs += [Library('libgl-mt', ext, create_gl, gl_symbols, [libc_name], False)] # noqa
|
||||
else:
|
||||
system_libs += [Library('libpthreads_stub', ext, create_pthreads_stub, stub_pthreads_symbols, [libc_name], False)] # noqa
|
||||
if shared.Settings.LEGACY_GL_EMULATION:
|
||||
system_libs += [Library('libgl-emu', ext, create_gl, gl_symbols, [libc_name], False)] # noqa
|
||||
else:
|
||||
system_libs += [Library('libgl', ext, create_gl, gl_symbols, [libc_name], False)] # noqa
|
||||
|
||||
system_libs.append(Library(libc_name, ext, create_libc, libc_symbols, libc_deps, False))
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче