@@ -76,10 +76,19 @@ type GPUExtent3D =
76
76
| GPUExtent3DDict ;
77
77
type GPUFlagsConstant =
78
78
number ;
79
+ type GPUImageCopyExternalImageSource =
80
+
81
+ | ImageBitmap
82
+ | HTMLVideoElement
83
+ | VideoFrame
84
+ | HTMLCanvasElement
85
+ | OffscreenCanvas ;
79
86
type GPUIndex32 =
80
87
number ;
81
88
type GPUIntegerCoordinate =
82
89
number ;
90
+ type GPUIntegerCoordinateOut =
91
+ number ;
83
92
type GPUMapModeFlags =
84
93
number ;
85
94
type GPUOrigin2D =
@@ -100,8 +109,12 @@ type GPUSignedOffset32 =
100
109
number ;
101
110
type GPUSize32 =
102
111
number ;
112
+ type GPUSize32Out =
113
+ number ;
103
114
type GPUSize64 =
104
115
number ;
116
+ type GPUSize64Out =
117
+ number ;
105
118
type GPUStencilValue =
106
119
number ;
107
120
type GPUTextureUsageFlags =
@@ -615,27 +628,27 @@ interface GPUCanvasConfiguration {
615
628
616
629
interface GPUColorDict {
617
630
/**
618
- * The red channel value
631
+ * The red channel value.
619
632
*/
620
633
r : number ;
621
634
/**
622
- * The green channel value
635
+ * The green channel value.
623
636
*/
624
637
g : number ;
625
638
/**
626
- * The blue channel value
639
+ * The blue channel value.
627
640
*/
628
641
b : number ;
629
642
/**
630
- * The alpha channel value
643
+ * The alpha channel value.
631
644
*/
632
645
a : number ;
633
646
}
634
647
635
648
interface GPUColorTargetState {
636
649
/**
637
650
* The {@link GPUTextureFormat} of this color target. The pipeline will only be compatible with
638
- * {@link GPURenderPassEncoder}s which use a {@link GPUTextureView} of the same format in the
651
+ * {@link GPURenderPassEncoder}s which use a {@link GPUTextureView} of this format in the
639
652
* corresponding color attachment.
640
653
*/
641
654
format : GPUTextureFormat ;
@@ -670,12 +683,12 @@ interface GPUComputePassTimestampWrites {
670
683
*/
671
684
querySet : GPUQuerySet ;
672
685
/**
673
- * If defined indicates the query index in {@link GPURenderPassTimestampWrites#querySet} into
686
+ * If defined, indicates the query index in {@link GPURenderPassTimestampWrites#querySet} into
674
687
* which the timestamp at the beginning of the compute pass will be written.
675
688
*/
676
689
beginningOfPassWriteIndex ?: GPUSize32 ;
677
690
/**
678
- * If defined indicates the query index in {@link GPURenderPassTimestampWrites#querySet} into
691
+ * If defined, indicates the query index in {@link GPURenderPassTimestampWrites#querySet} into
679
692
* which the timestamp at the end of the compute pass will be written.
680
693
*/
681
694
endOfPassWriteIndex ?: GPUSize32 ;
@@ -769,11 +782,11 @@ interface GPUDeviceDescriptor
769
782
770
783
interface GPUExtent3DDict {
771
784
/**
772
- * The width of the extent
785
+ * The width of the extent.
773
786
*/
774
787
width : GPUIntegerCoordinate ;
775
788
/**
776
- * The height of the extent
789
+ * The height of the extent.
777
790
*/
778
791
height ?: GPUIntegerCoordinate ;
779
792
/**
@@ -816,13 +829,41 @@ interface GPUImageCopyBuffer
816
829
interface GPUImageCopyExternalImage {
817
830
/**
818
831
* The source of the image copy. The copy source data is captured at the moment that
819
- * {@link GPUQueue#copyExternalImageToTexture} is issued.
820
- */
821
- source :
822
- | ImageBitmap
823
- | HTMLVideoElement
824
- | HTMLCanvasElement
825
- | OffscreenCanvas ;
832
+ * {@link GPUQueue#copyExternalImageToTexture} is issued. Source size is defined by source
833
+ * type, given by this table:
834
+ *
835
+ * <table class=data>
836
+ * <thead>
837
+ * <tr>
838
+ * <th>Source type
839
+ * <th>Width
840
+ * <th>Height
841
+ * </thead>
842
+ * <tbody>
843
+ * <tr>
844
+ * <td>{@link ImageBitmap}
845
+ * <td>{@link ImageBitmap#width|ImageBitmap.width}
846
+ * <td>{@link ImageBitmap#height|ImageBitmap.height}
847
+ * <tr>
848
+ * <td>{@link HTMLVideoElement}
849
+ * <td>video/intrinsic width|intrinsic width of the frame
850
+ * <td>video/intrinsic height|intrinsic height of the frame
851
+ * <tr>
852
+ * <td>{@link VideoFrame}
853
+ * <td>{@link VideoFrame#codedWidth|VideoFrame.codedWidth}
854
+ * <td>{@link VideoFrame#codedHeight|VideoFrame.codedHeight}
855
+ * <tr>
856
+ * <td>{@link HTMLCanvasElement}
857
+ * <td>{@link HTMLCanvasElement#width|HTMLCanvasElement.width}
858
+ * <td>{@link HTMLCanvasElement#height|HTMLCanvasElement.height}
859
+ * <tr>
860
+ * <td>{@link OffscreenCanvas}
861
+ * <td>{@link OffscreenCanvas#width|OffscreenCanvas.width}
862
+ * <td>{@link OffscreenCanvas#height|OffscreenCanvas.height}
863
+ * </tbody>
864
+ * </table>
865
+ */
866
+ source : GPUImageCopyExternalImageSource ;
826
867
/**
827
868
* Defines the origin of the copy - the minimum (top-left) corner of the source sub-region to copy from.
828
869
* Together with `copySize`, defines the full copy sub-region.
@@ -944,7 +985,7 @@ interface GPUOrigin3DDict {
944
985
interface GPUPipelineDescriptorBase
945
986
extends GPUObjectDescriptorBase {
946
987
/**
947
- * The {@link GPUPipelineLayout} for this pipeline or {@link GPUAutoLayoutMode#"auto"}, to generate
988
+ * The {@link GPUPipelineLayout} for this pipeline, or {@link GPUAutoLayoutMode#"auto"} to generate
948
989
* the pipeline layout automatically.
949
990
* Note: If {@link GPUAutoLayoutMode#"auto"} is used the pipeline cannot share {@link GPUBindGroup}s
950
991
* with any other pipelines.
@@ -1016,6 +1057,57 @@ interface GPUProgrammableStage {
1016
1057
/**
1017
1058
* Specifies the values of pipeline-overridable constants in the shader module
1018
1059
* {@link GPUProgrammableStage#module}.
1060
+ * Each such pipeline-overridable constant is uniquely identified by a single
1061
+ * pipeline-overridable constant identifier string (representing the numeric ID of the
1062
+ * constant, if one is specified, and otherwise the constant's identifier name).
1063
+ * WGSL names (identifiers) in source maps follow the rules defined in WGSL identifier comparison.
1064
+ * The key of each key-value pair must equal the identifier string of one such constant.
1065
+ * When the pipeline is executed, that constant will have the specified value.
1066
+ * Values are specified as <dfn typedef for="">GPUPipelineConstantValue</dfn>, which is a {@link double}.
1067
+ * They are converted [$to WGSL type$] of the pipeline-overridable constant (`bool`/`i32`/`u32`/`f32`/`f16`).
1068
+ * If conversion fails, a validation error is generated.
1069
+ * <div class=example>
1070
+ * Pipeline-overridable constants defined in WGSL:
1071
+ * <pre highlight=wgsl>
1072
+ * @id (0) override has_point_light: bool = true; // Algorithmic control.
1073
+ * @id (1200) override specular_param: f32 = 2.3; // Numeric control.
1074
+ * @id (1300) override gain: f32; // Must be overridden.
1075
+ * override width: f32 = 0.0; // Specifed at the API level
1076
+ * // using the name "width".
1077
+ * override depth: f32; // Specifed at the API level
1078
+ * // using the name "depth".
1079
+ * // Must be overridden.
1080
+ * override height = 2 * depth; // The default value
1081
+ * // (if not set at the API level),
1082
+ * // depends on another
1083
+ * // overridable constant.
1084
+ * </pre>
1085
+ * Corresponding JavaScript code, providing only the overrides which are required
1086
+ * (have no defaults):
1087
+ * <pre highlight=js>
1088
+ * {
1089
+ * // ...
1090
+ * constants: {
1091
+ * 1300: 2.0, // "gain"
1092
+ * depth: -1, // "depth"
1093
+ * }
1094
+ * }
1095
+ * </pre>
1096
+ * Corresponding JavaScript code, overriding all constants:
1097
+ * <pre highlight=js>
1098
+ * {
1099
+ * // ...
1100
+ * constants: {
1101
+ * 0: false, // "has_point_light"
1102
+ * 1200: 3.0, // "specular_param"
1103
+ * 1300: 2.0, // "gain"
1104
+ * width: 20, // "width"
1105
+ * depth: -1, // "depth"
1106
+ * height: 15, // "height"
1107
+ * }
1108
+ * }
1109
+ * </pre>
1110
+ * </div>
1019
1111
*/
1020
1112
constants ?: Record <
1021
1113
string ,
@@ -1040,7 +1132,7 @@ type GPUQueueDescriptor =
1040
1132
type GPURenderBundleDescriptor =
1041
1133
GPUObjectDescriptorBase ;
1042
1134
1043
- interface GPURenderBundleEncoderDescriptor
1135
+ interface GPURenderBundleEncoderDescriptor
1044
1136
extends GPURenderPassLayout {
1045
1137
/**
1046
1138
* If `true`, indicates that the render bundle does not modify the depth component of the
@@ -1200,12 +1292,12 @@ interface GPURenderPassTimestampWrites {
1200
1292
*/
1201
1293
querySet : GPUQuerySet ;
1202
1294
/**
1203
- * If defined indicates the query index in {@link GPURenderPassTimestampWrites#querySet} into
1295
+ * If defined, indicates the query index in {@link GPURenderPassTimestampWrites#querySet} into
1204
1296
* which the timestamp at the beginning of the render pass will be written.
1205
1297
*/
1206
1298
beginningOfPassWriteIndex ?: GPUSize32 ;
1207
1299
/**
1208
- * If defined indicates the query index in {@link GPURenderPassTimestampWrites#querySet} into
1300
+ * If defined, indicates the query index in {@link GPURenderPassTimestampWrites#querySet} into
1209
1301
* which the timestamp at the end of the render pass will be written.
1210
1302
*/
1211
1303
endOfPassWriteIndex ?: GPUSize32 ;
@@ -1477,7 +1569,7 @@ interface GPUTextureDescriptor
1477
1569
* </div>
1478
1570
* Formats in this list must be texture view format compatible with the texture format.
1479
1571
* <div algorithm>
1480
- * Two {@link GPUTextureFormat}s `format` and `viewFormat` are <dfn dfn for=>texture view format compatible</dfn> if:
1572
+ * Two {@link GPUTextureFormat}s `format` and `viewFormat` are <dfn dfn for="" >texture view format compatible</dfn> if:
1481
1573
* - `format` equals `viewFormat`, or
1482
1574
* - `format` and `viewFormat` differ only in whether they are `srgb` formats (have the `-srgb` suffix).
1483
1575
* </div>
@@ -1737,7 +1829,7 @@ interface GPURenderCommandsMixin {
1737
1829
1738
1830
interface NavigatorGPU {
1739
1831
/**
1740
- * Provides access to interfaces related to WebGPU .
1832
+ * A global singleton providing top-level entry points like { @link GPU#requestAdapter} .
1741
1833
*/
1742
1834
readonly gpu : GPU ;
1743
1835
}
@@ -1900,8 +1992,8 @@ interface GPUBuffer
1900
1992
* @internal
1901
1993
*/
1902
1994
readonly __brand : "GPUBuffer" ;
1903
- readonly size : GPUSize64 ;
1904
- readonly usage : GPUBufferUsageFlags ;
1995
+ readonly size : GPUSize64Out ;
1996
+ readonly usage : GPUFlagsConstant ;
1905
1997
readonly mapState : GPUBufferMapState ;
1906
1998
/**
1907
1999
* Maps the given range of the {@link GPUBuffer} and resolves the returned {@link Promise} when the
@@ -2098,6 +2190,8 @@ interface GPUCommandEncoder
2098
2190
) : undefined ;
2099
2191
/**
2100
2192
* Writes a timestamp value into a querySet when all previous commands have completed executing.
2193
+ * Note: Timestamp query values are written in nanoseconds, but how the value is determined is
2194
+ * implementation-defined and may not increase monotonically. See [[#timestamp]] for details.
2101
2195
* @param querySet - The query set that will store the timestamp values.
2102
2196
* @param queryIndex - The index of the query in the query set.
2103
2197
*/
@@ -2562,7 +2656,7 @@ interface GPUPipelineError
2562
2656
readonly __brand : "GPUPipelineError" ;
2563
2657
/**
2564
2658
* A read-only slot-backed attribute exposing the type of error encountered in pipeline creation
2565
- * as a <dfn enum for=>GPUPipelineErrorReason</dfn>:
2659
+ * as a <dfn enum for="" >GPUPipelineErrorReason</dfn>:
2566
2660
* <ul dfn-type=enum-value dfn-for=GPUPipelineErrorReason>
2567
2661
* - <dfn>"validation"</dfn>: A [$validation error$].
2568
2662
* - <dfn>"internal"</dfn>: An [$internal error$].
@@ -2615,7 +2709,7 @@ interface GPUQuerySet
2615
2709
/**
2616
2710
* The number of queries managed by this {@link GPUQuerySet}.
2617
2711
*/
2618
- readonly count : GPUSize32 ;
2712
+ readonly count : GPUSize32Out ;
2619
2713
}
2620
2714
2621
2715
declare var GPUQuerySet : {
@@ -2761,8 +2855,8 @@ interface GPURenderPassEncoder
2761
2855
*/
2762
2856
readonly __brand : "GPURenderPassEncoder" ;
2763
2857
/**
2764
- * Sets the viewport used during the rasterization stage to linearly map from normalized device
2765
- * coordinates to viewport coordinates.
2858
+ * Sets the viewport used during the rasterization stage to linearly map from
2859
+ * NDC|normalized device coordinates to viewport coordinates.
2766
2860
* @param x - Minimum X value of the viewport in pixels.
2767
2861
* @param y - Minimum Y value of the viewport in pixels.
2768
2862
* @param width - Width of the viewport in pixels.
@@ -2965,23 +3059,23 @@ interface GPUTexture
2965
3059
/**
2966
3060
* The width of this {@link GPUTexture}.
2967
3061
*/
2968
- readonly width : GPUIntegerCoordinate ;
3062
+ readonly width : GPUIntegerCoordinateOut ;
2969
3063
/**
2970
3064
* The height of this {@link GPUTexture}.
2971
3065
*/
2972
- readonly height : GPUIntegerCoordinate ;
3066
+ readonly height : GPUIntegerCoordinateOut ;
2973
3067
/**
2974
3068
* The depth or layer count of this {@link GPUTexture}.
2975
3069
*/
2976
- readonly depthOrArrayLayers : GPUIntegerCoordinate ;
3070
+ readonly depthOrArrayLayers : GPUIntegerCoordinateOut ;
2977
3071
/**
2978
3072
* The number of mip levels of this {@link GPUTexture}.
2979
3073
*/
2980
- readonly mipLevelCount : GPUIntegerCoordinate ;
3074
+ readonly mipLevelCount : GPUIntegerCoordinateOut ;
2981
3075
/**
2982
3076
* The number of sample count of this {@link GPUTexture}.
2983
3077
*/
2984
- readonly sampleCount : GPUSize32 ;
3078
+ readonly sampleCount : GPUSize32Out ;
2985
3079
/**
2986
3080
* The dimension of the set of texel for each of this {@link GPUTexture}'s subresources.
2987
3081
*/
@@ -2993,7 +3087,7 @@ interface GPUTexture
2993
3087
/**
2994
3088
* The allowed usages for this {@link GPUTexture}.
2995
3089
*/
2996
- readonly usage : GPUTextureUsageFlags ;
3090
+ readonly usage : GPUFlagsConstant ;
2997
3091
}
2998
3092
2999
3093
declare var GPUTexture : {
0 commit comments