Lines Matching refs:write
67 void MetalCodeGenerator::write(skstd::string_view s) {
81 this->write(s);
128 this->write(this->typeName(type));
215 this->write(" ");
216 this->write(name);
217 this->write("(");
229 this->write(separator);
239 this->write("&");
244 this->write(" ");
250 this->write(" _var");
251 this->write(to_string(index));
263 this->write(" _var");
264 this->write(to_string(index));
268 this->write(" = ");
281 this->write(" _skResult = ");
285 this->write("(");
290 this->write(separator);
293 this->write("_var");
294 this->write(to_string(index));
306 this->write(" = _var");
307 this->write(to_string(index));
365 this->write(getOutParamHelper(c, arguments, outVars));
367 this->write(function.mangledName());
370 this->write("(");
374 this->write(separator);
383 this->write(")");
521 this->write(c.function().name());
526 this->write("(");
529 this->write(separator);
533 this->write(")");
541 this->write(".sample(");
543 this->write(SAMPLER_SUFFIX);
544 this->write(", ");
549 this->write("(" + tmpVar + " = ");
551 this->write(", " + tmpVar + ".xy / " + tmpVar + ".z))");
555 this->write(")");
563 this->write("(" + tmpX + " = ");
565 this->write(", " + tmpY + " = ");
567 this->write(", " + tmpX + " - " + tmpY + " * floor(" + tmpX + " / " + tmpY + "))");
573 this->write("abs(");
575 this->write(" - ");
577 this->write(")");
585 this->write("(");
587 this->write(" * ");
589 this->write(")");
598 this->write("((((");
600 this->write(") * (");
602 this->write(") < 0) ? 1 : -1) * (");
604 this->write("))");
611 this->write(arguments[0]->type().columns() == 1 ? "abs(" : "length(");
613 this->write(")");
617 this->write(arguments[0]->type().columns() == 1 ? "sign(" : "normalize(");
619 this->write(")");
623 this->write("pack_float_to_unorm2x16(");
625 this->write(")");
629 this->write("unpack_unorm2x16_to_float(");
631 this->write(")");
635 this->write("pack_float_to_snorm2x16(");
637 this->write(")");
641 this->write("unpack_snorm2x16_to_float(");
643 this->write(")");
647 this->write("pack_float_to_unorm4x8(");
649 this->write(")");
653 this->write("unpack_unorm4x8_to_float(");
655 this->write(")");
659 this->write("pack_float_to_snorm4x8(");
661 this->write(")");
665 this->write("unpack_snorm4x8_to_float(");
667 this->write(")");
671 this->write("as_type<uint>(half2(");
673 this->write("))");
677 this->write("float2(as_type<half2>(");
679 this->write("))");
686 this->write(this->getBitcastIntrinsic(c.type()));
687 this->write("(");
689 this->write(")");
693 this->write("((");
695 this->write(") * 57.2957795)");
699 this->write("((");
701 this->write(") * 0.0174532925)");
705 this->write("dfdx");
710 this->write("(" + fRTFlipName + ".y * dfdy");
712 this->write(")");
716 this->write(this->getInversePolyfill(arguments));
721 this->write("rsqrt");
726 this->write(c.arguments().size() == 2 ? "atan2" : "atan");
737 this->write("(" + tmpI + " = ");
741 this->write(", " + tmpN + " = ");
745 this->write(", " + tmpI + " - 2 * " + tmpN + " * " + tmpI + " * " + tmpN + ")");
755 this->write("(refract(float2(");
757 this->write(", 0), float2(");
759 this->write(", 0), ");
761 this->write(").x)");
768 this->write("rint");
773 this->write("popcount(");
775 this->write(")");
787 this->write("(");
788 this->write(skTemp);
789 this->write(" = (");
791 this->write("), select(ctz(");
792 this->write(skTemp);
793 this->write("), ");
794 this->write(exprType);
795 this->write("(-1), ");
796 this->write(skTemp);
797 this->write(" == ");
798 this->write(exprType);
799 this->write("(0)))");
812 this->write("(");
813 this->write(skTemp1);
814 this->write(" = (");
816 this->write("), ");
824 this->write(skTemp2);
825 this->write(" = (select(");
826 this->write(skTemp1);
827 this->write(", ~");
828 this->write(skTemp1);
829 this->write(", ");
830 this->write(skTemp1);
831 this->write(" < 0)), ");
837 this->write("select(");
838 this->write(this->typeName(c.type()));
839 this->write("(clz(");
840 this->write(skTemp2);
841 this->write(")), ");
842 this->write(this->typeName(c.type()));
843 this->write("(-1), ");
844 this->write(skTemp2);
845 this->write(" == ");
846 this->write(exprType);
847 this->write("(0)))");
864 this->write("select");
878 this->write("(");
882 this->write(" == ");
885 this->write(" != ");
888 this->write(" < ");
891 this->write(" <= ");
894 this->write(" > ");
897 this->write(" >= ");
903 this->write(")");
1124 this->write(this->getMatrixConstructHelper(c));
1125 this->write("(");
1127 this->write(")");
1166 this->write(name);
1167 this->write("(");
1169 this->write(")");
1201 this->write(this->getVectorFromMat2x2ConstructorHelper(expr.type()));
1202 this->write("(");
1204 this->write(")");
1218 this->write(this->getMatrixConstructHelper(c));
1219 this->write("(");
1222 this->write(separator);
1226 this->write(")");
1239 this->write("(");
1243 this->write(separator);
1249 this->write("(");
1256 this->write(")");
1260 this->write(")");
1268 this->write(leftBracket);
1271 this->write(separator);
1275 this->write(rightBracket);
1287 this->write("float4(_fragCoord.x, ");
1288 this->write(fRTFlipName.c_str());
1289 this->write(".x + ");
1290 this->write(fRTFlipName.c_str());
1291 this->write(".y * _fragCoord.y, 0.0, _fragCoord.w)");
1305 this->write("_out.sk_FragColor");
1311 this->write("sk_VertexID");
1314 this->write("sk_InstanceID");
1319 this->write("(" + fRTFlipName + ".y < 0 ? _frontFacing : !_frontFacing)");
1325 this->write("_in.");
1327 this->write("_out.");
1330 this->write("_uniforms.");
1332 this->write("_globals.");
1341 this->write("[");
1343 this->write("]");
1350 this->write(".");
1354 this->write("_out.sk_Position");
1358 this->write("_out.sk_PointSize");
1361 this->write("_globals.");
1362 this->write(fInterfaceBlockNameMap[fInterfaceBlockMap[field]]);
1363 this->write("->");
1372 this->write(".");
1375 this->write(&("x\0y\0z\0w\0"[c * 2]));
1572 this->write("(");
1574 this->write("(");
1578 this->write(separator);
1579 this->write("1.0");
1583 this->write(") * ");
1585 this->write(")");
1601 this->write("all");
1608 this->write("any");
1625 this->write("(");
1643 this->write(" = ");
1645 this->write(" ");
1646 this->write(OperatorName(op.removeAssignment()));
1647 this->write(" ");
1649 this->write(String(" ") + OperatorName(op) + " ");
1661 this->write(")");
1668 this->write("(");
1671 this->write(" ? ");
1673 this->write(" : ");
1676 this->write(")");
1683 this->write("(");
1685 this->write(OperatorName(p.getOperator()));
1688 this->write(")");
1695 this->write("(");
1698 this->write(OperatorName(p.getOperator()));
1700 this->write(")");
1707 this->write(to_string(l.floatValue()));
1709 this->write("h");
1715 this->write(to_string(l.intValue() & 0xffffffff));
1716 this->write("u");
1718 this->write(to_string(l.intValue() & 0xffff));
1719 this->write("u");
1721 this->write(to_string(l.intValue()));
1726 this->write(l.boolValue() ? "true" : "false");
1737 this->write(separator);
1738 this->write("_in");
1742 this->write(separator);
1743 this->write("_out");
1747 this->write(separator);
1748 this->write("_uniforms");
1752 this->write(separator);
1753 this->write("_globals");
1757 this->write(separator);
1758 this->write("_fragCoord");
1767 this->write(separator);
1768 this->write("Inputs _in");
1772 this->write(separator);
1773 this->write("thread Outputs& _out");
1777 this->write(separator);
1778 this->write("Uniforms _uniforms");
1782 this->write(separator);
1783 this->write("thread Globals& _globals");
1787 this->write(separator);
1788 this->write("float4 _fragCoord");
1811 this->write("fragment Outputs fragmentMain");
1814 this->write("vertex Outputs vertexMain");
1820 this->write("(Inputs _in [[stage_in]]");
1822 this->write(", constant Uniforms& _uniforms [[buffer(" +
1840 this->write(", texture2d<half> ");
1842 this->write("[[texture(");
1843 this->write(to_string(var.var().modifiers().fLayout.fBinding));
1844 this->write(")]]");
1845 this->write(", sampler ");
1847 this->write(SAMPLER_SUFFIX);
1848 this->write("[[sampler(");
1849 this->write(to_string(var.var().modifiers().fLayout.fBinding));
1850 this->write(")]]");
1857 this->write(", constant ");
1859 this->write("& " );
1860 this->write(fInterfaceBlockNameMap[&intf]);
1861 this->write(" [[buffer(");
1862 this->write(to_string(this->getUniformBinding(intf.variable().modifiers())));
1863 this->write(")]]");
1868 this->write(", constant sksl_synthetic_uniforms& _anonInterface0 [[buffer(1)]]");
1871 this->write(", bool _frontFacing [[front_facing]]");
1872 this->write(", float4 _fragCoord [[position]]");
1874 this->write(", uint sk_VertexID [[vertex_id]], uint sk_InstanceID [[instance_id]]");
1879 this->write(" ");
1881 this->write("(");
1888 this->write(separator);
1894 this->write("&");
1896 this->write(" ");
1899 this->write(")");
1968 this->write(fFunctionHeader);
1969 this->write(buffer.str());
1974 this->write("thread ");
1977 this->write("const ");
1986 this->write("struct ");
1998 this->write("}");
2000 this->write(" ");
2001 this->write(intf.instanceName());
2003 this->write("[");
2004 this->write(to_string(intf.arraySize()));
2005 this->write("]");
2034 this->write("char pad");
2035 this->write(to_string(fPaddingCount++));
2036 this->write("[");
2037 this->write(to_string(fieldOffset - currentOffset));
2057 this->write(" ");
2072 this->write("_"); // adding underscore before name to avoid conflict with reserved words
2074 this->write(name);
2080 this->write(" ");
2083 this->write(" = ");
2086 this->write(";");
2096 this->write(";");
2117 this->write("break;");
2120 this->write("continue;");
2123 this->write("discard_fragment();");
2127 this->write(";");
2151 this->write("}");
2156 this->write("if (");
2158 this->write(") ");
2161 this->write(" else ");
2169 this->write("while (");
2171 this->write(") ");
2176 this->write("for (");
2180 this->write("; ");
2185 this->write("; ");
2189 this->write(") ");
2194 this->write("do ");
2196 this->write(" while (");
2198 this->write(");");
2202 this->write("switch (");
2209 this->write("case ");
2223 this->write("}");
2231 this->write("return _out;");
2242 this->write("_out.sk_FragColor = ");
2255 this->write("return");
2257 this->write(" ");
2260 this->write(";");
2264 this->write("#include <metal_stdlib>\n");
2265 this->write("#include <simd/simd.h>\n");
2266 this->write("using namespace metal;\n");
2279 this->write("struct Uniforms {\n");
2286 this->write(" ");
2288 this->write(" ");
2290 this->write(";\n");
2295 this->write("};\n");
2300 this->write("struct Inputs {\n");
2307 this->write(" ");
2309 this->write(" ");
2313 this->write(" [[attribute(" +
2316 this->write(" [[user(locn" +
2320 this->write(";\n");
2324 this->write("};\n");
2328 this->write("struct Outputs {\n");
2330 this->write(" float4 sk_Position [[position]];\n");
2332 this->write(" half4 sk_FragColor [[color(0)]];\n");
2340 this->write(" ");
2342 this->write(" ");
2350 this->write(" [[user(locn" + to_string(location) + ")]]");
2352 this->write(" [[color(" + to_string(location) + ")");
2355 this->write(", index(" + to_string(colorIndex) + ")");
2357 this->write("]]");
2359 this->write(";\n");
2364 this->write(" float sk_PointSize [[point_size]];\n");
2366 this->write("};\n");
2425 fCodeGen->write(" constant ");
2426 fCodeGen->write(block.typeName());
2427 fCodeGen->write("* ");
2429 fCodeGen->write(";\n");
2433 fCodeGen->write(" ");
2435 fCodeGen->write(" ");
2437 fCodeGen->write(";\n");
2441 fCodeGen->write(" sampler ");
2443 fCodeGen->write(";\n");
2447 fCodeGen->write(" ");
2450 fCodeGen->write(" ");
2452 fCodeGen->write(";\n");
2456 fCodeGen->write("struct Globals {\n");
2482 fCodeGen->write("&");
2498 fCodeGen->write("{}");
2503 fCodeGen->write(" Globals _globals{");
2506 fCodeGen->write(", ");