Title: [244442] trunk
Revision
244442
Author
justin_...@apple.com
Date
2019-04-18 15:42:36 -0700 (Thu, 18 Apr 2019)

Log Message

Source/WebCore:
[Web GPU] Implement API default values
https://bugs.webkit.org/show_bug.cgi?id=197032

Reviewed by Myles C. Maxfield.

Add default values and 'required' qualifiers recently merged to the WebGPU API.

WebGPU tests specifying these default values have been updated to rely on them for functionality.

* Modules/webgpu/GPUBindGroupLayoutBinding.idl:
* Modules/webgpu/GPUBindGroupLayoutDescriptor.idl:
* Modules/webgpu/GPUBlendDescriptor.idl:
* Modules/webgpu/GPUBufferDescriptor.idl:
* Modules/webgpu/GPUColor.idl:
* Modules/webgpu/GPUColorStateDescriptor.idl:
* Modules/webgpu/GPUDepthStencilStateDescriptor.idl:
* Modules/webgpu/GPUExtent3D.idl:
* Modules/webgpu/GPUInputStateDescriptor.idl:
* Modules/webgpu/GPUOrigin3D.h:
* Modules/webgpu/GPUOrigin3D.idl:
* Modules/webgpu/GPURequestAdapterOptions.idl:
* Modules/webgpu/GPUTextureDescriptor.idl:
* Modules/webgpu/GPUVertexAttributeDescriptor.idl:
* Modules/webgpu/GPUVertexInputDescriptor.idl:
* Modules/webgpu/WebGPUBindGroupBinding.idl:
* Modules/webgpu/WebGPUBindGroupDescriptor.idl:
* Modules/webgpu/WebGPUBufferBinding.h:
* Modules/webgpu/WebGPUBufferBinding.idl:
* Modules/webgpu/WebGPUCommandEncoder.idl:
* Modules/webgpu/WebGPUPipelineDescriptorBase.idl:
* Modules/webgpu/WebGPUPipelineLayoutDescriptor.idl:
* Modules/webgpu/WebGPUPipelineStageDescriptor.idl:
* Modules/webgpu/WebGPURenderPassDescriptor.idl:
* Modules/webgpu/WebGPURenderPipelineDescriptor.cpp:
(WebCore::WebGPURenderPipelineDescriptor::tryCreateGPURenderPipelineDescriptor const):
* Modules/webgpu/WebGPURenderPipelineDescriptor.h:
* Modules/webgpu/WebGPURenderPipelineDescriptor.idl:
* Modules/webgpu/WebGPUShaderModuleDescriptor.idl:
* platform/graphics/gpu/GPUBlendDescriptor.h:
* platform/graphics/gpu/GPUColorStateDescriptor.h:
* platform/graphics/gpu/GPUCommandBuffer.h:
* platform/graphics/gpu/GPUDepthStencilStateDescriptor.h:
* platform/graphics/gpu/GPURenderPassDescriptor.h:
* platform/graphics/gpu/GPURenderPipelineDescriptor.h:
(WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor):
* platform/graphics/gpu/GPURequestAdapterOptions.h:
* platform/graphics/gpu/GPUTextureDescriptor.h:
* platform/graphics/gpu/GPUVertexAttributeDescriptor.h:
* platform/graphics/gpu/GPUVertexInputDescriptor.h:
* platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
(WebCore::convertRenderPipelineDescriptor):
(WebCore::trySetFunctionsForPipelineDescriptor):

LayoutTests:
[WebGPU] Implement API default values
https://bugs.webkit.org/show_bug.cgi?id=197032

Reviewed by Myles C. Maxfield.

Update WebGPU tests to use default values wherever applicable.

* webgpu/bind-groups.html:
* webgpu/blend-triangle-strip.html:
* webgpu/blit-commands.html:
* webgpu/buffer-command-buffer-races.html:
* webgpu/buffer-resource-triangles.html:
* webgpu/color-write-mask-triangle-strip.html:
* webgpu/compute-squares.html:
* webgpu/depth-enabled-triangle-strip.html:
* webgpu/draw-indexed-triangles.html:
* webgpu/js/webgpu-functions.js:
(createBasicDepthTexture):
* webgpu/texture-triangle-strip.html:
* webgpu/textures-textureviews.html:
* webgpu/vertex-buffer-triangle-strip.html:
* webgpu/whlsl.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (244441 => 244442)


--- trunk/LayoutTests/ChangeLog	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/LayoutTests/ChangeLog	2019-04-18 22:42:36 UTC (rev 244442)
@@ -1,3 +1,28 @@
+2019-04-18  Justin Fan  <justin_...@apple.com>
+
+        [WebGPU] Implement API default values
+        https://bugs.webkit.org/show_bug.cgi?id=197032
+
+        Reviewed by Myles C. Maxfield.
+
+        Update WebGPU tests to use default values wherever applicable.
+
+        * webgpu/bind-groups.html:
+        * webgpu/blend-triangle-strip.html:
+        * webgpu/blit-commands.html:
+        * webgpu/buffer-command-buffer-races.html:
+        * webgpu/buffer-resource-triangles.html:
+        * webgpu/color-write-mask-triangle-strip.html:
+        * webgpu/compute-squares.html:
+        * webgpu/depth-enabled-triangle-strip.html:
+        * webgpu/draw-indexed-triangles.html:
+        * webgpu/js/webgpu-functions.js:
+        (createBasicDepthTexture):
+        * webgpu/texture-triangle-strip.html:
+        * webgpu/textures-textureviews.html:
+        * webgpu/vertex-buffer-triangle-strip.html:
+        * webgpu/whlsl.html:
+
 2019-04-18  Sihui Liu  <sihui_...@apple.com>
 
         Blob type cannot be stored correctly in IDB when IDBObjectStore has autoIncrement and keyPath options

Modified: trunk/LayoutTests/webgpu/bind-groups.html (244441 => 244442)


--- trunk/LayoutTests/webgpu/bind-groups.html	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/LayoutTests/webgpu/bind-groups.html	2019-04-18 22:42:36 UTC (rev 244442)
@@ -20,7 +20,7 @@
     const bindGroupLayout = device.createBindGroupLayout({ bindings: [bufferLayoutBinding] });
 
     const buffer = device.createBuffer({ size: 16, usage: GPUBufferUsage.STORAGE });
-    const bufferBinding = { buffer: buffer, offset: 0, size: 16 };
+    const bufferBinding = { buffer: buffer, size: 16 };
     const bindGroupBinding = { binding: 1, resource: bufferBinding };
 
     const bindGroup = device.createBindGroup({ layout: bindGroupLayout, bindings: [bindGroupBinding]});

Modified: trunk/LayoutTests/webgpu/blend-triangle-strip.html (244441 => 244442)


--- trunk/LayoutTests/webgpu/blend-triangle-strip.html	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/LayoutTests/webgpu/blend-triangle-strip.html	2019-04-18 22:42:36 UTC (rev 244442)
@@ -52,17 +52,8 @@
 
     const colorStates = [{
         format: "bgra8unorm",
-        alphaBlend: {
-            srcFactor: "one",
-            dstFactor: "one",
-            operation: "add"
-        },
-        colorBlend: {
-            srcFactor: "one",
-            dstFactor: "one",
-            operation: "add"
-        },
-        writeMask: GPUColorWriteBits.ALL
+        alphaBlend: { dstFactor: "one" },
+        colorBlend: { dstFactor: "one" }
     }];
 
     const inputStateDescriptor = {
@@ -70,13 +61,11 @@
         attributes: [{
             shaderLocation: positionAttributeNum,
             inputSlot: 0,
-            offset: 0,
             format: "float4"
         }],
         inputs: [{
             inputSlot: 0,
-            stride: 4 * 4,
-            stepMode: "vertex"
+            stride: 4 * 4
         }]
     };
 

Modified: trunk/LayoutTests/webgpu/blit-commands.html (244441 => 244442)


--- trunk/LayoutTests/webgpu/blit-commands.html	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/LayoutTests/webgpu/blit-commands.html	2019-04-18 22:42:36 UTC (rev 244442)
@@ -38,7 +38,6 @@
     const bufferB = device.createBuffer(bufferDescriptor);
     const bufferViewB = {
         buffer: bufferB,
-        offset: 0,
         rowPitch: image.width * 4,
         imageHeight: 0
     };
@@ -50,28 +49,14 @@
     };
     const textureDescriptor = {
         size: textureSize,
-        arrayLayerCount: 1,
-        mipLevelCount: 1,
-        sampleCount: 1,
-        dimension: "2d",
         format: "rgba8unorm",
         usage: GPUTextureUsage.TRANSFER_SRC | GPUTextureUsage.TRANSFER_DST
     };
     const textureA = device.createTexture(textureDescriptor);
-    const textureViewA = {
-        texture: textureA,
-        mipLevel: 0,
-        arrayLayer: 0,
-        origin: { x: 0, y: 0, z: 0 }
-    };
+    const textureViewA = { texture: textureA };
 
     const textureB = device.createTexture(textureDescriptor);
-    const textureViewB = {
-        texture: textureB,
-        mipLevel: 0,
-        arrayLayer: 0,
-        origin: { x: 0, y: 0, z: 0 }
-    };
+    const textureViewB = { texture: textureB };
 
     const readBufferDescriptor = {
         size: imageData.data.byteLength,
@@ -80,7 +65,6 @@
     const readBuffer = device.createBuffer(readBufferDescriptor);
     const readBufferView = {
         buffer: readBuffer,
-        offset: 0,
         rowPitch: image.width * 4,
         imageHeight: 0
     };

Modified: trunk/LayoutTests/webgpu/buffer-command-buffer-races.html (244441 => 244442)


--- trunk/LayoutTests/webgpu/buffer-command-buffer-races.html	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/LayoutTests/webgpu/buffer-command-buffer-races.html	2019-04-18 22:42:36 UTC (rev 244442)
@@ -48,18 +48,15 @@
         attributes: [{
             shaderLocation: 0,
             inputSlot: 0,
-            offset: 0,
             format: "float2"
         }, {
             shaderLocation: 1,
             inputSlot: 1,
-            offset: 0,
             format: "float3"
         }],
         inputs: [{
             inputSlot: 0,
-            stride: 4 * 2,
-            stepMode: "vertex"
+            stride: 4 * 2
         }, {
             inputSlot: 1,
             stride: 4 * 3,

Modified: trunk/LayoutTests/webgpu/buffer-resource-triangles.html (244441 => 244442)


--- trunk/LayoutTests/webgpu/buffer-resource-triangles.html	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/LayoutTests/webgpu/buffer-resource-triangles.html	2019-04-18 22:42:36 UTC (rev 244442)
@@ -108,11 +108,7 @@
 }
 
 function createBufferBinding(buffer) {
-    return {
-        buffer: buffer,
-        offset: 0,
-        size: vertexSize
-    };
+    return { buffer: buffer, size: vertexSize };
 }
 
 async function test() {
@@ -141,13 +137,11 @@
         attributes: [{
             shaderLocation: 0,
             inputSlot: 0,
-            offset: 0,
             format: "float4"
         }],
         inputs: [{
             inputSlot: 0,
-            stride: vertexSize,
-            stepMode: "vertex"
+            stride: vertexSize
         }]
     };
 

Modified: trunk/LayoutTests/webgpu/color-write-mask-triangle-strip.html (244441 => 244442)


--- trunk/LayoutTests/webgpu/color-write-mask-triangle-strip.html	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/LayoutTests/webgpu/color-write-mask-triangle-strip.html	2019-04-18 22:42:36 UTC (rev 244442)
@@ -52,16 +52,8 @@
     const shaderModule = device.createShaderModule({ code: shaderCode });
     const colorStates = [{
         format: "bgra8unorm",
-        alphaBlend: {
-            srcFactor: "one",
-            dstFactor: "zero",
-            operation: "add"
-        },
-        colorBlend: {
-            srcFactor: "one",
-            dstFactor: "zero",
-            operation: "add"
-        },
+        alphaBlend: {},
+        colorBlend: {},
         writeMask: GPUColorWriteBits.GREEN | GPUColorWriteBits.ALPHA
     }];
     const pipeline = createBasicPipeline(shaderModule, device, colorStates);

Modified: trunk/LayoutTests/webgpu/compute-squares.html (244441 => 244442)


--- trunk/LayoutTests/webgpu/compute-squares.html	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/LayoutTests/webgpu/compute-squares.html	2019-04-18 22:42:36 UTC (rev 244442)
@@ -45,7 +45,7 @@
     const bgLayoutBinding = { binding: dataBinding, visibility: GPUShaderStageBit.COMPUTE, type: "storage-buffer" };
     const bgLayout = device.createBindGroupLayout({ bindings: [bgLayoutBinding] });
     
-    const bufferBinding = { buffer: dataBuffer, offset: 0, size: data.byteLength };
+    const bufferBinding = { buffer: dataBuffer, size: data.byteLength };
     const bgBinding = { binding: dataBinding, resource: bufferBinding };
     
     const bindGroupDescriptor = { layout: bgLayout, bindings: [bgBinding] };

Modified: trunk/LayoutTests/webgpu/depth-enabled-triangle-strip.html (244441 => 244442)


--- trunk/LayoutTests/webgpu/depth-enabled-triangle-strip.html	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/LayoutTests/webgpu/depth-enabled-triangle-strip.html	2019-04-18 22:42:36 UTC (rev 244442)
@@ -68,13 +68,11 @@
         attributes: [{
             shaderLocation: 0,
             inputSlot: 0,
-            offset: 0,
             format: "float4"
         }],
         inputs: [{
             inputSlot: 0,
-            stride: 4 * 4,
-            stepMode: "vertex"
+            stride: 4 * 4
         }]
     }
 }

