Skip to content

Commit a6aaca5

Browse files
Translate "?" from "| null" into "null | undefined" (#163)
* Translate "?" from "| null" into "null | undefined" * apply to nullable arguments as well --------- Co-authored-by: Kai Ninomiya <kainino@chromium.org>
1 parent 8a75a9d commit a6aaca5

File tree

4 files changed

+43
-9
lines changed

4 files changed

+43
-9
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ Most or all of these should be fixed in the generator over time.
9999
- `Array` changed to `Iterable` for WebIDL `sequence`s in argument positions (but not in return positions).
100100
- `any` changed to `object` for WebIDL `object`.
101101
- `| SharedArrayBuffer` added for `[AllowShared] BufferSource`.
102+
- `| null` changed to `| null | undefined` for WebIDL nullable items (`T?`).
102103

103104
The following differences are TODO: should be changed in the final result.
104105

dist/index.d.ts

Lines changed: 39 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -655,6 +655,7 @@ interface GPUCanvasConfiguration {
655655
/**
656656
* The tone mapping determines how the content of textures returned by
657657
* {@link GPUCanvasContext#getCurrentTexture} are to be displayed.
658+
* Note: If an implementation doesn't support HDR WebGPU canvases, it should also not expose this member, to allow for feature detection. See {@link GPUCanvasContext#getConfiguration}.
658659
*/
659660
toneMapping?: GPUCanvasToneMapping;
660661
/**
@@ -927,7 +928,11 @@ interface GPUFragmentState
927928
* A list of {@link GPUColorTargetState} defining the formats and behaviors of the color targets
928929
* this pipeline writes to.
929930
*/
930-
targets: Iterable<GPUColorTargetState | null>;
931+
targets: Iterable<
932+
| GPUColorTargetState
933+
| null
934+
| undefined
935+
>;
931936
}
932937

933938
interface GPUMultisampleState {
@@ -991,7 +996,11 @@ interface GPUPipelineLayoutDescriptor
991996
* to a @group attribute in the {@link GPUShaderModule}, with the `N`th element corresponding
992997
* with `@group(N)`.
993998
*/
994-
bindGroupLayouts: Iterable<GPUBindGroupLayout | null>;
999+
bindGroupLayouts: Iterable<
1000+
| GPUBindGroupLayout
1001+
| null
1002+
| undefined
1003+
>;
9951004
}
9961005

9971006
interface GPUPrimitiveState {
@@ -1202,7 +1211,11 @@ interface GPURenderPassDescriptor
12021211
* Due to compatible usage list|usage compatibility, no color attachment
12031212
* may alias another attachment or any resource used inside the render pass.
12041213
*/
1205-
colorAttachments: Iterable<GPURenderPassColorAttachment | null>;
1214+
colorAttachments: Iterable<
1215+
| GPURenderPassColorAttachment
1216+
| null
1217+
| undefined
1218+
>;
12061219
/**
12071220
* The {@link GPURenderPassDepthStencilAttachment} value that defines the depth/stencil
12081221
* attachment that will be output to and tested against when executing this render pass.
@@ -1231,7 +1244,11 @@ interface GPURenderPassLayout
12311244
/**
12321245
* A list of the {@link GPUTextureFormat}s of the color attachments for this pass or bundle.
12331246
*/
1234-
colorFormats: Iterable<GPUTextureFormat | null>;
1247+
colorFormats: Iterable<
1248+
| GPUTextureFormat
1249+
| null
1250+
| undefined
1251+
>;
12351252
/**
12361253
* The {@link GPUTextureFormat} of the depth/stencil attachment for this pass or bundle.
12371254
*/
@@ -1329,6 +1346,7 @@ interface GPURequestAdapterOptions {
13291346
* attribute prior to requesting a {@link GPUDevice}.
13301347
*/
13311348
forceFallbackAdapter?: boolean;
1349+
xrCompatible?: boolean;
13321350
}
13331351

13341352
interface GPUSamplerBindingLayout {
@@ -1690,7 +1708,11 @@ interface GPUVertexState
16901708
* A list of {@link GPUVertexBufferLayout}s, each defining the layout of vertex attribute data in a
16911709
* vertex buffer used by this pipeline.
16921710
*/
1693-
buffers?: Iterable<GPUVertexBufferLayout | null>;
1711+
buffers?: Iterable<
1712+
| GPUVertexBufferLayout
1713+
| null
1714+
| undefined
1715+
>;
16941716
}
16951717

16961718
interface GPUBindingCommandsMixin {
@@ -1708,7 +1730,10 @@ interface GPUBindingCommandsMixin {
17081730
*/
17091731
setBindGroup(
17101732
index: GPUIndex32,
1711-
bindGroup: GPUBindGroup | null,
1733+
bindGroup:
1734+
| GPUBindGroup
1735+
| null
1736+
| undefined,
17121737
dynamicOffsets?: Iterable<GPUBufferDynamicOffset>
17131738
): undefined;
17141739
/**
@@ -1724,7 +1749,10 @@ interface GPUBindingCommandsMixin {
17241749
*/
17251750
setBindGroup(
17261751
index: GPUIndex32,
1727-
bindGroup: GPUBindGroup | null,
1752+
bindGroup:
1753+
| GPUBindGroup
1754+
| null
1755+
| undefined,
17281756
dynamicOffsetsData: Uint32Array,
17291757
dynamicOffsetsDataStart: GPUSize64,
17301758
dynamicOffsetsDataLength: GPUSize32
@@ -1802,7 +1830,10 @@ interface GPURenderCommandsMixin {
18021830
*/
18031831
setVertexBuffer(
18041832
slot: GPUIndex32,
1805-
buffer: GPUBuffer | null,
1833+
buffer:
1834+
| GPUBuffer
1835+
| null
1836+
| undefined,
18061837
offset?: GPUSize64,
18071838
size?: GPUSize64
18081839
): undefined;

generated/index.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,7 @@ interface GPUCanvasConfiguration {
601601
/**
602602
* The tone mapping determines how the content of textures returned by
603603
* {@link GPUCanvasContext#getCurrentTexture} are to be displayed.
604+
* Note: If an implementation doesn't support HDR WebGPU canvases, it should also not expose this member, to allow for feature detection. See {@link GPUCanvasContext#getConfiguration}.
604605
*/
605606
toneMapping?: GPUCanvasToneMapping;
606607
/**
@@ -1274,6 +1275,7 @@ interface GPURequestAdapterOptions {
12741275
featureLevel?: string;
12751276
powerPreference?: GPUPowerPreference;
12761277
forceFallbackAdapter?: boolean;
1278+
xrCompatible?: boolean;
12771279
}
12781280

12791281
interface GPUSamplerBindingLayout {

0 commit comments

Comments
 (0)