Bug 231661 - Make WebGPU.xcodeproj and WebGPU.framework
Summary: Make WebGPU.xcodeproj and WebGPU.framework
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGPU (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Myles C. Maxfield
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-10-13 01:36 PDT by Myles C. Maxfield
Modified: 2021-11-08 20:35 PST (History)
11 users (show)

See Also:


Attachments
WIP (139.57 KB, patch)
2021-10-13 01:44 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
WIP (138.17 KB, patch)
2021-10-14 13:34 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Standalone .xcodeproj (137.97 KB, patch)
2021-10-14 14:36 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (124.11 KB, patch)
2021-10-15 13:46 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
WebCore targets (125.61 KB, patch)
2021-10-15 14:01 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (138.19 KB, patch)
2021-10-18 20:55 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch (137.90 KB, patch)
2021-10-19 00:15 PDT, Myles C. Maxfield
dino: review+
Details | Formatted Diff | Diff
Patch for committing (136.53 KB, patch)
2021-10-19 13:36 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch for committing (136.56 KB, patch)
2021-10-19 13:58 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff
Patch for committing (136.63 KB, patch)
2021-10-19 14:02 PDT, Myles C. Maxfield
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Myles C. Maxfield 2021-10-13 01:36:55 PDT
Make WebGPU.xcodeproj and WebGPU.framework
Comment 1 Myles C. Maxfield 2021-10-13 01:44:09 PDT
Created attachment 441044 [details]
WIP
Comment 2 Alexey Proskuryakov 2021-10-13 08:46:42 PDT
Comment on attachment 441044 [details]
WIP

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

> Source/WebGPU/ChangeLog:9
> +        without requiring all of WebKit. This patch creates a new Xcode project

Is there a particular benefit of having a separate project, not just a target? Managing these adds substantial overhead.
Comment 3 Myles C. Maxfield 2021-10-13 18:55:07 PDT
Comment on attachment 441044 [details]
WIP

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

>> Source/WebGPU/ChangeLog:9
>> +        without requiring all of WebKit. This patch creates a new Xcode project
> 
> Is there a particular benefit of having a separate project, not just a target? Managing these adds substantial overhead.

I don't know!

If a separate team wanted to use the WebGPU implementation, but it was a new target (actually probably 2 new targets - WebGPU & WGSL), presumably inside WebCore.xcodeproj, what would that workflow look like?

Right now, we have PAL.xcodeproj as a child of WebCore.xcodeproj. Would that have the same substantial overhead?

Is your concern just about the addition of a .xcodeproj file, or is it also about creating a new .framework at build time?
Comment 4 Myles C. Maxfield 2021-10-13 18:56:37 PDT
Comment on attachment 441044 [details]
WIP

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

>>> Source/WebGPU/ChangeLog:9
>>> +        without requiring all of WebKit. This patch creates a new Xcode project
>> 
>> Is there a particular benefit of having a separate project, not just a target? Managing these adds substantial overhead.
> 
> I don't know!
> 
> If a separate team wanted to use the WebGPU implementation, but it was a new target (actually probably 2 new targets - WebGPU & WGSL), presumably inside WebCore.xcodeproj, what would that workflow look like?
> 
> Right now, we have PAL.xcodeproj as a child of WebCore.xcodeproj. Would that have the same substantial overhead?
> 
> Is your concern just about the addition of a .xcodeproj file, or is it also about creating a new .framework at build time?

s/Would that have the same substantial overhead?/Would moving a new .xcodeproj to become a child of WebCore.xcodeproj instead of a sibling have the same substantial overhead?/
Comment 5 Alexey Proskuryakov 2021-10-14 08:41:39 PDT
Following up directly.
Comment 6 Myles C. Maxfield 2021-10-14 13:34:55 PDT
Created attachment 441271 [details]
WIP
Comment 7 Myles C. Maxfield 2021-10-14 14:36:13 PDT
Created attachment 441287 [details]
Standalone .xcodeproj
Comment 8 Myles C. Maxfield 2021-10-15 13:46:10 PDT
Created attachment 441420 [details]
Patch
Comment 9 Myles C. Maxfield 2021-10-15 14:01:27 PDT
Created attachment 441424 [details]
WebCore targets
Comment 10 Sam Weinig 2021-10-15 14:30:23 PDT
Comment on attachment 441424 [details]
WebCore targets

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

> Source/WebCore/ChangeLog:13
> +        We've gotten some requests to be able to use WebGPU from native code,
> +        without requiring all of WebKit. This patch adds two new targets to
> +        WebCore.xcodeproj: one that builds the WGSL compiler, and one that
> +        builds WebGPU.framework. The WGSL compiler is built as a static library
> +        that is only used by WebGPU.framework. This patch implements one dummy
> +        function in both targets.

I think this might be better in Source/ rather than in Source/WebCore/? What do you think?
Comment 11 Sam Weinig 2021-10-15 14:33:05 PDT
(In reply to Alexey Proskuryakov from comment #2)
> Comment on attachment 441044 [details]
> WIP
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=441044&action=review
> 
> > Source/WebGPU/ChangeLog:9
> > +        without requiring all of WebKit. This patch creates a new Xcode project
> 
> Is there a particular benefit of having a separate project, not just a
> target? Managing these adds substantial overhead.

Having separate projects makes it much clearer what the lines of abstraction are and what is a layering violation.
Comment 12 Myles C. Maxfield 2021-10-15 14:36:55 PDT
(In reply to Sam Weinig from comment #11)
> (In reply to Alexey Proskuryakov from comment #2)
> > Comment on attachment 441044 [details]
> > WIP
> > 
> > View in context:
> > https://bugs.webkit.org/attachment.cgi?id=441044&action=review
> > 
> > > Source/WebGPU/ChangeLog:9
> > > +        without requiring all of WebKit. This patch creates a new Xcode project
> > 
> > Is there a particular benefit of having a separate project, not just a
> > target? Managing these adds substantial overhead.
> 
> Having separate projects makes it much clearer what the lines of abstraction
> are and what is a layering violation.

[To anyone following along, I'm following-up with Sam offline, since there are considerations here regarding Apple's internal build systems.]
Comment 13 Myles C. Maxfield 2021-10-15 15:09:10 PDT
Comment on attachment 441287 [details]
Standalone .xcodeproj

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

> Source/WebGPU/Configurations/WebGPU.xcconfig:30
> +INSTALL_PATH = $(INSTALL_PATH_$(WK_COCOA_TOUCH));
> +INSTALL_PATH_cocoatouch = $(WK_ALTERNATE_WEBKIT_SDK_PATH)$(SYSTEM_LIBRARY_DIR)/PrivateFrameworks;
> +INSTALL_PATH_ = $(WEBGPU_FRAMEWORKS_DIR);

This is wrong. It shouldn't be installed inside WebKit.framework.
Comment 14 Myles C. Maxfield 2021-10-18 20:54:30 PDT
Comment on attachment 441424 [details]
WebCore targets

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

> Source/WebCore/Configurations/WebCore.xcconfig:65
> +NORMAL_WEBKIT_FRAMEWORKS_DIR = $(WK_ALTERNATE_WEBKIT_SDK_PATH)$(SYSTEM_LIBRARY_DIR)/Frameworks;
> +
> +WEBKIT_FRAMEWORKS_DIR = $(WEBKIT_FRAMEWORKS_DIR_USE_OVERRIDE_FRAMEWORKS_DIR_$(WK_USE_OVERRIDE_FRAMEWORKS_DIR));
> +WEBKIT_FRAMEWORKS_DIR_USE_OVERRIDE_FRAMEWORKS_DIR_NO = $(NORMAL_WEBKIT_FRAMEWORKS_DIR);
> +WEBKIT_FRAMEWORKS_DIR_USE_OVERRIDE_FRAMEWORKS_DIR_YES = $(WK_OVERRIDE_FRAMEWORKS_DIR);
> +
> +INSTALL_PATH = $(WEBKIT_FRAMEWORKS_DIR);

Whoops
Comment 15 Myles C. Maxfield 2021-10-18 20:55:53 PDT
Created attachment 441686 [details]
Patch
Comment 16 Myles C. Maxfield 2021-10-19 00:15:32 PDT
Created attachment 441694 [details]
Patch
Comment 17 Dean Jackson 2021-10-19 10:55:21 PDT
Comment on attachment 441694 [details]
Patch

rs=me
Comment 18 Myles C. Maxfield 2021-10-19 13:36:02 PDT
Created attachment 441784 [details]
Patch for committing
Comment 19 Myles C. Maxfield 2021-10-19 13:58:30 PDT
Created attachment 441789 [details]
Patch for committing
Comment 20 Myles C. Maxfield 2021-10-19 14:02:18 PDT
Created attachment 441791 [details]
Patch for committing
Comment 21 Radar WebKit Bug Importer 2021-10-20 01:37:21 PDT
<rdar://problem/84452606>
Comment 22 Myles C. Maxfield 2021-10-29 15:08:54 PDT
Comment on attachment 441791 [details]
Patch for committing

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

> Source/WebGPU/WebGPU/WebGPUObjC.mm:33
> +    id<MTLDevice> device = MTLCreateSystemDefaultDevice();

https://trac.webkit.org/browser/webkit/trunk/Tools/Scripts/configure-xcode-for-embedded-development#L329 😅
Comment 23 EWS 2021-11-08 20:35:11 PST
Committed r285480 (244004@main): <https://commits.webkit.org/244004@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 441791 [details].