-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CR Request for WebGPU and WebGPU Shading Language - webgpu / WGSL #676
Comments
We're checking with the Privacy WG regarding gpuweb/gpuweb#3101 . |
Latest horizontal reviews date back to 2022 and there has been a lot of changes since then. Were the latest substantive changes reviewed? |
The changes have not been reviewed. Virtually all of the substantive updates since 2022 were "low-level", at least compared to the level at which horizontal reviews usually operate. Main updates were:
To help assess the udpates, see below for a diff of the IDL since July 2022, computed using data in Webref. Another useful source of changes is the What's new in WebGPU blog series that lists implementation updates in Chrome versions since roughly the same date. IDL diff since July 2022diff --git a/ed/idl/webgpu.idl b/ed/idl/webgpu.idl
index 16db18674..401d2ec69 100644
--- a/ed/idl/webgpu.idl
+++ b/ed/idl/webgpu.idl
@@ -8,16 +8,18 @@ interface mixin GPUObjectBase {
};
dictionary GPUObjectDescriptorBase {
- USVString label;
+ USVString label = "";
};
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPUSupportedLimits {
readonly attribute unsigned long maxTextureDimension1D;
readonly attribute unsigned long maxTextureDimension2D;
readonly attribute unsigned long maxTextureDimension3D;
readonly attribute unsigned long maxTextureArrayLayers;
readonly attribute unsigned long maxBindGroups;
+ readonly attribute unsigned long maxBindGroupsPlusVertexBuffers;
+ readonly attribute unsigned long maxBindingsPerBindGroup;
readonly attribute unsigned long maxDynamicUniformBuffersPerPipelineLayout;
readonly attribute unsigned long maxDynamicStorageBuffersPerPipelineLayout;
readonly attribute unsigned long maxSampledTexturesPerShaderStage;
@@ -30,11 +32,12 @@ interface GPUSupportedLimits {
readonly attribute unsigned long minUniformBufferOffsetAlignment;
readonly attribute unsigned long minStorageBufferOffsetAlignment;
readonly attribute unsigned long maxVertexBuffers;
+ readonly attribute unsigned long long maxBufferSize;
readonly attribute unsigned long maxVertexAttributes;
readonly attribute unsigned long maxVertexBufferArrayStride;
- readonly attribute unsigned long maxInterStageShaderComponents;
readonly attribute unsigned long maxInterStageShaderVariables;
readonly attribute unsigned long maxColorAttachments;
+ readonly attribute unsigned long maxColorAttachmentBytesPerSample;
readonly attribute unsigned long maxComputeWorkgroupStorageSize;
readonly attribute unsigned long maxComputeInvocationsPerWorkgroup;
readonly attribute unsigned long maxComputeWorkgroupSizeX;
@@ -43,12 +46,17 @@ interface GPUSupportedLimits {
readonly attribute unsigned long maxComputeWorkgroupsPerDimension;
};
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPUSupportedFeatures {
readonly setlike<DOMString>;
};
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
+interface WGSLLanguageFeatures {
+ readonly setlike<DOMString>;
+};
+
+[Exposed=(Window, Worker), SecureContext]
interface GPUAdapterInfo {
readonly attribute DOMString vendor;
readonly attribute DOMString architecture;
@@ -62,35 +70,39 @@ interface mixin NavigatorGPU {
Navigator includes NavigatorGPU;
WorkerNavigator includes NavigatorGPU;
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPU {
Promise<GPUAdapter?> requestAdapter(optional GPURequestAdapterOptions options = {});
GPUTextureFormat getPreferredCanvasFormat();
+ [SameObject] readonly attribute WGSLLanguageFeatures wgslLanguageFeatures;
};
dictionary GPURequestAdapterOptions {
+ DOMString featureLevel = "core";
GPUPowerPreference powerPreference;
boolean forceFallbackAdapter = false;
+ boolean xrCompatible = false;
};
enum GPUPowerPreference {
"low-power",
- "high-performance"
+ "high-performance",
};
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPUAdapter {
[SameObject] readonly attribute GPUSupportedFeatures features;
[SameObject] readonly attribute GPUSupportedLimits limits;
+ [SameObject] readonly attribute GPUAdapterInfo info;
readonly attribute boolean isFallbackAdapter;
Promise<GPUDevice> requestDevice(optional GPUDeviceDescriptor descriptor = {});
- Promise<GPUAdapterInfo> requestAdapterInfo(optional sequence<DOMString> unmaskHints = []);
};
-dictionary GPUDeviceDescriptor : GPUObjectDescriptorBase {
+dictionary GPUDeviceDescriptor
+ : GPUObjectDescriptorBase {
sequence<GPUFeatureName> requiredFeatures = [];
- record<DOMString, GPUSize64> requiredLimits = {};
+ record<DOMString, (GPUSize64 or undefined)> requiredLimits = {};
GPUQueueDescriptor defaultQueue = {};
};
@@ -98,19 +110,26 @@ enum GPUFeatureName {
"depth-clip-control",
"depth32float-stencil8",
"texture-compression-bc",
+ "texture-compression-bc-sliced-3d",
"texture-compression-etc2",
"texture-compression-astc",
+ "texture-compression-astc-sliced-3d",
"timestamp-query",
"indirect-first-instance",
"shader-f16",
+ "rg11b10ufloat-renderable",
"bgra8unorm-storage",
- "rg11b10ufloat-renderable"
+ "float32-filterable",
+ "float32-blendable",
+ "clip-distances",
+ "dual-source-blending",
};
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPUDevice : EventTarget {
[SameObject] readonly attribute GPUSupportedFeatures features;
[SameObject] readonly attribute GPUSupportedLimits limits;
+ [SameObject] readonly attribute GPUAdapterInfo adapterInfo;
[SameObject] readonly attribute GPUQueue queue;
@@ -138,10 +157,10 @@ interface GPUDevice : EventTarget {
};
GPUDevice includes GPUObjectBase;
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPUBuffer {
- readonly attribute GPUSize64 size;
- readonly attribute GPUBufferUsageFlags usage;
+ readonly attribute GPUSize64Out size;
+ readonly attribute GPUFlagsConstant usage;
readonly attribute GPUBufferMapState mapState;
@@ -156,17 +175,18 @@ GPUBuffer includes GPUObjectBase;
enum GPUBufferMapState {
"unmapped",
"pending",
- "mapped"
+ "mapped",
};
-dictionary GPUBufferDescriptor : GPUObjectDescriptorBase {
+dictionary GPUBufferDescriptor
+ : GPUObjectDescriptorBase {
required GPUSize64 size;
required GPUBufferUsageFlags usage;
boolean mappedAtCreation = false;
};
typedef [EnforceRange] unsigned long GPUBufferUsageFlags;
-[Exposed=(Window, DedicatedWorker)]
+[Exposed=(Window, Worker), SecureContext]
namespace GPUBufferUsage {
const GPUFlagsConstant MAP_READ = 0x0001;
const GPUFlagsConstant MAP_WRITE = 0x0002;
@@ -181,30 +201,31 @@ namespace GPUBufferUsage {
};
typedef [EnforceRange] unsigned long GPUMapModeFlags;
-[Exposed=(Window, DedicatedWorker)]
+[Exposed=(Window, Worker), SecureContext]
namespace GPUMapMode {
const GPUFlagsConstant READ = 0x0001;
const GPUFlagsConstant WRITE = 0x0002;
};
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPUTexture {
GPUTextureView createView(optional GPUTextureViewDescriptor descriptor = {});
undefined destroy();
- readonly attribute GPUIntegerCoordinate width;
- readonly attribute GPUIntegerCoordinate height;
- readonly attribute GPUIntegerCoordinate depthOrArrayLayers;
- readonly attribute GPUIntegerCoordinate mipLevelCount;
- readonly attribute GPUSize32 sampleCount;
+ readonly attribute GPUIntegerCoordinateOut width;
+ readonly attribute GPUIntegerCoordinateOut height;
+ readonly attribute GPUIntegerCoordinateOut depthOrArrayLayers;
+ readonly attribute GPUIntegerCoordinateOut mipLevelCount;
+ readonly attribute GPUSize32Out sampleCount;
readonly attribute GPUTextureDimension dimension;
readonly attribute GPUTextureFormat format;
- readonly attribute GPUTextureUsageFlags usage;
+ readonly attribute GPUFlagsConstant usage;
};
GPUTexture includes GPUObjectBase;
-dictionary GPUTextureDescriptor : GPUObjectDescriptorBase {
+dictionary GPUTextureDescriptor
+ : GPUObjectDescriptorBase {
required GPUExtent3D size;
GPUIntegerCoordinate mipLevelCount = 1;
GPUSize32 sampleCount = 1;
@@ -217,11 +238,11 @@ dictionary GPUTextureDescriptor : GPUObjectDescriptorBase {
enum GPUTextureDimension {
"1d",
"2d",
- "3d"
+ "3d",
};
typedef [EnforceRange] unsigned long GPUTextureUsageFlags;
-[Exposed=(Window, DedicatedWorker)]
+[Exposed=(Window, Worker), SecureContext]
namespace GPUTextureUsage {
const GPUFlagsConstant COPY_SRC = 0x01;
const GPUFlagsConstant COPY_DST = 0x02;
@@ -230,14 +251,16 @@ namespace GPUTextureUsage {
const GPUFlagsConstant RENDER_ATTACHMENT = 0x10;
};
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPUTextureView {
};
GPUTextureView includes GPUObjectBase;
-dictionary GPUTextureViewDescriptor : GPUObjectDescriptorBase {
+dictionary GPUTextureViewDescriptor
+ : GPUObjectDescriptorBase {
GPUTextureFormat format;
GPUTextureViewDimension dimension;
+ GPUTextureUsageFlags usage = 0;
GPUTextureAspect aspect = "all";
GPUIntegerCoordinate baseMipLevel = 0;
GPUIntegerCoordinate mipLevelCount;
@@ -251,13 +274,13 @@ enum GPUTextureViewDimension {
"2d-array",
"cube",
"cube-array",
- "3d"
+ "3d",
};
enum GPUTextureAspect {
"all",
"stencil-only",
- "depth-only"
+ "depth-only",
};
enum GPUTextureFormat {
@@ -292,6 +315,7 @@ enum GPUTextureFormat {
"bgra8unorm-srgb",
// Packed 32-bit formats
"rgb9e5ufloat",
+ "rgb10a2uint",
"rgb10a2unorm",
"rg11b10ufloat",
@@ -377,26 +401,27 @@ enum GPUTextureFormat {
"astc-12x10-unorm",
"astc-12x10-unorm-srgb",
"astc-12x12-unorm",
- "astc-12x12-unorm-srgb"
+ "astc-12x12-unorm-srgb",
};
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPUExternalTexture {
- readonly attribute boolean expired;
};
GPUExternalTexture includes GPUObjectBase;
-dictionary GPUExternalTextureDescriptor : GPUObjectDescriptorBase {
- required HTMLVideoElement source;
+dictionary GPUExternalTextureDescriptor
+ : GPUObjectDescriptorBase {
+ required (HTMLVideoElement or VideoFrame) source;
PredefinedColorSpace colorSpace = "srgb";
};
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPUSampler {
};
GPUSampler includes GPUObjectBase;
-dictionary GPUSamplerDescriptor : GPUObjectDescriptorBase {
+dictionary GPUSamplerDescriptor
+ : GPUObjectDescriptorBase {
GPUAddressMode addressModeU = "clamp-to-edge";
GPUAddressMode addressModeV = "clamp-to-edge";
GPUAddressMode addressModeW = "clamp-to-edge";
@@ -412,17 +437,17 @@ dictionary GPUSamplerDescriptor : GPUObjectDescriptorBase {
enum GPUAddressMode {
"clamp-to-edge",
"repeat",
- "mirror-repeat"
+ "mirror-repeat",
};
enum GPUFilterMode {
"nearest",
- "linear"
+ "linear",
};
enum GPUMipmapFilterMode {
"nearest",
- "linear"
+ "linear",
};
enum GPUCompareFunction {
@@ -433,15 +458,16 @@ enum GPUCompareFunction {
"greater",
"not-equal",
"greater-equal",
- "always"
+ "always",
};
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPUBindGroupLayout {
};
GPUBindGroupLayout includes GPUObjectBase;
-dictionary GPUBindGroupLayoutDescriptor : GPUObjectDescriptorBase {
+dictionary GPUBindGroupLayoutDescriptor
+ : GPUObjectDescriptorBase {
required sequence<GPUBindGroupLayoutEntry> entries;
};
@@ -457,7 +483,7 @@ dictionary GPUBindGroupLayoutEntry {
};
typedef [EnforceRange] unsigned long GPUShaderStageFlags;
-[Exposed=(Window, DedicatedWorker)]
+[Exposed=(Window, Worker), SecureContext]
namespace GPUShaderStage {
const GPUFlagsConstant VERTEX = 0x1;
const GPUFlagsConstant FRAGMENT = 0x2;
@@ -467,7 +493,7 @@ namespace GPUShaderStage {
enum GPUBufferBindingType {
"uniform",
"storage",
- "read-only-storage"
+ "read-only-storage",
};
dictionary GPUBufferBindingLayout {
@@ -479,7 +505,7 @@ dictionary GPUBufferBindingLayout {
enum GPUSamplerBindingType {
"filtering",
"non-filtering",
- "comparison"
+ "comparison",
};
dictionary GPUSamplerBindingLayout {
@@ -491,7 +517,7 @@ enum GPUTextureSampleType {
"unfilterable-float",
"depth",
"sint",
- "uint"
+ "uint",
};
dictionary GPUTextureBindingLayout {
@@ -501,7 +527,9 @@ dictionary GPUTextureBindingLayout {
};
enum GPUStorageTextureAccess {
- "write-only"
+ "write-only",
+ "read-only",
+ "read-write",
};
dictionary GPUStorageTextureBindingLayout {
@@ -513,12 +541,13 @@ dictionary GPUStorageTextureBindingLayout {
dictionary GPUExternalTextureBindingLayout {
};
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPUBindGroup {
};
GPUBindGroup includes GPUObjectBase;
-dictionary GPUBindGroupDescriptor : GPUObjectDescriptorBase {
+dictionary GPUBindGroupDescriptor
+ : GPUObjectDescriptorBase {
required GPUBindGroupLayout layout;
required sequence<GPUBindGroupEntry> entries;
};
@@ -536,38 +565,40 @@ dictionary GPUBufferBinding {
GPUSize64 size;
};
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPUPipelineLayout {
};
GPUPipelineLayout includes GPUObjectBase;
-dictionary GPUPipelineLayoutDescriptor : GPUObjectDescriptorBase {
- required sequence<GPUBindGroupLayout> bindGroupLayouts;
+dictionary GPUPipelineLayoutDescriptor
+ : GPUObjectDescriptorBase {
+ required sequence<GPUBindGroupLayout?> bindGroupLayouts;
};
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPUShaderModule {
- Promise<GPUCompilationInfo> compilationInfo();
+ Promise<GPUCompilationInfo> getCompilationInfo();
};
GPUShaderModule includes GPUObjectBase;
-dictionary GPUShaderModuleDescriptor : GPUObjectDescriptorBase {
+dictionary GPUShaderModuleDescriptor
+ : GPUObjectDescriptorBase {
required USVString code;
- object sourceMap;
- record<USVString, GPUShaderModuleCompilationHint> hints;
+ sequence<GPUShaderModuleCompilationHint> compilationHints = [];
};
dictionary GPUShaderModuleCompilationHint {
+ required USVString entryPoint;
(GPUPipelineLayout or GPUAutoLayoutMode) layout;
};
enum GPUCompilationMessageType {
"error",
"warning",
- "info"
+ "info",
};
-[Exposed=(Window, DedicatedWorker), Serializable, SecureContext]
+[Exposed=(Window, Worker), Serializable, SecureContext]
interface GPUCompilationMessage {
readonly attribute DOMString message;
readonly attribute GPUCompilationMessageType type;
@@ -577,16 +608,32 @@ interface GPUCompilationMessage {
readonly attribute unsigned long long length;
};
-[Exposed=(Window, DedicatedWorker), Serializable, SecureContext]
+[Exposed=(Window, Worker), Serializable, SecureContext]
interface GPUCompilationInfo {
readonly attribute FrozenArray<GPUCompilationMessage> messages;
};
+[Exposed=(Window, Worker), SecureContext, Serializable]
+interface GPUPipelineError : DOMException {
+ constructor(optional DOMString message = "", GPUPipelineErrorInit options);
+ readonly attribute GPUPipelineErrorReason reason;
+};
+
+dictionary GPUPipelineErrorInit {
+ required GPUPipelineErrorReason reason;
+};
+
+enum GPUPipelineErrorReason {
+ "validation",
+ "internal",
+};
+
enum GPUAutoLayoutMode {
- "auto"
+ "auto",
};
-dictionary GPUPipelineDescriptorBase : GPUObjectDescriptorBase {
+dictionary GPUPipelineDescriptorBase
+ : GPUObjectDescriptorBase {
required (GPUPipelineLayout or GPUAutoLayoutMode) layout;
};
@@ -596,29 +643,31 @@ interface mixin GPUPipelineBase {
dictionary GPUProgrammableStage {
required GPUShaderModule module;
- required USVString entryPoint;
- record<USVString, GPUPipelineConstantValue> constants;
+ USVString entryPoint;
+ record<USVString, GPUPipelineConstantValue> constants = {};
};
-typedef double GPUPipelineConstantValue; // May represent WGSL’s bool, f32, i32, u32, and f16 if enabled.
+typedef double GPUPipelineConstantValue; // May represent WGSL's bool, f32, i32, u32, and f16 if enabled.
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPUComputePipeline {
};
GPUComputePipeline includes GPUObjectBase;
GPUComputePipeline includes GPUPipelineBase;
-dictionary GPUComputePipelineDescriptor : GPUPipelineDescriptorBase {
+dictionary GPUComputePipelineDescriptor
+ : GPUPipelineDescriptorBase {
required GPUProgrammableStage compute;
};
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPURenderPipeline {
};
GPURenderPipeline includes GPUObjectBase;
GPURenderPipeline includes GPUPipelineBase;
-dictionary GPURenderPipelineDescriptor : GPUPipelineDescriptorBase {
+dictionary GPURenderPipelineDescriptor
+ : GPUPipelineDescriptorBase {
required GPUVertexState vertex;
GPUPrimitiveState primitive = {};
GPUDepthStencilState depthStencil;
@@ -641,18 +690,18 @@ enum GPUPrimitiveTopology {
"line-list",
"line-strip",
"triangle-list",
- "triangle-strip"
+ "triangle-strip",
};
enum GPUFrontFace {
"ccw",
- "cw"
+ "cw",
};
enum GPUCullMode {
"none",
"front",
- "back"
+ "back",
};
dictionary GPUMultisampleState {
@@ -661,7 +710,8 @@ dictionary GPUMultisampleState {
boolean alphaToCoverageEnabled = false;
};
-dictionary GPUFragmentState : GPUProgrammableStage {
+dictionary GPUFragmentState
+ : GPUProgrammableStage {
required sequence<GPUColorTargetState?> targets;
};
@@ -678,7 +728,7 @@ dictionary GPUBlendState {
};
typedef [EnforceRange] unsigned long GPUColorWriteFlags;
-[Exposed=(Window, DedicatedWorker)]
+[Exposed=(Window, Worker), SecureContext]
namespace GPUColorWrite {
const GPUFlagsConstant RED = 0x1;
const GPUFlagsConstant GREEN = 0x2;
@@ -706,7 +756,11 @@ enum GPUBlendFactor {
"one-minus-dst-alpha",
"src-alpha-saturated",
"constant",
- "one-minus-constant"
+ "one-minus-constant",
+ "src1",
+ "one-minus-src1",
+ "src1-alpha",
+ "one-minus-src1-alpha",
};
enum GPUBlendOperation {
@@ -714,14 +768,14 @@ enum GPUBlendOperation {
"subtract",
"reverse-subtract",
"min",
- "max"
+ "max",
};
dictionary GPUDepthStencilState {
required GPUTextureFormat format;
- boolean depthWriteEnabled = false;
- GPUCompareFunction depthCompare = "always";
+ boolean depthWriteEnabled;
+ GPUCompareFunction depthCompare;
GPUStencilFaceState stencilFront = {};
GPUStencilFaceState stencilBack = {};
@@ -749,31 +803,40 @@ enum GPUStencilOperation {
"increment-clamp",
"decrement-clamp",
"increment-wrap",
- "decrement-wrap"
+ "decrement-wrap",
};
enum GPUIndexFormat {
"uint16",
- "uint32"
+ "uint32",
};
enum GPUVertexFormat {
+ "uint8",
"uint8x2",
"uint8x4",
+ "sint8",
"sint8x2",
"sint8x4",
+ "unorm8",
"unorm8x2",
"unorm8x4",
+ "snorm8",
"snorm8x2",
"snorm8x4",
+ "uint16",
"uint16x2",
"uint16x4",
+ "sint16",
"sint16x2",
"sint16x4",
+ "unorm16",
"unorm16x2",
"unorm16x4",
+ "snorm16",
"snorm16x2",
"snorm16x4",
+ "float16",
"float16x2",
"float16x4",
"float32",
@@ -787,15 +850,18 @@ enum GPUVertexFormat {
"sint32",
"sint32x2",
"sint32x3",
- "sint32x4"
+ "sint32x4",
+ "unorm10-10-10-2",
+ "unorm8x4-bgra",
};
enum GPUVertexStepMode {
"vertex",
- "instance"
+ "instance",
};
-dictionary GPUVertexState : GPUProgrammableStage {
+dictionary GPUVertexState
+ : GPUProgrammableStage {
sequence<GPUVertexBufferLayout?> buffers = [];
};
@@ -812,18 +878,57 @@ dictionary GPUVertexAttribute {
required GPUIndex32 shaderLocation;
};
-[Exposed=(Window, DedicatedWorker), SecureContext]
+dictionary GPUTexelCopyBufferLayout {
+ GPUSize64 offset = 0;
+ GPUSize32 bytesPerRow;
+ GPUSize32 rowsPerImage;
+};
+
+dictionary GPUTexelCopyBufferInfo
+ : GPUTexelCopyBufferLayout {
+ required GPUBuffer buffer;
+};
+
+dictionary GPUTexelCopyTextureInfo {
+ required GPUTexture texture;
+ GPUIntegerCoordinate mipLevel = 0;
+ GPUOrigin3D origin = {};
+ GPUTextureAspect aspect = "all";
+};
+
+dictionary GPUCopyExternalImageDestInfo
+ : GPUTexelCopyTextureInfo {
+ PredefinedColorSpace colorSpace = "srgb";
+ boolean premultipliedAlpha = false;
+};
+
+typedef (ImageBitmap or
+ ImageData or
+ HTMLImageElement or
+ HTMLVideoElement or
+ VideoFrame or
+ HTMLCanvasElement or
+ OffscreenCanvas) GPUCopyExternalImageSource;
+
+dictionary GPUCopyExternalImageSourceInfo {
+ required GPUCopyExternalImageSource source;
+ GPUOrigin2D origin = {};
+ boolean flipY = false;
+};
+
+[Exposed=(Window, Worker), SecureContext]
interface GPUCommandBuffer {
};
GPUCommandBuffer includes GPUObjectBase;
-dictionary GPUCommandBufferDescriptor : GPUObjectDescriptorBase {
+dictionary GPUCommandBufferDescriptor
+ : GPUObjectDescriptorBase {
};
interface mixin GPUCommandsMixin {
};
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPUCommandEncoder {
GPURenderPassEncoder beginRenderPass(GPURenderPassDescriptor descriptor);
GPUComputePassEncoder beginComputePass(optional GPUComputePassDescriptor descriptor = {});
@@ -836,18 +941,18 @@ interface GPUCommandEncoder {
GPUSize64 size);
undefined copyBufferToTexture(
- GPUImageCopyBuffer source,
- GPUImageCopyTexture destination,
+ GPUTexelCopyBufferInfo source,
+ GPUTexelCopyTextureInfo destination,
GPUExtent3D copySize);
undefined copyTextureToBuffer(
- GPUImageCopyTexture source,
- GPUImageCopyBuffer destination,
+ GPUTexelCopyTextureInfo source,
+ GPUTexelCopyBufferInfo destination,
GPUExtent3D copySize);
undefined copyTextureToTexture(
- GPUImageCopyTexture source,
- GPUImageCopyTexture destination,
+ GPUTexelCopyTextureInfo source,
+ GPUTexelCopyTextureInfo destination,
GPUExtent3D copySize);
undefined clearBuffer(
@@ -855,8 +960,6 @@ interface GPUCommandEncoder {
optional GPUSize64 offset = 0,
optional GPUSize64 size);
- undefined writeTimestamp(GPUQuerySet querySet, GPUSize32 queryIndex);
-
undefined resolveQuerySet(
GPUQuerySet querySet,
GPUSize32 firstQuery,
@@ -870,42 +973,15 @@ GPUCommandEncoder includes GPUObjectBase;
GPUCommandEncoder includes GPUCommandsMixin;
GPUCommandEncoder includes GPUDebugCommandsMixin;
-dictionary GPUCommandEncoderDescriptor : GPUObjectDescriptorBase {
-};
-
-dictionary GPUImageDataLayout {
- GPUSize64 offset = 0;
- GPUSize32 bytesPerRow;
- GPUSize32 rowsPerImage;
-};
-
-dictionary GPUImageCopyBuffer : GPUImageDataLayout {
- required GPUBuffer buffer;
-};
-
-dictionary GPUImageCopyTexture {
- required GPUTexture texture;
- GPUIntegerCoordinate mipLevel = 0;
- GPUOrigin3D origin = {};
- GPUTextureAspect aspect = "all";
-};
-
-dictionary GPUImageCopyTextureTagged : GPUImageCopyTexture {
- PredefinedColorSpace colorSpace = "srgb";
- boolean premultipliedAlpha = false;
-};
-
-dictionary GPUImageCopyExternalImage {
- required (ImageBitmap or HTMLCanvasElement or OffscreenCanvas) source;
- GPUOrigin2D origin = {};
- boolean flipY = false;
+dictionary GPUCommandEncoderDescriptor
+ : GPUObjectDescriptorBase {
};
interface mixin GPUBindingCommandsMixin {
- undefined setBindGroup(GPUIndex32 index, GPUBindGroup bindGroup,
+ undefined setBindGroup(GPUIndex32 index, GPUBindGroup? bindGroup,
optional sequence<GPUBufferDynamicOffset> dynamicOffsets = []);
- undefined setBindGroup(GPUIndex32 index, GPUBindGroup bindGroup,
+ undefined setBindGroup(GPUIndex32 index, GPUBindGroup? bindGroup,
Uint32Array dynamicOffsetsData,
GPUSize64 dynamicOffsetsDataStart,
GPUSize32 dynamicOffsetsDataLength);
@@ -917,7 +993,7 @@ interface mixin GPUDebugCommandsMixin {
undefined insertDebugMarker(USVString markerLabel);
};
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPUComputePassEncoder {
undefined setPipeline(GPUComputePipeline pipeline);
undefined dispatchWorkgroups(GPUSize32 workgroupCountX, optional GPUSize32 workgroupCountY = 1, optional GPUSize32 workgroupCountZ = 1);
@@ -930,24 +1006,18 @@ GPUComputePassEncoder includes GPUCommandsMixin;
GPUComputePassEncoder includes GPUDebugCommandsMixin;
GPUComputePassEncoder includes GPUBindingCommandsMixin;
-enum GPUComputePassTimestampLocation {
- "beginning",
- "end"
-};
-
-dictionary GPUComputePassTimestampWrite {
+dictionary GPUComputePassTimestampWrites {
required GPUQuerySet querySet;
- required GPUSize32 queryIndex;
- required GPUComputePassTimestampLocation location;
+ GPUSize32 beginningOfPassWriteIndex;
+ GPUSize32 endOfPassWriteIndex;
};
-typedef sequence<GPUComputePassTimestampWrite> GPUComputePassTimestampWrites;
-
-dictionary GPUComputePassDescriptor : GPUObjectDescriptorBase {
- GPUComputePassTimestampWrites timestampWrites = [];
+dictionary GPUComputePassDescriptor
+ : GPUObjectDescriptorBase {
+ GPUComputePassTimestampWrites timestampWrites;
};
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPURenderPassEncoder {
undefined setViewport(float x, float y,
float width, float height,
@@ -971,29 +1041,24 @@ GPURenderPassEncoder includes GPUDebugCommandsMixin;
GPURenderPassEncoder includes GPUBindingCommandsMixin;
GPURenderPassEncoder includes GPURenderCommandsMixin;
-enum GPURenderPassTimestampLocation {
- "beginning",
- "end"
-};
-
-dictionary GPURenderPassTimestampWrite {
+dictionary GPURenderPassTimestampWrites {
required GPUQuerySet querySet;
- required GPUSize32 queryIndex;
- required GPURenderPassTimestampLocation location;
+ GPUSize32 beginningOfPassWriteIndex;
+ GPUSize32 endOfPassWriteIndex;
};
-typedef sequence<GPURenderPassTimestampWrite> GPURenderPassTimestampWrites;
-
-dictionary GPURenderPassDescriptor : GPUObjectDescriptorBase {
+dictionary GPURenderPassDescriptor
+ : GPUObjectDescriptorBase {
required sequence<GPURenderPassColorAttachment?> colorAttachments;
GPURenderPassDepthStencilAttachment depthStencilAttachment;
GPUQuerySet occlusionQuerySet;
- GPURenderPassTimestampWrites timestampWrites = [];
+ GPURenderPassTimestampWrites timestampWrites;
GPUSize64 maxDrawCount = 50000000;
};
dictionary GPURenderPassColorAttachment {
required GPUTextureView view;
+ GPUIntegerCoordinate depthSlice;
GPUTextureView resolveTarget;
GPUColor clearValue;
@@ -1004,7 +1069,7 @@ dictionary GPURenderPassColorAttachment {
dictionary GPURenderPassDepthStencilAttachment {
required GPUTextureView view;
- float depthClearValue = 0;
+ float depthClearValue;
GPULoadOp depthLoadOp;
GPUStoreOp depthStoreOp;
boolean depthReadOnly = false;
@@ -1017,15 +1082,16 @@ dictionary GPURenderPassDepthStencilAttachment {
enum GPULoadOp {
"load",
- "clear"
+ "clear",
};
enum GPUStoreOp {
"store",
- "discard"
+ "discard",
};
-dictionary GPURenderPassLayout: GPUObjectDescriptorBase {
+dictionary GPURenderPassLayout
+ : GPUObjectDescriptorBase {
required sequence<GPUTextureFormat?> colorFormats;
GPUTextureFormat depthStencilFormat;
GPUSize32 sampleCount = 1;
@@ -1035,7 +1101,7 @@ interface mixin GPURenderCommandsMixin {
undefined setPipeline(GPURenderPipeline pipeline);
undefined setIndexBuffer(GPUBuffer buffer, GPUIndexFormat indexFormat, optional GPUSize64 offset = 0, optional GPUSize64 size);
- undefined setVertexBuffer(GPUIndex32 slot, GPUBuffer buffer, optional GPUSize64 offset = 0, optional GPUSize64 size);
+ undefined setVertexBuffer(GPUIndex32 slot, GPUBuffer? buffer, optional GPUSize64 offset = 0, optional GPUSize64 size);
undefined draw(GPUSize32 vertexCount, optional GPUSize32 instanceCount = 1,
optional GPUSize32 firstVertex = 0, optional GPUSize32 firstInstance = 0);
@@ -1048,15 +1114,16 @@ interface mixin GPURenderCommandsMixin {
undefined drawIndexedIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset);
};
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPURenderBundle {
};
GPURenderBundle includes GPUObjectBase;
-dictionary GPURenderBundleDescriptor : GPUObjectDescriptorBase {
+dictionary GPURenderBundleDescriptor
+ : GPUObjectDescriptorBase {
};
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPURenderBundleEncoder {
GPURenderBundle finish(optional GPURenderBundleDescriptor descriptor = {});
};
@@ -1066,15 +1133,17 @@ GPURenderBundleEncoder includes GPUDebugCommandsMixin;
GPURenderBundleEncoder includes GPUBindingCommandsMixin;
GPURenderBundleEncoder includes GPURenderCommandsMixin;
-dictionary GPURenderBundleEncoderDescriptor : GPURenderPassLayout {
+dictionary GPURenderBundleEncoderDescriptor
+ : GPURenderPassLayout {
boolean depthReadOnly = false;
boolean stencilReadOnly = false;
};
-dictionary GPUQueueDescriptor : GPUObjectDescriptorBase {
+dictionary GPUQueueDescriptor
+ : GPUObjectDescriptorBase {
};
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPUQueue {
undefined submit(sequence<GPUCommandBuffer> commandBuffers);
@@ -1083,55 +1152,66 @@ interface GPUQueue {
undefined writeBuffer(
GPUBuffer buffer,
GPUSize64 bufferOffset,
- [AllowShared] BufferSource data,
+ AllowSharedBufferSource data,
optional GPUSize64 dataOffset = 0,
optional GPUSize64 size);
undefined writeTexture(
- GPUImageCopyTexture destination,
- [AllowShared] BufferSource data,
- GPUImageDataLayout dataLayout,
+ GPUTexelCopyTextureInfo destination,
+ AllowSharedBufferSource data,
+ GPUTexelCopyBufferLayout dataLayout,
GPUExtent3D size);
undefined copyExternalImageToTexture(
- GPUImageCopyExternalImage source,
- GPUImageCopyTextureTagged destination,
+ GPUCopyExternalImageSourceInfo source,
+ GPUCopyExternalImageDestInfo destination,
GPUExtent3D copySize);
};
GPUQueue includes GPUObjectBase;
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPUQuerySet {
undefined destroy();
readonly attribute GPUQueryType type;
- readonly attribute GPUSize32 count;
+ readonly attribute GPUSize32Out count;
};
GPUQuerySet includes GPUObjectBase;
-dictionary GPUQuerySetDescriptor : GPUObjectDescriptorBase {
+dictionary GPUQuerySetDescriptor
+ : GPUObjectDescriptorBase {
required GPUQueryType type;
required GPUSize32 count;
};
enum GPUQueryType {
"occlusion",
- "timestamp"
+ "timestamp",
};
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPUCanvasContext {
readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas;
undefined configure(GPUCanvasConfiguration configuration);
undefined unconfigure();
+ GPUCanvasConfiguration? getConfiguration();
GPUTexture getCurrentTexture();
};
enum GPUCanvasAlphaMode {
"opaque",
- "premultiplied"
+ "premultiplied",
+};
+
+enum GPUCanvasToneMappingMode {
+ "standard",
+ "extended",
+};
+
+dictionary GPUCanvasToneMapping {
+ GPUCanvasToneMappingMode mode = "standard";
};
dictionary GPUCanvasConfiguration {
@@ -1140,16 +1220,18 @@ dictionary GPUCanvasConfiguration {
GPUTextureUsageFlags usage = 0x10; // GPUTextureUsage.RENDER_ATTACHMENT
sequence<GPUTextureFormat> viewFormats = [];
PredefinedColorSpace colorSpace = "srgb";
+ GPUCanvasToneMapping toneMapping = {};
GPUCanvasAlphaMode alphaMode = "opaque";
};
enum GPUDeviceLostReason {
- "destroyed"
+ "unknown",
+ "destroyed",
};
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPUDeviceLostInfo {
- readonly attribute (GPUDeviceLostReason or undefined) reason;
+ readonly attribute GPUDeviceLostReason reason;
readonly attribute DOMString message;
};
@@ -1157,38 +1239,47 @@ partial interface GPUDevice {
readonly attribute Promise<GPUDeviceLostInfo> lost;
};
-enum GPUErrorFilter {
- "out-of-memory",
- "validation"
-};
-
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPUError {
readonly attribute DOMString message;
};
-[Exposed=(Window, DedicatedWorker), SecureContext]
-interface GPUOutOfMemoryError : GPUError {
+[Exposed=(Window, Worker), SecureContext]
+interface GPUValidationError
+ : GPUError {
+ constructor(DOMString message);
+};
+
+[Exposed=(Window, Worker), SecureContext]
+interface GPUOutOfMemoryError
+ : GPUError {
constructor(DOMString message);
};
-[Exposed=(Window, DedicatedWorker), SecureContext]
-interface GPUValidationError : GPUError {
+[Exposed=(Window, Worker), SecureContext]
+interface GPUInternalError
+ : GPUError {
constructor(DOMString message);
};
+enum GPUErrorFilter {
+ "validation",
+ "out-of-memory",
+ "internal",
+};
+
partial interface GPUDevice {
undefined pushErrorScope(GPUErrorFilter filter);
Promise<GPUError?> popErrorScope();
};
-[Exposed=(Window, DedicatedWorker), SecureContext]
+[Exposed=(Window, Worker), SecureContext]
interface GPUUncapturedErrorEvent : Event {
constructor(
DOMString type,
GPUUncapturedErrorEventInit gpuUncapturedErrorEventInitDict
);
- readonly attribute GPUError error;
+ [SameObject] readonly attribute GPUError error;
};
dictionary GPUUncapturedErrorEventInit : EventInit {
@@ -1196,7 +1287,6 @@ dictionary GPUUncapturedErrorEventInit : EventInit {
};
partial interface GPUDevice {
- [Exposed=(Window, DedicatedWorker)]
attribute EventHandler onuncapturederror;
};
@@ -1211,6 +1301,10 @@ typedef [EnforceRange] unsigned long GPUIndex32;
typedef [EnforceRange] unsigned long GPUSize32;
typedef [EnforceRange] long GPUSignedOffset32;
+typedef unsigned long long GPUSize64Out;
+typedef unsigned long GPUIntegerCoordinateOut;
+typedef unsigned long GPUSize32Out;
+
typedef unsigned long GPUFlagsConstant;
dictionary GPUColorDict { |
Approved. The potential issues related to privacy and security would need to continue to be investigated. Implementation experience during the Candidate Recommendation will be important. |
Document title, URLs, estimated publication date
Two specs to transition:
Note: The source of the specifications to publish as CR is maintained in a dedicated
milestone-0
branch in the repository. Themain
branch contains further updates that will not be part of this snapshot.No specific deadline for the publication date. Whenever transition is approved.
Abstract
Status
The group intends to switch to the "Living Recommendations" mode for both specifications once the proposed charter has been reviewed by the AC and approved. If the specifications get published under the current charter and exit criteria need to be specified, the idea would be to use regular exit criteria, like:
Minimal CR duration: 2 months.
Link to the group's decision to request transition
See resolution during last F2F. The group has resolved pending "milestone 0" since the F2F, also see the CR tracking issue
Changes
First CR
Requirements satisfied
Dependencies met (or not)
Normative dependencies are established standards with one exception: WebGPU specifies the integration with WebCodecs to process media frames, and WebCodecs is still a Working Draft at this stage. The
VideoFrame
interface at the core of this integration is stable and implemented across browsers already.Wide Review
An issue was raised during PING review on the fingerprinting surface of the API (gpuweb/gpuweb#3101). The group reduced the fingerprinting surface to 5 bits and documented the mitigations that were put in place and the rationale in the issue. This issue is still under discussion in PING.
Issues addressed
All issues at milestone 0 have been addressed.
Formal Objections
None
Implementation
Implementations of WebGPU and WGSL are shipping or are about to ship in major browser codebases:
The group maintains a conformance test suite (no implementation report available today)
Patent disclosures
https://www.w3.org/groups/wg/gpu/ipr/
The text was updated successfully, but these errors were encountered: