Skip to content

Commit

Permalink
retire USES_GL_EMULATION
Browse files Browse the repository at this point in the history
  • Loading branch information
hujiajie committed Dec 5, 2018
1 parent 5297f33 commit a977211
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
4 changes: 0 additions & 4 deletions src/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,10 +169,6 @@ EXPORTED_FUNCTIONS = set(EXPORTED_FUNCTIONS);
EXCEPTION_CATCHING_WHITELIST = set(EXCEPTION_CATCHING_WHITELIST);
IMPLEMENTED_FUNCTIONS = set(IMPLEMENTED_FUNCTIONS);

// TODO: Implement support for proper preprocessing, e.g. "#if A || B" and "#if defined(A) || defined(B)" to
// avoid needing this here.
USES_GL_EMULATION = FULL_ES2 || LEGACY_GL_EMULATION;

DEAD_FUNCTIONS.forEach(function(dead) {
DEFAULT_LIBRARY_FUNCS_TO_INCLUDE.push(dead.substr(1));
});
Expand Down
2 changes: 1 addition & 1 deletion src/library_browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -1188,7 +1188,7 @@ var LibraryBrowser = {

// Signal GL rendering layer that processing of a new frame is about to start. This helps it optimize
// VBO double-buffering and reduce GPU stalls.
#if USES_GL_EMULATION
#if FULL_ES2 || LEGACY_GL_EMULATION
GL.newRenderingFrameStarted();
#endif

Expand Down
10 changes: 5 additions & 5 deletions src/library_gl.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var LibraryGL = {
syncs: [],
#endif

#if USES_GL_EMULATION
#if FULL_ES2 || LEGACY_GL_EMULATION
currArrayBuffer: 0,
currElementArrayBuffer: 0,
#endif
Expand Down Expand Up @@ -77,7 +77,7 @@ var LibraryGL = {
unpackAlignment: 4, // default alignment is 4 bytes

init: function() {
#if USES_GL_EMULATION
#if FULL_ES2 || LEGACY_GL_EMULATION
GL.createLog2ceilLookup(GL.MAX_TEMP_BUFFER_SIZE);
#endif
GL.miniTempBuffer = new Float32Array(GL.MINI_TEMP_BUFFER_SIZE);
Expand Down Expand Up @@ -113,7 +113,7 @@ var LibraryGL = {
miniTempBuffer: null,
miniTempBufferViews: [0], // index i has the view of size i+1

#if USES_GL_EMULATION
#if FULL_ES2 || LEGACY_GL_EMULATION
// When user GL code wants to render from client-side memory, we need to upload the vertex data to a temp VBO
// for rendering. Maintain a set of temp VBOs that are created-on-demand to appropriate sizes, and never destroyed.
// Also, for best performance the VBOs are double-buffered, i.e. every second frame we switch the set of VBOs we
Expand Down Expand Up @@ -3642,7 +3642,7 @@ var LibraryGL = {
#endif
var bufferObj = buffer ? GL.buffers[buffer] : null;

#if USES_GL_EMULATION
#if FULL_ES2 || LEGACY_GL_EMULATION
if (target == GLctx.ARRAY_BUFFER) {
GL.currArrayBuffer = buffer;
#if LEGACY_GL_EMULATION
Expand Down Expand Up @@ -4282,7 +4282,7 @@ var LibraryGL = {
#endif
GLctx['bindVertexArray'](GL.vaos[vao]);
#endif
#if USES_GL_EMULATION
#if FULL_ES2 || LEGACY_GL_EMULATION
var ibo = GLctx.getParameter(GLctx.ELEMENT_ARRAY_BUFFER_BINDING);
GL.currElementArrayBuffer = ibo ? (ibo.name | 0) : 0;
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/library_vr.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ var LibraryWebVR = {
/* Prevent scheduler being called twice when loop is changed */
display.mainLoop.running = true;

#if USES_GL_EMULATION
#if FULL_ES2 || LEGACY_GL_EMULATION
GL.newRenderingFrameStarted();
#endif

Expand Down

0 comments on commit a977211

Please sign in to comment.