Reland "Add some SkSL intrinsics to our dm tests."

This reverts commit b576168c8c.

Reason for revert: disabled floor test due to undiagnosed ANGLE + DX9 + Intel6000 failures

Original change's description:
> Revert "Add some SkSL intrinsics to our dm tests."
>
> This reverts commit 0492a744a5.
>
> Reason for revert: Intel HD6000 + ANGLE DX9 fails the floor() test.
>
> Original change's description:
> > Add some SkSL intrinsics to our dm tests.
> >
> > This CL adds dm coverage for:
> > - abs(half)
> > - sign(half)
> > - floor
> > - ceil
> >
> > And creates test output for abs(int) and sign(int); these aren't covered
> > by dm because they don't exist in ES2 and so are unsupported by Runtime
> > Effects.
> >
> > Change-Id: Ia3e660408cef50dec8fa4b6bdc12906e96179f6e
> > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/360419
> > Reviewed-by: Ethan Nicholas <ethannicholas@google.com>
> > Commit-Queue: John Stiles <johnstiles@google.com>
> > Auto-Submit: John Stiles <johnstiles@google.com>
>
> TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com
>
> Change-Id: I62121efee9315b16e61e7d38659b6f629bdf8bd8
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362056
> Reviewed-by: John Stiles <johnstiles@google.com>
> Commit-Queue: John Stiles <johnstiles@google.com>

TBR=brianosman@google.com,ethannicholas@google.com,johnstiles@google.com

Change-Id: I22f22f631d85d93a8fe5686a99311ec2cf85fa4d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/362103
Reviewed-by: John Stiles <johnstiles@google.com>
Commit-Queue: John Stiles <johnstiles@google.com>
Auto-Submit: John Stiles <johnstiles@google.com>
This commit is contained in:
John Stiles 2021-01-29 11:44:13 -05:00 committed by Skia Commit-Bot
parent c621dcf354
commit e1658b5977
34 changed files with 841 additions and 210 deletions

View File

