Bug 245755 - [WGSL] Implement hex float parsing
Summary: [WGSL] Implement hex float parsing
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGPU (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-09-27 15:38 PDT by Dan Glastonbury
Modified: 2022-09-27 15:39 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Glastonbury 2022-09-27 15:38:36 PDT
WGSL doesn't support hex float parsing.

With a test, such as:

```
TEST(WGSLConstLiteralTests, AbstractFloatLiteralHex)
{
    const ConstLiteralTestCase<double> testCases[] = {
        { "0xa.fp+2"_s, 0xa.fp+2 },
        { "0X.3"_s, 0X.3p+0 },
        { "0X1.fp-4"_s, 0X1.fp-4 }
    };

    for (const auto& testCase : testCases) {
         auto parseResult = parseLCharPrimaryExpression(testCase.input);
         EXPECT_TRUE(parseResult);

         auto expr = WTFMove(*parseResult);
         EXPECT_TRUE(expr->isAbstractFloatLiteral());

         const auto& floatLiteral = downcast<WGSL::AST::AbstractFloatLiteral>(expr.get());
         EXPECT_EQ(floatLiteral.value(), testCase.expectedValue);
         auto inputLength = testCase.input.length();
         EXPECT_EQ(floatLiteral.span(), WGSL::SourceSpan(0, inputLength, inputLength, 0));
     }
}
```
Comment 1 Radar WebKit Bug Importer 2022-09-27 15:39:19 PDT
<rdar://problem/100479770>