• Home
  • Raw
  • Download

Lines Matching refs:write

35 void MetalCodeGenerator::write(const char* s) {  in write()  function in SkSL::MetalCodeGenerator
49 this->write(s); in writeLine()
54 void MetalCodeGenerator::write(const String& s) { in write() function in SkSL::MetalCodeGenerator
55 this->write(s.c_str()); in write()
76 this->write(type.name()); in writeType()
85 this->write("}"); in writeType()
89 this->write(to_string(type.columns())); in writeType()
93 this->write(to_string(type.columns())); in writeType()
94 this->write("x"); in writeType()
95 this->write(to_string(type.rows())); in writeType()
98 this->write("texture2d<float> "); // FIXME - support other texture types; in writeType()
103 this->write(fContext.fFloat_Type->name()); in writeType()
105 this->write("char"); in writeType()
107 this->write("uchar"); in writeType()
109 this->write(type.name()); in writeType()
176 this->write(" < "); in writeIntrinsicCall()
179 this->write(" <= "); in writeIntrinsicCall()
182 this->write(" > "); in writeIntrinsicCall()
185 this->write(" >= "); in writeIntrinsicCall()
204 this->write("atan2"); in writeFunctionCall()
206 this->write("rsqrt"); in writeFunctionCall()
211 this->write("dfdx"); in writeFunctionCall()
213 this->write("dfdy"); in writeFunctionCall()
217 this->write("("); in writeFunctionCall()
220 this->write("_in"); in writeFunctionCall()
224 this->write(separator); in writeFunctionCall()
225 this->write("_out"); in writeFunctionCall()
229 this->write(separator); in writeFunctionCall()
230 this->write("_uniforms"); in writeFunctionCall()
234 this->write(separator); in writeFunctionCall()
235 this->write("_globals"); in writeFunctionCall()
240 this->write(separator); in writeFunctionCall()
243 this->write("&"); in writeFunctionCall()
247 this->write(")"); in writeFunctionCall()
263 this->write(name); in writeInverseHack()
270 this->write(".sample("); in writeSpecialIntrinsic()
272 this->write(SAMPLER_SUFFIX); in writeSpecialIntrinsic()
273 this->write(", "); in writeSpecialIntrinsic()
276 this->write(".xy)"); // FIXME - add projection functionality in writeSpecialIntrinsic()
279 this->write(")"); in writeSpecialIntrinsic()
284 this->write("(("); in writeSpecialIntrinsic()
286 this->write(") - ("); in writeSpecialIntrinsic()
288 this->write(") * floor(("); in writeSpecialIntrinsic()
290 this->write(") / ("); in writeSpecialIntrinsic()
292 this->write(")))"); in writeSpecialIntrinsic()
372 this->write(name); in writeConstructor()
373 this->write("("); in writeConstructor()
375 this->write(")"); in writeConstructor()
378 this->write("("); in writeConstructor()
382 this->write(separator); in writeConstructor()
389 this->write(to_string(c.fType.rows())); in writeConstructor()
390 this->write("("); in writeConstructor()
396 this->write(")"); in writeConstructor()
400 this->write(")"); in writeConstructor()
405 this->write("float4(_fragCoord.x, _anonInterface0.u_skRTHeight - _fragCoord.y, 0.0, " in writeFragCoord()
412 this->write("_out->sk_FragColor"); in writeVariableReference()
418 this->write("sk_VertexID"); in writeVariableReference()
421 this->write("sk_InstanceID"); in writeVariableReference()
426 this->write(fProgram.fSettings.fFlipY ? "_frontFacing" : "(!_frontFacing)"); in writeVariableReference()
431 this->write("_in."); in writeVariableReference()
433 this->write("_out->"); in writeVariableReference()
436 this->write("_uniforms."); in writeVariableReference()
438 this->write("_globals->"); in writeVariableReference()
447 this->write("["); in writeIndexExpression()
449 this->write("]"); in writeIndexExpression()
456 this->write("."); in writeFieldAccess()
460 this->write("gl_ClipDistance"); in writeFieldAccess()
463 this->write("_out->sk_Position"); in writeFieldAccess()
467 this->write("_out->sk_PointSize"); in writeFieldAccess()
470 this->write("_globals->"); in writeFieldAccess()
471 this->write(fInterfaceBlockNameMap[fInterfaceBlockMap[field]]); in writeFieldAccess()
472 this->write("->"); in writeFieldAccess()
481 this->write("."); in writeSwizzle()
483 this->write(&("x\0y\0z\0w\0"[c * 2])); in writeSwizzle()
531 this->write("("); in writeBinaryExpression()
539 this->write("*"); in writeBinaryExpression()
550 this->write(" = "); in writeBinaryExpression()
552 this->write(" "); in writeBinaryExpression()
555 this->write(op.substr(0, op.size() - 1).c_str()); in writeBinaryExpression()
556 this->write(" "); in writeBinaryExpression()
558 this->write(String(" ") + Compiler::OperatorName(b.fOperator) + " "); in writeBinaryExpression()
562 this->write(")"); in writeBinaryExpression()
569 this->write("("); in writeTernaryExpression()
572 this->write(" ? "); in writeTernaryExpression()
574 this->write(" : "); in writeTernaryExpression()
577 this->write(")"); in writeTernaryExpression()
584 this->write("("); in writePrefixExpression()
586 this->write(Compiler::OperatorName(p.fOperator)); in writePrefixExpression()
589 this->write(")"); in writePrefixExpression()
596 this->write("("); in writePostfixExpression()
599 this->write(Compiler::OperatorName(p.fOperator)); in writePostfixExpression()
601 this->write(")"); in writePostfixExpression()
606 this->write(b.fValue ? "true" : "false"); in writeBoolLiteral()
611 this->write(to_string(i.fValue & 0xffffffff) + "u"); in writeIntLiteral()
613 this->write(to_string((int32_t) i.fValue)); in writeIntLiteral()
618 this->write(to_string(f.fValue)); in writeFloatLiteral()
631 this->write("fragment Outputs main0"); in writeFunction()
633 this->write("fragment Outputs fragmentMain"); in writeFunction()
638 this->write("vertex Outputs main0"); in writeFunction()
640 this->write("vertex Outputs vertexMain"); in writeFunction()
646 this->write("(Inputs _in [[stage_in]]"); in writeFunction()
648 this->write(", constant Uniforms& _uniforms [[buffer(" + in writeFunction()
660 this->write(", texture2d<float> "); // FIXME - support other texture types in writeFunction()
662 this->write("[[texture("); in writeFunction()
663 this->write(to_string(var.fVar->fModifiers.fLayout.fBinding)); in writeFunction()
664 this->write(")]]"); in writeFunction()
665 this->write(", sampler "); in writeFunction()
667 this->write(SAMPLER_SUFFIX); in writeFunction()
668 this->write("[[sampler("); in writeFunction()
669 this->write(to_string(var.fVar->fModifiers.fLayout.fBinding)); in writeFunction()
670 this->write(")]]"); in writeFunction()
678 this->write(", constant "); in writeFunction()
680 this->write("& " ); in writeFunction()
681 this->write(fInterfaceBlockNameMap[&intf]); in writeFunction()
682 this->write(" [[buffer("); in writeFunction()
684 this->write(to_string(intf.fVariable.fModifiers.fLayout.fSet)); in writeFunction()
686 this->write(to_string(intf.fVariable.fModifiers.fLayout.fBinding)); in writeFunction()
688 this->write(")]]"); in writeFunction()
696 this->write(", constant sksl_synthetic_uniforms& _anonInterface0 [[buffer(0)]]"); in writeFunction()
698 this->write(", constant sksl_synthetic_uniforms& _anonInterface0 [[buffer(1)]]"); in writeFunction()
701 this->write(", bool _frontFacing [[front_facing]]"); in writeFunction()
702 this->write(", float4 _fragCoord [[position]]"); in writeFunction()
704 this->write(", uint sk_VertexID [[vertex_id]], uint sk_InstanceID [[instance_id]]"); in writeFunction()
709 this->write(" "); in writeFunction()
711 this->write("("); in writeFunction()
713 this->write("Inputs _in"); in writeFunction()
717 this->write(separator); in writeFunction()
718 this->write("thread Outputs* _out"); in writeFunction()
722 this->write(separator); in writeFunction()
723 this->write("Uniforms _uniforms"); in writeFunction()
727 this->write(separator); in writeFunction()
728 this->write("thread Globals* _globals"); in writeFunction()
733 this->write(separator); in writeFunction()
744 this->write("*"); in writeFunction()
746 this->write(" "); in writeFunction()
750 this->write("[]"); in writeFunction()
752 this->write("[" + to_string(s) + "]"); in writeFunction()
766 this->write(" _globals->"); in writeFunction()
768 this->write(" = &"); in writeFunction()
770 this->write(";\n"); in writeFunction()
773 this->write(" _globals->"); in writeFunction()
775 this->write(" = "); in writeFunction()
780 this->write(" _globals->"); in writeFunction()
782 this->write(" = "); in writeFunction()
784 this->write(";\n"); in writeFunction()
785 this->write(" _globals->"); in writeFunction()
787 this->write(SAMPLER_SUFFIX); in writeFunction()
788 this->write(" = "); in writeFunction()
790 this->write(SAMPLER_SUFFIX); in writeFunction()
791 this->write(";\n"); in writeFunction()
820 this->write(fFunctionHeader); in writeFunction()
821 this->write(buffer.str()); in writeFunction()
827 this->write("thread "); in writeModifiers()
830 this->write("constant "); in writeModifiers()
839 this->write("struct "); in writeInterfaceBlock()
852 this->write("}"); in writeInterfaceBlock()
854 this->write(" "); in writeInterfaceBlock()
855 this->write(intf.fInstanceName); in writeInterfaceBlock()
857 this->write("["); in writeInterfaceBlock()
861 this->write("]"); in writeInterfaceBlock()
887 this->write("char pad"); in writeFields()
888 this->write(to_string(fPaddingCount++)); in writeFields()
889 this->write("["); in writeFields()
890 this->write(to_string(fieldOffset - currentOffset)); in writeFields()
913 this->write(PACKED_PREFIX); in writeFields()
924 this->write(" "); in writeFields()
928 this->write("[]"); in writeFields()
930 this->write("[" + to_string(s) + "]"); in writeFields()
946 this->write("_"); // adding underscore before name to avoid conflict with reserved words in writeName()
948 this->write(name); in writeName()
960 this->write(", "); in writeVarDeclarations()
964 this->write(" "); in writeVarDeclarations()
969 this->write("["); in writeVarDeclarations()
973 this->write("]"); in writeVarDeclarations()
976 this->write(" = "); in writeVarDeclarations()
989 this->write(";"); in writeVarDeclarations()
1000 this->write(";"); in writeStatement()
1024 this->write("break;"); in writeStatement()
1027 this->write("continue;"); in writeStatement()
1030 this->write("discard_fragment();"); in writeStatement()
1033 this->write(";"); in writeStatement()
1054 this->write("}"); in writeBlock()
1058 this->write("if ("); in writeIfStatement()
1060 this->write(") "); in writeIfStatement()
1063 this->write(" else "); in writeIfStatement()
1069 this->write("for ("); in writeForStatement()
1073 this->write("; "); in writeForStatement()
1078 this->write("; "); in writeForStatement()
1082 this->write(") "); in writeForStatement()
1087 this->write("while ("); in writeWhileStatement()
1089 this->write(") "); in writeWhileStatement()
1094 this->write("do "); in writeDoStatement()
1096 this->write(" while ("); in writeDoStatement()
1098 this->write(");"); in writeDoStatement()
1102 this->write("switch ("); in writeSwitchStatement()
1108 this->write("case "); in writeSwitchStatement()
1122 this->write("}"); in writeSwitchStatement()
1126 this->write("return"); in writeReturnStatement()
1128 this->write(" "); in writeReturnStatement()
1131 this->write(";"); in writeReturnStatement()
1135 this->write("#include <metal_stdlib>\n"); in writeHeader()
1136 this->write("#include <simd/simd.h>\n"); in writeHeader()
1137 this->write("using namespace metal;\n"); in writeHeader()
1151 this->write("struct Uniforms {\n"); in writeUniformStruct()
1162 this->write(" "); in writeUniformStruct()
1164 this->write(" "); in writeUniformStruct()
1169 this->write(";\n"); in writeUniformStruct()
1174 this->write("};\n"); in writeUniformStruct()
1179 this->write("struct Inputs {\n"); in writeInputStruct()
1189 this->write(" "); in writeInputStruct()
1191 this->write(" "); in writeInputStruct()
1197 this->write(" [[attribute(" + in writeInputStruct()
1200 this->write(" [[user(locn" + in writeInputStruct()
1205 this->write(";\n"); in writeInputStruct()
1209 this->write("};\n"); in writeInputStruct()
1213 this->write("struct Outputs {\n"); in writeOutputStruct()
1215 this->write(" float4 sk_Position [[position]];\n"); in writeOutputStruct()
1217 this->write(" float4 sk_FragColor [[color(0)]];\n"); in writeOutputStruct()
1228 this->write(" "); in writeOutputStruct()
1230 this->write(" "); in writeOutputStruct()
1235 this->write(" [[user(locn" + in writeOutputStruct()
1238 this->write(" [[color(" + in writeOutputStruct()
1242 this->write(", index(" + to_string(colorIndex) + ")"); in writeOutputStruct()
1244 this->write("]]"); in writeOutputStruct()
1247 this->write(";\n"); in writeOutputStruct()
1252 this->write(" float sk_PointSize;\n"); in writeOutputStruct()
1254 this->write("};\n"); in writeOutputStruct()
1278 this->write("struct Globals {\n"); in writeGlobalStruct()
1284 this->write(" constant "); in writeGlobalStruct()
1285 this->write(intfType->fTypeName); in writeGlobalStruct()
1286 this->write("* "); in writeGlobalStruct()
1288 this->write(";\n"); in writeGlobalStruct()
1300 this->write("struct Globals {\n"); in writeGlobalStruct()
1304 this->write(" "); in writeGlobalStruct()
1306 this->write(" "); in writeGlobalStruct()
1312 this->write(";\n"); in writeGlobalStruct()
1313 this->write(" sampler "); in writeGlobalStruct()
1315 this->write(SAMPLER_SUFFIX); in writeGlobalStruct()
1321 this->write(";\n"); in writeGlobalStruct()
1326 this->write("};\n"); in writeGlobalStruct()
1528 fOut->write((const char*) &MVKMagicNum, sizeof(MVKMagicNum)); in generateCode()
1548 this->write("\0"); in generateCode()