-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Bug: WebGL tex(Sub)Image2D optionals #14305
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
Comments
The function has two overloads in the library: texImage2D(target: number, level: number, internalformat: number, width: number , height: number, border: number , format: number, type: number, pixels?: ArrayBufferView): void;
texImage2D(target: number, level: number, internalformat: number, format: number, type: number , pixels?: ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement): void; Which from a cursory glance seem to match the description on https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/texImage2D. Can you elaborate on why this is not correct? |
The WebGL specification for
In this case On the other hand, if you correctly set the parameter to For comparison,
In that case Edit: |
Thanks for the explanation. looks like we need to split this declaration into two. A PR would be appreciated. |
Oh i see the PR. thanks! |
TypeScript Version: 2.2.1 (and previous)
Code
Expected behavior:
A1 should fail and raise something like
Valid arities are: [6, 9], but 8 arguments provided.
A2 should pass, in order to create an empty texture and modify the content later.
A3 should fail, because no source (
ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement
) was provided.B1 should fail and raise something like
Valid arities are: [7, 9], but 8 arguments provided.
B2 should pass, eventually WebGL will return
INVALID_VALUE
for the missing pixels.B3 should fail, because no source (
ImageData | HTMLVideoElement | HTMLImageElement | HTMLCanvasElement
) was provided.Actual behavior:
A1 will pass tsc, but resulting code fails in browser (Tested with Chrome and Firefox, so far).
A2 will fail tsc, expecting
ArrayBufferView | undefined
.A3 will pass tsc, but resulting code fails in browser (Tested with Chrome and Firefox, so far).
B1 will pass tsc, but resulting code fails in browser (Tested with Chrome and Firefox, so far).
B2 will fail tsc, expecting
ArrayBufferView | undefined
.B3 will pass tsc, but resulting code fails in browser (Tested with Chrome and Firefox, so far).
The text was updated successfully, but these errors were encountered: