Skip to content

Commit fad5aab

Browse files
authored
Add GPUBuffer (#2376)
Co-authored-by: saschanaz <[email protected]>
1 parent 0f96fae commit fad5aab

17 files changed

+960
-3
lines changed

baselines/dom.generated.d.ts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14748,6 +14748,62 @@ declare var GPUBindGroupLayout: {
1474814748
new(): GPUBindGroupLayout;
1474914749
};
1475014750

14751+
/**
14752+
* The **`GPUBuffer`** interface of the WebGPU API represents a block of memory that can be used to store raw data to use in GPU operations.
14753+
* Available only in secure contexts.
14754+
*
14755+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer)
14756+
*/
14757+
interface GPUBuffer extends GPUObjectBase {
14758+
/**
14759+
* The **`mapState`** read-only property of the GPUBuffer interface represents the mapped state of the GPUBuffer.
14760+
*
14761+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/mapState)
14762+
*/
14763+
readonly mapState: GPUBufferMapState;
14764+
/**
14765+
* The **`size`** read-only property of the GPUBuffer interface represents the length of the GPUBuffer's memory allocation, in bytes.
14766+
*
14767+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/size)
14768+
*/
14769+
readonly size: GPUSize64Out;
14770+
/**
14771+
* The **`usage`** read-only property of the GPUBuffer interface contains the bitwise flags representing the allowed usages of the GPUBuffer.
14772+
*
14773+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/usage)
14774+
*/
14775+
readonly usage: GPUFlagsConstant;
14776+
/**
14777+
* The **`destroy()`** method of the GPUBuffer interface destroys the GPUBuffer.
14778+
*
14779+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/destroy)
14780+
*/
14781+
destroy(): void;
14782+
/**
14783+
* The **`getMappedRange()`** method of the GPUBuffer interface returns an ArrayBuffer containing the mapped contents of the GPUBuffer in the specified range.
14784+
*
14785+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/getMappedRange)
14786+
*/
14787+
getMappedRange(offset?: GPUSize64, size?: GPUSize64): ArrayBuffer;
14788+
/**
14789+
* The **`mapAsync()`** method of the GPUBuffer interface maps the specified range of the GPUBuffer. It returns a Promise that resolves when the GPUBuffer's content is ready to be accessed. While the GPUBuffer is mapped it cannot be used in any GPU commands.
14790+
*
14791+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/mapAsync)
14792+
*/
14793+
mapAsync(mode: GPUMapModeFlags, offset?: GPUSize64, size?: GPUSize64): Promise<void>;
14794+
/**
14795+
* The **`unmap()`** method of the GPUBuffer interface unmaps the mapped range of the GPUBuffer, making its contents available for use by the GPU again after it has previously been mapped with GPUBuffer.mapAsync() (the GPU cannot access a mapped GPUBuffer).
14796+
*
14797+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/unmap)
14798+
*/
14799+
unmap(): void;
14800+
}
14801+
14802+
declare var GPUBuffer: {
14803+
prototype: GPUBuffer;
14804+
new(): GPUBuffer;
14805+
};
14806+
1475114807
/**
1475214808
* The **`GPUCommandBuffer`** interface of the WebGPU API represents a pre-recorded list of GPU commands that can be submitted to a GPUQueue for execution.
1475314809
* Available only in secure contexts.
@@ -43000,7 +43056,10 @@ type GLuint64 = number;
4300043056
type GPUFlagsConstant = number;
4300143057
type GPUIntegerCoordinate = number;
4300243058
type GPUIntegerCoordinateOut = number;
43059+
type GPUMapModeFlags = number;
4300343060
type GPUSize32Out = number;
43061+
type GPUSize64 = number;
43062+
type GPUSize64Out = number;
4300443063
type GPUTextureUsageFlags = number;
4300543064
type HTMLOrSVGImageElement = HTMLImageElement | SVGImageElement;
4300643065
type HTMLOrSVGScriptElement = HTMLScriptElement | SVGScriptElement;
@@ -43105,6 +43164,7 @@ type FontDisplay = "auto" | "block" | "fallback" | "optional" | "swap";
4310543164
type FontFaceLoadStatus = "error" | "loaded" | "loading" | "unloaded";
4310643165
type FontFaceSetLoadStatus = "loaded" | "loading";
4310743166
type FullscreenNavigationUI = "auto" | "hide" | "show";
43167+
type GPUBufferMapState = "mapped" | "pending" | "unmapped";
4310843168
type GPUCompilationMessageType = "error" | "info" | "warning";
4310943169
type GPUDeviceLostReason = "destroyed" | "unknown";
4311043170
type GPUPipelineErrorReason = "internal" | "validation";

baselines/serviceworker.generated.d.ts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4225,6 +4225,62 @@ declare var GPUBindGroupLayout: {
42254225
new(): GPUBindGroupLayout;
42264226
};
42274227

4228+
/**
4229+
* The **`GPUBuffer`** interface of the WebGPU API represents a block of memory that can be used to store raw data to use in GPU operations.
4230+
* Available only in secure contexts.
4231+
*
4232+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer)
4233+
*/
4234+
interface GPUBuffer extends GPUObjectBase {
4235+
/**
4236+
* The **`mapState`** read-only property of the GPUBuffer interface represents the mapped state of the GPUBuffer.
4237+
*
4238+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/mapState)
4239+
*/
4240+
readonly mapState: GPUBufferMapState;
4241+
/**
4242+
* The **`size`** read-only property of the GPUBuffer interface represents the length of the GPUBuffer's memory allocation, in bytes.
4243+
*
4244+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/size)
4245+
*/
4246+
readonly size: GPUSize64Out;
4247+
/**
4248+
* The **`usage`** read-only property of the GPUBuffer interface contains the bitwise flags representing the allowed usages of the GPUBuffer.
4249+
*
4250+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/usage)
4251+
*/
4252+
readonly usage: GPUFlagsConstant;
4253+
/**
4254+
* The **`destroy()`** method of the GPUBuffer interface destroys the GPUBuffer.
4255+
*
4256+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/destroy)
4257+
*/
4258+
destroy(): void;
4259+
/**
4260+
* The **`getMappedRange()`** method of the GPUBuffer interface returns an ArrayBuffer containing the mapped contents of the GPUBuffer in the specified range.
4261+
*
4262+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/getMappedRange)
4263+
*/
4264+
getMappedRange(offset?: GPUSize64, size?: GPUSize64): ArrayBuffer;
4265+
/**
4266+
* The **`mapAsync()`** method of the GPUBuffer interface maps the specified range of the GPUBuffer. It returns a Promise that resolves when the GPUBuffer's content is ready to be accessed. While the GPUBuffer is mapped it cannot be used in any GPU commands.
4267+
*
4268+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/mapAsync)
4269+
*/
4270+
mapAsync(mode: GPUMapModeFlags, offset?: GPUSize64, size?: GPUSize64): Promise<void>;
4271+
/**
4272+
* The **`unmap()`** method of the GPUBuffer interface unmaps the mapped range of the GPUBuffer, making its contents available for use by the GPU again after it has previously been mapped with GPUBuffer.mapAsync() (the GPU cannot access a mapped GPUBuffer).
4273+
*
4274+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/unmap)
4275+
*/
4276+
unmap(): void;
4277+
}
4278+
4279+
declare var GPUBuffer: {
4280+
prototype: GPUBuffer;
4281+
new(): GPUBuffer;
4282+
};
4283+
42284284
/**
42294285
* The **`GPUCommandBuffer`** interface of the WebGPU API represents a pre-recorded list of GPU commands that can be submitted to a GPUQueue for execution.
42304286
* Available only in secure contexts.
@@ -12302,7 +12358,10 @@ type GLuint64 = number;
1230212358
type GPUFlagsConstant = number;
1230312359
type GPUIntegerCoordinate = number;
1230412360
type GPUIntegerCoordinateOut = number;
12361+
type GPUMapModeFlags = number;
1230512362
type GPUSize32Out = number;
12363+
type GPUSize64 = number;
12364+
type GPUSize64Out = number;
1230612365
type GPUTextureUsageFlags = number;
1230712366
type HashAlgorithmIdentifier = AlgorithmIdentifier;
1230812367
type HeadersInit = [string, string][] | Record<string, string> | Headers;
@@ -12352,6 +12411,7 @@ type FontDisplay = "auto" | "block" | "fallback" | "optional" | "swap";
1235212411
type FontFaceLoadStatus = "error" | "loaded" | "loading" | "unloaded";
1235312412
type FontFaceSetLoadStatus = "loaded" | "loading";
1235412413
type FrameType = "auxiliary" | "nested" | "none" | "top-level";
12414+
type GPUBufferMapState = "mapped" | "pending" | "unmapped";
1235512415
type GPUCompilationMessageType = "error" | "info" | "warning";
1235612416
type GPUDeviceLostReason = "destroyed" | "unknown";
1235712417
type GPUPipelineErrorReason = "internal" | "validation";

baselines/sharedworker.generated.d.ts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3908,6 +3908,62 @@ declare var GPUBindGroupLayout: {
39083908
new(): GPUBindGroupLayout;
39093909
};
39103910

3911+
/**
3912+
* The **`GPUBuffer`** interface of the WebGPU API represents a block of memory that can be used to store raw data to use in GPU operations.
3913+
* Available only in secure contexts.
3914+
*
3915+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer)
3916+
*/
3917+
interface GPUBuffer extends GPUObjectBase {
3918+
/**
3919+
* The **`mapState`** read-only property of the GPUBuffer interface represents the mapped state of the GPUBuffer.
3920+
*
3921+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/mapState)
3922+
*/
3923+
readonly mapState: GPUBufferMapState;
3924+
/**
3925+
* The **`size`** read-only property of the GPUBuffer interface represents the length of the GPUBuffer's memory allocation, in bytes.
3926+
*
3927+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/size)
3928+
*/
3929+
readonly size: GPUSize64Out;
3930+
/**
3931+
* The **`usage`** read-only property of the GPUBuffer interface contains the bitwise flags representing the allowed usages of the GPUBuffer.
3932+
*
3933+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/usage)
3934+
*/
3935+
readonly usage: GPUFlagsConstant;
3936+
/**
3937+
* The **`destroy()`** method of the GPUBuffer interface destroys the GPUBuffer.
3938+
*
3939+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/destroy)
3940+
*/
3941+
destroy(): void;
3942+
/**
3943+
* The **`getMappedRange()`** method of the GPUBuffer interface returns an ArrayBuffer containing the mapped contents of the GPUBuffer in the specified range.
3944+
*
3945+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/getMappedRange)
3946+
*/
3947+
getMappedRange(offset?: GPUSize64, size?: GPUSize64): ArrayBuffer;
3948+
/**
3949+
* The **`mapAsync()`** method of the GPUBuffer interface maps the specified range of the GPUBuffer. It returns a Promise that resolves when the GPUBuffer's content is ready to be accessed. While the GPUBuffer is mapped it cannot be used in any GPU commands.
3950+
*
3951+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/mapAsync)
3952+
*/
3953+
mapAsync(mode: GPUMapModeFlags, offset?: GPUSize64, size?: GPUSize64): Promise<void>;
3954+
/**
3955+
* The **`unmap()`** method of the GPUBuffer interface unmaps the mapped range of the GPUBuffer, making its contents available for use by the GPU again after it has previously been mapped with GPUBuffer.mapAsync() (the GPU cannot access a mapped GPUBuffer).
3956+
*
3957+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/unmap)
3958+
*/
3959+
unmap(): void;
3960+
}
3961+
3962+
declare var GPUBuffer: {
3963+
prototype: GPUBuffer;
3964+
new(): GPUBuffer;
3965+
};
3966+
39113967
/**
39123968
* The **`GPUCommandBuffer`** interface of the WebGPU API represents a pre-recorded list of GPU commands that can be submitted to a GPUQueue for execution.
39133969
* Available only in secure contexts.
@@ -11972,7 +12028,10 @@ type GLuint64 = number;
1197212028
type GPUFlagsConstant = number;
1197312029
type GPUIntegerCoordinate = number;
1197412030
type GPUIntegerCoordinateOut = number;
12031+
type GPUMapModeFlags = number;
1197512032
type GPUSize32Out = number;
12033+
type GPUSize64 = number;
12034+
type GPUSize64Out = number;
1197612035
type GPUTextureUsageFlags = number;
1197712036
type HashAlgorithmIdentifier = AlgorithmIdentifier;
1197812037
type HeadersInit = [string, string][] | Record<string, string> | Headers;
@@ -12018,6 +12077,7 @@ type FileSystemHandleKind = "directory" | "file";
1201812077
type FontDisplay = "auto" | "block" | "fallback" | "optional" | "swap";
1201912078
type FontFaceLoadStatus = "error" | "loaded" | "loading" | "unloaded";
1202012079
type FontFaceSetLoadStatus = "loaded" | "loading";
12080+
type GPUBufferMapState = "mapped" | "pending" | "unmapped";
1202112081
type GPUCompilationMessageType = "error" | "info" | "warning";
1202212082
type GPUDeviceLostReason = "destroyed" | "unknown";
1202312083
type GPUPipelineErrorReason = "internal" | "validation";

baselines/ts5.5/dom.generated.d.ts

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14734,6 +14734,62 @@ declare var GPUBindGroupLayout: {
1473414734
new(): GPUBindGroupLayout;
1473514735
};
1473614736

14737+
/**
14738+
* The **`GPUBuffer`** interface of the WebGPU API represents a block of memory that can be used to store raw data to use in GPU operations.
14739+
* Available only in secure contexts.
14740+
*
14741+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer)
14742+
*/
14743+
interface GPUBuffer extends GPUObjectBase {
14744+
/**
14745+
* The **`mapState`** read-only property of the GPUBuffer interface represents the mapped state of the GPUBuffer.
14746+
*
14747+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/mapState)
14748+
*/
14749+
readonly mapState: GPUBufferMapState;
14750+
/**
14751+
* The **`size`** read-only property of the GPUBuffer interface represents the length of the GPUBuffer's memory allocation, in bytes.
14752+
*
14753+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/size)
14754+
*/
14755+
readonly size: GPUSize64Out;
14756+
/**
14757+
* The **`usage`** read-only property of the GPUBuffer interface contains the bitwise flags representing the allowed usages of the GPUBuffer.
14758+
*
14759+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/usage)
14760+
*/
14761+
readonly usage: GPUFlagsConstant;
14762+
/**
14763+
* The **`destroy()`** method of the GPUBuffer interface destroys the GPUBuffer.
14764+
*
14765+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/destroy)
14766+
*/
14767+
destroy(): void;
14768+
/**
14769+
* The **`getMappedRange()`** method of the GPUBuffer interface returns an ArrayBuffer containing the mapped contents of the GPUBuffer in the specified range.
14770+
*
14771+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/getMappedRange)
14772+
*/
14773+
getMappedRange(offset?: GPUSize64, size?: GPUSize64): ArrayBuffer;
14774+
/**
14775+
* The **`mapAsync()`** method of the GPUBuffer interface maps the specified range of the GPUBuffer. It returns a Promise that resolves when the GPUBuffer's content is ready to be accessed. While the GPUBuffer is mapped it cannot be used in any GPU commands.
14776+
*
14777+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/mapAsync)
14778+
*/
14779+
mapAsync(mode: GPUMapModeFlags, offset?: GPUSize64, size?: GPUSize64): Promise<void>;
14780+
/**
14781+
* The **`unmap()`** method of the GPUBuffer interface unmaps the mapped range of the GPUBuffer, making its contents available for use by the GPU again after it has previously been mapped with GPUBuffer.mapAsync() (the GPU cannot access a mapped GPUBuffer).
14782+
*
14783+
* [MDN Reference](https://developer.mozilla.org/docs/Web/API/GPUBuffer/unmap)
14784+
*/
14785+
unmap(): void;
14786+
}
14787+
14788+
declare var GPUBuffer: {
14789+
prototype: GPUBuffer;
14790+
new(): GPUBuffer;
14791+
};
14792+
1473714793
/**
1473814794
* The **`GPUCommandBuffer`** interface of the WebGPU API represents a pre-recorded list of GPU commands that can be submitted to a GPUQueue for execution.
1473914795
* Available only in secure contexts.
@@ -42974,7 +43030,10 @@ type GLuint64 = number;
4297443030
type GPUFlagsConstant = number;
4297543031
type GPUIntegerCoordinate = number;
4297643032
type GPUIntegerCoordinateOut = number;
43033+
type GPUMapModeFlags = number;
4297743034
type GPUSize32Out = number;
43035+
type GPUSize64 = number;
43036+
type GPUSize64Out = number;
4297843037
type GPUTextureUsageFlags = number;
4297943038
type HTMLOrSVGImageElement = HTMLImageElement | SVGImageElement;
4298043039
type HTMLOrSVGScriptElement = HTMLScriptElement | SVGScriptElement;
@@ -43079,6 +43138,7 @@ type FontDisplay = "auto" | "block" | "fallback" | "optional" | "swap";
4307943138
type FontFaceLoadStatus = "error" | "loaded" | "loading" | "unloaded";
4308043139
type FontFaceSetLoadStatus = "loaded" | "loading";
4308143140
type FullscreenNavigationUI = "auto" | "hide" | "show";
43141+
type GPUBufferMapState = "mapped" | "pending" | "unmapped";
4308243142
type GPUCompilationMessageType = "error" | "info" | "warning";
4308343143
type GPUDeviceLostReason = "destroyed" | "unknown";
4308443144
type GPUPipelineErrorReason = "internal" | "validation";

0 commit comments

Comments
 (0)