Modified: trunk/LayoutTests/webgpu/draw-indexed-triangles.html (244441 => 244442)


--- trunk/LayoutTests/webgpu/draw-indexed-triangles.html	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/LayoutTests/webgpu/draw-indexed-triangles.html	2019-04-18 22:42:36 UTC (rev 244442)
@@ -77,7 +77,6 @@
         attributes: [{
             shaderLocation: 0,
             inputSlot: 0,
-            offset: 0,
             format: "float4"
         }, {
             shaderLocation: 1,
@@ -87,8 +86,7 @@
         }],
         inputs: [{
             inputSlot: 0,
-            stride: 4 * 5,
-            stepMode: "vertex"
+            stride: 4 * 5
         }]
     };
 }

Modified: trunk/LayoutTests/webgpu/js/webgpu-functions.js (244441 => 244442)


--- trunk/LayoutTests/webgpu/js/webgpu-functions.js	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/LayoutTests/webgpu/js/webgpu-functions.js	2019-04-18 22:42:36 UTC (rev 244442)
@@ -25,10 +25,6 @@
 
     return device.createTexture({
         size: depthSize,
-        arrayLayerCount: 1,
-        mipLevelCount: 1,
-        sampleCount: 1,
-        dimension: "2d",
         format: "depth32float-stencil8",
         usage: GPUTextureUsage.OUTPUT_ATTACHMENT
     });
@@ -48,33 +44,25 @@
     if (!colorStates) {
         colorStates = [{ 
             format: "bgra8unorm",
-            alphaBlend: {
-                srcFactor: "one",
-                dstFactor: "zero",
-                operation: "add"
-            },
-            colorBlend: {
-                srcFactor: "one",
-                dstFactor: "zero",
-                operation: "add"
-            },
-            writeMask: GPUColorWriteBits.ALL
+            alphaBlend: {},
+            colorBlend: {}
         }];
     }
 
+    if (!inputStateDescriptor)
+        inputStateDescriptor = { attributes: [], inputs: [] };
+
     const pipelineDescriptor = {
         vertexStage: vertexStageDescriptor,
         fragmentStage: fragmentStageDescriptor,
         primitiveTopology: primitiveTopology,
-        colorStates: colorStates
+        colorStates: colorStates,
+        inputState: inputStateDescriptor
     };
 
     if (pipelineLayout)
         pipelineDescriptor.layout = pipelineLayout;
 
-    if (inputStateDescriptor)
-        pipelineDescriptor.inputState = inputStateDescriptor;
-
     if (depthStateDescriptor)
         pipelineDescriptor.depthStencilState = depthStateDescriptor;
 

Modified: trunk/LayoutTests/webgpu/texture-triangle-strip.html (244441 => 244442)


--- trunk/LayoutTests/webgpu/texture-triangle-strip.html	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/LayoutTests/webgpu/texture-triangle-strip.html	2019-04-18 22:42:36 UTC (rev 244442)
@@ -61,22 +61,18 @@
         attributes: [{
             shaderLocation: positionAttributeNum,
             inputSlot: positionBufferIndex,
-            offset: 0,
             format: "float4"
         }, {
             shaderLocation: texCoordsAttributeNum,
             inputSlot: texCoordsBufferIndex,
-            offset: 0,
             format: "float2"
         }],
         inputs: [{
             inputSlot: positionBufferIndex,
-            stride: 4 * 4,
-            stepMode: "vertex"
+            stride: 4 * 4
         }, {
             inputSlot: texCoordsBufferIndex,
-            stride: 4 * 2,
-            stepMode: "vertex"
+            stride: 4 * 2
         }]
     }
 }
@@ -142,10 +138,6 @@
 
     const textureDescriptor = {
         size: { width: image.width, height: image.height, depth: 1 },
-        arrayLayerCount: 1,
-        mipLevelCount: 1,
-        sampleCount: 1,
-        dimension: "2d",
         format: "rgba8unorm",
         usage: GPUTextureUsage.TRANSFER_DST | GPUTextureUsage.SAMPLED
     };
@@ -190,16 +182,10 @@
 
     const bufferCopyView = {
         buffer: textureBuffer,
-        offset: 0,
         rowPitch: image.width * 4,
         imageHeight: 0
     };
-    const textureCopyView = {
-        texture: texture,
-        mipLevel: 0,
-        arrayLayer: 0,
-        origin: { x: 0, y: 0, z: 0 }
-    };
+    const textureCopyView = { texture: texture };
     commandEncoder.copyBufferToTexture(bufferCopyView, textureCopyView, textureSize);
     const passEncoder = beginBasicRenderPass(swapChain, commandEncoder);
     passEncoder.setPipeline(pipeline);

Modified: trunk/LayoutTests/webgpu/textures-textureviews.html (244441 => 244442)


