Ethan Nicholas | 842d31b | 2019-01-22 10:59:11 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019 Google Inc. |
| 3 | * |
| 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
| 6 | */ |
| 7 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "src/sksl/SkSLCompiler.h" |
Ethan Nicholas | 842d31b | 2019-01-22 10:59:11 -0500 | [diff] [blame] | 9 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 10 | #include "tests/Test.h" |
Ethan Nicholas | 842d31b | 2019-01-22 10:59:11 -0500 | [diff] [blame] | 11 | |
John Stiles | 88a4107 | 2020-07-06 09:59:45 -0400 | [diff] [blame] | 12 | static void test(skiatest::Reporter* r, const SkSL::Program::Settings& settings, const char* src, |
Ethan Nicholas | 842d31b | 2019-01-22 10:59:11 -0500 | [diff] [blame] | 13 | const char* expected, SkSL::Program::Inputs* inputs, |
| 14 | SkSL::Program::Kind kind = SkSL::Program::kFragment_Kind) { |
| 15 | SkSL::Compiler compiler; |
| 16 | SkSL::String output; |
| 17 | std::unique_ptr<SkSL::Program> program = compiler.convertProgram(kind, SkSL::String(src), |
| 18 | settings); |
| 19 | if (!program) { |
| 20 | SkDebugf("Unexpected error compiling %s\n%s", src, compiler.errorText().c_str()); |
| 21 | } |
| 22 | REPORTER_ASSERT(r, program); |
| 23 | *inputs = program->fInputs; |
| 24 | REPORTER_ASSERT(r, compiler.toMetal(*program, &output)); |
| 25 | if (program) { |
| 26 | SkSL::String skExpected(expected); |
| 27 | if (output != skExpected) { |
| 28 | SkDebugf("MSL MISMATCH:\nsource:\n%s\n\nexpected:\n'%s'\n\nreceived:\n'%s'", src, |
| 29 | expected, output.c_str()); |
| 30 | } |
| 31 | REPORTER_ASSERT(r, output == skExpected); |
| 32 | } |
| 33 | } |
| 34 | |
John Stiles | 88a4107 | 2020-07-06 09:59:45 -0400 | [diff] [blame] | 35 | static void test(skiatest::Reporter* r, const GrShaderCaps& caps, const char* src, |
Ethan Nicholas | 842d31b | 2019-01-22 10:59:11 -0500 | [diff] [blame] | 36 | const char* expected, SkSL::Program::Kind kind = SkSL::Program::kFragment_Kind) { |
| 37 | SkSL::Program::Settings settings; |
| 38 | settings.fCaps = ∩︀ |
| 39 | SkSL::Program::Inputs inputs; |
John Stiles | 88a4107 | 2020-07-06 09:59:45 -0400 | [diff] [blame] | 40 | test(r, settings, src, expected, &inputs, kind); |
Ethan Nicholas | 842d31b | 2019-01-22 10:59:11 -0500 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | DEF_TEST(SkSLMetalHelloWorld, r) { |
John Stiles | 88a4107 | 2020-07-06 09:59:45 -0400 | [diff] [blame] | 44 | test(r, *SkSL::ShaderCapsFactory::Default(), |
Ethan Nicholas | e1f5502 | 2019-02-05 17:17:40 -0500 | [diff] [blame] | 45 | "void main() { sk_FragColor = half4(0.75); }", |
Ethan Nicholas | 842d31b | 2019-01-22 10:59:11 -0500 | [diff] [blame] | 46 | "#include <metal_stdlib>\n" |
| 47 | "#include <simd/simd.h>\n" |
| 48 | "using namespace metal;\n" |
| 49 | "struct Inputs {\n" |
| 50 | "};\n" |
| 51 | "struct Outputs {\n" |
| 52 | " float4 sk_FragColor [[color(0)]];\n" |
| 53 | "};\n" |
Jim Van Verth | 6bc650e | 2019-02-07 14:53:23 -0500 | [diff] [blame] | 54 | "fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {\n" |
Ethan Nicholas | 842d31b | 2019-01-22 10:59:11 -0500 | [diff] [blame] | 55 | " Outputs _outputStruct;\n" |
| 56 | " thread Outputs* _out = &_outputStruct;\n" |
| 57 | " _out->sk_FragColor = float4(0.75);\n" |
| 58 | " return *_out;\n" |
| 59 | "}\n"); |
| 60 | } |
| 61 | |
John Stiles | 1bdafbf | 2020-05-28 12:17:20 -0400 | [diff] [blame] | 62 | DEF_TEST(SkSLMetal2x2MatrixCopyFromFloat2x2, r) { |
John Stiles | 88a4107 | 2020-07-06 09:59:45 -0400 | [diff] [blame] | 63 | test(r, *SkSL::ShaderCapsFactory::Default(), |
| 64 | R"__SkSL__( |
John Stiles | 1bdafbf | 2020-05-28 12:17:20 -0400 | [diff] [blame] | 65 | void main() { |
| 66 | float2x2 m1 = float2x2(float2(1, 2), float2(3, 4)); |
| 67 | float2x2 m2 = m1; |
| 68 | float2x2 m3 = float2x2(m1); |
| 69 | sk_FragColor = half4(half(m1[0][0] + m2[0][0] + m3[0][0])); |
| 70 | })__SkSL__", |
John Stiles | 88a4107 | 2020-07-06 09:59:45 -0400 | [diff] [blame] | 71 | R"__MSL__(#include <metal_stdlib> |
John Stiles | 1bdafbf | 2020-05-28 12:17:20 -0400 | [diff] [blame] | 72 | #include <simd/simd.h> |
| 73 | using namespace metal; |
| 74 | struct Inputs { |
| 75 | }; |
| 76 | struct Outputs { |
| 77 | float4 sk_FragColor [[color(0)]]; |
| 78 | }; |
| 79 | fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { |
| 80 | Outputs _outputStruct; |
| 81 | thread Outputs* _out = &_outputStruct; |
| 82 | _out->sk_FragColor = float4((float2x2(float2(1.0, 2.0), float2(3.0, 4.0))[0][0] + float2x2(float2(1.0, 2.0), float2(3.0, 4.0))[0][0]) + float2x2(float2(1.0, 2.0), float2(3.0, 4.0))[0][0]); |
| 83 | return *_out; |
| 84 | } |
| 85 | )__MSL__"); |
| 86 | } |
| 87 | |
| 88 | DEF_TEST(SkSLMetal2x2MatrixCopyFromConstantPropagatedFloat4, r) { |
John Stiles | 88a4107 | 2020-07-06 09:59:45 -0400 | [diff] [blame] | 89 | test(r, *SkSL::ShaderCapsFactory::Default(), |
| 90 | R"__SkSL__( |
John Stiles | 1bdafbf | 2020-05-28 12:17:20 -0400 | [diff] [blame] | 91 | void main() { |
| 92 | float2x2 m1 = float2x2(float4(1, 2, 3, 4)); |
| 93 | float2x2 m2 = m1; |
| 94 | float2x2 m3 = float2x2(m1); |
| 95 | sk_FragColor = half4(half(m1[0][0] + m2[0][0] + m3[0][0])); |
| 96 | })__SkSL__", |
John Stiles | 1bdafbf | 2020-05-28 12:17:20 -0400 | [diff] [blame] | 97 | R"__MSL__(#include <metal_stdlib> |
| 98 | #include <simd/simd.h> |
| 99 | using namespace metal; |
| 100 | struct Inputs { |
| 101 | }; |
| 102 | struct Outputs { |
| 103 | float4 sk_FragColor [[color(0)]]; |
| 104 | }; |
| 105 | float2x2 float2x2_from_float4(float4 x0) { |
| 106 | return float2x2(float2(x0[0], x0[1]), float2(x0[2], x0[3])); |
| 107 | } |
| 108 | fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { |
| 109 | Outputs _outputStruct; |
| 110 | thread Outputs* _out = &_outputStruct; |
| 111 | _out->sk_FragColor = float4((float2x2_from_float4(float4(1.0, 2.0, 3.0, 4.0))[0][0] + float2x2_from_float4(float4(1.0, 2.0, 3.0, 4.0))[0][0]) + float2x2_from_float4(float4(1.0, 2.0, 3.0, 4.0))[0][0]); |
| 112 | return *_out; |
| 113 | } |
| 114 | )__MSL__"); |
| 115 | } |
| 116 | |
John Stiles | fcf8cb2 | 2020-08-06 14:29:22 -0400 | [diff] [blame] | 117 | DEF_TEST(SkSLMetalCastMat2x2ToMat3x3, r) { |
| 118 | test(r, *SkSL::ShaderCapsFactory::Default(), |
| 119 | R"__SkSL__( |
| 120 | void main() { |
| 121 | float3x3 a = float3x3(1); |
| 122 | float3x3 b = float3x3(float2x2(1)); |
| 123 | sk_FragColor.x = (a[0] == b[0]) ? 0 : 1; |
| 124 | } |
| 125 | )__SkSL__", |
| 126 | R"__MSL__(#include <metal_stdlib> |
| 127 | #include <simd/simd.h> |
| 128 | using namespace metal; |
| 129 | struct Inputs { |
| 130 | }; |
| 131 | struct Outputs { |
| 132 | float4 sk_FragColor [[color(0)]]; |
| 133 | }; |
| 134 | float3x3 float3x3_from_float2x2(float2x2 x0) { |
| 135 | return float3x3(float3(x0[0].xy, 0.0), float3(x0[1].xy, 0.0), float3(0.0, 0.0, 1.0)); |
| 136 | } |
| 137 | fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { |
| 138 | Outputs _outputStruct; |
| 139 | thread Outputs* _out = &_outputStruct; |
| 140 | _out->sk_FragColor.x = float(all(float3x3(1.0)[0] == float3x3_from_float2x2(float2x2(1.0))[0]) ? 0 : 1); |
| 141 | return *_out; |
| 142 | } |
| 143 | )__MSL__"); |
| 144 | } |
| 145 | |
| 146 | DEF_TEST(SkSLMetalCastMat2x3ToMat4x4, r) { |
| 147 | test(r, *SkSL::ShaderCapsFactory::Default(), |
| 148 | R"__SkSL__( |
| 149 | void main() { |
| 150 | float4x4 a = float4x4(6); |
| 151 | float4x4 b = float4x4(float2x3(7)); |
| 152 | sk_FragColor.x = (a[1] == b[1]) ? 0 : 1; |
| 153 | } |
| 154 | )__SkSL__", |
| 155 | R"__MSL__(#include <metal_stdlib> |
| 156 | #include <simd/simd.h> |
| 157 | using namespace metal; |
| 158 | struct Inputs { |
| 159 | }; |
| 160 | struct Outputs { |
| 161 | float4 sk_FragColor [[color(0)]]; |
| 162 | }; |
| 163 | float4x4 float4x4_from_float2x3(float2x3 x0) { |
| 164 | return float4x4(float4(x0[0].xyz, 0.0), float4(x0[1].xyz, 0.0), float4(0.0, 0.0, 1.0, 0.0), float4(0.0, 0.0, 0.0, 1.0)); |
| 165 | } |
| 166 | fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { |
| 167 | Outputs _outputStruct; |
| 168 | thread Outputs* _out = &_outputStruct; |
| 169 | _out->sk_FragColor.x = float(all(float4x4(6.0)[1] == float4x4_from_float2x3(float2x3(7.0))[1]) ? 0 : 1); |
| 170 | return *_out; |
| 171 | } |
| 172 | )__MSL__"); |
| 173 | } |
| 174 | |
| 175 | DEF_TEST(SkSLMetalCastMat4x4ToMat3x4, r) { |
| 176 | test(r, *SkSL::ShaderCapsFactory::Default(), |
| 177 | R"__SkSL__( |
| 178 | void main() { |
| 179 | float3x4 a = float3x4(1); |
| 180 | float3x4 b = float3x4(float4x4(1)); |
| 181 | sk_FragColor.x = (a[0] == b[0]) ? 0 : 1; |
| 182 | } |
| 183 | )__SkSL__", |
| 184 | R"__MSL__(#include <metal_stdlib> |
| 185 | #include <simd/simd.h> |
| 186 | using namespace metal; |
| 187 | struct Inputs { |
| 188 | }; |
| 189 | struct Outputs { |
| 190 | float4 sk_FragColor [[color(0)]]; |
| 191 | }; |
| 192 | float3x4 float3x4_from_float4x4(float4x4 x0) { |
| 193 | return float3x4(float4(x0[0].xyzw), float4(x0[1].xyzw), float4(x0[2].xyzw)); |
| 194 | } |
| 195 | fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { |
| 196 | Outputs _outputStruct; |
| 197 | thread Outputs* _out = &_outputStruct; |
| 198 | _out->sk_FragColor.x = float(all(float3x4(1.0)[0] == float3x4_from_float4x4(float4x4(1.0))[0]) ? 0 : 1); |
| 199 | return *_out; |
| 200 | } |
| 201 | )__MSL__"); |
| 202 | } |
| 203 | |
| 204 | DEF_TEST(SkSLMetalCastMat4x4ToMat4x3, r) { |
| 205 | test(r, *SkSL::ShaderCapsFactory::Default(), |
| 206 | R"__SkSL__( |
| 207 | void main() { |
| 208 | float4x3 a = float4x3(1); |
| 209 | float4x3 b = float4x3(float4x4(1)); |
| 210 | sk_FragColor.x = (a[0] == b[0]) ? 0 : 1; |
| 211 | } |
| 212 | )__SkSL__", |
| 213 | R"__MSL__(#include <metal_stdlib> |
| 214 | #include <simd/simd.h> |
| 215 | using namespace metal; |
| 216 | struct Inputs { |
| 217 | }; |
| 218 | struct Outputs { |
| 219 | float4 sk_FragColor [[color(0)]]; |
| 220 | }; |
| 221 | float4x3 float4x3_from_float4x4(float4x4 x0) { |
| 222 | return float4x3(float3(x0[0].xyz), float3(x0[1].xyz), float3(x0[2].xyz), float3(x0[3].xyz)); |
| 223 | } |
| 224 | fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { |
| 225 | Outputs _outputStruct; |
| 226 | thread Outputs* _out = &_outputStruct; |
| 227 | _out->sk_FragColor.x = float(all(float4x3(1.0)[0] == float4x3_from_float4x4(float4x4(1.0))[0]) ? 0 : 1); |
| 228 | return *_out; |
| 229 | } |
| 230 | )__MSL__"); |
| 231 | } |
| 232 | |
Ethan Nicholas | 842d31b | 2019-01-22 10:59:11 -0500 | [diff] [blame] | 233 | DEF_TEST(SkSLMetalMatrices, r) { |
John Stiles | 88a4107 | 2020-07-06 09:59:45 -0400 | [diff] [blame] | 234 | test(r, *SkSL::ShaderCapsFactory::Default(), |
| 235 | R"__SkSL__( |
John Stiles | 1bdafbf | 2020-05-28 12:17:20 -0400 | [diff] [blame] | 236 | void main() { |
| 237 | float2x2 m1 = float2x2(float4(1, 2, 3, 4)); |
| 238 | float2x2 m2 = float2x2(float4(0)); |
| 239 | float2x2 m3 = float2x2(m1); |
| 240 | float2x2 m4 = float2x2(1); |
| 241 | float2x2 m5 = float2x2(m1[0][0]); |
| 242 | float2x2 m6 = float2x2(1, 2, 3, 4); |
| 243 | float2x2 m7 = float2x2(5, float3(6, 7, 8)); |
| 244 | float3x2 m8 = float3x2(float2(1, 2), 3, float3(4, 5, 6)); |
| 245 | float3x3 m9 = float3x3(1); |
| 246 | float4x4 m10 = float4x4(1); |
| 247 | float4x4 m11 = float4x4(2); |
| 248 | sk_FragColor = half4(half(m1[0][0] + m2[0][0] + m3[0][0] + m4[0][0] + m5[0][0] + |
| 249 | m6[0][0] + m7[0][0] + m8[0][0] + m9[0][0] + m10[0][0] + m11[0][0])); |
| 250 | })__SkSL__", |
John Stiles | 1bdafbf | 2020-05-28 12:17:20 -0400 | [diff] [blame] | 251 | R"__MSL__(#include <metal_stdlib> |
| 252 | #include <simd/simd.h> |
| 253 | using namespace metal; |
| 254 | struct Inputs { |
| 255 | }; |
| 256 | struct Outputs { |
| 257 | float4 sk_FragColor [[color(0)]]; |
| 258 | }; |
| 259 | float2x2 float2x2_from_float4(float4 x0) { |
| 260 | return float2x2(float2(x0[0], x0[1]), float2(x0[2], x0[3])); |
| 261 | } |
| 262 | float2x2 float2x2_from_float_float3(float x0, float3 x1) { |
| 263 | return float2x2(float2(x0, x1[0]), float2(x1[1], x1[2])); |
| 264 | } |
| 265 | float3x2 float3x2_from_float2_float_float3(float2 x0, float x1, float3 x2) { |
| 266 | return float3x2(float2(x0[0], x0[1]), float2(x1, x2[0]), float2(x2[1], x2[2])); |
| 267 | } |
| 268 | fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { |
| 269 | Outputs _outputStruct; |
| 270 | thread Outputs* _out = &_outputStruct; |
| 271 | float2x2 m5 = float2x2(float2x2_from_float4(float4(1.0, 2.0, 3.0, 4.0))[0][0]); |
| 272 | _out->sk_FragColor = float4((((((((((float2x2_from_float4(float4(1.0, 2.0, 3.0, 4.0))[0][0] + float2x2_from_float4(float4(0.0))[0][0]) + float2x2_from_float4(float4(1.0, 2.0, 3.0, 4.0))[0][0]) + float2x2(1.0)[0][0]) + m5[0][0]) + float2x2(float2(1.0, 2.0), float2(3.0, 4.0))[0][0]) + float2x2_from_float_float3(5.0, float3(6.0, 7.0, 8.0))[0][0]) + float3x2_from_float2_float_float3(float2(1.0, 2.0), 3.0, float3(4.0, 5.0, 6.0))[0][0]) + float3x3(1.0)[0][0]) + float4x4(1.0)[0][0]) + float4x4(2.0)[0][0]); |
| 273 | return *_out; |
| 274 | } |
| 275 | )__MSL__"); |
Ethan Nicholas | 842d31b | 2019-01-22 10:59:11 -0500 | [diff] [blame] | 276 | } |
Ethan Nicholas | 5476f2e | 2019-03-07 15:11:31 -0500 | [diff] [blame] | 277 | |
| 278 | DEF_TEST(SkSLMetalConstantSwizzle, r) { |
John Stiles | 88a4107 | 2020-07-06 09:59:45 -0400 | [diff] [blame] | 279 | test(r, *SkSL::ShaderCapsFactory::Default(), |
Ethan Nicholas | 5476f2e | 2019-03-07 15:11:31 -0500 | [diff] [blame] | 280 | "void main() {" |
| 281 | "sk_FragColor = half4(0.5).rgb1;" |
| 282 | "}", |
Ethan Nicholas | 5476f2e | 2019-03-07 15:11:31 -0500 | [diff] [blame] | 283 | "#include <metal_stdlib>\n" |
| 284 | "#include <simd/simd.h>\n" |
| 285 | "using namespace metal;\n" |
| 286 | "struct Inputs {\n" |
| 287 | "};\n" |
| 288 | "struct Outputs {\n" |
| 289 | " float4 sk_FragColor [[color(0)]];\n" |
| 290 | "};\n" |
| 291 | "fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) {\n" |
| 292 | " Outputs _outputStruct;\n" |
| 293 | " thread Outputs* _out = &_outputStruct;\n" |
Brian Osman | 2564767 | 2020-09-15 15:16:56 -0400 | [diff] [blame] | 294 | " _out->sk_FragColor = float4(float4(0.5).xyz, 1.0);\n" |
Ethan Nicholas | 5476f2e | 2019-03-07 15:11:31 -0500 | [diff] [blame] | 295 | " return *_out;\n" |
| 296 | "}\n"); |
| 297 | } |
John Stiles | 88a4107 | 2020-07-06 09:59:45 -0400 | [diff] [blame] | 298 | |
| 299 | DEF_TEST(SkSLMetalNumericGlobals, r) { |
| 300 | test(r, *SkSL::ShaderCapsFactory::Default(), |
| 301 | R"__SkSL__( |
| 302 | half attr1; |
| 303 | int attr2 = 123; |
| 304 | float attr3; |
| 305 | half4 attr4 = half4(4, 5, 6, 7); |
| 306 | void main() |
| 307 | { |
| 308 | sk_FragColor = half4(attr1, attr2, half(attr3), attr4.x); |
| 309 | } |
| 310 | )__SkSL__", |
| 311 | R"__MSL__(#include <metal_stdlib> |
| 312 | #include <simd/simd.h> |
| 313 | using namespace metal; |
| 314 | struct Inputs { |
| 315 | }; |
| 316 | struct Outputs { |
| 317 | float4 sk_FragColor [[color(0)]]; |
| 318 | }; |
| 319 | struct Globals { |
| 320 | float attr1; |
| 321 | int attr2; |
| 322 | float attr3; |
| 323 | float4 attr4; |
| 324 | }; |
| 325 | |
| 326 | |
| 327 | |
| 328 | fragment Outputs fragmentMain(Inputs _in [[stage_in]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { |
| 329 | Globals globalStruct{{}, 123, {}, float4(4.0, 5.0, 6.0, 7.0)}; |
| 330 | thread Globals* _globals = &globalStruct; |
| 331 | (void)_globals; |
| 332 | Outputs _outputStruct; |
| 333 | thread Outputs* _out = &_outputStruct; |
| 334 | _out->sk_FragColor = float4(_globals->attr1, float(_globals->attr2), _globals->attr3, _globals->attr4.x); |
| 335 | return *_out; |
| 336 | } |
| 337 | )__MSL__"); |
| 338 | } |
| 339 | |
| 340 | DEF_TEST(SkSLMetalSamplerGlobals, r) { |
| 341 | test(r, *SkSL::ShaderCapsFactory::Default(), |
| 342 | R"__SkSL__( |
| 343 | layout(binding=1) uniform sampler2D texA; |
| 344 | layout(binding=0) uniform sampler2D texB; |
| 345 | void main() |
| 346 | { |
| 347 | sk_FragColor = sample(texA, half2(0)) * sample(texB, half2(0)); |
| 348 | } |
| 349 | )__SkSL__", |
| 350 | R"__MSL__(#include <metal_stdlib> |
| 351 | #include <simd/simd.h> |
| 352 | using namespace metal; |
| 353 | struct Inputs { |
| 354 | }; |
| 355 | struct Outputs { |
| 356 | float4 sk_FragColor [[color(0)]]; |
| 357 | }; |
| 358 | struct Globals { |
| 359 | texture2d<float> texA; |
| 360 | sampler texASmplr; |
| 361 | texture2d<float> texB; |
| 362 | sampler texBSmplr; |
| 363 | }; |
| 364 | |
| 365 | fragment Outputs fragmentMain(Inputs _in [[stage_in]], texture2d<float> texA[[texture(1)]], sampler texASmplr[[sampler(1)]], texture2d<float> texB[[texture(0)]], sampler texBSmplr[[sampler(0)]], bool _frontFacing [[front_facing]], float4 _fragCoord [[position]]) { |
| 366 | Globals globalStruct{texA, texASmplr, texB, texBSmplr}; |
| 367 | thread Globals* _globals = &globalStruct; |
| 368 | (void)_globals; |
| 369 | Outputs _outputStruct; |
| 370 | thread Outputs* _out = &_outputStruct; |
| 371 | _out->sk_FragColor = _globals->texA.sample(_globals->texASmplr, float2(0.0)) * _globals->texB.sample(_globals->texBSmplr, float2(0.0)); |
| 372 | return *_out; |
| 373 | } |
| 374 | )__MSL__"); |
| 375 | } |