-
Notifications
You must be signed in to change notification settings - Fork 3.5k
no_garbage_in_glinvalidateframebuffer #4893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
no_garbage_in_glinvalidateframebuffer #4893
Conversation
src/library_gl.js
Outdated
| #if USE_WEBGL2 | ||
| // For glInvalidateFramebuffer and glInvalidateSubFramebuffer, create a set of short fixed-length arrays to avoid | ||
| // having to generate any garbage in those functions. | ||
| GL.tempFixedLengthArray = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to declare this on the object, tempFixedLengthArray: [], , that way it isn't a new property at this time, better for JS optimizations.
kripken
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm with those minor comments
src/library_gl.js
Outdated
| for (var i = 0; i < numAttachments; i++) | ||
| list.push({{{ makeGetValue('attachments', 'i*4', 'i32') }}}); | ||
| #if GL_ASSERTIONS | ||
| assert(numAttachments < GL.tempFixedLengthArray.length, 'Invalid count of numAttachments='+numAttachments+' passed to glInvalidateFramebuffer (that many attachment points do not exist in GL)'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
spaces before and after +
src/library_gl.js
Outdated
| for (var i = 0; i < numAttachments; i++) | ||
| list.push({{{ makeGetValue('attachments', 'i*4', 'i32') }}}); | ||
| #if GL_ASSERTIONS | ||
| assert(numAttachments < GL.tempFixedLengthArray.length, 'Invalid count of numAttachments='+numAttachments+' passed to glInvalidateSubFramebuffer (that many attachment points do not exist in GL)'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
…uffer() and glInvalidateSubFramebuffer() functions.
863a074 to
2bc6946
Compare
|
Addressed comments and tested out in real world codebase, which shows we're garbage clean here now. |
Optimize away temporary garbage created in WebGL 2 glInvalidateFramebuffer() and glInvalidateSubFramebuffer() functions.