-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Introduce GL state tracking #5739
Conversation
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.
👏 This looks great.
@@ -29,30 +31,34 @@ class IndexBuffer { | |||
// The bound index buffer is part of vertex array object state. We don't want to | |||
// modify whatever VAO happens to be currently bound, so make sure the default | |||
// vertex array provided by the context is bound instead. | |||
if (this.gl.extVertexArrayObject === undefined) { | |||
(this.gl: any).extVertexArrayObject = this.gl.getExtension("OES_vertex_array_object"); |
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.
Glad to eliminate this any
.
src/gl/index_buffer.js
Outdated
const gl = this.context.gl; | ||
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.buffer); | ||
// this.context.bindElementBuffer.set(this.buffer); | ||
// TODO not sure why this doesn't work, but using bindElementBuffer throws: |
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.
My hunch would be that a necessary call to gl.bindBuffer()
is getting incorrectly deduped away somehow.
src/gl/state.js
Outdated
} | ||
|
||
set(t: T) { | ||
if (this.current !== t) { |
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.
We have to be careful about using the !==
operator here. It will always use object identity when T
is an object or array type like BlendFuncType
or StencilFuncType
. That probably isn't what we want. We have a couple deep equal implementations that might work, or we could add an equal(a: T, b: T): boolean
method to the Value
interface.
src/gl/types.js
Outdated
|
||
export type BlendFuncType = [BlendFuncConstant, BlendFuncConstant]; | ||
|
||
export type ColorType = [number, number, number, number]; |
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.
Follow #5573 and use Color
instead.
yarn.lock
Outdated
@@ -188,11 +188,7 @@ | |||
version "3.0.0" | |||
resolved "https://registry.yarnpkg.com/@mapbox/whoots-js/-/whoots-js-3.0.0.tgz#c1de4293081424da3ac30c23afa850af1019bb54" | |||
|
|||
"@types/node@*": |
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.
Are there actual dependency updates in here or is this an accidental change (different version of yarn maybe?)
53bae79
to
b979169
Compare
I rolled back use of |
… case by case basis
This PR introduces GL state tracking (similar to gl-native behavior) as a first step in #145.
Updated benchmark results: link
Remaining