--- trunk/LayoutTests/webgpu/textures-textureviews.html	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/LayoutTests/webgpu/textures-textureviews.html	2019-04-18 22:42:36 UTC (rev 244442)
@@ -18,10 +18,6 @@
 
 let texDescriptor = {
     size: texSize,
-    arrayLayerCount: 1,
-    mipLevelCount: 1,
-    sampleCount: 1,
-    dimension: "2d",
     format: "depth32float-stencil8",
     usage: GPUTextureUsage.OUTPUT_ATTACHMENT
 };

Modified: trunk/LayoutTests/webgpu/vertex-buffer-triangle-strip.html (244441 => 244442)


--- trunk/LayoutTests/webgpu/vertex-buffer-triangle-strip.html	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/LayoutTests/webgpu/vertex-buffer-triangle-strip.html	2019-04-18 22:42:36 UTC (rev 244442)
@@ -66,7 +66,6 @@
         attributes: [{
             shaderLocation: 0,
             inputSlot: 0,
-            offset: 0,
             format: "float4"
         }, {
             shaderLocation: 1,
@@ -76,8 +75,7 @@
         }],
         inputs: [{
             inputSlot: 0,
-            stride: 4 * 5,
-            stepMode: "vertex"
+            stride: 4 * 5
         }]
     }
 }

Modified: trunk/LayoutTests/webgpu/whlsl.html (244441 => 244442)


--- trunk/LayoutTests/webgpu/whlsl.html	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/LayoutTests/webgpu/whlsl.html	2019-04-18 22:42:36 UTC (rev 244442)
@@ -23,16 +23,16 @@
     const fragmentStage = {module: shaderModule, entryPoint: "fragmentShader"};
     const primitiveTopology = "triangle-strip";
     const rasterizationState = {frontFace: "cw", cullMode: "none"};
-    const alphaBlend = {srcFactor: "one", dstFactor: "zero", operation: "add"};
-    const colorBlend = {srcFactor: "one", dstFactor: "zero", operation: "add"};
+    const alphaBlend = {};
+    const colorBlend = {};
     const colorStates = [{format: "rgba8unorm", alphaBlend, colorBlend, writeMask: 15}]; // GPUColorWriteBits.ALL
     const depthStencilState = null;
     
-    const attribute0 = {shaderLocation: 0, inputSlot: 0, offset: 0, format: "float4"};
-    const attribute1 = {shaderLocation: 1, inputSlot: 1, offset: 0, format: "float"};
+    const attribute0 = {shaderLocation: 0, inputSlot: 0, format: "float4"};
+    const attribute1 = {shaderLocation: 1, inputSlot: 1, format: "float"};
     const attributes = [attribute0, attribute1];
-    const input0 = {inputSlot: 0, stride: 16, stepMode: "vertex"};
-    const input1 = {inputSlot: 1, stride: 4, stepMode: "vertex"};
+    const input0 = {inputSlot: 0, stride: 16 };
+    const input1 = {inputSlot: 1, stride: 4 };
     const inputs = [input0, input1];
     const inputState = {indexFormat: "uint32", attributes, inputs};
 
@@ -83,7 +83,7 @@
     resourceBufferFloat32Array[0] = 1;
     resourceBuffer.unmap();
 
-    const bufferBinding = {buffer: resourceBuffer, offset: 0, size: 4};
+    const bufferBinding = {buffer: resourceBuffer, size: 4};
     const bindGroupBinding = {binding: 0, resource: bufferBinding};
     const bindGroupDescriptor = {layout: bindGroupLayout, bindings: [bindGroupBinding]};
     const bindGroup = device.createBindGroup(bindGroupDescriptor);

Modified: trunk/Source/WebCore/ChangeLog (244441 => 244442)


--- trunk/Source/WebCore/ChangeLog	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/ChangeLog	2019-04-18 22:42:36 UTC (rev 244442)
@@ -1,3 +1,58 @@
+2019-04-18  Justin Fan  <justin_...@apple.com>
+
+        [Web GPU] Implement API default values
+        https://bugs.webkit.org/show_bug.cgi?id=197032
+
+        Reviewed by Myles C. Maxfield.
+
+        Add default values and 'required' qualifiers recently merged to the WebGPU API.
+
+        WebGPU tests specifying these default values have been updated to rely on them for functionality.
+
+        * Modules/webgpu/GPUBindGroupLayoutBinding.idl:
+        * Modules/webgpu/GPUBindGroupLayoutDescriptor.idl:
+        * Modules/webgpu/GPUBlendDescriptor.idl:
+        * Modules/webgpu/GPUBufferDescriptor.idl:
+        * Modules/webgpu/GPUColor.idl:
+        * Modules/webgpu/GPUColorStateDescriptor.idl:
+        * Modules/webgpu/GPUDepthStencilStateDescriptor.idl:
+        * Modules/webgpu/GPUExtent3D.idl:
+        * Modules/webgpu/GPUInputStateDescriptor.idl:
+        * Modules/webgpu/GPUOrigin3D.h:
+        * Modules/webgpu/GPUOrigin3D.idl:
+        * Modules/webgpu/GPURequestAdapterOptions.idl:
+        * Modules/webgpu/GPUTextureDescriptor.idl:
+        * Modules/webgpu/GPUVertexAttributeDescriptor.idl:
+        * Modules/webgpu/GPUVertexInputDescriptor.idl:
+        * Modules/webgpu/WebGPUBindGroupBinding.idl:
+        * Modules/webgpu/WebGPUBindGroupDescriptor.idl:
+        * Modules/webgpu/WebGPUBufferBinding.h:
+        * Modules/webgpu/WebGPUBufferBinding.idl:
+        * Modules/webgpu/WebGPUCommandEncoder.idl:
+        * Modules/webgpu/WebGPUPipelineDescriptorBase.idl:
+        * Modules/webgpu/WebGPUPipelineLayoutDescriptor.idl:
+        * Modules/webgpu/WebGPUPipelineStageDescriptor.idl:
+        * Modules/webgpu/WebGPURenderPassDescriptor.idl:
+        * Modules/webgpu/WebGPURenderPipelineDescriptor.cpp:
+        (WebCore::WebGPURenderPipelineDescriptor::tryCreateGPURenderPipelineDescriptor const):
+        * Modules/webgpu/WebGPURenderPipelineDescriptor.h:
+        * Modules/webgpu/WebGPURenderPipelineDescriptor.idl:
+        * Modules/webgpu/WebGPUShaderModuleDescriptor.idl:
+        * platform/graphics/gpu/GPUBlendDescriptor.h:
+        * platform/graphics/gpu/GPUColorStateDescriptor.h:
+        * platform/graphics/gpu/GPUCommandBuffer.h:
+        * platform/graphics/gpu/GPUDepthStencilStateDescriptor.h:
+        * platform/graphics/gpu/GPURenderPassDescriptor.h:
+        * platform/graphics/gpu/GPURenderPipelineDescriptor.h:
+        (WebCore::GPURenderPipelineDescriptor::GPURenderPipelineDescriptor):
+        * platform/graphics/gpu/GPURequestAdapterOptions.h:
+        * platform/graphics/gpu/GPUTextureDescriptor.h:
+        * platform/graphics/gpu/GPUVertexAttributeDescriptor.h:
+        * platform/graphics/gpu/GPUVertexInputDescriptor.h:
+        * platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm:
+        (WebCore::convertRenderPipelineDescriptor):
+        (WebCore::trySetFunctionsForPipelineDescriptor):
+
 2019-04-18  Jer Noble  <jer.no...@apple.com>
 
         Refactoring: Pull all fullscreen code out of Document and into its own helper class

Modified: trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutBinding.idl (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutBinding.idl	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutBinding.idl	2019-04-18 22:42:36 UTC (rev 244442)
@@ -43,7 +43,7 @@
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU
 ] dictionary GPUBindGroupLayoutBinding {
-    u32 binding;
-    GPUShaderStageFlags visibility;
-    GPUBindingType type;
+    required u32 binding;
+    required GPUShaderStageFlags visibility;
+    required GPUBindingType type;
 };

Modified: trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutDescriptor.idl (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutDescriptor.idl	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/GPUBindGroupLayoutDescriptor.idl	2019-04-18 22:42:36 UTC (rev 244442)
@@ -28,5 +28,5 @@
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU
 ] dictionary GPUBindGroupLayoutDescriptor {
-    sequence<GPUBindGroupLayoutBinding> bindings;
+    required sequence<GPUBindGroupLayoutBinding> bindings;
 };

Modified: trunk/Source/WebCore/Modules/webgpu/GPUBlendDescriptor.idl (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/GPUBlendDescriptor.idl	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/GPUBlendDescriptor.idl	2019-04-18 22:42:36 UTC (rev 244442)
@@ -56,7 +56,7 @@
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU
 ] dictionary GPUBlendDescriptor {
-    GPUBlendFactor srcFactor;
-    GPUBlendFactor dstFactor;
-    GPUBlendOperation operation;
+    GPUBlendFactor srcFactor = "one";
+    GPUBlendFactor dstFactor = "zero";
+    GPUBlendOperation operation = "add";
 };

Modified: trunk/Source/WebCore/Modules/webgpu/GPUBufferDescriptor.idl (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/GPUBufferDescriptor.idl	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/GPUBufferDescriptor.idl	2019-04-18 22:42:36 UTC (rev 244442)
@@ -31,6 +31,6 @@
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU
 ] dictionary GPUBufferDescriptor {
-    u64 size;
-    GPUBufferUsageFlags usage;
+    required u64 size;
+    required GPUBufferUsageFlags usage;
 };

Modified: trunk/Source/WebCore/Modules/webgpu/GPUColor.idl (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/GPUColor.idl	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/GPUColor.idl	2019-04-18 22:42:36 UTC (rev 244442)
@@ -28,8 +28,8 @@
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU
 ] dictionary GPUColor {
-    float r;
-    float g;
-    float b;
-    float a;
+    required float r;
+    required float g;
+    required float b;
+    required float a;
 };

Modified: trunk/Source/WebCore/Modules/webgpu/GPUColorStateDescriptor.idl (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/GPUColorStateDescriptor.idl	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/GPUColorStateDescriptor.idl	2019-04-18 22:42:36 UTC (rev 244442)
@@ -30,9 +30,9 @@
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU
 ] dictionary GPUColorStateDescriptor {
-    GPUTextureFormat format;
+    required GPUTextureFormat format;
 
-    GPUBlendDescriptor alphaBlend;
-    GPUBlendDescriptor colorBlend;
-    GPUColorWriteFlags writeMask;
+    required GPUBlendDescriptor alphaBlend;
+    required GPUBlendDescriptor colorBlend;
+    GPUColorWriteFlags writeMask; // GPUColorWriteBits.ALL
 };

Modified: trunk/Source/WebCore/Modules/webgpu/GPUDepthStencilStateDescriptor.idl (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/GPUDepthStencilStateDescriptor.idl	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/GPUDepthStencilStateDescriptor.idl	2019-04-18 22:42:36 UTC (rev 244442)
@@ -28,8 +28,8 @@
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU
 ] dictionary GPUDepthStencilStateDescriptor {
-    boolean depthWriteEnabled;
-    GPUCompareFunction depthCompare;
+    boolean depthWriteEnabled = false;
+    GPUCompareFunction depthCompare = "always";
 
 /* Not Yet Implemented
     GPUStencilStateFaceDescriptor stencilFront;

Modified: trunk/Source/WebCore/Modules/webgpu/GPUExtent3D.idl (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/GPUExtent3D.idl	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/GPUExtent3D.idl	2019-04-18 22:42:36 UTC (rev 244442)
@@ -30,7 +30,7 @@
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU
 ] dictionary GPUExtent3D {
-    u32 width;
-    u32 height;
-    u32 depth;
+    required u32 width;
+    required u32 height;
+    required u32 depth;
 };

Modified: trunk/Source/WebCore/Modules/webgpu/GPUInputStateDescriptor.idl (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/GPUInputStateDescriptor.idl	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/GPUInputStateDescriptor.idl	2019-04-18 22:42:36 UTC (rev 244442)
@@ -37,8 +37,8 @@
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU
 ] dictionary GPUInputStateDescriptor {
-    GPUIndexFormat indexFormat;
+    GPUIndexFormat? indexFormat;
 
-    sequence<GPUVertexAttributeDescriptor> attributes;
-    sequence<GPUVertexInputDescriptor> inputs;
+    required sequence<GPUVertexAttributeDescriptor> attributes;
+    required sequence<GPUVertexInputDescriptor> inputs;
 };

Modified: trunk/Source/WebCore/Modules/webgpu/GPUOrigin3D.h (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/GPUOrigin3D.h	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/GPUOrigin3D.h	2019-04-18 22:42:36 UTC (rev 244442)
@@ -30,9 +30,9 @@
 namespace WebCore {
 
 struct GPUOrigin3D {
-    unsigned x;
-    unsigned y;
-    unsigned z;
+    unsigned x { 0 };
+    unsigned y { 0 };
+    unsigned z { 0 };
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/Modules/webgpu/GPUOrigin3D.idl (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/GPUOrigin3D.idl	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/GPUOrigin3D.idl	2019-04-18 22:42:36 UTC (rev 244442)
@@ -30,7 +30,7 @@
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU
 ] dictionary GPUOrigin3D {
-    u32 x;
-    u32 y;
-    u32 z;
+    u32 x = 0;
+    u32 y = 0;
+    u32 z = 0;
 };

Modified: trunk/Source/WebCore/Modules/webgpu/GPURequestAdapterOptions.idl (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/GPURequestAdapterOptions.idl	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/GPURequestAdapterOptions.idl	2019-04-18 22:42:36 UTC (rev 244442)
@@ -35,5 +35,5 @@
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU
 ] dictionary GPURequestAdapterOptions {
-    GPUPowerPreference powerPreference;
+    GPUPowerPreference? powerPreference;
 };

Modified: trunk/Source/WebCore/Modules/webgpu/GPUTextureDescriptor.idl (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/GPUTextureDescriptor.idl	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/GPUTextureDescriptor.idl	2019-04-18 22:42:36 UTC (rev 244442)
@@ -39,11 +39,11 @@
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU
 ] dictionary GPUTextureDescriptor {
-    GPUExtent3D size;
-    u32 arrayLayerCount;
-    u32 mipLevelCount;
-    u32 sampleCount;
-    GPUTextureDimension dimension;
-    GPUTextureFormat format;
-    GPUTextureUsageFlags usage;
+    required GPUExtent3D size;
+    u32 arrayLayerCount = 1;
+    u32 mipLevelCount = 1;
+    u32 sampleCount = 1;
+    GPUTextureDimension dimension = "2d";
+    required GPUTextureFormat format;
+    required GPUTextureUsageFlags usage;
 };

Modified: trunk/Source/WebCore/Modules/webgpu/GPUVertexAttributeDescriptor.idl (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/GPUVertexAttributeDescriptor.idl	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/GPUVertexAttributeDescriptor.idl	2019-04-18 22:42:36 UTC (rev 244442)
@@ -40,8 +40,8 @@
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU
 ] dictionary GPUVertexAttributeDescriptor {
-    u32 shaderLocation;
-    u32 inputSlot;
-    u64 offset;
-    GPUVertexFormat format;
+    required u32 shaderLocation;
+    required u32 inputSlot;
+    u64 offset = 0;
+    required GPUVertexFormat format;
 };

Modified: trunk/Source/WebCore/Modules/webgpu/GPUVertexInputDescriptor.idl (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/GPUVertexInputDescriptor.idl	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/GPUVertexInputDescriptor.idl	2019-04-18 22:42:36 UTC (rev 244442)
@@ -38,7 +38,7 @@
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU
 ] dictionary GPUVertexInputDescriptor {
-    u32 inputSlot;
-    u64 stride;
-    GPUInputStepMode stepMode;
+    required u32 inputSlot;
+    required u64 stride;
+    GPUInputStepMode stepMode = "vertex";
 };

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupBinding.idl (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupBinding.idl	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupBinding.idl	2019-04-18 22:42:36 UTC (rev 244442)
@@ -31,6 +31,6 @@
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU
 ] dictionary WebGPUBindGroupBinding {
-    u32 binding;
-    WebGPUBindingResource resource;
+    required u32 binding;
+    required WebGPUBindingResource resource;
 };

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupDescriptor.idl (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupDescriptor.idl	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUBindGroupDescriptor.idl	2019-04-18 22:42:36 UTC (rev 244442)
@@ -28,6 +28,6 @@
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU
 ] dictionary WebGPUBindGroupDescriptor {
-    WebGPUBindGroupLayout layout;
-    sequence<WebGPUBindGroupBinding> bindings;
+    required WebGPUBindGroupLayout layout;
+    required sequence<WebGPUBindGroupBinding> bindings;
 };

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUBufferBinding.idl (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUBufferBinding.idl	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUBufferBinding.idl	2019-04-18 22:42:36 UTC (rev 244442)
@@ -30,7 +30,7 @@
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU
 ] dictionary WebGPUBufferBinding {
-    WebGPUBuffer buffer;
-    u64 offset;
-    u64 size;
+    required WebGPUBuffer buffer;
+    u64 offset = 0;
+    required u64 size;
 };

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.idl (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.idl	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUCommandEncoder.idl	2019-04-18 22:42:36 UTC (rev 244442)
@@ -32,10 +32,10 @@
     EnabledAtRuntime=WebGPU,
     ImplementedAs=WebGPUBufferCopyView
 ] dictionary GPUBufferCopyView {
-    WebGPUBuffer buffer;
-    u64 offset;
-    u32 rowPitch;
-    u32 imageHeight;
+    required WebGPUBuffer buffer;
+    u64 offset = 0;
+    required u32 rowPitch;
+    required u32 imageHeight;
 };
 
 [
@@ -43,10 +43,10 @@
     EnabledAtRuntime=WebGPU,
     ImplementedAs=WebGPUTextureCopyView
 ] dictionary GPUTextureCopyView {
-    WebGPUTexture texture;
-    u32 mipLevel;
-    u32 arrayLayer;
-    GPUOrigin3D origin;
+    required WebGPUTexture texture;
+    u32 mipLevel = 0;
+    u32 arrayLayer = 0;
+    GPUOrigin3D origin; // {x: 0, y: 0, z: 0}
 };
 
 [

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUPipelineDescriptorBase.idl (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUPipelineDescriptorBase.idl	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUPipelineDescriptorBase.idl	2019-04-18 22:42:36 UTC (rev 244442)
@@ -28,5 +28,5 @@
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU
 ] dictionary WebGPUPipelineDescriptorBase {
-    WebGPUPipelineLayout layout;
+    WebGPUPipelineLayout? layout = null;
 };

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUPipelineLayoutDescriptor.idl (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUPipelineLayoutDescriptor.idl	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUPipelineLayoutDescriptor.idl	2019-04-18 22:42:36 UTC (rev 244442)
@@ -28,5 +28,5 @@
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU
 ] dictionary WebGPUPipelineLayoutDescriptor {
-    sequence<WebGPUBindGroupLayout> bindGroupLayouts;
+    required sequence<WebGPUBindGroupLayout> bindGroupLayouts;
 };

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUPipelineStageDescriptor.idl (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUPipelineStageDescriptor.idl	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUPipelineStageDescriptor.idl	2019-04-18 22:42:36 UTC (rev 244442)
@@ -30,6 +30,6 @@
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU
 ] dictionary WebGPUPipelineStageDescriptor {
-    WebGPUShaderModule module;
-    DOMString entryPoint;
+    required WebGPUShaderModule module;
+    required DOMString entryPoint;
 };

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassDescriptor.idl (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassDescriptor.idl	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPURenderPassDescriptor.idl	2019-04-18 22:42:36 UTC (rev 244442)
@@ -29,12 +29,12 @@
     EnabledAtRuntime=WebGPU,
     ImplementedAs=WebGPURenderPassColorAttachmentDescriptor
 ] dictionary GPURenderPassColorAttachmentDescriptor {
-    WebGPUTextureView attachment;
+    required WebGPUTextureView attachment;
     // GPUTextureView? resolveTarget;
 
-    GPULoadOp loadOp;
-    GPUStoreOp storeOp;
-    GPUColor clearColor;
+    required GPULoadOp loadOp;
+    required GPUStoreOp storeOp;
+    GPUColor clearColor; // {r: 0.0, g: 0.0, b: 0.0, a: 1.0}
 };
 
 [
@@ -42,11 +42,11 @@
     EnabledAtRuntime=WebGPU,
     ImplementedAs=WebGPURenderPassDepthStencilAttachmentDescriptor
 ] dictionary GPURenderPassDepthStencilAttachmentDescriptor {
-    WebGPUTextureView attachment;
+    required WebGPUTextureView attachment;
 
-    GPULoadOp depthLoadOp;
-    GPUStoreOp depthStoreOp;
-    float clearDepth;
+    required GPULoadOp depthLoadOp;
+    required GPUStoreOp depthStoreOp;
+    required float clearDepth;
 
 /* Not yet implemented
     GPULoadOp stencilLoadOp;
@@ -59,6 +59,6 @@
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU
 ] dictionary WebGPURenderPassDescriptor {
-    sequence<GPURenderPassColorAttachmentDescriptor> colorAttachments;
-    GPURenderPassDepthStencilAttachmentDescriptor? depthStencilAttachment;
+    required sequence<GPURenderPassColorAttachmentDescriptor> colorAttachments;
+    GPURenderPassDepthStencilAttachmentDescriptor? depthStencilAttachment = null;
 };

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.cpp (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.cpp	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.cpp	2019-04-18 22:42:36 UTC (rev 244442)
@@ -37,9 +37,12 @@
     auto pipelineLayout = layout ? makeRefPtr(layout->pipelineLayout()) : nullptr;
 
     auto vertex = vertexStage.tryCreateGPUPipelineStageDescriptor();
-    auto fragment = fragmentStage.tryCreateGPUPipelineStageDescriptor();
 
-    if (!vertex || !fragment) {
+    Optional<GPUPipelineStageDescriptor> fragment;
+    if (fragmentStage)
+        fragment = fragmentStage->tryCreateGPUPipelineStageDescriptor();
+
+    if (!vertex || (fragmentStage && !fragment)) {
         LOG(WebGPU, "WebGPUDevice::createRenderPipeline(): Invalid GPUPipelineStageDescriptor!");
         return WTF::nullopt;
     }
@@ -46,7 +49,7 @@
 
     // FIXME: Web GPU validation, e.g. fail if colorStates is larger than (max number of supported color states).
 
-    return GPURenderPipelineDescriptor { WTFMove(pipelineLayout), WTFMove(*vertex), WTFMove(*fragment), *this };
+    return GPURenderPipelineDescriptor { WTFMove(pipelineLayout), WTFMove(*vertex), WTFMove(fragment), *this };
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.h (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.h	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.h	2019-04-18 22:42:36 UTC (rev 244442)
@@ -38,7 +38,7 @@
     Optional<GPURenderPipelineDescriptor> tryCreateGPURenderPipelineDescriptor() const;
 
     WebGPUPipelineStageDescriptor vertexStage;
-    WebGPUPipelineStageDescriptor fragmentStage;
+    Optional<WebGPUPipelineStageDescriptor> fragmentStage;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.idl (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.idl	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.idl	2019-04-18 22:42:36 UTC (rev 244442)
@@ -38,11 +38,11 @@
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU
 ] dictionary WebGPURenderPipelineDescriptor : WebGPUPipelineDescriptorBase {
-    WebGPUPipelineStageDescriptor vertexStage;
-    WebGPUPipelineStageDescriptor fragmentStage;
+    required WebGPUPipelineStageDescriptor vertexStage;
+    WebGPUPipelineStageDescriptor? fragmentStage = null;
 
-    GPUPrimitiveTopology primitiveTopology;
-    sequence<GPUColorStateDescriptor> colorStates;
-    GPUDepthStencilStateDescriptor? depthStencilState;
-    GPUInputStateDescriptor inputState;
+    required GPUPrimitiveTopology primitiveTopology;
+    required sequence<GPUColorStateDescriptor> colorStates;
+    GPUDepthStencilStateDescriptor? depthStencilState = null;
+    required GPUInputStateDescriptor inputState;
 };

Modified: trunk/Source/WebCore/Modules/webgpu/WebGPUShaderModuleDescriptor.idl (244441 => 244442)


--- trunk/Source/WebCore/Modules/webgpu/WebGPUShaderModuleDescriptor.idl	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/Modules/webgpu/WebGPUShaderModuleDescriptor.idl	2019-04-18 22:42:36 UTC (rev 244442)
@@ -28,6 +28,6 @@
     Conditional=WEBGPU,
     EnabledAtRuntime=WebGPU
 ] dictionary WebGPUShaderModuleDescriptor {
-    /*ArrayBuffer*/ DOMString code; // FIXME: DOMString for MTL prototyping only.
+    required /*ArrayBuffer*/ DOMString code; // FIXME: DOMString for MTL prototyping only.
     boolean isWHLSL = false;
 };

Modified: trunk/Source/WebCore/platform/graphics/gpu/GPUColorStateDescriptor.h (244441 => 244442)


--- trunk/Source/WebCore/platform/graphics/gpu/GPUColorStateDescriptor.h	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPUColorStateDescriptor.h	2019-04-18 22:42:36 UTC (rev 244442)
@@ -38,7 +38,7 @@
 
     GPUBlendDescriptor alphaBlend;
     GPUBlendDescriptor colorBlend;
-    GPUColorWriteFlags writeMask;
+    GPUColorWriteFlags writeMask { static_cast<GPUColorWriteFlags>(GPUColorWriteBits::Flags::All) };
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/gpu/GPURenderPassDescriptor.h (244441 => 244442)


--- trunk/Source/WebCore/platform/graphics/gpu/GPURenderPassDescriptor.h	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPURenderPassDescriptor.h	2019-04-18 22:42:36 UTC (rev 244442)
@@ -39,7 +39,7 @@
 struct GPURenderPassColorAttachmentDescriptorBase {
     GPULoadOp loadOp;
     GPUStoreOp storeOp;
-    GPUColor clearColor;
+    GPUColor clearColor { 0, 0, 0, 1 };
 };
 
 struct GPURenderPassColorAttachmentDescriptor final : GPURenderPassColorAttachmentDescriptorBase {

Modified: trunk/Source/WebCore/platform/graphics/gpu/GPURenderPipelineDescriptor.h (244441 => 244442)


--- trunk/Source/WebCore/platform/graphics/gpu/GPURenderPipelineDescriptor.h	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPURenderPipelineDescriptor.h	2019-04-18 22:42:36 UTC (rev 244442)
@@ -53,7 +53,7 @@
 };
 
 struct GPURenderPipelineDescriptor : GPUPipelineDescriptorBase, GPURenderPipelineDescriptorBase {
-    GPURenderPipelineDescriptor(RefPtr<GPUPipelineLayout>&& layout, GPUPipelineStageDescriptor&& vertex, GPUPipelineStageDescriptor&& fragment, const GPURenderPipelineDescriptorBase& base)
+    GPURenderPipelineDescriptor(RefPtr<GPUPipelineLayout>&& layout, GPUPipelineStageDescriptor&& vertex, Optional<GPUPipelineStageDescriptor>&& fragment, const GPURenderPipelineDescriptorBase& base)
         : GPUPipelineDescriptorBase { WTFMove(layout) }
         , GPURenderPipelineDescriptorBase(base)
         , vertexStage(WTFMove(vertex))
@@ -62,7 +62,7 @@
     }
 
     GPUPipelineStageDescriptor vertexStage;
