Summary: | [WHLSL] 'uint y = x ? 1 : 2' fails to typecheck | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Myles C. Maxfield <mmaxfield> | ||||||||||
Component: | WebGPU | Assignee: | Saam Barati <saam> | ||||||||||
Status: | RESOLVED WONTFIX | ||||||||||||
Severity: | Normal | CC: | rmorisset | ||||||||||
Priority: | P2 | ||||||||||||
Version: | WebKit Nightly Build | ||||||||||||
Hardware: | Unspecified | ||||||||||||
OS: | Unspecified | ||||||||||||
Attachments: |
|
Description
Myles C. Maxfield
2019-06-27 14:47:33 PDT
``` float foo() { return true ? 1 : 2 } ``` This patch should add the following text into the "operator cast" section of the standard library: operator uchar(bool x) { return x ? 1 : 0; } operator ushort(bool x) { return x ? 1 : 0; } operator uint(bool x) { return x ? 1 : 0; } operator char(bool x) { return x ? 1 : 0; } operator short(bool x) { return x ? 1 : 0; } operator half(bool x) { return x ? 1 : 0; } operator float(bool x) { return x ? 1 : 0; } Created attachment 373448 [details]
WIP
Trying to fix some final bugs
Created attachment 373449 [details]
WIP
Created attachment 373457 [details]
patch
(In reply to Myles C. Maxfield from comment #2) > This patch should add the following text into the "operator cast" section of > the standard library: > > operator uchar(bool x) { > return x ? 1 : 0; > } > operator ushort(bool x) { > return x ? 1 : 0; > } > operator uint(bool x) { > return x ? 1 : 0; > } > operator char(bool x) { > return x ? 1 : 0; > } > operator short(bool x) { > return x ? 1 : 0; > } > operator half(bool x) { > return x ? 1 : 0; > } > operator float(bool x) { > return x ? 1 : 0; > } I need to rebase and do this, but the patch won't change. So it's still valuable to review in its current form. Created attachment 373458 [details]
patch
Comment on attachment 373458 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=373458&action=review I don't currently understand this code well enough to give it an r+ > Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp:-368 > - } Why change this? > Source/WebCore/Modules/webgpu/WHLSL/WHLSLPrepare.cpp:63 > +static constexpr bool dumpASTAtEnd = true; Please remove. Comment on attachment 373458 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=373458&action=review >> Source/WebCore/Modules/webgpu/WHLSL/WHLSLParser.cpp:-368 >> - } > > Why change this? This is not intentional. Will revert WHLSL is no longer relevant. |