-
Notifications
You must be signed in to change notification settings - Fork 63
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
refactor buffer storage 4 #179
base: 12-17-refactor_buffer_storage_split_split
Are you sure you want to change the base?
refactor buffer storage 4 #179
Conversation
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
private regl: Regl; | ||
public renderer: ReglRenderer; | ||
private bufferMap: WeakMap<ArrayBufferView, DS.BufferLocation> = new Map(); | ||
private bufferMap: WeakMap<ArrayBufferView, DS.BufferLocation<Buffer>> = new Map(); |
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.
The code initializes a WeakMap
but incorrectly uses the Map
constructor. To fix the type mismatch, replace new Map()
with new WeakMap()
. This will ensure the implementation matches the declared type and maintains the intended weak reference behavior.
Spotted by Graphite Reviewer
Is this helpful? React 👍 or 👎 to let us know.
}; | ||
|
||
export type WebGPUBufferLocation = BufferLocation<GPUBuffer> & { |
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 might have to wait if we don't do the webGPU imports.
stride: 4, // meaningless here. | ||
byte_size: this.buffer_size - this.pointer, | ||
}); | ||
console.log("YOOO") |
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.
console.log("YOOO") |
This takes the memory management class used to hold webGL buffers and breaks it into an abstract type and a webGL specific type so that we can re-use the same code later to hold webGPU memory as well.