@ -209,7 +209,8 @@ sksl_spirv_tests = [
]
sksl_shared_tests = [
"/sksl/intrinsics/Abs.sksl",
"/sksl/intrinsics/AbsFloat.sksl",
"/sksl/intrinsics/AbsInt.sksl",
"/sksl/intrinsics/Acos.sksl",
"/sksl/intrinsics/Acosh.sksl",
"/sksl/intrinsics/All.sksl",
@ -274,7 +275,8 @@ sksl_shared_tests = [
"/sksl/intrinsics/Round.sksl",
"/sksl/intrinsics/RoundEven.sksl",
"/sksl/intrinsics/Saturate.sksl",
"/sksl/intrinsics/Sign.sksl",
"/sksl/intrinsics/SignFloat.sksl",
"/sksl/intrinsics/SignInt.sksl",
"/sksl/intrinsics/Sin.sksl",
"/sksl/intrinsics/Sinh.sksl",
"/sksl/intrinsics/Smoothstep.sksl",

View File

@ -1,6 +0,0 @@
in half a;
in int b;
void main() {
sk_FragColor.x = abs(a);
sk_FragColor.x = half(abs(b));
}

View File

@ -0,0 +1,10 @@
uniform half4 testInputs;
uniform half4 colorGreen, colorRed;
half4 main() {
half4 expected = half4(1.25, 0, 0.75, 2.25);
return (abs(testInputs.x) == expected.x &&
abs(testInputs.xy) == expected.xy &&
abs(testInputs.xyz) == expected.xyz &&
abs(testInputs.xyzw) == expected.xyzw) ? colorGreen : colorRed;
}

View File

@ -0,0 +1,10 @@
uniform half4 testInputs;
uniform half4 colorGreen, colorRed;
half4 main() {
int4 expected = int4(1, 0, 0, 2);
return (abs(int4(testInputs).x) == expected.x &&
abs(int4(testInputs).xy) == expected.xy &&
abs(int4(testInputs).xyz) == expected.xyz &&
abs(int4(testInputs).xyzw) == expected.xyzw) ? colorGreen : colorRed;
}

View File

@ -1 +1,10 @@
in half a; void main() { sk_FragColor.x = ceil(a); }
uniform half4 testInputs;
uniform half4 colorGreen, colorRed;
half4 main() {
half4 expected = half4(-1, 0, 1, 3);
return (ceil(testInputs.x) == expected.x &&
ceil(testInputs.xy) == expected.xy &&
ceil(testInputs.xyz) == expected.xyz &&
ceil(testInputs.xyzw) == expected.xyzw) ? colorGreen : colorRed;
}

View File

@ -1 +1,10 @@
in half a; void main() { sk_FragColor.x = floor(a); }
uniform half4 testInputs;
uniform half4 colorGreen, colorRed;
half4 main() {
half4 expected = half4(-2, 0, 0, 2);
return (floor(testInputs.x) == expected.x &&
floor(testInputs.xy) == expected.xy &&
floor(testInputs.xyz) == expected.xyz &&
floor(testInputs.xyzw) == expected.xyzw) ? colorGreen : colorRed;
}

View File

@ -1,6 +0,0 @@
in half a;
in int b;
void main() {
sk_FragColor.x = sign(a);
sk_FragColor.x = half(sign(b));
}

View File

@ -0,0 +1,10 @@
uniform half4 testInputs;
uniform half4 colorGreen, colorRed;
half4 main() {
half4 expected = half4(-1, 0, 1, 1);
return (sign(testInputs.x) == expected.x &&
sign(testInputs.xy) == expected.xy &&
sign(testInputs.xyz) == expected.xyz &&
sign(testInputs.xyzw) == expected.xyzw) ? colorGreen : colorRed;
}

View File

@ -0,0 +1,10 @@
uniform half4 minus1234;
uniform half4 colorGreen, colorRed;
half4 main() {
int4 expected = int4(-1, 0, 0, 1);
return (sign(int4(testInputs).x) == expected.x &&
sign(int4(testInputs).xy) == expected.xy &&
sign(int4(testInputs).xyz) == expected.xyz &&
sign(int4(testInputs).xyzw) == expected.xyzw) ? colorGreen : colorRed;
}

View File

@ -48,12 +48,13 @@ static void test(skiatest::Reporter* r, SkSurface* surface, const char* testFile
}
SkRuntimeShaderBuilder builder(effect);
set_uniform(&builder, "colorBlack", SkV4{0, 0, 0, 1});
set_uniform(&builder, "colorRed", SkV4{1, 0, 0, 1});
set_uniform(&builder, "colorGreen", SkV4{0, 1, 0, 1});
set_uniform(&builder, "colorBlue", SkV4{0, 0, 1, 1});
set_uniform(&builder, "colorWhite", SkV4{1, 1, 1, 1});
set_uniform(&builder, "unknownInput", 1.0f);
set_uniform(&builder, "colorBlack", SkV4{0, 0, 0, 1});
set_uniform(&builder, "colorRed", SkV4{1, 0, 0, 1});
set_uniform(&builder, "colorGreen", SkV4{0, 1, 0, 1});
set_uniform(&builder, "colorBlue", SkV4{0, 0, 1, 1});
set_uniform(&builder, "colorWhite", SkV4{1, 1, 1, 1});
set_uniform(&builder, "testInputs", SkV4{-1.25, 0, 0.75, 2.25});
set_uniform(&builder, "unknownInput", 1.0f);
sk_sp<SkShader> shader = builder.makeShader(/*localMatrix=*/nullptr, /*isOpaque=*/true);
if (!shader) {
@ -106,8 +107,17 @@ SKSL_TEST(SkSLShortCircuitBoolFolding, "folding/ShortCircuitBoolFolding.sksl")
SKSL_TEST(SkSLVectorScalarFolding, "folding/VectorScalarFolding.sksl")
SKSL_TEST(SkSLVectorVectorFolding, "folding/VectorVectorFolding.sksl")
SKSL_TEST(SkSLIntrinsicAbsFloat, "intrinsics/AbsFloat.sksl")
SKSL_TEST(SkSLIntrinsicCeil, "intrinsics/Ceil.sksl")
SKSL_TEST(SkSLIntrinsicSignFloat, "intrinsics/SignFloat.sksl")
SKSL_TEST(SkSLForLoopControlFlow, "shared/ForLoopControlFlow.sksl")
/*
TODO(johnstiles): work around failures on ANGLE + Intel6000 + DX9 configuration and reland
SKSL_TEST(SkSLIntrinsicFloor, "intrinsics/Floor.sksl")
*/
/*
TODO(skia:10939): enable this test when Runtime Effects supports structs in function signatures
SKSL_TEST(SkSLStructsInFunctions, "shared/StructsInFunctions.sksl")
@ -119,6 +129,9 @@ TODO(skia:11209): enable these tests when Runtime Effects have support for ES3
SKSL_TEST(SkSLIntFoldingES3, "folding/IntFoldingES3.sksl")
SKSL_TEST(SkSLMatrixFoldingES3, "folding/MatrixFoldingES3.sksl")
SKSL_TEST(SkSLIntrinsicAbsInt, "intrinsics/AbsInt.sksl")
SKSL_TEST(SkSLIntrinsicSignInt, "intrinsics/SignInt.sksl")
SKSL_TEST(SkSLDoWhileControlFlow, "shared/DoWhileControlFlow.sksl")
SKSL_TEST(SkSLWhileLoopControlFlow, "shared/WhileLoopControlFlow.sksl")
*/

View File

@ -1,46 +0,0 @@
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %sk_FragColor %sk_Clockwise %a %b
OpExecutionMode %main OriginUpperLeft
OpName %sk_FragColor "sk_FragColor"
OpName %sk_Clockwise "sk_Clockwise"
OpName %a "a"
OpName %b "b"
OpName %main "main"
OpDecorate %sk_FragColor RelaxedPrecision
OpDecorate %sk_FragColor Location 0
OpDecorate %sk_FragColor Index 0
OpDecorate %sk_Clockwise RelaxedPrecision
OpDecorate %sk_Clockwise BuiltIn FrontFacing
OpDecorate %a RelaxedPrecision
OpDecorate %19 RelaxedPrecision
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%sk_FragColor = OpVariable %_ptr_Output_v4float Output
%bool = OpTypeBool
%_ptr_Input_bool = OpTypePointer Input %bool
%sk_Clockwise = OpVariable %_ptr_Input_bool Input
%_ptr_Input_float = OpTypePointer Input %float
%a = OpVariable %_ptr_Input_float Input
%int = OpTypeInt 32 1
%_ptr_Input_int = OpTypePointer Input %int
%b = OpVariable %_ptr_Input_int Input
%void = OpTypeVoid
%16 = OpTypeFunction %void
%_ptr_Output_float = OpTypePointer Output %float
%int_0 = OpConstant %int 0
%main = OpFunction %void None %16
%17 = OpLabel
%19 = OpLoad %float %a
%18 = OpExtInst %float %1 FAbs %19
%20 = OpAccessChain %_ptr_Output_float %sk_FragColor %int_0
OpStore %20 %18
%24 = OpLoad %int %b
%23 = OpExtInst %int %1 SAbs %24
%25 = OpConvertSToF %float %23
%26 = OpAccessChain %_ptr_Output_float %sk_FragColor %int_0
OpStore %26 %25
OpReturn
OpFunctionEnd

View File

@ -1,8 +0,0 @@
out vec4 sk_FragColor;
in float a;
in int b;
void main() {
sk_FragColor.x = abs(a);
sk_FragColor.x = float(abs(b));
}

View File

@ -1,19 +0,0 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct Inputs {
float a;
int b;
};
struct Outputs {
float4 sk_FragColor [[color(0)]];
};
fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
Outputs _out;
(void)_out;
_out.sk_FragColor.x = abs(_in.a);
_out.sk_FragColor.x = float(abs(_in.b));
return _out;
}

View File

@ -0,0 +1,131 @@
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %_entrypoint "_entrypoint" %sk_FragColor %sk_Clockwise
OpExecutionMode %_entrypoint OriginUpperLeft
OpName %sk_FragColor "sk_FragColor"
OpName %sk_Clockwise "sk_Clockwise"
OpName %_UniformBuffer "_UniformBuffer"
OpMemberName %_UniformBuffer 0 "testInputs"
OpMemberName %_UniformBuffer 1 "colorGreen"
OpMemberName %_UniformBuffer 2 "colorRed"
OpName %_entrypoint "_entrypoint"
OpName %main "main"
OpDecorate %sk_FragColor RelaxedPrecision
OpDecorate %sk_FragColor Location 0
OpDecorate %sk_FragColor Index 0
OpDecorate %sk_Clockwise RelaxedPrecision
OpDecorate %sk_Clockwise BuiltIn FrontFacing
OpMemberDecorate %_UniformBuffer 0 Offset 0
OpMemberDecorate %_UniformBuffer 0 RelaxedPrecision
OpMemberDecorate %_UniformBuffer 1 Offset 16
OpMemberDecorate %_UniformBuffer 1 RelaxedPrecision
OpMemberDecorate %_UniformBuffer 2 Offset 32
OpMemberDecorate %_UniformBuffer 2 RelaxedPrecision
OpDecorate %_UniformBuffer Block
OpDecorate %10 Binding 0
OpDecorate %10 DescriptorSet 0
OpDecorate %26 RelaxedPrecision
OpDecorate %34 RelaxedPrecision
OpDecorate %47 RelaxedPrecision
OpDecorate %60 RelaxedPrecision
OpDecorate %74 RelaxedPrecision
OpDecorate %77 RelaxedPrecision
OpDecorate %78 RelaxedPrecision
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%sk_FragColor = OpVariable %_ptr_Output_v4float Output
%bool = OpTypeBool
%_ptr_Input_bool = OpTypePointer Input %bool
%sk_Clockwise = OpVariable %_ptr_Input_bool Input
%_UniformBuffer = OpTypeStruct %v4float %v4float %v4float
%_ptr_Uniform__UniformBuffer = OpTypePointer Uniform %_UniformBuffer
%10 = OpVariable %_ptr_Uniform__UniformBuffer Uniform
%void = OpTypeVoid
%15 = OpTypeFunction %void
%18 = OpTypeFunction %v4float
%false = OpConstantFalse %bool
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%float_1_25 = OpConstant %float 1.25
%v2float = OpTypeVector %float 2
%float_0 = OpConstant %float 0
%38 = OpConstantComposite %v2float %float_1_25 %float_0
%v2bool = OpTypeVector %bool 2
%v3float = OpTypeVector %float 3
%float_0_75 = OpConstant %float 0.75
%51 = OpConstantComposite %v3float %float_1_25 %float_0 %float_0_75
%v3bool = OpTypeVector %bool 3
%float_2_25 = OpConstant %float 2.25
%62 = OpConstantComposite %v4float %float_1_25 %float_0 %float_0_75 %float_2_25
%v4bool = OpTypeVector %bool 4
%_ptr_Function_v4float = OpTypePointer Function %v4float
%int_1 = OpConstant %int 1
%int_2 = OpConstant %int 2
%_entrypoint = OpFunction %void None %15
%16 = OpLabel
%17 = OpFunctionCall %v4float %main
OpStore %sk_FragColor %17
OpReturn
OpFunctionEnd
%main = OpFunction %v4float None %18
%19 = OpLabel
%67 = OpVariable %_ptr_Function_v4float Function
%22 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%26 = OpLoad %v4float %22
%27 = OpCompositeExtract %float %26 0
%21 = OpExtInst %float %1 FAbs %27
%29 = OpFOrdEqual %bool %21 %float_1_25
OpSelectionMerge %31 None
OpBranchConditional %29 %30 %31
%30 = OpLabel
%33 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%34 = OpLoad %v4float %33
%35 = OpVectorShuffle %v2float %34 %34 0 1
%32 = OpExtInst %v2float %1 FAbs %35
%39 = OpFOrdEqual %v2bool %32 %38
%41 = OpAll %bool %39
OpBranch %31
%31 = OpLabel
%42 = OpPhi %bool %false %19 %41 %30
OpSelectionMerge %44 None
OpBranchConditional %42 %43 %44
%43 = OpLabel
%46 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%47 = OpLoad %v4float %46
%48 = OpVectorShuffle %v3float %47 %47 0 1 2
%45 = OpExtInst %v3float %1 FAbs %48
%52 = OpFOrdEqual %v3bool %45 %51
%54 = OpAll %bool %52
OpBranch %44
%44 = OpLabel
%55 = OpPhi %bool %false %31 %54 %43
OpSelectionMerge %57 None
OpBranchConditional %55 %56 %57
%56 = OpLabel
%59 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%60 = OpLoad %v4float %59
%58 = OpExtInst %v4float %1 FAbs %60
%63 = OpFOrdEqual %v4bool %58 %62
%65 = OpAll %bool %63
OpBranch %57
%57 = OpLabel
%66 = OpPhi %bool %false %44 %65 %56
OpSelectionMerge %71 None
OpBranchConditional %66 %69 %70
%69 = OpLabel
%72 = OpAccessChain %_ptr_Uniform_v4float %10 %int_1
%74 = OpLoad %v4float %72
OpStore %67 %74
OpBranch %71
%70 = OpLabel
%75 = OpAccessChain %_ptr_Uniform_v4float %10 %int_2
%77 = OpLoad %v4float %75
OpStore %67 %77
OpBranch %71
%71 = OpLabel
%78 = OpLoad %v4float %67
OpReturnValue %78
OpFunctionEnd

View File

@ -0,0 +1,8 @@
out vec4 sk_FragColor;
uniform vec4 testInputs;
uniform vec4 colorGreen;
uniform vec4 colorRed;
vec4 main() {
return ((abs(testInputs.x) == 1.25 && abs(testInputs.xy) == vec2(1.25, 0.0)) && abs(testInputs.xyz) == vec3(1.25, 0.0, 0.75)) && abs(testInputs) == vec4(1.25, 0.0, 0.75, 2.25) ? colorGreen : colorRed;
}

View File

@ -0,0 +1,22 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct Uniforms {
float4 testInputs;
float4 colorGreen;
float4 colorRed;
};
struct Inputs {
};
struct Outputs {
float4 sk_FragColor [[color(0)]];
};
fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
Outputs _out;
(void)_out;
_out.sk_FragColor = ((abs(_uniforms.testInputs.x) == 1.25 && all(abs(_uniforms.testInputs.xy) == float2(1.25, 0.0))) && all(abs(_uniforms.testInputs.xyz) == float3(1.25, 0.0, 0.75))) && all(abs(_uniforms.testInputs) == float4(1.25, 0.0, 0.75, 2.25)) ? _uniforms.colorGreen : _uniforms.colorRed;
return _out;
}

View File

@ -0,0 +1,152 @@
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %_entrypoint "_entrypoint" %sk_FragColor %sk_Clockwise
OpExecutionMode %_entrypoint OriginUpperLeft
OpName %sk_FragColor "sk_FragColor"
OpName %sk_Clockwise "sk_Clockwise"
OpName %_UniformBuffer "_UniformBuffer"
OpMemberName %_UniformBuffer 0 "testInputs"
OpMemberName %_UniformBuffer 1 "colorGreen"
OpMemberName %_UniformBuffer 2 "colorRed"
OpName %_entrypoint "_entrypoint"
OpName %main "main"
OpDecorate %sk_FragColor RelaxedPrecision
OpDecorate %sk_FragColor Location 0
OpDecorate %sk_FragColor Index 0
OpDecorate %sk_Clockwise RelaxedPrecision
OpDecorate %sk_Clockwise BuiltIn FrontFacing
OpMemberDecorate %_UniformBuffer 0 Offset 0
OpMemberDecorate %_UniformBuffer 0 RelaxedPrecision
OpMemberDecorate %_UniformBuffer 1 Offset 16
OpMemberDecorate %_UniformBuffer 1 RelaxedPrecision
OpMemberDecorate %_UniformBuffer 2 Offset 32
OpMemberDecorate %_UniformBuffer 2 RelaxedPrecision
OpDecorate %_UniformBuffer Block
OpDecorate %10 Binding 0
OpDecorate %10 DescriptorSet 0
OpDecorate %26 RelaxedPrecision
OpDecorate %35 RelaxedPrecision
OpDecorate %53 RelaxedPrecision
OpDecorate %73 RelaxedPrecision
OpDecorate %96 RelaxedPrecision
OpDecorate %98 RelaxedPrecision
OpDecorate %99 RelaxedPrecision
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%sk_FragColor = OpVariable %_ptr_Output_v4float Output
%bool = OpTypeBool
%_ptr_Input_bool = OpTypePointer Input %bool
%sk_Clockwise = OpVariable %_ptr_Input_bool Input
%_UniformBuffer = OpTypeStruct %v4float %v4float %v4float
%_ptr_Uniform__UniformBuffer = OpTypePointer Uniform %_UniformBuffer
%10 = OpVariable %_ptr_Uniform__UniformBuffer Uniform
%void = OpTypeVoid
%15 = OpTypeFunction %void
%18 = OpTypeFunction %v4float
%false = OpConstantFalse %bool
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%int_1 = OpConstant %int 1
%v2float = OpTypeVector %float 2
%v2int = OpTypeVector %int 2
%44 = OpConstantComposite %v2int %int_1 %int_0
%v2bool = OpTypeVector %bool 2
%v3float = OpTypeVector %float 3
%v3int = OpTypeVector %int 3
%64 = OpConstantComposite %v3int %int_1 %int_0 %int_0
%v3bool = OpTypeVector %bool 3
%v4int = OpTypeVector %int 4
%int_2 = OpConstant %int 2
%85 = OpConstantComposite %v4int %int_1 %int_0 %int_0 %int_2
%v4bool = OpTypeVector %bool 4
%_ptr_Function_v4float = OpTypePointer Function %v4float
%_entrypoint = OpFunction %void None %15
%16 = OpLabel
%17 = OpFunctionCall %v4float %main
OpStore %sk_FragColor %17
OpReturn
OpFunctionEnd
%main = OpFunction %v4float None %18
%19 = OpLabel
%90 = OpVariable %_ptr_Function_v4float Function
%22 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%26 = OpLoad %v4float %22
%27 = OpCompositeExtract %float %26 0
%28 = OpConvertFToS %int %27
%21 = OpExtInst %int %1 SAbs %28
%30 = OpIEqual %bool %21 %int_1
OpSelectionMerge %32 None
OpBranchConditional %30 %31 %32
%31 = OpLabel
%34 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%35 = OpLoad %v4float %34
%36 = OpVectorShuffle %v2float %35 %35 0 1
%38 = OpCompositeExtract %float %36 0
%39 = OpConvertFToS %int %38
%40 = OpCompositeExtract %float %36 1
%41 = OpConvertFToS %int %40
%42 = OpCompositeConstruct %v2int %39 %41
%33 = OpExtInst %v2int %1 SAbs %42
%45 = OpIEqual %v2bool %33 %44
%47 = OpAll %bool %45
OpBranch %32
%32 = OpLabel
%48 = OpPhi %bool %false %19 %47 %31
OpSelectionMerge %50 None
OpBranchConditional %48 %49 %50
%49 = OpLabel
%52 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%53 = OpLoad %v4float %52
%54 = OpVectorShuffle %v3float %53 %53 0 1 2
%56 = OpCompositeExtract %float %54 0
%57 = OpConvertFToS %int %56
%58 = OpCompositeExtract %float %54 1
%59 = OpConvertFToS %int %58
%60 = OpCompositeExtract %float %54 2
%61 = OpConvertFToS %int %60
%62 = OpCompositeConstruct %v3int %57 %59 %61
%51 = OpExtInst %v3int %1 SAbs %62
%65 = OpIEqual %v3bool %51 %64
%67 = OpAll %bool %65
OpBranch %50
%50 = OpLabel
%68 = OpPhi %bool %false %32 %67 %49
OpSelectionMerge %70 None
OpBranchConditional %68 %69 %70
%69 = OpLabel
%72 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%73 = OpLoad %v4float %72
%74 = OpCompositeExtract %float %73 0
%75 = OpConvertFToS %int %74
%76 = OpCompositeExtract %float %73 1
%77 = OpConvertFToS %int %76
%78 = OpCompositeExtract %float %73 2
%79 = OpConvertFToS %int %78
%80 = OpCompositeExtract %float %73 3
%81 = OpConvertFToS %int %80
%82 = OpCompositeConstruct %v4int %75 %77 %79 %81
%71 = OpExtInst %v4int %1 SAbs %82
%86 = OpIEqual %v4bool %71 %85
%88 = OpAll %bool %86
OpBranch %70
%70 = OpLabel
%89 = OpPhi %bool %false %50 %88 %69
OpSelectionMerge %94 None
OpBranchConditional %89 %92 %93
%92 = OpLabel
%95 = OpAccessChain %_ptr_Uniform_v4float %10 %int_1
%96 = OpLoad %v4float %95
OpStore %90 %96
OpBranch %94
%93 = OpLabel
%97 = OpAccessChain %_ptr_Uniform_v4float %10 %int_2
%98 = OpLoad %v4float %97
OpStore %90 %98
OpBranch %94
%94 = OpLabel
%99 = OpLoad %v4float %90
OpReturnValue %99
OpFunctionEnd

View File

@ -0,0 +1,8 @@
out vec4 sk_FragColor;
uniform vec4 testInputs;
uniform vec4 colorGreen;
uniform vec4 colorRed;
vec4 main() {
return ((abs(int(testInputs.x)) == 1 && abs(ivec2(testInputs.xy)) == ivec2(1, 0)) && abs(ivec3(testInputs.xyz)) == ivec3(1, 0, 0)) && abs(ivec4(testInputs)) == ivec4(1, 0, 0, 2) ? colorGreen : colorRed;
}

View File

@ -0,0 +1,22 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct Uniforms {
float4 testInputs;
float4 colorGreen;
float4 colorRed;
};
struct Inputs {
};
struct Outputs {
float4 sk_FragColor [[color(0)]];
};
fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
Outputs _out;
(void)_out;
_out.sk_FragColor = ((abs(int(_uniforms.testInputs.x)) == 1 && all(abs(int2(_uniforms.testInputs.xy)) == int2(1, 0))) && all(abs(int3(_uniforms.testInputs.xyz)) == int3(1, 0, 0))) && all(abs(int4(_uniforms.testInputs)) == int4(1, 0, 0, 2)) ? _uniforms.colorGreen : _uniforms.colorRed;
return _out;
}

