Bug 167952

Summary: WebGPU prototype
Product: WebKit Reporter: Dean Jackson <dino>
Component: WebGPUAssignee: Dean Jackson <dino>
Status: REOPENED ---    
Severity: Normal CC: cdumez, changseok, chi187, commit-queue, daxpedda, dino, esprehn+autocc, graouts, gyuyoung.kim, i.kakeru, jonlee, keith_miller, kkinnunen, kondapallykalyan, mark.lam, mike, msaboff, rtfss1, saam, y.kikura, zan
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 169219, 169365, 169366, 169367, 169368, 169370, 169371, 169372, 169375, 169376, 169377, 169378, 169379, 169380, 169381, 169451, 169535, 169539    
Bug Blocks:    
Attachments:
Description Flags
Prototype
none
Frontend patch that should build when WEBGPU not defined
none
Frontend patch that should build when WEBGPU not defined
none
1. Frontend patch that should build when WEBGPU not defined
none
2. Adjust Front-End classes to build with platform stubs
none
2. Adjust Front-End classes to build with platform stubs
none
Complete patch (1+2)
dino: review+
Patch for EWS none

Description Dean Jackson 2017-02-07 13:09:09 PST
A prototype for a new GPU API.
Comment 1 Dean Jackson 2017-02-07 13:14:28 PST
Created attachment 300839 [details]
Prototype

Here is a WIP patch. It definitely can't be landed in the current form.

- it doesn't yet match the API proposal
- it doesn't separate WebGPU from the Metal API. i.e. there should be a GPU* interface with GPU*Metal implementations
- it does no validation
- it doesn't have a compile time or runtime guard

