Bug 216713

Summary: [WebGPU] Add ENABLE(WHLSL_COMPILER) guard
Product: WebKit Reporter: Don Olmstead <don.olmstead>
Component: WebGPUAssignee: Don Olmstead <don.olmstead>
Status: RESOLVED FIXED    
Severity: Normal CC: benjamin, cdumez, changseok, cmarcelo, darin, ews-watchlist, mmaxfield, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 216712    
Attachments:
Description Flags
Patch
mmaxfield: review+
Patch none

Description Don Olmstead 2020-09-18 12:18:53 PDT
The WHLSL compiler is Metal specific.
Comment 1 Don Olmstead 2020-09-18 12:36:42 PDT
Created attachment 409164 [details]
Patch
Comment 2 Myles C. Maxfield 2020-09-18 13:27:02 PDT
Comment on attachment 409164 [details]
Patch

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

> Source/WTF/wtf/PlatformEnableCocoa.h:564
> +#define ENABLE_WEBGPU 0

This shouldn't be unnecessary. The ENABLE() macro yields false if the token isn't defined.
Comment 3 Myles C. Maxfield 2020-09-18 13:28:01 PDT
Comment on attachment 409164 [details]
Patch

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

>> Source/WTF/wtf/PlatformEnableCocoa.h:564
>> +#define ENABLE_WEBGPU 0
> 
> This shouldn't be unnecessary. The ENABLE() macro yields false if the token isn't defined.

This shouldn't be unnecessary. The ENABLE() macro yields false if the token isn't defined.

> Source/WTF/wtf/PlatformEnableCocoa.h:568
> +#define ENABLE_WHLSL_COMPILER ENABLE_WEBGPU

Why can't we just put this #define in the above block, and #define it to 1? I don't think we have precedence in these PlatformEnable files for defining things to be equal to other things.
Comment 4 Myles C. Maxfield 2020-09-18 13:28:59 PDT
s/precedence/precedent/
Comment 5 Darin Adler 2020-09-18 13:46:02 PDT
Comment on attachment 409164 [details]
Patch

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

>> Source/WTF/wtf/PlatformEnableCocoa.h:568
>> +#define ENABLE_WHLSL_COMPILER ENABLE_WEBGPU
> 
> Why can't we just put this #define in the above block, and #define it to 1? I don't think we have precedence in these PlatformEnable files for defining things to be equal to other things.

I wouldn’t combine the blocks. But I would write it like this:

#if !defined(ENABLE_WHLSL_COMPILER) && ENABLE(WEBGPU)
#define ENABLE_WHLSL_COMPILER 1
#endif
Comment 6 Darin Adler 2020-09-18 13:46:52 PDT
Comment on attachment 409164 [details]
Patch

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

>>> Source/WTF/wtf/PlatformEnableCocoa.h:568
>>> +#define ENABLE_WHLSL_COMPILER ENABLE_WEBGPU
>> 
>> Why can't we just put this #define in the above block, and #define it to 1? I don't think we have precedence in these PlatformEnable files for defining things to be equal to other things.
> 
> I wouldn’t combine the blocks. But I would write it like this:
> 
> #if !defined(ENABLE_WHLSL_COMPILER) && ENABLE(WEBGPU)
> #define ENABLE_WHLSL_COMPILER 1
> #endif

Or alternatively we could always check both in the code, and have ENABLE_WHLSL_COMPILER be a no-op when ENABLE(WEBGPU) is not set.
Comment 7 Don Olmstead 2020-09-18 13:50:48 PDT
Created attachment 409169 [details]
Patch
Comment 8 EWS 2020-09-18 15:54:33 PDT
Committed r267288: <https://trac.webkit.org/changeset/267288>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 409169 [details].
Comment 9 Radar WebKit Bug Importer 2020-09-18 15:55:17 PDT
<rdar://problem/69180169>