View File

@ -1,19 +1,37 @@
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %sk_FragColor %sk_Clockwise %a
OpExecutionMode %main OriginUpperLeft
OpEntryPoint Fragment %_entrypoint "_entrypoint" %sk_FragColor %sk_Clockwise
OpExecutionMode %_entrypoint OriginUpperLeft
OpName %sk_FragColor "sk_FragColor"
OpName %sk_Clockwise "sk_Clockwise"
OpName %a "a"
OpName %_UniformBuffer "_UniformBuffer"
OpMemberName %_UniformBuffer 0 "testInputs"
OpMemberName %_UniformBuffer 1 "colorGreen"
OpMemberName %_UniformBuffer 2 "colorRed"
OpName %_entrypoint "_entrypoint"
OpName %main "main"
OpDecorate %sk_FragColor RelaxedPrecision
OpDecorate %sk_FragColor Location 0
OpDecorate %sk_FragColor Index 0
OpDecorate %sk_Clockwise RelaxedPrecision
OpDecorate %sk_Clockwise BuiltIn FrontFacing
OpDecorate %a RelaxedPrecision
OpDecorate %16 RelaxedPrecision
OpMemberDecorate %_UniformBuffer 0 Offset 0
OpMemberDecorate %_UniformBuffer 0 RelaxedPrecision
OpMemberDecorate %_UniformBuffer 1 Offset 16
OpMemberDecorate %_UniformBuffer 1 RelaxedPrecision
OpMemberDecorate %_UniformBuffer 2 Offset 32
OpMemberDecorate %_UniformBuffer 2 RelaxedPrecision
OpDecorate %_UniformBuffer Block
OpDecorate %10 Binding 0
OpDecorate %10 DescriptorSet 0
OpDecorate %26 RelaxedPrecision
OpDecorate %34 RelaxedPrecision
OpDecorate %47 RelaxedPrecision
OpDecorate %60 RelaxedPrecision
OpDecorate %74 RelaxedPrecision
OpDecorate %77 RelaxedPrecision
OpDecorate %78 RelaxedPrecision
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
@ -21,18 +39,93 @@ OpDecorate %16 RelaxedPrecision
%bool = OpTypeBool
%_ptr_Input_bool = OpTypePointer Input %bool
%sk_Clockwise = OpVariable %_ptr_Input_bool Input
%_ptr_Input_float = OpTypePointer Input %float
%a = OpVariable %_ptr_Input_float Input
%_UniformBuffer = OpTypeStruct %v4float %v4float %v4float
%_ptr_Uniform__UniformBuffer = OpTypePointer Uniform %_UniformBuffer
%10 = OpVariable %_ptr_Uniform__UniformBuffer Uniform
%void = OpTypeVoid
%13 = OpTypeFunction %void
%_ptr_Output_float = OpTypePointer Output %float
%15 = OpTypeFunction %void
%18 = OpTypeFunction %v4float
%false = OpConstantFalse %bool
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%main = OpFunction %void None %13
%14 = OpLabel
%16 = OpLoad %float %a
%15 = OpExtInst %float %1 Ceil %16
%17 = OpAccessChain %_ptr_Output_float %sk_FragColor %int_0
OpStore %17 %15
%float_n1 = OpConstant %float -1
%v2float = OpTypeVector %float 2
%float_0 = OpConstant %float 0
%38 = OpConstantComposite %v2float %float_n1 %float_0
%v2bool = OpTypeVector %bool 2
%v3float = OpTypeVector %float 3
%float_1 = OpConstant %float 1
%51 = OpConstantComposite %v3float %float_n1 %float_0 %float_1
%v3bool = OpTypeVector %bool 3
%float_3 = OpConstant %float 3
%62 = OpConstantComposite %v4float %float_n1 %float_0 %float_1 %float_3
%v4bool = OpTypeVector %bool 4
%_ptr_Function_v4float = OpTypePointer Function %v4float
%int_1 = OpConstant %int 1
%int_2 = OpConstant %int 2
%_entrypoint = OpFunction %void None %15
%16 = OpLabel
%17 = OpFunctionCall %v4float %main
OpStore %sk_FragColor %17
OpReturn
OpFunctionEnd
%main = OpFunction %v4float None %18
%19 = OpLabel
%67 = OpVariable %_ptr_Function_v4float Function
%22 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%26 = OpLoad %v4float %22
%27 = OpCompositeExtract %float %26 0
%21 = OpExtInst %float %1 Ceil %27
%29 = OpFOrdEqual %bool %21 %float_n1
OpSelectionMerge %31 None
OpBranchConditional %29 %30 %31
%30 = OpLabel
%33 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%34 = OpLoad %v4float %33
%35 = OpVectorShuffle %v2float %34 %34 0 1
%32 = OpExtInst %v2float %1 Ceil %35
%39 = OpFOrdEqual %v2bool %32 %38
%41 = OpAll %bool %39
OpBranch %31
%31 = OpLabel
%42 = OpPhi %bool %false %19 %41 %30
OpSelectionMerge %44 None
OpBranchConditional %42 %43 %44
%43 = OpLabel
%46 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%47 = OpLoad %v4float %46
%48 = OpVectorShuffle %v3float %47 %47 0 1 2
%45 = OpExtInst %v3float %1 Ceil %48
%52 = OpFOrdEqual %v3bool %45 %51
%54 = OpAll %bool %52
OpBranch %44
%44 = OpLabel
%55 = OpPhi %bool %false %31 %54 %43
OpSelectionMerge %57 None
OpBranchConditional %55 %56 %57
%56 = OpLabel
%59 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%60 = OpLoad %v4float %59
%58 = OpExtInst %v4float %1 Ceil %60
%63 = OpFOrdEqual %v4bool %58 %62
%65 = OpAll %bool %63
OpBranch %57
%57 = OpLabel
%66 = OpPhi %bool %false %44 %65 %56
OpSelectionMerge %71 None
OpBranchConditional %66 %69 %70
%69 = OpLabel
%72 = OpAccessChain %_ptr_Uniform_v4float %10 %int_1
%74 = OpLoad %v4float %72
OpStore %67 %74
OpBranch %71
%70 = OpLabel
%75 = OpAccessChain %_ptr_Uniform_v4float %10 %int_2
%77 = OpLoad %v4float %75
OpStore %67 %77
OpBranch %71
%71 = OpLabel
%78 = OpLoad %v4float %67
OpReturnValue %78
OpFunctionEnd

