• Home
  • Raw
  • Download

Lines Matching refs:write

37 void MetalCodeGenerator::write(const char* s) {  in write()  function in SkSL::MetalCodeGenerator
51 this->write(s); in writeLine()
56 void MetalCodeGenerator::write(const String& s) { in write() function in SkSL::MetalCodeGenerator
57 this->write(s.c_str()); in write()
78 this->write(type.name()); in writeType()
87 this->write("}"); in writeType()
91 this->write(to_string(type.columns())); in writeType()
95 this->write(to_string(type.columns())); in writeType()
96 this->write("x"); in writeType()
97 this->write(to_string(type.rows())); in writeType()
100 this->write("texture2d<float> "); // FIXME - support other texture types; in writeType()
105 this->write(fContext.fFloat_Type->name()); in writeType()
107 this->write("char"); in writeType()
109 this->write("uchar"); in writeType()
111 this->write(type.name()); in writeType()
178 this->write(" == "); in writeIntrinsicCall()
181 this->write(" != "); in writeIntrinsicCall()
184 this->write(" < "); in writeIntrinsicCall()
187 this->write(" <= "); in writeIntrinsicCall()
190 this->write(" > "); in writeIntrinsicCall()
193 this->write(" >= "); in writeIntrinsicCall()
212 this->write("atan2"); in writeFunctionCall()
214 this->write("rsqrt"); in writeFunctionCall()
219 this->write("dfdx"); in writeFunctionCall()
222 this->write((fProgram.fSettings.fFlipY) ? "-dfdy" : "dfdy"); in writeFunctionCall()
226 this->write("("); in writeFunctionCall()
229 this->write("_in"); in writeFunctionCall()
233 this->write(separator); in writeFunctionCall()
234 this->write("_out"); in writeFunctionCall()
238 this->write(separator); in writeFunctionCall()
239 this->write("_uniforms"); in writeFunctionCall()
243 this->write(separator); in writeFunctionCall()
244 this->write("_globals"); in writeFunctionCall()
249 this->write(separator); in writeFunctionCall()
252 this->write("&"); in writeFunctionCall()
256 this->write(")"); in writeFunctionCall()
336 this->write(name); in writeInverseHack()
343 this->write(".sample("); in writeSpecialIntrinsic()
345 this->write(SAMPLER_SUFFIX); in writeSpecialIntrinsic()
346 this->write(", "); in writeSpecialIntrinsic()
349 this->write(".xy)"); // FIXME - add projection functionality in writeSpecialIntrinsic()
352 this->write(")"); in writeSpecialIntrinsic()
357 this->write("(("); in writeSpecialIntrinsic()
359 this->write(") - ("); in writeSpecialIntrinsic()
361 this->write(") * floor(("); in writeSpecialIntrinsic()
363 this->write(") / ("); in writeSpecialIntrinsic()
365 this->write(")))"); in writeSpecialIntrinsic()
469 this->write(name); in writeConstructor()
470 this->write("("); in writeConstructor()
472 this->write(")"); in writeConstructor()
475 this->write("("); in writeConstructor()
479 this->write(separator); in writeConstructor()
485 this->write(to_string(c.fType.rows())); in writeConstructor()
486 this->write("("); in writeConstructor()
492 this->write(")"); in writeConstructor()
496 this->write(")"); in writeConstructor()
502 this->write("float4(_fragCoord.x, _anonInterface0.u_skRTHeight - _fragCoord.y, 0.0, " in writeFragCoord()
505 this->write("float4(_fragCoord.x, _fragCoord.y, 0.0, _fragCoord.w)"); in writeFragCoord()
512 this->write("_out->sk_FragColor"); in writeVariableReference()
518 this->write("sk_VertexID"); in writeVariableReference()
521 this->write("sk_InstanceID"); in writeVariableReference()
526 this->write(fProgram.fSettings.fFlipY ? "_frontFacing" : "(!_frontFacing)"); in writeVariableReference()
531 this->write("_in."); in writeVariableReference()
533 this->write("_out->"); in writeVariableReference()
536 this->write("_uniforms."); in writeVariableReference()
538 this->write("_globals->"); in writeVariableReference()
547 this->write("["); in writeIndexExpression()
549 this->write("]"); in writeIndexExpression()
556 this->write("."); in writeFieldAccess()
560 this->write("gl_ClipDistance"); in writeFieldAccess()
563 this->write("_out->sk_Position"); in writeFieldAccess()
567 this->write("_out->sk_PointSize"); in writeFieldAccess()
570 this->write("_globals->"); in writeFieldAccess()
571 this->write(fInterfaceBlockNameMap[fInterfaceBlockMap[field]]); in writeFieldAccess()
572 this->write("->"); in writeFieldAccess()
583 this->write("("); in writeSwizzle()
586 this->write("."); in writeSwizzle()
589 this->write(&("x\0y\0z\0w\0"[c * 2])); in writeSwizzle()
593 this->write(", 0)"); in writeSwizzle()
596 this->write(", 1)"); in writeSwizzle()
659 this->write("all"); in writeBinaryExpression()
665 this->write("!all"); in writeBinaryExpression()
673 this->write("("); in writeBinaryExpression()
681 this->write("*"); in writeBinaryExpression()
696 this->write(" = "); in writeBinaryExpression()
698 this->write(" "); in writeBinaryExpression()
701 this->write(op.substr(0, op.size() - 1).c_str()); in writeBinaryExpression()
702 this->write(" "); in writeBinaryExpression()
704 this->write(String(" ") + Compiler::OperatorName(b.fOperator) + " "); in writeBinaryExpression()
708 this->write(")"); in writeBinaryExpression()
715 this->write("("); in writeTernaryExpression()
718 this->write(" ? "); in writeTernaryExpression()
720 this->write(" : "); in writeTernaryExpression()
723 this->write(")"); in writeTernaryExpression()
730 this->write("("); in writePrefixExpression()
732 this->write(Compiler::OperatorName(p.fOperator)); in writePrefixExpression()
735 this->write(")"); in writePrefixExpression()
742 this->write("("); in writePostfixExpression()
745 this->write(Compiler::OperatorName(p.fOperator)); in writePostfixExpression()
747 this->write(")"); in writePostfixExpression()
752 this->write(b.fValue ? "true" : "false"); in writeBoolLiteral()
757 this->write(to_string(i.fValue & 0xffffffff) + "u"); in writeIntLiteral()
759 this->write(to_string((int32_t) i.fValue)); in writeIntLiteral()
764 this->write(to_string(f.fValue)); in writeFloatLiteral()
777 this->write("fragment Outputs main0"); in writeFunction()
779 this->write("fragment Outputs fragmentMain"); in writeFunction()
784 this->write("vertex Outputs main0"); in writeFunction()
786 this->write("vertex Outputs vertexMain"); in writeFunction()
792 this->write("(Inputs _in [[stage_in]]"); in writeFunction()
794 this->write(", constant Uniforms& _uniforms [[buffer(" + in writeFunction()
806 this->write(", texture2d<float> "); // FIXME - support other texture types in writeFunction()
808 this->write("[[texture("); in writeFunction()
809 this->write(to_string(var.fVar->fModifiers.fLayout.fBinding)); in writeFunction()
810 this->write(")]]"); in writeFunction()
811 this->write(", sampler "); in writeFunction()
813 this->write(SAMPLER_SUFFIX); in writeFunction()
814 this->write("[[sampler("); in writeFunction()
815 this->write(to_string(var.fVar->fModifiers.fLayout.fBinding)); in writeFunction()
816 this->write(")]]"); in writeFunction()
824 this->write(", constant "); in writeFunction()
826 this->write("& " ); in writeFunction()
827 this->write(fInterfaceBlockNameMap[&intf]); in writeFunction()
828 this->write(" [[buffer("); in writeFunction()
830 this->write(to_string(intf.fVariable.fModifiers.fLayout.fSet)); in writeFunction()
832 this->write(to_string(intf.fVariable.fModifiers.fLayout.fBinding)); in writeFunction()
834 this->write(")]]"); in writeFunction()
840 this->write(", constant sksl_synthetic_uniforms& _anonInterface0 [[buffer(0)]]"); in writeFunction()
842 this->write(", constant sksl_synthetic_uniforms& _anonInterface0 [[buffer(1)]]"); in writeFunction()
845 this->write(", bool _frontFacing [[front_facing]]"); in writeFunction()
846 this->write(", float4 _fragCoord [[position]]"); in writeFunction()
848 this->write(", uint sk_VertexID [[vertex_id]], uint sk_InstanceID [[instance_id]]"); in writeFunction()
853 this->write(" "); in writeFunction()
855 this->write("("); in writeFunction()
857 this->write("Inputs _in"); in writeFunction()
861 this->write(separator); in writeFunction()
862 this->write("thread Outputs* _out"); in writeFunction()
866 this->write(separator); in writeFunction()
867 this->write("Uniforms _uniforms"); in writeFunction()
871 this->write(separator); in writeFunction()
872 this->write("thread Globals* _globals"); in writeFunction()
877 this->write(separator); in writeFunction()
888 this->write("*"); in writeFunction()
890 this->write(" "); in writeFunction()
894 this->write("[]"); in writeFunction()
896 this->write("[" + to_string(s) + "]"); in writeFunction()
910 this->write(" _globals->"); in writeFunction()
912 this->write(" = &"); in writeFunction()
914 this->write(";\n"); in writeFunction()
917 this->write(" _globals->"); in writeFunction()
919 this->write(" = "); in writeFunction()
924 this->write(" _globals->"); in writeFunction()
926 this->write(" = "); in writeFunction()
928 this->write(";\n"); in writeFunction()
929 this->write(" _globals->"); in writeFunction()
931 this->write(SAMPLER_SUFFIX); in writeFunction()
932 this->write(" = "); in writeFunction()
934 this->write(SAMPLER_SUFFIX); in writeFunction()
935 this->write(";\n"); in writeFunction()
964 this->write(fFunctionHeader); in writeFunction()
965 this->write(buffer.str()); in writeFunction()
971 this->write("thread "); in writeModifiers()
974 this->write("constant "); in writeModifiers()
983 this->write("struct "); in writeInterfaceBlock()
996 this->write("}"); in writeInterfaceBlock()
998 this->write(" "); in writeInterfaceBlock()
999 this->write(intf.fInstanceName); in writeInterfaceBlock()
1001 this->write("["); in writeInterfaceBlock()
1005 this->write("]"); in writeInterfaceBlock()
1031 this->write("char pad"); in writeFields()
1032 this->write(to_string(fPaddingCount++)); in writeFields()
1033 this->write("["); in writeFields()
1034 this->write(to_string(fieldOffset - currentOffset)); in writeFields()
1057 this->write(PACKED_PREFIX); in writeFields()
1068 this->write(" "); in writeFields()
1072 this->write("[]"); in writeFields()
1074 this->write("[" + to_string(s) + "]"); in writeFields()
1090 this->write("_"); // adding underscore before name to avoid conflict with reserved words in writeName()
1092 this->write(name); in writeName()
1104 this->write(", "); in writeVarDeclarations()
1108 this->write(" "); in writeVarDeclarations()
1113 this->write("["); in writeVarDeclarations()
1117 this->write("]"); in writeVarDeclarations()
1120 this->write(" = "); in writeVarDeclarations()
1133 this->write(";"); in writeVarDeclarations()
1144 this->write(";"); in writeStatement()
1168 this->write("break;"); in writeStatement()
1171 this->write("continue;"); in writeStatement()
1174 this->write("discard_fragment();"); in writeStatement()
1177 this->write(";"); in writeStatement()
1198 this->write("}"); in writeBlock()
1202 this->write("if ("); in writeIfStatement()
1204 this->write(") "); in writeIfStatement()
1207 this->write(" else "); in writeIfStatement()
1213 this->write("for ("); in writeForStatement()
1217 this->write("; "); in writeForStatement()
1222 this->write("; "); in writeForStatement()
1226 this->write(") "); in writeForStatement()
1231 this->write("while ("); in writeWhileStatement()
1233 this->write(") "); in writeWhileStatement()
1238 this->write("do "); in writeDoStatement()
1240 this->write(" while ("); in writeDoStatement()
1242 this->write(");"); in writeDoStatement()
1246 this->write("switch ("); in writeSwitchStatement()
1252 this->write("case "); in writeSwitchStatement()
1266 this->write("}"); in writeSwitchStatement()
1270 this->write("return"); in writeReturnStatement()
1272 this->write(" "); in writeReturnStatement()
1275 this->write(";"); in writeReturnStatement()
1279 this->write("#include <metal_stdlib>\n"); in writeHeader()
1280 this->write("#include <simd/simd.h>\n"); in writeHeader()
1281 this->write("using namespace metal;\n"); in writeHeader()
1295 this->write("struct Uniforms {\n"); in writeUniformStruct()
1306 this->write(" "); in writeUniformStruct()
1308 this->write(" "); in writeUniformStruct()
1313 this->write(";\n"); in writeUniformStruct()
1318 this->write("};\n"); in writeUniformStruct()
1323 this->write("struct Inputs {\n"); in writeInputStruct()
1333 this->write(" "); in writeInputStruct()
1335 this->write(" "); in writeInputStruct()
1341 this->write(" [[attribute(" + in writeInputStruct()
1344 this->write(" [[user(locn" + in writeInputStruct()
1349 this->write(";\n"); in writeInputStruct()
1353 this->write("};\n"); in writeInputStruct()
1357 this->write("struct Outputs {\n"); in writeOutputStruct()
1359 this->write(" float4 sk_Position [[position]];\n"); in writeOutputStruct()
1361 this->write(" float4 sk_FragColor [[color(0)]];\n"); in writeOutputStruct()
1372 this->write(" "); in writeOutputStruct()
1374 this->write(" "); in writeOutputStruct()
1379 this->write(" [[user(locn" + in writeOutputStruct()
1382 this->write(" [[color(" + in writeOutputStruct()
1386 this->write(", index(" + to_string(colorIndex) + ")"); in writeOutputStruct()
1388 this->write("]]"); in writeOutputStruct()
1391 this->write(";\n"); in writeOutputStruct()
1396 this->write(" float sk_PointSize;\n"); in writeOutputStruct()
1398 this->write("};\n"); in writeOutputStruct()
1420 this->write("struct Globals {\n"); in writeGlobalStruct()
1426 this->write(" constant "); in writeGlobalStruct()
1427 this->write(intfType->fTypeName); in writeGlobalStruct()
1428 this->write("* "); in writeGlobalStruct()
1430 this->write(";\n"); in writeGlobalStruct()
1442 this->write("struct Globals {\n"); in writeGlobalStruct()
1446 this->write(" "); in writeGlobalStruct()
1448 this->write(" "); in writeGlobalStruct()
1454 this->write(";\n"); in writeGlobalStruct()
1455 this->write(" sampler "); in writeGlobalStruct()
1457 this->write(SAMPLER_SUFFIX); in writeGlobalStruct()
1463 this->write(";\n"); in writeGlobalStruct()
1468 this->write("};\n"); in writeGlobalStruct()
1670 fOut->write((const char*) &MVKMagicNum, sizeof(MVKMagicNum)); in generateCode()
1690 this->write("\0"); in generateCode()