Repository navigation
Conversation
This slightly refactors the state of GPUCanvasContext and makes a bunch of small editorial changes in related areas. Note the changes in GPUCanvasContext.configure which move all of the error handling back to the content timeline (instead of the device timeline). This is because it was previously attempted to early-return from the device timeline and expected it to terminate the content timeline steps, which isn't possible.
f3faab3 to
05fa0b0
Compare
| {{GPUCanvasContext}} has the following internal slots: | ||
|
|
||
| <dl dfn-type=attribute dfn-for="GPUCanvasContext"> | ||
| : <dfn>\[[validConfiguration]]</dfn> of type boolean, initially `false`. |
There was a problem hiding this comment.
The validConfiguration flag was tracked separately from the configuration itself because at the time we did the refactor to fold the swap chain into the context I recall us making the decision that as long as configure() had been called (and a device had been supplied) you would always get a texture out of getCurrentTexture(), even if it was an invalid one. That normalizes this with how createTexture() works, where something like an invalid size would give back an invalid texture in both cases.
There was a problem hiding this comment.
I see, I had forgotten this. Given that getCurrentTexture() can still throw exceptions (if the context entirely unconfigured), I'm not sure how helpful this is?
It would especially make sense for getCurrentTexture() to throw if configure() also threw, see [1]. Seems to me to be consistent we should either:
- Have
configure()unconditionally set the configuration even if it doesn't make sense, and validate asynchronously. If configured incorrectly, return invalid textures fromgetCurrentTexture(). - Have
configure()validate synchronously and on failure either:
a. Leave the old configuration in place (if any) sogetCurrentTexture()keeps working as it did.
b. Leave the canvas unconfigured sogetCurrentTexture()now throws.
Right now the spec is in an "impossible" in-between state where I think it requires a content-gpu-content round-trip unless the configuration state could somehow move to the gpu process (I don't think it can).
There was a problem hiding this comment.
Have configure() unconditionally set the configuration even if it doesn't make sense, and validate asynchronously. If configured incorrectly, return invalid textures from getCurrentTexture().
I suppose since device is a required member of GPUCanvasConfiguration this makes sense. The IDL validation will throw if they don't provide a device, so it satisfies the logic of "if configure() threw getCurrentTexture() will throw. For everything else we'll be guaranteed to have a device, even if it's a destroyed/invalid one, so we can raise validation errors and create invalid textures.
| 1. Generate a {{GPUValidationError}} in the current scope of |device| with an appropriate error message. | ||
| 1. Return. | ||
|
|
||
| Issue: Just throw an exception instead? |
| {{GPUCanvasContext}} has the following internal slots: | ||
|
|
||
| <dl dfn-type=attribute dfn-for="GPUCanvasContext"> | ||
| : <dfn>\[[validConfiguration]]</dfn> of type boolean, initially `false`. |
There was a problem hiding this comment.
I see, I had forgotten this. Given that getCurrentTexture() can still throw exceptions (if the context entirely unconfigured), I'm not sure how helpful this is?
It would especially make sense for getCurrentTexture() to throw if configure() also threw, see [1]. Seems to me to be consistent we should either:
- Have
configure()unconditionally set the configuration even if it doesn't make sense, and validate asynchronously. If configured incorrectly, return invalid textures fromgetCurrentTexture(). - Have
configure()validate synchronously and on failure either:
a. Leave the old configuration in place (if any) sogetCurrentTexture()keeps working as it did.
b. Leave the canvas unconfigured sogetCurrentTexture()now throws.
Right now the spec is in an "impossible" in-between state where I think it requires a content-gpu-content round-trip unless the configuration state could somehow move to the gpu process (I don't think it can).
|
Obsoleted by #2416 which sidesteps complexities here by having the current texture always match the canvas size. |
This is in draft
...while I figure out whether having differing intrinsic size and natural dimensions as defined here makes sense.
This slightly refactors the state of GPUCanvasContext and makes a bunch
of small editorial changes in related areas.
Note the changes in GPUCanvasContext.configure which move all of the
error handling back to the content timeline (instead of the device
timeline). This is because it was previously attempted to early-return
from the device timeline and expected it to terminate the content
timeline steps, which isn't possible.
Preview | Diff