View File

@ -1,6 +1,8 @@
out vec4 sk_FragColor;
in float a;
void main() {
sk_FragColor.x = ceil(a);
uniform vec4 testInputs;
uniform vec4 colorGreen;
uniform vec4 colorRed;
vec4 main() {
return ((ceil(testInputs.x) == -1.0 && ceil(testInputs.xy) == vec2(-1.0, 0.0)) && ceil(testInputs.xyz) == vec3(-1.0, 0.0, 1.0)) && ceil(testInputs) == vec4(-1.0, 0.0, 1.0, 3.0) ? colorGreen : colorRed;
}

View File

@ -1,16 +1,22 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct Uniforms {
float4 testInputs;
float4 colorGreen;
float4 colorRed;
};
struct Inputs {
float a;
};
struct Outputs {
float4 sk_FragColor [[color(0)]];
};
fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
Outputs _out;
(void)_out;
_out.sk_FragColor.x = ceil(_in.a);
_out.sk_FragColor = ((ceil(_uniforms.testInputs.x) == -1.0 && all(ceil(_uniforms.testInputs.xy) == float2(-1.0, 0.0))) && all(ceil(_uniforms.testInputs.xyz) == float3(-1.0, 0.0, 1.0))) && all(ceil(_uniforms.testInputs) == float4(-1.0, 0.0, 1.0, 3.0)) ? _uniforms.colorGreen : _uniforms.colorRed;
return _out;
}

