-
Notifications
You must be signed in to change notification settings - Fork 692
add first prototype of texElementImage2D #3752
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2210,8 +2210,52 @@ <h4>Texture objects</h4> | |
| <p><em>offset</em> is the byte offset into the WebGLBuffer's data store; generates an <code>INVALID_VALUE</code> error if it's less than 0.</p> | ||
| <p>The ETC2 and EAC texture formats defined in OpenGL ES 3.0 are <a href="#NO_ETC2_EAC">not available in WebGL 2.0</a>. | ||
| </dd> | ||
|
|
||
| <dt class="idl-code"> | ||
| [throws] undefined texElementImage2D(GLenum target, GLint level, GLint internalformat, GLenum format, GLenum type, | ||
| Element element); | ||
| </dt> | ||
| <dd> | ||
| <p>Renders the given element to the currently bound WebGLTexture.</p> | ||
| <p>The width and height of the texture are derived from the CSS borderbox of the element at the time of rendering. Add links to whatwg.</p> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This seems pretty limiting compared to the 2d equivalent. Could this take optional width & height args? This seems especially important for high-dpr. It also seems to be desirable to use a portion of an element in a texture, eg for extreme zoomed cases. This is also something you can do with the 2d API. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the IDL changes in this PR are a bit behind; the current chromium implementation has four overrides for @foolip can you update the PR to match the chromium implementation?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The width/height was there originally but we were told that those APIs were going to be removed in the future. Has that changed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Setting it on the element means scaling everything else up within it, which is a pain. Trying to deal with the sub-rect case is even more painful. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @szager-chromium that's good to hear. Although, it's a little frustrating that for some things, the explainer is more up to date, and for other things the PRs are more up to date, and for other things, like this, neither has the details. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where's the up to date proposal for the WebGPU API addition? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Now that I'm looking at the code (which ironically I wrote), I see there there is a variant that allows you specify destination I can't remember what I was thinking there, but the WebGPU API shape has definitely not had a lot of scrutiny yet, and can still be easily changed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It does seem worth having an API that allows both. It'd seem odd if the WebGPU version was the least capable. I guess this can get more review when it's properly proposed somewhere. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The missing overload has been added to the WebGPU equivalent API. |
||
| <p>TBD: define state of rendering + security. These will be more links to whatwg</p><p></p> | ||
| <p>If this function is called with an <code>HTMLElement</code> that is not a direct descendant of the <a href="#context-canvas">canvas</a> of the current context, generates an <code>INVALID_OPERATION</code> error.</p> | ||
| <p>If a WebGLBuffer is bound to the <code>PIXEL_UNPACK_BUFFER</code> target, generates an <code>INVALID_OPERATION</code> error.</p> | ||
| <p>The combination of <em>internalformat</em>, <em>format</em>, and <em>type</em> must be listed in the following table:</p> | ||
| <table id="TEXTURE_TYPES_FORMATS_FROM_DOM_ELEMENTS_TABLE_2"> | ||
| <tr><th>Internal Format</th><th>Format</th><th>Type</th></tr> | ||
| <tr><td>RGB</td><td>RGB</td><td>UNSIGNED_BYTE</td></tr> | ||
| <tr><td>RGBA</td><td>RGBA</td><td>UNSIGNED_BYTE</td></tr> | ||
| <tr><td>RGB16F</td><td>RGB</td><td>HALF_FLOAT<br>FLOAT</td></tr> | ||
| <tr><td>RGB32F</td><td>RGB</td><td>FLOAT</td></tr> | ||
| <tr><td>RGBA16F</td><td>RGBA</td><td>HALF_FLOAT<br>FLOAT</td></tr> | ||
| <tr><td>RGBA32F</td><td>RGBA</td><td>FLOAT</td></tr> | ||
| </table> | ||
| <p> | ||
| If <a href="#PIXEL_STORE_PARAM_CONSTRAINTS">pixel store parameter constraints</a> are not met, | ||
| generates an <code>INVALID_OPERATION</code> error. | ||
| </p> | ||
| </dd> | ||
|
|
||
| <dt class="idl-code"> | ||
| [throws] undefined texElementImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a duplicate of the entry on line 2240 and should be removed. |
||
| GLenum format, GLenum type, Element element); | ||
| </dt> | ||
| <dd> | ||
| <p>Renders the given element to the currently bound WebGLTexture.</p> | ||
| <p>The texture is resized to <code>width</code> and <code>height</code>>. Add links to whatwg.</p> | ||
| <p>TBD: define state of rendering + security. These will be more links to whatwg</p><p></p> | ||
| <p>If this function is called with an <code>HTMLElement</code> that is not a direct descendant of the <a href="#context-canvas">canvas</a> of the current context, generates an <code>INVALID_OPERATION</code> error.</p> | ||
| <p>If a WebGLBuffer is bound to the <code>PIXEL_UNPACK_BUFFER</code> target, generates an <code>INVALID_OPERATION</code> error.</p> | ||
| <p>See <a href="../1.0/index.html#TEXTURE_TYPES_FORMATS_FROM_DOM_ELEMENTS_TABLE_2">texElementImage2D</a> for the interpretation of the <em>internalformat</em>, <em>format</em> and <em>type</em> arguments, and notes on the <code>UNPACK_PREMULTIPLY_ALPHA_WEBGL</code> pixel storage parameter. </p> | ||
| <p> | ||
| If <a href="#PIXEL_STORE_PARAM_CONSTRAINTS">pixel store parameter constraints</a> are not met, | ||
| generates an <code>INVALID_OPERATION</code> error. | ||
| </p> | ||
| </dd> | ||
| </dl> | ||
|
|
||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please remove extra blank line. |
||
| <!-- ======================================================================================================= --> | ||
|
|
||
| <h4>Programs and Shaders</h4> | ||
|
|
||
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 semantics of HTML-in-Canvas have evolved significantly in https://github.com/WICG/html-in-canvas . Now there's a
paintevent which applications should watch for, andtexElementImage2Dcopies in the rendered version of the element at the time of the lastpaintevent. Could you please expand out the text here to describe more precisely what ends up in theWebGLTexture? URL links to the upstream spec would probably be best, to avoid duplicating text.