Use out-of-band messaging for the mipmap and array layer count#945
Use out-of-band messaging for the mipmap and array layer count#945
Conversation
…tureViewDescriptor
kainino0x
left a comment
There was a problem hiding this comment.
Nice, this one was on my todo list but I hadn't gotten to it yet.
spec/index.bs
Outdated
|
|
||
| * {{GPUTextureViewDescriptor/mipLevelCount}}: | ||
| If 0, defaults to |texture|.{{GPUTextureDescriptor/mipLevelCount}} − {{GPUTextureViewDescriptor/baseMipLevel}}. | ||
| If undefined or "null", defaults to |texture|.{{GPUTextureDescriptor/mipLevelCount}} − {{GPUTextureViewDescriptor/baseMipLevel}}. |
There was a problem hiding this comment.
is null actually allowed for optional dictionary fields? I haven't bothered to check....
I usually just say "unspecified" as a catch-all for whatever IDL does.
There was a problem hiding this comment.
Just curious, what if it's specified as mipLevelCount: null?
It's technically specified, but we'd want to treat it as unspecified.
There was a problem hiding this comment.
Depends on whether that's allowed by the IDL conversion rules (a quick test tells me it probably is).
We should find language from another spec and adopt it. here's a random one I found in the web audio spec:
https://www.w3.org/TR/webaudio/#ref-for-dom-audiocontextoptions-samplerate
If contextOptions.sampleRate is specified, set the sampleRate of this AudioContext to this value.
There was a problem hiding this comment.
Here we are operating on the IDL representation rather than the ECMAScript representation. So this is after this algorithm has run:
https://heycam.github.io/webidl/#es-dictionary
but I'm having a hard time understanding this algorithm - it doesn't seem to say anything about how to handle optional members.
There was a problem hiding this comment.
More specifically, this:
- If esMemberValue is not undefined, then:
- Let idlMemberValue be the result of converting esMemberValue to an IDL value whose type is the type member is declared to be of.
seems to say that null is NOT supposed to be treated as undefined for an optional member, and instead should fail conversion from null to GPUIntegerCoordinate.
There was a problem hiding this comment.
Resolved that it doesn't matter:
- If IDL says this is an error, we don't see the
nullvalue. - If IDL says this is not an error, the IDL should convert JS
nullinto IDLUndefined.
|
putting this on the editors meeting agenda because I guess we want to figure out what's up with webidl |
846: Make level and layer count for texture view optional r=cwfitzgerald a=kvark **Connections** implements gpuweb/gpuweb#945 **Description** `NonZeroU32` is more idiomatic here **Testing** untested, but should work Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com>
This is in line with the changes we are doing for
minBufferBindingSizeand other sizes.I don't like the "if xxx, defaults to yyy" scheme of things, since it's not clear how "defaults to" works in this case. This PR keeps this, but would be nice to refactor this later in follow-ups.
Preview | Diff