View File

@ -1,19 +1,37 @@
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %sk_FragColor %sk_Clockwise %a
OpExecutionMode %main OriginUpperLeft
OpEntryPoint Fragment %_entrypoint "_entrypoint" %sk_FragColor %sk_Clockwise
OpExecutionMode %_entrypoint OriginUpperLeft
OpName %sk_FragColor "sk_FragColor"
OpName %sk_Clockwise "sk_Clockwise"
OpName %a "a"
OpName %_UniformBuffer "_UniformBuffer"
OpMemberName %_UniformBuffer 0 "testInputs"
OpMemberName %_UniformBuffer 1 "colorGreen"
OpMemberName %_UniformBuffer 2 "colorRed"
OpName %_entrypoint "_entrypoint"
OpName %main "main"
OpDecorate %sk_FragColor RelaxedPrecision
OpDecorate %sk_FragColor Location 0
OpDecorate %sk_FragColor Index 0
OpDecorate %sk_Clockwise RelaxedPrecision
OpDecorate %sk_Clockwise BuiltIn FrontFacing
OpDecorate %a RelaxedPrecision
OpDecorate %16 RelaxedPrecision
OpMemberDecorate %_UniformBuffer 0 Offset 0
OpMemberDecorate %_UniformBuffer 0 RelaxedPrecision
OpMemberDecorate %_UniformBuffer 1 Offset 16
OpMemberDecorate %_UniformBuffer 1 RelaxedPrecision
OpMemberDecorate %_UniformBuffer 2 Offset 32
OpMemberDecorate %_UniformBuffer 2 RelaxedPrecision
OpDecorate %_UniformBuffer Block
OpDecorate %10 Binding 0
OpDecorate %10 DescriptorSet 0
OpDecorate %26 RelaxedPrecision
OpDecorate %34 RelaxedPrecision
OpDecorate %47 RelaxedPrecision
OpDecorate %59 RelaxedPrecision
OpDecorate %73 RelaxedPrecision
OpDecorate %76 RelaxedPrecision
OpDecorate %77 RelaxedPrecision
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
@ -21,18 +39,92 @@ OpDecorate %16 RelaxedPrecision
%bool = OpTypeBool
%_ptr_Input_bool = OpTypePointer Input %bool
%sk_Clockwise = OpVariable %_ptr_Input_bool Input
%_ptr_Input_float = OpTypePointer Input %float
%a = OpVariable %_ptr_Input_float Input
%_UniformBuffer = OpTypeStruct %v4float %v4float %v4float
%_ptr_Uniform__UniformBuffer = OpTypePointer Uniform %_UniformBuffer
%10 = OpVariable %_ptr_Uniform__UniformBuffer Uniform
%void = OpTypeVoid
%13 = OpTypeFunction %void
%_ptr_Output_float = OpTypePointer Output %float
%15 = OpTypeFunction %void
%18 = OpTypeFunction %v4float
%false = OpConstantFalse %bool
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%main = OpFunction %void None %13
%14 = OpLabel
%16 = OpLoad %float %a
%15 = OpExtInst %float %1 Floor %16
%17 = OpAccessChain %_ptr_Output_float %sk_FragColor %int_0
OpStore %17 %15
%float_n2 = OpConstant %float -2
%v2float = OpTypeVector %float 2
%float_0 = OpConstant %float 0
%38 = OpConstantComposite %v2float %float_n2 %float_0
%v2bool = OpTypeVector %bool 2
%v3float = OpTypeVector %float 3
%50 = OpConstantComposite %v3float %float_n2 %float_0 %float_0
%v3bool = OpTypeVector %bool 3
%float_2 = OpConstant %float 2
%61 = OpConstantComposite %v4float %float_n2 %float_0 %float_0 %float_2
%v4bool = OpTypeVector %bool 4
%_ptr_Function_v4float = OpTypePointer Function %v4float
%int_1 = OpConstant %int 1
%int_2 = OpConstant %int 2
%_entrypoint = OpFunction %void None %15
%16 = OpLabel
%17 = OpFunctionCall %v4float %main
OpStore %sk_FragColor %17
OpReturn
OpFunctionEnd
%main = OpFunction %v4float None %18
%19 = OpLabel
%66 = OpVariable %_ptr_Function_v4float Function
%22 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%26 = OpLoad %v4float %22
%27 = OpCompositeExtract %float %26 0
%21 = OpExtInst %float %1 Floor %27
%29 = OpFOrdEqual %bool %21 %float_n2
OpSelectionMerge %31 None
OpBranchConditional %29 %30 %31
%30 = OpLabel
%33 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%34 = OpLoad %v4float %33
%35 = OpVectorShuffle %v2float %34 %34 0 1
%32 = OpExtInst %v2float %1 Floor %35
%39 = OpFOrdEqual %v2bool %32 %38
%41 = OpAll %bool %39
OpBranch %31
%31 = OpLabel
%42 = OpPhi %bool %false %19 %41 %30
OpSelectionMerge %44 None
OpBranchConditional %42 %43 %44
%43 = OpLabel
%46 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%47 = OpLoad %v4float %46
%48 = OpVectorShuffle %v3float %47 %47 0 1 2
%45 = OpExtInst %v3float %1 Floor %48
%51 = OpFOrdEqual %v3bool %45 %50
%53 = OpAll %bool %51
OpBranch %44
%44 = OpLabel
%54 = OpPhi %bool %false %31 %53 %43
OpSelectionMerge %56 None
OpBranchConditional %54 %55 %56
%55 = OpLabel
%58 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%59 = OpLoad %v4float %58
%57 = OpExtInst %v4float %1 Floor %59
%62 = OpFOrdEqual %v4bool %57 %61
%64 = OpAll %bool %62
OpBranch %56
%56 = OpLabel
%65 = OpPhi %bool %false %44 %64 %55
OpSelectionMerge %70 None
OpBranchConditional %65 %68 %69
%68 = OpLabel
%71 = OpAccessChain %_ptr_Uniform_v4float %10 %int_1
%73 = OpLoad %v4float %71
OpStore %66 %73
OpBranch %70
%69 = OpLabel
%74 = OpAccessChain %_ptr_Uniform_v4float %10 %int_2
%76 = OpLoad %v4float %74
OpStore %66 %76
OpBranch %70
%70 = OpLabel
%77 = OpLoad %v4float %66
OpReturnValue %77
OpFunctionEnd

