1252 {
1253
1254
1255
1256
1257 this->preprocessProgram();
1258
1259 {
1260 AutoOutputStream outputToHeader(this, &fHeader, &fIndentation);
1261 this->writeEnables();
1262 this->writeStageInputStruct();
1263 this->writeStageOutputStruct();
1264 this->writeUniformsAndBuffers();
1265 this->writeNonBlockUniformsForTests();
1266 }
1267 StringStream body;
1268 {
1269
1270 AutoOutputStream outputToBody(this, &body, &fIndentation);
1271 const FunctionDefinition* mainFunc = nullptr;
1272 for (
const ProgramElement* e :
fProgram.elements()) {
1273 this->writeProgramElement(*e);
1274
1275 if (
e->is<FunctionDefinition>()) {
1276 const FunctionDefinition& func =
e->as<FunctionDefinition>();
1277 if (func.declaration().isMain()) {
1278 mainFunc = &func;
1279 }
1280 }
1281 }
1282
1283
1284
1285
1286 if (mainFunc) {
1287 this->writeEntryPoint(*mainFunc);
1288 }
1289 }
1290
1293
1294 this->writeUniformPolyfills();
1295
1297}
void write_stringstream(const StringStream &s, OutputStream &out)