It's here just to experiment.
Comment 2 rtfss1 2017-02-09 04:25:11 PST
Hi,
interesting Webkit that current patch uses metal shaders.
For me this might be even a good shader language to use in WebGPU, but then will be time for requesting Apple to open source Metal shader compiler stack like Microsoft has done recently with current HLSL shader compiler that translates to his new intermediate format DXIL.. the new Microsoft compiler uses LLVM/Clang stack and seems Apple Metal shader compiler too.. 
So briefly here (may be not the current best place to ask), with Khronos LLVM IR<->SPIR-V translator and DXIL open source only modern shader language compiler not open source is Metal and would make sense to open source it for WebGPU implementations on other OSes and even make easier porting modern macos/IOS games using Metal to other OSes..
Makes sense?
thanks..
Comment 3 Jon Lee 2017-02-14 16:08:26 PST
(In reply to comment #2)
> So briefly here (may be not the current best place to ask)

@rtfss1, the best place to pose technical questions is in the WebGPU GitHub repo: https://github.com/gpuweb/gpuweb
Comment 4 Jon Lee 2017-03-10 17:09:57 PST
Created attachment 304103 [details]
Frontend patch that should build when WEBGPU not defined

No review yet.
Comment 5 WebKit Commit Bot 2017-03-10 17:12:31 PST
Attachment 304103 [details] did not pass style-queue:


ERROR: Source/WebCore/html/canvas/WebGPURenderingContext.cpp:39:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/html/canvas/WebGPURenderingContext.cpp:43:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/html/canvas/WebGPURenderingContext.cpp:90:  Multi line control clauses should use braces.  [whitespace/braces] [4]
ERROR: Source/WebCore/html/canvas/WebGPURenderingContext.cpp:122:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
ERROR: Source/WebCore/html/canvas/WebGPURenderCommandEncoder.h:51:  The parameter name "buffer" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/WebCore/html/canvas/WebGPURenderCommandEncoder.h:51:  Omit int when using unsigned  [runtime/unsigned] [1]
ERROR: Source/WebCore/html/canvas/WebGPURenderCommandEncoder.h:52:  The parameter name "buffer" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/WebCore/html/canvas/WebGPURenderCommandEncoder.h:52:  Omit int when using unsigned  [runtime/unsigned] [1]
ERROR: Source/WebCore/html/canvas/WebGPURenderCommandEncoder.h:53:  Omit int when using unsigned  [runtime/unsigned] [1]
ERROR: Source/WebCore/Configurations/FeatureDefines.xcconfig:0:  Any changes made to FeatureDefines should be made to all of them (changed file does not match Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig). Use sync-feature-defines if possible.  [featuredefines/equality] [5]
ERROR: Source/WebCore/Configurations/FeatureDefines.xcconfig:0:  Any changes made to FeatureDefines should be made to all of them (changed file does not match Source/WebCore/PAL/Configurations/FeatureDefines.xcconfig). Use sync-feature-defines if possible.  [featuredefines/equality] [5]
ERROR: Source/WebCore/Configurations/FeatureDefines.xcconfig:0:  Any changes made to FeatureDefines should be made to all of them (changed file does not match Source/WebKit/mac/Configurations/FeatureDefines.xcconfig). Use sync-feature-defines if possible.  [featuredefines/equality] [5]
ERROR: Source/WebCore/Configurations/FeatureDefines.xcconfig:0:  Any changes made to FeatureDefines should be made to all of them (changed file does not match Source/WebKit2/Configurations/FeatureDefines.xcconfig). Use sync-feature-defines if possible.  [featuredefines/equality] [5]
ERROR: Source/WebCore/Configurations/FeatureDefines.xcconfig:0:  Any changes made to FeatureDefines should be made to all of them (changed file does not match Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig). Use sync-feature-defines if possible.  [featuredefines/equality] [5]
ERROR: Source/WebCore/html/canvas/WebGPUCommandBuffer.cpp:36:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/html/canvas/WebGPUTextureDescriptor.cpp:61:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
ERROR: Source/WebCore/html/canvas/WebGPURenderPipelineState.cpp:32:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/html/canvas/WebGPURenderPassDescriptor.cpp:31:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/html/canvas/WebGPURenderPassDescriptor.cpp:34:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/html/canvas/WebGPURenderPassDescriptor.cpp:46:  Wrong number of spaces before statement. (expected: 4)  [whitespace/indent] [4]
ERROR: Source/WebCore/html/canvas/WebGPURenderPassDescriptor.cpp:76:  One line control clauses should not use braces.  [whitespace/braces] [4]
ERROR: Source/WebCore/html/canvas/WebGPUCommandBuffer.h:51:  The parameter name "descriptor" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/WebCore/html/canvas/WebGPUObject.h:48:  The parameter name "context" adds no information, so it should be removed.  [readability/parameter_name] [5]
ERROR: Source/WebCore/html/canvas/WebGPURenderPipelineDescriptor.cpp:32:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/html/canvas/WebGPURenderPipelineDescriptor.cpp:35:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/html/canvas/WebGPURenderPipelineDescriptor.cpp:65:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
ERROR: Source/WebCore/html/canvas/WebGPURenderPipelineDescriptor.cpp:112:  One line control clauses should not use braces.  [whitespace/braces] [4]
ERROR: Source/WebCore/html/canvas/WebGPUDepthStencilDescriptor.cpp:61:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
ERROR: Source/WebCore/html/canvas/WebGPURenderCommandEncoder.cpp:31:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/html/canvas/WebGPURenderCommandEncoder.cpp:36:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/html/canvas/WebGPURenderCommandEncoder.cpp:38:  Alphabetical sorting problem.  [build/include_order] [4]
ERROR: Source/WebCore/html/canvas/WebGPURenderCommandEncoder.cpp:74:  Omit int when using unsigned  [runtime/unsigned] [1]
ERROR: Source/WebCore/html/canvas/WebGPURenderCommandEncoder.cpp:82:  Omit int when using unsigned  [runtime/unsigned] [1]
ERROR: Source/WebCore/html/canvas/WebGPURenderCommandEncoder.cpp:90:  Omit int when using unsigned  [runtime/unsigned] [1]
ERROR: Source/WebCore/html/canvas/WebGPUDepthStencilState.cpp:32:  Alphabetical sorting problem.  [build/include_order] [4]
Total errors found: 35 in 72 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 Jon Lee 2017-03-10 18:03:09 PST
Created attachment 304108 [details]
Frontend patch that should build when WEBGPU not defined
Comment 7 WebKit Commit Bot 2017-03-10 18:05:11 PST
Attachment 304108 [details] did not pass style-queue:


ERROR: Source/WebCore/html/canvas/WebGPURenderingContext.cpp:90:  Multi line control clauses should use braces.  [whitespace/braces] [4]
ERROR: Source/WebCore/html/canvas/WebGPURenderCommandEncoder.h:51:  Omit int when using unsigned  [runtime/unsigned] [1]
ERROR: Source/WebCore/html/canvas/WebGPURenderCommandEncoder.h:52:  Omit int when using unsigned  [runtime/unsigned] [1]
ERROR: Source/WebCore/html/canvas/WebGPURenderCommandEncoder.h:53:  Omit int when using unsigned  [runtime/unsigned] [1]
ERROR: Source/WebCore/Configurations/FeatureDefines.xcconfig:0:  Any changes made to FeatureDefines should be made to all of them (changed file does not match Source/JavaScriptCore/Configurations/FeatureDefines.xcconfig). Use sync-feature-defines if possible.  [featuredefines/equality] [5]
ERROR: Source/WebCore/Configurations/FeatureDefines.xcconfig:0:  Any changes made to FeatureDefines should be made to all of them (changed file does not match Source/WebCore/PAL/Configurations/FeatureDefines.xcconfig). Use sync-feature-defines if possible.  [featuredefines/equality] [5]
ERROR: Source/WebCore/Configurations/FeatureDefines.xcconfig:0:  Any changes made to FeatureDefines should be made to all of them (changed file does not match Source/WebKit/mac/Configurations/FeatureDefines.xcconfig). Use sync-feature-defines if possible.  [featuredefines/equality] [5]
ERROR: Source/WebCore/Configurations/FeatureDefines.xcconfig:0:  Any changes made to FeatureDefines should be made to all of them (changed file does not match Source/WebKit2/Configurations/FeatureDefines.xcconfig). Use sync-feature-defines if possible.  [featuredefines/equality] [5]
ERROR: Source/WebCore/Configurations/FeatureDefines.xcconfig:0:  Any changes made to FeatureDefines should be made to all of them (changed file does not match Tools/TestWebKitAPI/Configurations/FeatureDefines.xcconfig). Use sync-feature-defines if possible.  [featuredefines/equality] [5]
ERROR: Source/WebCore/html/canvas/WebGPURenderCommandEncoder.cpp:74:  Omit int when using unsigned  [runtime/unsigned] [1]
ERROR: Source/WebCore/html/canvas/WebGPURenderCommandEncoder.cpp:82:  Omit int when using unsigned  [runtime/unsigned] [1]
ERROR: Source/WebCore/html/canvas/WebGPURenderCommandEncoder.cpp:90:  Omit int when using unsigned  [runtime/unsigned] [1]
Total errors found: 12 in 72 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 8 Jon Lee 2017-03-10 20:38:14 PST
Created attachment 304121 [details]
1. Frontend patch that should build when WEBGPU not defined
Comment 9 Jon Lee 2017-03-10 20:39:01 PST
Created attachment 304122 [details]
2. Adjust Front-End classes to build with platform stubs
Comment 10 Jon Lee 2017-03-10 22:35:47 PST
Created attachment 304136 [details]
2. Adjust Front-End classes to build with platform stubs
Comment 11 Jon Lee 2017-03-10 22:38:47 PST
Created attachment 304137 [details]
Complete patch (1+2)
Comment 12 WebKit Commit Bot 2017-03-10 22:42:21 PST
Attachment 304137 [details] did not pass style-queue:


ERROR: Source/WebCore/html/canvas/WebGPURenderCommandEncoder.h:45:  Omit int when using unsigned  [runtime/unsigned] [1]
ERROR: Source/WebCore/html/canvas/WebGPURenderCommandEncoder.h:46:  Omit int when using unsigned  [runtime/unsigned] [1]
ERROR: Source/WebCore/html/canvas/WebGPURenderCommandEncoder.h:47:  Omit int when using unsigned  [runtime/unsigned] [1]
ERROR: Source/WebCore/html/canvas/WebGPURenderCommandEncoder.h:65:  Omit int when using unsigned  [runtime/unsigned] [1]
ERROR: Source/WebCore/html/canvas/WebGPURenderCommandEncoder.h:66:  Omit int when using unsigned  [runtime/unsigned] [1]
ERROR: Source/WebCore/html/canvas/WebGPURenderCommandEncoder.h:67:  Omit int when using unsigned  [runtime/unsigned] [1]
ERROR: Source/WebCore/ChangeLog:36:  Need whitespace between colon and description  [changelog/filechangedescriptionwhitespace] [5]
ERROR: Source/WebCore/ChangeLog:37:  Need whitespace between colon and description  [changelog/filechangedescriptionwhitespace] [5]
ERROR: Source/WebCore/ChangeLog:38:  Need whitespace between colon and description  [changelog/filechangedescriptionwhitespace] [5]
ERROR: Source/WebCore/ChangeLog:39:  Need whitespace between colon and description  [changelog/filechangedescriptionwhitespace] [5]
ERROR: Source/WebCore/ChangeLog:40:  Need whitespace between colon and description  [changelog/filechangedescriptionwhitespace] [5]
ERROR: Source/WebCore/ChangeLog:41:  Need whitespace between colon and description  [changelog/filechangedescriptionwhitespace] [5]
ERROR: Source/WebCore/ChangeLog:42:  Need whitespace between colon and description  [changelog/filechangedescriptionwhitespace] [5]
ERROR: Source/WebCore/ChangeLog:43:  Need whitespace between colon and description  [changelog/filechangedescriptionwhitespace] [5]
ERROR: Source/WebCore/ChangeLog:44:  Need whitespace between colon and description  [changelog/filechangedescriptionwhitespace] [5]
ERROR: Source/WebCore/ChangeLog:45:  Need whitespace between colon and description  [changelog/filechangedescriptionwhitespace] [5]
ERROR: Source/WebCore/ChangeLog:46:  Need whitespace between colon and description  [changelog/filechangedescriptionwhitespace] [5]
ERROR: Source/WebCore/ChangeLog:47:  Need whitespace between colon and description  [changelog/filechangedescriptionwhitespace] [5]
ERROR: Source/WebCore/ChangeLog:48:  Need whitespace between colon and description  [changelog/filechangedescriptionwhitespace] [5]
ERROR: Source/WebCore/ChangeLog:49:  Need whitespace between colon and description  [changelog/filechangedescriptionwhitespace] [5]
ERROR: Source/WebCore/ChangeLog:50:  Need whitespace between colon and description  [changelog/filechangedescriptionwhitespace] [5]
ERROR: Source/WebCore/ChangeLog:51:  Need whitespace between colon and description  [changelog/filechangedescriptionwhitespace] [5]
ERROR: Source/WebCore/ChangeLog:52:  Need whitespace between colon and description  [changelog/filechangedescriptionwhitespace] [5]
ERROR: Source/WebCore/ChangeLog:53:  Need whitespace between colon and description  [changelog/filechangedescriptionwhitespace] [5]
ERROR: Source/WebCore/ChangeLog:54:  Need whitespace between colon and description  [changelog/filechangedescriptionwhitespace] [5]
ERROR: Source/WebCore/ChangeLog:55:  Need whitespace between colon and description  [changelog/filechangedescriptionwhitespace] [5]
ERROR: Source/WebCore/ChangeLog:56:  Need whitespace between colon and description  [changelog/filechangedescriptionwhitespace] [5]
ERROR: Source/WebCore/html/canvas/WebGPURenderCommandEncoder.cpp:76:  Omit int when using unsigned  [runtime/unsigned] [1]
ERROR: Source/WebCore/html/canvas/WebGPURenderCommandEncoder.cpp:84:  Omit int when using unsigned  [runtime/unsigned] [1]
ERROR: Source/WebCore/html/canvas/WebGPURenderCommandEncoder.cpp:92:  Omit int when using unsigned  [runtime/unsigned] [1]
Total errors found: 30 in 75 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 13 Dean Jackson 2017-03-11 14:48:22 PST
Comment on attachment 304137 [details]
Complete patch (1+2)

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

> Source/WebCore/ChangeLog:12
> +        * Configurations/FeatureDefines.xcconfig: For EWS, turn of WebGPU in WebCore. This
> +        should not be checked in.

Removing this since you've undone the change.

> Source/WebCore/ChangeLog:15
> +        * WebCore.xcodeproj/project.pbxproj: Add WebGPU files.

I'm going to add them to PlatformMac.cmake too.

> Source/WebCore/html/canvas/WebGPUCommandBuffer.cpp:31
> +/***

I'll replace these with /* FIXME: WebGPU - not implemented yet.

> Source/WebCore/html/canvas/WebGPUCommandBuffer.cpp:52
> +    LOG(WebGPU, "-- WebGPUCommandBuffer::WebGPUCommandBuffer() NEW");

I also cleaned these up  (my mistake originally)
Comment 14 Dean Jackson 2017-03-11 15:04:42 PST
Created attachment 304179 [details]
Patch for EWS
Comment 15 Dean Jackson 2017-03-11 15:10:26 PST
Committed r213762: <http://trac.webkit.org/changeset/213762>
Comment 16 Jon Lee 2017-03-12 20:10:08 PDT
Front end checked in, but back end still needs to be done. Reopening.
Comment 17 Jon Lee 2017-03-13 00:12:33 PDT
*** Bug 169376 has been marked as a duplicate of this bug. ***
Comment 18 Jon Lee 2017-03-13 00:12:36 PDT
*** Bug 169377 has been marked as a duplicate of this bug. ***
Comment 19 Jon Lee 2017-03-13 00:12:39 PDT
*** Bug 169378 has been marked as a duplicate of this bug. ***
Comment 20 Jon Lee 2017-03-13 00:12:42 PDT
*** Bug 169379 has been marked as a duplicate of this bug. ***
Comment 21 Jon Lee 2017-03-13 00:12:44 PDT
*** Bug 169380 has been marked as a duplicate of this bug. ***
Comment 22 Jon Lee 2017-03-13 00:12:50 PDT
*** Bug 169381 has been marked as a duplicate of this bug. ***