Skip to content
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

Merged
merged 8 commits into from
Apr 24, 2023

Conversation

dev7355608
Copy link
Collaborator

Description of change

/** Source array Cannot be {@code ClampedUint8Array} because it cant be uploaded to WebGL */

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.6

Extended the automatic type detection in fromBuffer.

Removed format: FORMATS.RGBA, from the default fromBuffer options, because that's the default generally.

Pre-Merge Checklist
  • Tests and/or benchmarks are included
  • Documentation is changed or added
  • Lint process passed (npm run lint)
  • Tests passed (npm run test)

@codesandbox-ci
Copy link

codesandbox-ci bot commented Apr 3, 2023

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:

Sandbox Source
pixi.js-sandbox Configuration

@bigtimebuddy bigtimebuddy added this to the v7.3.0 milestone Apr 3, 2023
* @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
Copy link
Member

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!

Copy link
Collaborator Author

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?

Copy link
Member

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

@GoodBoyDigital GoodBoyDigital added the 💞 Migrate to v8 This PR needs to be migrated to v8 label Apr 4, 2023
@dev7355608
Copy link
Collaborator Author

I noticed that removing the documentation of BufferResource.data (the comment about Uint8ClampedArray) made it vanish from the docs. I assume that data is supposed to be a public member.

@bigtimebuddy bigtimebuddy added the ✅ Ready To Merge Helpful when issues are in the queue waiting to get merged. This means the PR is completed and has t label Apr 19, 2023
@bigtimebuddy bigtimebuddy merged commit f0fac33 into dev Apr 24, 2023
@bigtimebuddy bigtimebuddy deleted the fix/BufferResource.data branch April 24, 2023 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💞 Migrate to v8 This PR needs to be migrated to v8 ✅ Ready To Merge Helpful when issues are in the queue waiting to get merged. This means the PR is completed and has t
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants