Bug 197032 - [Web GPU] Implement API default values
Summary: [Web GPU] Implement API default values
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Justin Fan
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-04-17 12:58 PDT by Justin Fan
Modified: 2019-04-18 15:43 PDT (History)
9 users (show)

See Also:


Attachments
Patch (51.50 KB, patch)
2019-04-17 13:04 PDT, Justin Fan
no flags Details | Formatted Diff | Diff
Patch for landing (46.72 KB, patch)
2019-04-18 14:54 PDT, Justin Fan
no flags Details | Formatted Diff | Diff
Patch for landing (46.72 KB, patch)
2019-04-18 15:05 PDT, Justin Fan
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Fan 2019-04-17 12:58:14 PDT
[Web GPU] Implement API default values
Comment 1 Justin Fan 2019-04-17 13:04:55 PDT
Created attachment 367668 [details]
Patch
Comment 2 Myles C. Maxfield 2019-04-18 13:32:07 PDT
Comment on attachment 367668 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=367668&action=review

> Source/WebCore/ChangeLog:8
> +        Add default values and 'required' qualifiers recently merged to the WebGPU API.

It's pretty frightening that this patch doesn't update almost any .cpp or .mm files, which means we were happily accepting garbage values before. I would have hoped that before this patch, all the C++ code that received these values would have done more default value creation or exception/error throwing, and this patch could have deleted all that C++ code in favor of using the IDL to represent the same checks.

> Source/WebCore/Modules/webgpu/WebGPUBufferBinding.h:37
> +    uint64_t offset = 0;

Shouldn't this be done in the IDL?

> Source/WebCore/Modules/webgpu/WebGPURenderPipelineDescriptor.h:41
> +    Optional<WebGPUPipelineStageDescriptor> fragmentStage;

👍

> Source/WebCore/platform/graphics/gpu/GPUBlendDescriptor.h:59
> +    GPUBlendFactor srcFactor { GPUBlendFactor::One };
> +    GPUBlendFactor dstFactor { GPUBlendFactor::Zero };
> +    GPUBlendOperation operation { GPUBlendOperation::Add };

Doesn't the IDL take care of this for you? And ditto below.

> LayoutTests/ChangeLog:24
> +        * 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:

Just deleting code from existing tests isn't very exhaustive. There should probably be a single new file that has a bunch of tests in it, where each test specifies every value except one, and then draws something, and we determine from the rendered content (or from some other mechanism) whether the default value was specified.

If we made such a test we should consider contributing it to the WG. The WG is going to try to make a comprehensive test suite.
Comment 3 Justin Fan 2019-04-18 14:54:27 PDT
Created attachment 367761 [details]
Patch for landing
Comment 4 WebKit Commit Bot 2019-04-18 14:56:09 PDT
Comment on attachment 367761 [details]
Patch for landing

Rejecting attachment 367761 [details] from commit-queue.

Failed to run "['/Volumes/Data/EWS/WebKit/Tools/Scripts/webkit-patch', '--status-host=webkit-queues.webkit.org', '--bot-id=webkit-cq-01', 'validate-changelog', '--check-oops', '--non-interactive', 367761, '--port=mac']" exit_code: 1 cwd: /Volumes/Data/EWS/WebKit

ChangeLog entry in LayoutTests/ChangeLog contains OOPS!.

Full output: https://webkit-queues.webkit.org/results/11919784
Comment 5 Justin Fan 2019-04-18 15:05:51 PDT
Created attachment 367763 [details]
Patch for landing
Comment 6 WebKit Commit Bot 2019-04-18 15:42:43 PDT
Comment on attachment 367763 [details]
Patch for landing

Clearing flags on attachment: 367763

Committed r244442: <https://trac.webkit.org/changeset/244442>
Comment 7 WebKit Commit Bot 2019-04-18 15:42:44 PDT
All reviewed patches have been landed.  Closing bug.
Comment 8 Radar WebKit Bug Importer 2019-04-18 15:43:22 PDT
<rdar://problem/50031486>