-    GPUPipelineStageDescriptor fragmentStage;
+    Optional<GPUPipelineStageDescriptor> fragmentStage;
 };
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/gpu/GPURequestAdapterOptions.h (244441 => 244442)


--- trunk/Source/WebCore/platform/graphics/gpu/GPURequestAdapterOptions.h	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/platform/graphics/gpu/GPURequestAdapterOptions.h	2019-04-18 22:42:36 UTC (rev 244442)
@@ -27,6 +27,8 @@
 
 #if ENABLE(WEBGPU)
 
+#include <wtf/Optional.h>
+
 namespace WebCore {
 
 enum class GPUPowerPreference {
@@ -35,7 +37,7 @@
 };
 
 struct GPURequestAdapterOptions {
-    GPUPowerPreference powerPreference;
+    Optional<GPUPowerPreference> powerPreference;
 };
     
 } // namespace WebCore

Modified: trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm (244441 => 244442)


--- trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm	2019-04-18 22:26:07 UTC (rev 244441)
+++ trunk/Source/WebCore/platform/graphics/gpu/cocoa/GPURenderPipelineMetal.mm	2019-04-18 22:42:36 UTC (rev 244442)
@@ -199,7 +199,8 @@
             return WTF::nullopt;
     }
     whlslDescriptor.vertexEntryPointName = descriptor.vertexStage.entryPoint;
-    whlslDescriptor.fragmentEntryPointName = descriptor.fragmentStage.entryPoint;
+    if (descriptor.fragmentStage)
+        whlslDescriptor.fragmentEntryPointName = descriptor.fragmentStage->entryPoint;
     return whlslDescriptor;
 }
 
@@ -275,19 +276,23 @@
     const auto& vertexStage = descriptor.vertexStage;
     const auto& fragmentStage = descriptor.fragmentStage;
 
-    if (vertexStage.module.ptr() == fragmentStage.module.ptr()) {
-        // FIXME: https://bugs.webkit.org/show_bug.cgi?id=195446 Allow WHLSL shaders to come from different programs.
-        const auto& whlslSource = vertexStage.module->whlslSource();
-        if (!whlslSource.isNull())
+    const auto& whlslSource = vertexStage.module->whlslSource();
+    if (!whlslSource.isNull()) {
+        if (!fragmentStage || vertexStage.module.ptr() == fragmentStage->module.ptr()) {
+            // FIXME: https://bugs.webkit.org/show_bug.cgi?id=195446 Allow WHLSL shaders to come from different programs.
             return trySetWHLSLFunctionsForPipelineDescriptor(functionName, mtlDescriptor, descriptor, whlslSource, device);
+        }
     }
 
     auto vertexLibrary = vertexStage.module->platformShaderModule();
     MTLLibrary *fragmentLibrary = nil;
-    if (!fragmentStage.entryPoint.isNull())
-        fragmentLibrary = fragmentStage.module->platformShaderModule();
+    String fragmentEntryPoint;
+    if (fragmentStage) {
+        fragmentLibrary = fragmentStage->module->platformShaderModule();
+        fragmentEntryPoint = fragmentStage->entryPoint;
+    }
 
-    return trySetMetalFunctionsForPipelineDescriptor(functionName, vertexLibrary, fragmentLibrary, mtlDescriptor, vertexStage.entryPoint, fragmentStage.entryPoint);
+    return trySetMetalFunctionsForPipelineDescriptor(functionName, vertexLibrary, fragmentLibrary, mtlDescriptor, vertexStage.entryPoint, fragmentEntryPoint);
 }
 
 static MTLVertexFormat mtlVertexFormatForGPUVertexFormat(GPUVertexFormat format)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to