View File

@ -1,6 +1,8 @@
out vec4 sk_FragColor;
in float a;
void main() {
sk_FragColor.x = floor(a);
uniform vec4 testInputs;
uniform vec4 colorGreen;
uniform vec4 colorRed;
vec4 main() {
return ((floor(testInputs.x) == -2.0 && floor(testInputs.xy) == vec2(-2.0, 0.0)) && floor(testInputs.xyz) == vec3(-2.0, 0.0, 0.0)) && floor(testInputs) == vec4(-2.0, 0.0, 0.0, 2.0) ? colorGreen : colorRed;
}

View File

@ -1,16 +1,22 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct Uniforms {
float4 testInputs;
float4 colorGreen;
float4 colorRed;
};
struct Inputs {
float a;
};
struct Outputs {
float4 sk_FragColor [[color(0)]];
};
fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
Outputs _out;
(void)_out;
_out.sk_FragColor.x = floor(_in.a);
_out.sk_FragColor = ((floor(_uniforms.testInputs.x) == -2.0 && all(floor(_uniforms.testInputs.xy) == float2(-2.0, 0.0))) && all(floor(_uniforms.testInputs.xyz) == float3(-2.0, 0.0, 0.0))) && all(floor(_uniforms.testInputs) == float4(-2.0, 0.0, 0.0, 2.0)) ? _uniforms.colorGreen : _uniforms.colorRed;
return _out;
}

