7591d4b5ef
Throughout SkSL we've begun using doubles as a convenient way to store any SkSL value (int, float, bool) in a single type. This idea has now been extended to literals. Rather than having three expression kinds for integers, floats and boolean literals, we can have just one. These can be accessed in a type-specific way (`floatValue`, `intValue`, and `boolValue` return the expected type, or assert if it's not the matching type), or in a type-agnostic way (`value` will return a double and works on any type of Literal). This allows us to remove a complex template trick (Literal<T> is gone), removes two redundant Expression types, and and lets us reduce our code size in ConstantFolder, FunctionCall, etc. Most of the conversion process was pretty straightforward: * `IntLiteral::Make` becomes `Literal::MakeInt` * `x.is<IntLiteral>()` becomes `x.isIntLiteral()` * `x.as<IntLiteral>.value()` becomes `x.as<Literal>.intValue()` Change-Id: Ic328533611e4551669c7fc9d7f9c03e34699f3f6 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/447836 Commit-Queue: John Stiles <johnstiles@google.com> Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
6 lines
113 B
GLSL
6 lines
113 B
GLSL
### Compilation failed:
|
|
|
|
error: 1: unknown identifier 'x1'
|
|
error: 2: expected 'half', but found 'float'
|
|
2 errors
|