-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Change BufferResource.data
type to include all possible typed arrays
#9332
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit c75dba7:
|
* @param {PIXI.IBlobOptions} options | ||
* @param {boolean}[options.autoLoad] - whether to fetch the data immediately; | ||
* you can fetch it later via {@link PIXI.BlobResource#load} | ||
* @param {boolean}[options.width] - the width in pixels. | ||
* @param {boolean}[options.height] - the height in pixels. | ||
*/ | ||
constructor(source: string | Uint8Array | Uint32Array | Float32Array, | ||
options: IBlobOptions = { width: 1, height: 1, autoLoad: true }) | ||
constructor(source: string | Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array |
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.
should we consider making a type for :Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array
Might make all the functions params a little less wordy!
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.
Created the BufferType
type. Not sure if it's the best name though. Maybe more specific like BufferResourceDataType
is better?
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.
I'm fine with BufferType
I noticed that removing the documentation of |
Description of change
The spec allows
Uint8ClampedArray
:Must have been this bug in Chrome, which has been fixed a long time ago: https://bugs.chromium.org/p/chromium/issues/detail?id=961658
Added all typed array types that are allowed in
texImage2D
as listed here: https://registry.khronos.org/webgl/specs/latest/2.0/#3.7.6Extended the automatic type detection in
fromBuffer
.Removed
format: FORMATS.RGBA,
from the defaultfromBuffer
options, because that's the default generally.Pre-Merge Checklist
npm run lint
)npm run test
)