View File

@ -1,46 +0,0 @@
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %main "main" %sk_FragColor %sk_Clockwise %a %b
OpExecutionMode %main OriginUpperLeft
OpName %sk_FragColor "sk_FragColor"
OpName %sk_Clockwise "sk_Clockwise"
OpName %a "a"
OpName %b "b"
OpName %main "main"
OpDecorate %sk_FragColor RelaxedPrecision
OpDecorate %sk_FragColor Location 0
OpDecorate %sk_FragColor Index 0
OpDecorate %sk_Clockwise RelaxedPrecision
OpDecorate %sk_Clockwise BuiltIn FrontFacing
OpDecorate %a RelaxedPrecision
OpDecorate %19 RelaxedPrecision
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%sk_FragColor = OpVariable %_ptr_Output_v4float Output
%bool = OpTypeBool
%_ptr_Input_bool = OpTypePointer Input %bool
%sk_Clockwise = OpVariable %_ptr_Input_bool Input
%_ptr_Input_float = OpTypePointer Input %float
%a = OpVariable %_ptr_Input_float Input
%int = OpTypeInt 32 1
%_ptr_Input_int = OpTypePointer Input %int
%b = OpVariable %_ptr_Input_int Input
%void = OpTypeVoid
%16 = OpTypeFunction %void
%_ptr_Output_float = OpTypePointer Output %float
%int_0 = OpConstant %int 0
%main = OpFunction %void None %16
%17 = OpLabel
%19 = OpLoad %float %a
%18 = OpExtInst %float %1 FSign %19
%20 = OpAccessChain %_ptr_Output_float %sk_FragColor %int_0
OpStore %20 %18
%24 = OpLoad %int %b
%23 = OpExtInst %int %1 SSign %24
%25 = OpConvertSToF %float %23
%26 = OpAccessChain %_ptr_Output_float %sk_FragColor %int_0
OpStore %26 %25
OpReturn
OpFunctionEnd

View File

@ -1,8 +0,0 @@
out vec4 sk_FragColor;
in float a;
in int b;
void main() {
sk_FragColor.x = sign(a);
sk_FragColor.x = float(sign(b));
}

View File

@ -1,19 +0,0 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct Inputs {
float a;
int b;
};
struct Outputs {
float4 sk_FragColor [[color(0)]];
};
fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
Outputs _out;
(void)_out;
_out.sk_FragColor.x = sign(_in.a);
_out.sk_FragColor.x = float(sign(_in.b));
return _out;
}

View File

