712fd6bbb9
Enums are an SkSL-only concept--when we output code, we emit plain IntLiterals--so the fix is simply to ignore the Enum program element when we encounter it. This is what GLSLCodeGen does as well. Also added a unit test to confirm that enums work normally, and that enums are subject to optimization and static-comparison checks just as ints would be. Change-Id: Ic4f8da7a27983add9eb41b936d46f6638d22bd4b Bug: skia:11003 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/338800 Reviewed-by: Ethan Nicholas <ethannicholas@google.com> Reviewed-by: Brian Osman <brianosman@google.com> Commit-Queue: Ethan Nicholas <ethannicholas@google.com> Auto-Submit: John Stiles <johnstiles@google.com>
47 lines
1.1 KiB
Metal
47 lines
1.1 KiB
Metal
#include <metal_stdlib>
|
|
#include <simd/simd.h>
|
|
using namespace metal;
|
|
struct Inputs {
|
|
};
|
|
struct Outputs {
|
|
float4 sk_FragColor [[color(0)]];
|
|
};
|
|
fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
|
|
Outputs _outputStruct;
|
|
thread Outputs* _out = &_outputStruct;
|
|
{
|
|
_out->sk_FragColor = float4(1.0);
|
|
}
|
|
{
|
|
_out->sk_FragColor = float4(2.0);
|
|
}
|
|
{
|
|
_out->sk_FragColor = float4(6.0);
|
|
}
|
|
_out->sk_FragColor = float4(7.0);
|
|
_out->sk_FragColor = float4(-8.0);
|
|
_out->sk_FragColor = float4(-9.0);
|
|
_out->sk_FragColor = float4(10.0);
|
|
{
|
|
_out->sk_FragColor = float4(11.0);
|
|
}
|
|
{
|
|
_out->sk_FragColor = float4(13.0);
|
|
}
|
|
{
|
|
_out->sk_FragColor = float4(15.0);
|
|
}
|
|
{
|
|
_out->sk_FragColor = float4(16.0);
|
|
}
|
|
{
|
|
_out->sk_FragColor = float4(18.0);
|
|
}
|
|
_out->sk_FragColor = float4(19.0);
|
|
_out->sk_FragColor = float4(20.0);
|
|
{
|
|
_out->sk_FragColor = float4(21.0);
|
|
}
|
|
return *_out;
|
|
}
|