Skip to content

Commit f5fb928

Browse files
authored
Add GPUDevice.createBindGroupLayout (#2421)
Co-authored-by: saschanaz <saschanaz@users.noreply.github.com>
1 parent 4d7a1cd commit f5fb928

17 files changed

+800
-7
lines changed

baselines/dom.generated.d.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -815,6 +815,20 @@ interface GPUBindGroupEntry {
815815
resource: GPUBindingResource;
816816
}
817817

818+
interface GPUBindGroupLayoutDescriptor extends GPUObjectDescriptorBase {
819+
entries: GPUBindGroupLayoutEntry[];
820+
}
821+
822+
interface GPUBindGroupLayoutEntry {
823+
binding: GPUIndex32;
824+
buffer?: GPUBufferBindingLayout;
825+
externalTexture?: GPUExternalTextureBindingLayout;
826+
sampler?: GPUSamplerBindingLayout;
827+
storageTexture?: GPUStorageTextureBindingLayout;
828+
texture?: GPUTextureBindingLayout;
829+
visibility: GPUShaderStageFlags;
830+
}
831+
818832
interface GPUBlendComponent {
819833
dstFactor?: GPUBlendFactor;
820834
operation?: GPUBlendOperation;
@@ -832,6 +846,12 @@ interface GPUBufferBinding {
832846
size?: GPUSize64;
833847
}
834848

849+
interface GPUBufferBindingLayout {
850+
hasDynamicOffset?: boolean;
851+
minBindingSize?: GPUSize64;
852+
type?: GPUBufferBindingType;
853+
}
854+
835855
interface GPUBufferDescriptor extends GPUObjectDescriptorBase {
836856
mappedAtCreation?: boolean;
837857
size: GPUSize64;
@@ -915,6 +935,9 @@ interface GPUExtent3DDict {
915935
width: GPUIntegerCoordinate;
916936
}
917937

938+
interface GPUExternalTextureBindingLayout {
939+
}
940+
918941
interface GPUExternalTextureDescriptor extends GPUObjectDescriptorBase {
919942
colorSpace?: PredefinedColorSpace;
920943
source: HTMLVideoElement | VideoFrame;
@@ -1033,6 +1056,10 @@ interface GPURenderPipelineDescriptor extends GPUPipelineDescriptorBase {
10331056
vertex: GPUVertexState;
10341057
}
10351058

1059+
interface GPUSamplerBindingLayout {
1060+
type?: GPUSamplerBindingType;
1061+
}
1062+
10361063
interface GPUSamplerDescriptor extends GPUObjectDescriptorBase {
10371064
addressModeU?: GPUAddressMode;
10381065
addressModeV?: GPUAddressMode;
@@ -1057,6 +1084,12 @@ interface GPUStencilFaceState {
10571084
passOp?: GPUStencilOperation;
10581085
}
10591086

1087+
interface GPUStorageTextureBindingLayout {
1088+
access?: GPUStorageTextureAccess;
1089+
format: GPUTextureFormat;
1090+
viewDimension?: GPUTextureViewDimension;
1091+
}
1092+
10601093
interface GPUTexelCopyBufferInfo extends GPUTexelCopyBufferLayout {
10611094
buffer: GPUBuffer;
10621095
}
@@ -1074,6 +1107,12 @@ interface GPUTexelCopyTextureInfo {
10741107
texture: GPUTexture;
10751108
}
10761109

1110+
interface GPUTextureBindingLayout {
1111+
multisampled?: boolean;
1112+
sampleType?: GPUTextureSampleType;
1113+
viewDimension?: GPUTextureViewDimension;
1114+
}
1115+
10771116
interface GPUTextureDescriptor extends GPUObjectDescriptorBase {
10781117
dimension?: GPUTextureDimension;
10791118
format: GPUTextureFormat;
@@ -15497,6 +15536,12 @@ interface GPUDevice extends EventTarget, GPUObjectBase {
1549715536
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/createBindGroup)
1549815537
*/
1549915538
createBindGroup(descriptor: GPUBindGroupDescriptor): GPUBindGroup;
15539+
/**
15540+
* The **`createBindGroupLayout()`** method of the GPUDevice interface creates a GPUBindGroupLayout that defines the structure and purpose of related GPU resources such as buffers that will be used in a pipeline, and is used as a template when creating GPUBindGroups.
15541+
*
15542+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/createBindGroupLayout)
15543+
*/
15544+
createBindGroupLayout(descriptor: GPUBindGroupLayoutDescriptor): GPUBindGroupLayout;
1550015545
/**
1550115546
* The **`createBuffer()`** method of the GPUDevice interface creates a GPUBuffer in which to store raw data to use in GPU operations.
1550215547
*
@@ -44033,6 +44078,7 @@ type GPUOrigin2D = GPUIntegerCoordinate[] | GPUOrigin2DDict;
4403344078
type GPUOrigin3D = GPUIntegerCoordinate[] | GPUOrigin3DDict;
4403444079
type GPUPipelineConstantValue = number;
4403544080
type GPUSampleMask = number;
44081+
type GPUShaderStageFlags = number;
4403644082
type GPUSignedOffset32 = number;
4403744083
type GPUSize32 = number;
4403844084
type GPUSize32Out = number;
@@ -44150,6 +44196,7 @@ type GPUAddressMode = "clamp-to-edge" | "mirror-repeat" | "repeat";
4415044196
type GPUAutoLayoutMode = "auto";
4415144197
type GPUBlendFactor = "constant" | "dst" | "dst-alpha" | "one" | "one-minus-constant" | "one-minus-dst" | "one-minus-dst-alpha" | "one-minus-src" | "one-minus-src-alpha" | "src" | "src-alpha" | "src-alpha-saturated" | "zero";
4415244198
type GPUBlendOperation = "add" | "max" | "min" | "reverse-subtract" | "subtract";
44199+
type GPUBufferBindingType = "read-only-storage" | "storage" | "uniform";
4415344200
type GPUBufferMapState = "mapped" | "pending" | "unmapped";
4415444201
type GPUCanvasAlphaMode = "opaque" | "premultiplied";
4415544202
type GPUCanvasToneMappingMode = "extended" | "standard";
@@ -44166,11 +44213,14 @@ type GPUMipmapFilterMode = "linear" | "nearest";
4416644213
type GPUPipelineErrorReason = "internal" | "validation";
4416744214
type GPUPrimitiveTopology = "line-list" | "line-strip" | "point-list" | "triangle-list" | "triangle-strip";
4416844215
type GPUQueryType = "occlusion" | "timestamp";
44216+
type GPUSamplerBindingType = "comparison" | "filtering" | "non-filtering";
4416944217
type GPUStencilOperation = "decrement-clamp" | "decrement-wrap" | "increment-clamp" | "increment-wrap" | "invert" | "keep" | "replace" | "zero";
44218+
type GPUStorageTextureAccess = "read-only" | "read-write" | "write-only";
4417044219
type GPUStoreOp = "discard" | "store";
4417144220
type GPUTextureAspect = "all" | "depth-only" | "stencil-only";
4417244221
type GPUTextureDimension = "1d" | "2d" | "3d";
4417344222
type GPUTextureFormat = "astc-10x10-unorm" | "astc-10x10-unorm-srgb" | "astc-10x5-unorm" | "astc-10x5-unorm-srgb" | "astc-10x6-unorm" | "astc-10x6-unorm-srgb" | "astc-10x8-unorm" | "astc-10x8-unorm-srgb" | "astc-12x10-unorm" | "astc-12x10-unorm-srgb" | "astc-12x12-unorm" | "astc-12x12-unorm-srgb" | "astc-4x4-unorm" | "astc-4x4-unorm-srgb" | "astc-5x4-unorm" | "astc-5x4-unorm-srgb" | "astc-5x5-unorm" | "astc-5x5-unorm-srgb" | "astc-6x5-unorm" | "astc-6x5-unorm-srgb" | "astc-6x6-unorm" | "astc-6x6-unorm-srgb" | "astc-8x5-unorm" | "astc-8x5-unorm-srgb" | "astc-8x6-unorm" | "astc-8x6-unorm-srgb" | "astc-8x8-unorm" | "astc-8x8-unorm-srgb" | "bc1-rgba-unorm" | "bc1-rgba-unorm-srgb" | "bc2-rgba-unorm" | "bc2-rgba-unorm-srgb" | "bc3-rgba-unorm" | "bc3-rgba-unorm-srgb" | "bc4-r-snorm" | "bc4-r-unorm" | "bc5-rg-snorm" | "bc5-rg-unorm" | "bc6h-rgb-float" | "bc6h-rgb-ufloat" | "bc7-rgba-unorm" | "bc7-rgba-unorm-srgb" | "bgra8unorm" | "bgra8unorm-srgb" | "depth16unorm" | "depth24plus" | "depth24plus-stencil8" | "depth32float" | "depth32float-stencil8" | "eac-r11snorm" | "eac-r11unorm" | "eac-rg11snorm" | "eac-rg11unorm" | "etc2-rgb8a1unorm" | "etc2-rgb8a1unorm-srgb" | "etc2-rgb8unorm" | "etc2-rgb8unorm-srgb" | "etc2-rgba8unorm" | "etc2-rgba8unorm-srgb" | "r16float" | "r16sint" | "r16snorm" | "r16uint" | "r16unorm" | "r32float" | "r32sint" | "r32uint" | "r8sint" | "r8snorm" | "r8uint" | "r8unorm" | "rg11b10ufloat" | "rg16float" | "rg16sint" | "rg16snorm" | "rg16uint" | "rg16unorm" | "rg32float" | "rg32sint" | "rg32uint" | "rg8sint" | "rg8snorm" | "rg8uint" | "rg8unorm" | "rgb10a2uint" | "rgb10a2unorm" | "rgb9e5ufloat" | "rgba16float" | "rgba16sint" | "rgba16snorm" | "rgba16uint" | "rgba16unorm" | "rgba32float" | "rgba32sint" | "rgba32uint" | "rgba8sint" | "rgba8snorm" | "rgba8uint" | "rgba8unorm" | "rgba8unorm-srgb" | "stencil8";
44223+
type GPUTextureSampleType = "depth" | "float" | "sint" | "uint" | "unfilterable-float";
4417444224
type GPUTextureViewDimension = "1d" | "2d" | "2d-array" | "3d" | "cube" | "cube-array";
4417544225
type GPUVertexFormat = "float16" | "float16x2" | "float16x4" | "float32" | "float32x2" | "float32x3" | "float32x4" | "sint16" | "sint16x2" | "sint16x4" | "sint32" | "sint32x2" | "sint32x3" | "sint32x4" | "sint8" | "sint8x2" | "sint8x4" | "snorm16" | "snorm16x2" | "snorm16x4" | "snorm8" | "snorm8x2" | "snorm8x4" | "uint16" | "uint16x2" | "uint16x4" | "uint32" | "uint32x2" | "uint32x3" | "uint32x4" | "uint8" | "uint8x2" | "uint8x4" | "unorm10-10-10-2" | "unorm16" | "unorm16x2" | "unorm16x4" | "unorm8" | "unorm8x2" | "unorm8x4" | "unorm8x4-bgra";
4417644226
type GPUVertexStepMode = "instance" | "vertex";

baselines/serviceworker.generated.d.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,20 @@ interface GPUBindGroupEntry {
282282
resource: GPUBindingResource;
283283
}
284284

285+
interface GPUBindGroupLayoutDescriptor extends GPUObjectDescriptorBase {
286+
entries: GPUBindGroupLayoutEntry[];
287+
}
288+
289+
interface GPUBindGroupLayoutEntry {
290+
binding: GPUIndex32;
291+
buffer?: GPUBufferBindingLayout;
292+
externalTexture?: GPUExternalTextureBindingLayout;
293+
sampler?: GPUSamplerBindingLayout;
294+
storageTexture?: GPUStorageTextureBindingLayout;
295+
texture?: GPUTextureBindingLayout;
296+
visibility: GPUShaderStageFlags;
297+
}
298+
285299
interface GPUBlendComponent {
286300
dstFactor?: GPUBlendFactor;
287301
operation?: GPUBlendOperation;
@@ -299,6 +313,12 @@ interface GPUBufferBinding {
299313
size?: GPUSize64;
300314
}
301315

316+
interface GPUBufferBindingLayout {
317+
hasDynamicOffset?: boolean;
318+
minBindingSize?: GPUSize64;
319+
type?: GPUBufferBindingType;
320+
}
321+
302322
interface GPUBufferDescriptor extends GPUObjectDescriptorBase {
303323
mappedAtCreation?: boolean;
304324
size: GPUSize64;
@@ -382,6 +402,9 @@ interface GPUExtent3DDict {
382402
width: GPUIntegerCoordinate;
383403
}
384404

405+
interface GPUExternalTextureBindingLayout {
406+
}
407+
385408
interface GPUExternalTextureDescriptor extends GPUObjectDescriptorBase {
386409
colorSpace?: PredefinedColorSpace;
387410
}
@@ -499,6 +522,10 @@ interface GPURenderPipelineDescriptor extends GPUPipelineDescriptorBase {
499522
vertex: GPUVertexState;
500523
}
501524

525+
interface GPUSamplerBindingLayout {
526+
type?: GPUSamplerBindingType;
527+
}
528+
502529
interface GPUSamplerDescriptor extends GPUObjectDescriptorBase {
503530
addressModeU?: GPUAddressMode;
504531
addressModeV?: GPUAddressMode;
@@ -523,6 +550,12 @@ interface GPUStencilFaceState {
523550
passOp?: GPUStencilOperation;
524551
}
525552

553+
interface GPUStorageTextureBindingLayout {
554+
access?: GPUStorageTextureAccess;
555+
format: GPUTextureFormat;
556+
viewDimension?: GPUTextureViewDimension;
557+
}
558+
526559
interface GPUTexelCopyBufferInfo extends GPUTexelCopyBufferLayout {
527560
buffer: GPUBuffer;
528561
}
@@ -540,6 +573,12 @@ interface GPUTexelCopyTextureInfo {
540573
texture: GPUTexture;
541574
}
542575

576+
interface GPUTextureBindingLayout {
577+
multisampled?: boolean;
578+
sampleType?: GPUTextureSampleType;
579+
viewDimension?: GPUTextureViewDimension;
580+
}
581+
543582
interface GPUTextureDescriptor extends GPUObjectDescriptorBase {
544583
dimension?: GPUTextureDimension;
545584
format: GPUTextureFormat;
@@ -4936,6 +4975,12 @@ interface GPUDevice extends EventTarget, GPUObjectBase {
49364975
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/createBindGroup)
49374976
*/
49384977
createBindGroup(descriptor: GPUBindGroupDescriptor): GPUBindGroup;
4978+
/**
4979+
* The **`createBindGroupLayout()`** method of the GPUDevice interface creates a GPUBindGroupLayout that defines the structure and purpose of related GPU resources such as buffers that will be used in a pipeline, and is used as a template when creating GPUBindGroups.
4980+
*
4981+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUDevice/createBindGroupLayout)
4982+
*/
4983+
createBindGroupLayout(descriptor: GPUBindGroupLayoutDescriptor): GPUBindGroupLayout;
49394984
/**
49404985
* The **`createBuffer()`** method of the GPUDevice interface creates a GPUBuffer in which to store raw data to use in GPU operations.
49414986
*
@@ -13200,6 +13245,7 @@ type GPUOrigin2D = GPUIntegerCoordinate[] | GPUOrigin2DDict;
1320013245
type GPUOrigin3D = GPUIntegerCoordinate[] | GPUOrigin3DDict;
1320113246
type GPUPipelineConstantValue = number;
1320213247
type GPUSampleMask = number;
13248+
type GPUShaderStageFlags = number;
1320313249
type GPUSignedOffset32 = number;
1320413250
type GPUSize32 = number;
1320513251
type GPUSize32Out = number;
@@ -13259,6 +13305,7 @@ type GPUAddressMode = "clamp-to-edge" | "mirror-repeat" | "repeat";
1325913305
type GPUAutoLayoutMode = "auto";
1326013306
type GPUBlendFactor = "constant" | "dst" | "dst-alpha" | "one" | "one-minus-constant" | "one-minus-dst" | "one-minus-dst-alpha" | "one-minus-src" | "one-minus-src-alpha" | "src" | "src-alpha" | "src-alpha-saturated" | "zero";
1326113307
type GPUBlendOperation = "add" | "max" | "min" | "reverse-subtract" | "subtract";
13308+
type GPUBufferBindingType = "read-only-storage" | "storage" | "uniform";
1326213309
type GPUBufferMapState = "mapped" | "pending" | "unmapped";
1326313310
type GPUCanvasAlphaMode = "opaque" | "premultiplied";
1326413311
type GPUCanvasToneMappingMode = "extended" | "standard";
@@ -13275,11 +13322,14 @@ type GPUMipmapFilterMode = "linear" | "nearest";
1327513322
type GPUPipelineErrorReason = "internal" | "validation";
1327613323
type GPUPrimitiveTopology = "line-list" | "line-strip" | "point-list" | "triangle-list" | "triangle-strip";
1327713324
type GPUQueryType = "occlusion" | "timestamp";
13325+
type GPUSamplerBindingType = "comparison" | "filtering" | "non-filtering";
1327813326
type GPUStencilOperation = "decrement-clamp" | "decrement-wrap" | "increment-clamp" | "increment-wrap" | "invert" | "keep" | "replace" | "zero";
13327+
type GPUStorageTextureAccess = "read-only" | "read-write" | "write-only";
1327913328
type GPUStoreOp = "discard" | "store";
1328013329
type GPUTextureAspect = "all" | "depth-only" | "stencil-only";
1328113330
type GPUTextureDimension = "1d" | "2d" | "3d";
1328213331
type GPUTextureFormat = "astc-10x10-unorm" | "astc-10x10-unorm-srgb" | "astc-10x5-unorm" | "astc-10x5-unorm-srgb" | "astc-10x6-unorm" | "astc-10x6-unorm-srgb" | "astc-10x8-unorm" | "astc-10x8-unorm-srgb" | "astc-12x10-unorm" | "astc-12x10-unorm-srgb" | "astc-12x12-unorm" | "astc-12x12-unorm-srgb" | "astc-4x4-unorm" | "astc-4x4-unorm-srgb" | "astc-5x4-unorm" | "astc-5x4-unorm-srgb" | "astc-5x5-unorm" | "astc-5x5-unorm-srgb" | "astc-6x5-unorm" | "astc-6x5-unorm-srgb" | "astc-6x6-unorm" | "astc-6x6-unorm-srgb" | "astc-8x5-unorm" | "astc-8x5-unorm-srgb" | "astc-8x6-unorm" | "astc-8x6-unorm-srgb" | "astc-8x8-unorm" | "astc-8x8-unorm-srgb" | "bc1-rgba-unorm" | "bc1-rgba-unorm-srgb" | "bc2-rgba-unorm" | "bc2-rgba-unorm-srgb" | "bc3-rgba-unorm" | "bc3-rgba-unorm-srgb" | "bc4-r-snorm" | "bc4-r-unorm" | "bc5-rg-snorm" | "bc5-rg-unorm" | "bc6h-rgb-float" | "bc6h-rgb-ufloat" | "bc7-rgba-unorm" | "bc7-rgba-unorm-srgb" | "bgra8unorm" | "bgra8unorm-srgb" | "depth16unorm" | "depth24plus" | "depth24plus-stencil8" | "depth32float" | "depth32float-stencil8" | "eac-r11snorm" | "eac-r11unorm" | "eac-rg11snorm" | "eac-rg11unorm" | "etc2-rgb8a1unorm" | "etc2-rgb8a1unorm-srgb" | "etc2-rgb8unorm" | "etc2-rgb8unorm-srgb" | "etc2-rgba8unorm" | "etc2-rgba8unorm-srgb" | "r16float" | "r16sint" | "r16snorm" | "r16uint" | "r16unorm" | "r32float" | "r32sint" | "r32uint" | "r8sint" | "r8snorm" | "r8uint" | "r8unorm" | "rg11b10ufloat" | "rg16float" | "rg16sint" | "rg16snorm" | "rg16uint" | "rg16unorm" | "rg32float" | "rg32sint" | "rg32uint" | "rg8sint" | "rg8snorm" | "rg8uint" | "rg8unorm" | "rgb10a2uint" | "rgb10a2unorm" | "rgb9e5ufloat" | "rgba16float" | "rgba16sint" | "rgba16snorm" | "rgba16uint" | "rgba16unorm" | "rgba32float" | "rgba32sint" | "rgba32uint" | "rgba8sint" | "rgba8snorm" | "rgba8uint" | "rgba8unorm" | "rgba8unorm-srgb" | "stencil8";
13332+
type GPUTextureSampleType = "depth" | "float" | "sint" | "uint" | "unfilterable-float";
1328313333
type GPUTextureViewDimension = "1d" | "2d" | "2d-array" | "3d" | "cube" | "cube-array";
1328413334
type GPUVertexFormat = "float16" | "float16x2" | "float16x4" | "float32" | "float32x2" | "float32x3" | "float32x4" | "sint16" | "sint16x2" | "sint16x4" | "sint32" | "sint32x2" | "sint32x3" | "sint32x4" | "sint8" | "sint8x2" | "sint8x4" | "snorm16" | "snorm16x2" | "snorm16x4" | "snorm8" | "snorm8x2" | "snorm8x4" | "uint16" | "uint16x2" | "uint16x4" | "uint32" | "uint32x2" | "uint32x3" | "uint32x4" | "uint8" | "uint8x2" | "uint8x4" | "unorm10-10-10-2" | "unorm16" | "unorm16x2" | "unorm16x4" | "unorm8" | "unorm8x2" | "unorm8x4" | "unorm8x4-bgra";
1328513335
type GPUVertexStepMode = "instance" | "vertex";

0 commit comments

Comments
 (0)