@ -0,0 +1,130 @@
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical GLSL450
OpEntryPoint Fragment %_entrypoint "_entrypoint" %sk_FragColor %sk_Clockwise
OpExecutionMode %_entrypoint OriginUpperLeft
OpName %sk_FragColor "sk_FragColor"
OpName %sk_Clockwise "sk_Clockwise"
OpName %_UniformBuffer "_UniformBuffer"
OpMemberName %_UniformBuffer 0 "testInputs"
OpMemberName %_UniformBuffer 1 "colorGreen"
OpMemberName %_UniformBuffer 2 "colorRed"
OpName %_entrypoint "_entrypoint"
OpName %main "main"
OpDecorate %sk_FragColor RelaxedPrecision
OpDecorate %sk_FragColor Location 0
OpDecorate %sk_FragColor Index 0
OpDecorate %sk_Clockwise RelaxedPrecision
OpDecorate %sk_Clockwise BuiltIn FrontFacing
OpMemberDecorate %_UniformBuffer 0 Offset 0
OpMemberDecorate %_UniformBuffer 0 RelaxedPrecision
OpMemberDecorate %_UniformBuffer 1 Offset 16
OpMemberDecorate %_UniformBuffer 1 RelaxedPrecision
OpMemberDecorate %_UniformBuffer 2 Offset 32
OpMemberDecorate %_UniformBuffer 2 RelaxedPrecision
OpDecorate %_UniformBuffer Block
OpDecorate %10 Binding 0
OpDecorate %10 DescriptorSet 0
OpDecorate %26 RelaxedPrecision
OpDecorate %34 RelaxedPrecision
OpDecorate %47 RelaxedPrecision
OpDecorate %60 RelaxedPrecision
OpDecorate %73 RelaxedPrecision
OpDecorate %76 RelaxedPrecision
OpDecorate %77 RelaxedPrecision
%float = OpTypeFloat 32
%v4float = OpTypeVector %float 4
%_ptr_Output_v4float = OpTypePointer Output %v4float
%sk_FragColor = OpVariable %_ptr_Output_v4float Output
%bool = OpTypeBool
%_ptr_Input_bool = OpTypePointer Input %bool
%sk_Clockwise = OpVariable %_ptr_Input_bool Input
%_UniformBuffer = OpTypeStruct %v4float %v4float %v4float
%_ptr_Uniform__UniformBuffer = OpTypePointer Uniform %_UniformBuffer
%10 = OpVariable %_ptr_Uniform__UniformBuffer Uniform
%void = OpTypeVoid
%15 = OpTypeFunction %void
%18 = OpTypeFunction %v4float
%false = OpConstantFalse %bool
%_ptr_Uniform_v4float = OpTypePointer Uniform %v4float
%int = OpTypeInt 32 1
%int_0 = OpConstant %int 0
%float_n1 = OpConstant %float -1
%v2float = OpTypeVector %float 2
%float_0 = OpConstant %float 0
%38 = OpConstantComposite %v2float %float_n1 %float_0
%v2bool = OpTypeVector %bool 2
%v3float = OpTypeVector %float 3
%float_1 = OpConstant %float 1
%51 = OpConstantComposite %v3float %float_n1 %float_0 %float_1
%v3bool = OpTypeVector %bool 3
%61 = OpConstantComposite %v4float %float_n1 %float_0 %float_1 %float_1
%v4bool = OpTypeVector %bool 4
%_ptr_Function_v4float = OpTypePointer Function %v4float
%int_1 = OpConstant %int 1
%int_2 = OpConstant %int 2
%_entrypoint = OpFunction %void None %15
%16 = OpLabel
%17 = OpFunctionCall %v4float %main
OpStore %sk_FragColor %17
OpReturn
OpFunctionEnd
%main = OpFunction %v4float None %18
%19 = OpLabel
%66 = OpVariable %_ptr_Function_v4float Function
%22 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%26 = OpLoad %v4float %22
%27 = OpCompositeExtract %float %26 0
%21 = OpExtInst %float %1 FSign %27
%29 = OpFOrdEqual %bool %21 %float_n1
OpSelectionMerge %31 None
OpBranchConditional %29 %30 %31
%30 = OpLabel
%33 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%34 = OpLoad %v4float %33
%35 = OpVectorShuffle %v2float %34 %34 0 1
%32 = OpExtInst %v2float %1 FSign %35
%39 = OpFOrdEqual %v2bool %32 %38
%41 = OpAll %bool %39
OpBranch %31
%31 = OpLabel
%42 = OpPhi %bool %false %19 %41 %30
OpSelectionMerge %44 None
OpBranchConditional %42 %43 %44
%43 = OpLabel
%46 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%47 = OpLoad %v4float %46
%48 = OpVectorShuffle %v3float %47 %47 0 1 2
%45 = OpExtInst %v3float %1 FSign %48
%52 = OpFOrdEqual %v3bool %45 %51
%54 = OpAll %bool %52
OpBranch %44
%44 = OpLabel
%55 = OpPhi %bool %false %31 %54 %43
OpSelectionMerge %57 None
OpBranchConditional %55 %56 %57
%56 = OpLabel
%59 = OpAccessChain %_ptr_Uniform_v4float %10 %int_0
%60 = OpLoad %v4float %59
%58 = OpExtInst %v4float %1 FSign %60
%62 = OpFOrdEqual %v4bool %58 %61
%64 = OpAll %bool %62
OpBranch %57
%57 = OpLabel
%65 = OpPhi %bool %false %44 %64 %56
OpSelectionMerge %70 None
OpBranchConditional %65 %68 %69
%68 = OpLabel
%71 = OpAccessChain %_ptr_Uniform_v4float %10 %int_1
%73 = OpLoad %v4float %71
OpStore %66 %73
OpBranch %70
%69 = OpLabel
%74 = OpAccessChain %_ptr_Uniform_v4float %10 %int_2
%76 = OpLoad %v4float %74
OpStore %66 %76
OpBranch %70
%70 = OpLabel
%77 = OpLoad %v4float %66
OpReturnValue %77
OpFunctionEnd

View File

@ -0,0 +1,8 @@
out vec4 sk_FragColor;
uniform vec4 testInputs;
uniform vec4 colorGreen;
uniform vec4 colorRed;
vec4 main() {
return ((sign(testInputs.x) == -1.0 && sign(testInputs.xy) == vec2(-1.0, 0.0)) && sign(testInputs.xyz) == vec3(-1.0, 0.0, 1.0)) && sign(testInputs) == vec4(-1.0, 0.0, 1.0, 1.0) ? colorGreen : colorRed;
}

View File

@ -0,0 +1,22 @@
#include <metal_stdlib>
#include <simd/simd.h>
using namespace metal;
struct Uniforms {
float4 testInputs;
float4 colorGreen;
float4 colorRed;
};
struct Inputs {
};
struct Outputs {
float4 sk_FragColor [[color(0)]];
};
fragment Outputs fragmentMain(Inputs _in [[stage_in]], constant Uniforms& _uniforms [[buffer(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {
Outputs _out;
(void)_out;
_out.sk_FragColor = ((sign(_uniforms.testInputs.x) == -1.0 && all(sign(_uniforms.testInputs.xy) == float2(-1.0, 0.0))) && all(sign(_uniforms.testInputs.xyz) == float3(-1.0, 0.0, 1.0))) && all(sign(_uniforms.testInputs) == float4(-1.0, 0.0, 1.0, 1.0)) ? _uniforms.colorGreen : _uniforms.colorRed;
return _out;
}

View File

@ -0,0 +1,4 @@
### Compilation failed:
error: 6: unknown identifier 'testInputs'
1 error

View File

@ -0,0 +1,4 @@
### Compilation failed:
error: 6: unknown identifier 'testInputs'
1 error

View File

@ -0,0 +1,4 @@
### Compilation failed:
error: 6: unknown identifier 'testInputs'
1 error