Lines Matching full:token
207 for (auto token = tokenizer->NextToken();; token = tokenizer->NextToken()) { in ParseBufferData() local
208 if (token->IsEOL()) in ParseBufferData()
210 if (token->IsEOS()) { in ParseBufferData()
217 if (token->IsIdentifier() && token->AsString() == "END") in ParseBufferData()
219 if (!token->IsInteger() && !token->IsDouble() && !token->IsHex()) in ParseBufferData()
220 return Result("invalid BUFFER data value: " + token->ToOriginalString()); in ParseBufferData()
230 token->ConvertToDouble(); in ParseBufferData()
232 double val = token->IsHex() ? static_cast<double>(token->AsHex()) in ParseBufferData()
233 : token->AsDouble(); in ParseBufferData()
237 if (token->IsDouble()) { in ParseBufferData()
239 token->ToOriginalString()); in ParseBufferData()
242 uint64_t val = token->IsHex() ? token->AsHex() : token->AsUint64(); in ParseBufferData()
288 for (auto token = tokenizer_->NextToken(); !token->IsEOS(); in Parse() local
289 token = tokenizer_->NextToken()) { in Parse()
290 if (token->IsEOL()) in Parse()
292 if (!token->IsIdentifier()) in Parse()
296 std::string tok = token->AsString(); in Parse()
326 r = Result("unknown token: " + tok); in Parse()
447 auto token = tokenizer_->NextToken(); in ValidateEndOfStatement() local
448 if (token->IsEOL() || token->IsEOS()) in ValidateEndOfStatement()
451 token->ToOriginalString()); in ValidateEndOfStatement()
455 auto token = tokenizer_->NextToken(); in ParseShaderBlock() local
456 if (!token->IsIdentifier()) in ParseShaderBlock()
457 return Result("invalid token when looking for shader type"); in ParseShaderBlock()
460 Result r = ToShaderType(token->AsString(), &type); in ParseShaderBlock()
466 token = tokenizer_->NextToken(); in ParseShaderBlock()
467 if (!token->IsIdentifier()) in ParseShaderBlock()
468 return Result("invalid token when looking for shader name"); in ParseShaderBlock()
470 shader->SetName(token->AsString()); in ParseShaderBlock()
472 token = tokenizer_->NextToken(); in ParseShaderBlock()
473 if (!token->IsIdentifier()) in ParseShaderBlock()
474 return Result("invalid token when looking for shader format"); in ParseShaderBlock()
476 std::string fmt = token->AsString(); in ParseShaderBlock()
501 token = tokenizer_->PeekNextToken(); in ParseShaderBlock()
502 if (token->IsIdentifier() && token->AsString() == "TARGET_ENV") { in ParseShaderBlock()
504 token = tokenizer_->NextToken(); in ParseShaderBlock()
505 if (!token->IsIdentifier() && !token->IsString()) in ParseShaderBlock()
507 shader->SetTargetEnv(token->AsString()); in ParseShaderBlock()
510 token = tokenizer_->PeekNextToken(); in ParseShaderBlock()
511 if (token->IsIdentifier() && token->AsString() == "VIRTUAL_FILE") { in ParseShaderBlock()
514 token = tokenizer_->NextToken(); in ParseShaderBlock()
515 if (!token->IsIdentifier() && !token->IsString()) in ParseShaderBlock()
518 auto path = token->AsString(); in ParseShaderBlock()
549 token = tokenizer_->NextToken(); in ParseShaderBlock()
550 if (!token->IsIdentifier() || token->AsString() != "END") in ParseShaderBlock()
561 auto token = tokenizer_->NextToken(); in ParsePipelineBlock() local
562 if (!token->IsIdentifier()) in ParsePipelineBlock()
563 return Result("invalid token when looking for pipeline type"); in ParsePipelineBlock()
566 Result r = ToPipelineType(token->AsString(), &type); in ParsePipelineBlock()
572 token = tokenizer_->NextToken(); in ParsePipelineBlock()
573 if (!token->IsIdentifier()) in ParsePipelineBlock()
574 return Result("invalid token when looking for pipeline name"); in ParsePipelineBlock()
576 pipeline->SetName(token->AsString()); in ParsePipelineBlock()
587 std::unique_ptr<Token> token; in ParsePipelineBody() local
588 for (token = tokenizer_->NextToken(); !token->IsEOS(); in ParsePipelineBody()
589 token = tokenizer_->NextToken()) { in ParsePipelineBody()
590 if (token->IsEOL()) in ParsePipelineBody()
592 if (!token->IsIdentifier()) in ParsePipelineBody()
596 std::string tok = token->AsString(); in ParsePipelineBody()
624 r = Result("unknown token in pipeline block: " + tok); in ParsePipelineBody()
630 if (!token->IsIdentifier() || token->AsString() != "END") in ParsePipelineBody()
641 auto token = tokenizer_->NextToken(); in ParsePipelineAttach() local
642 if (!token->IsIdentifier()) in ParsePipelineAttach()
643 return Result("invalid token in ATTACH command"); in ParsePipelineAttach()
645 auto* shader = script_->GetShader(token->AsString()); in ParsePipelineAttach()
649 token = tokenizer_->NextToken(); in ParsePipelineAttach()
650 if (token->IsEOL() || token->IsEOS()) { in ParsePipelineAttach()
659 if (!token->IsIdentifier()) in ParsePipelineAttach()
660 return Result("invalid token after ATTACH"); in ParsePipelineAttach()
664 auto type = token->AsString(); in ParsePipelineAttach()
666 token = tokenizer_->NextToken(); in ParsePipelineAttach()
667 if (!token->IsIdentifier()) in ParsePipelineAttach()
670 Result r = ToShaderType(token->AsString(), &shader_type); in ParsePipelineAttach()
676 token = tokenizer_->NextToken(); in ParsePipelineAttach()
677 if (!token->IsIdentifier()) in ParsePipelineAttach()
680 type = token->AsString(); in ParsePipelineAttach()
693 token = tokenizer_->NextToken(); in ParsePipelineAttach()
694 if (!token->IsIdentifier()) in ParsePipelineAttach()
697 r = pipeline->SetShaderEntryPoint(shader, token->AsString()); in ParsePipelineAttach()
701 token = tokenizer_->NextToken(); in ParsePipelineAttach()
705 if (token->IsIdentifier() && token->AsString() == "SPECIALIZE") { in ParsePipelineAttach()
710 token = tokenizer_->NextToken(); in ParsePipelineAttach()
712 if (token->IsEOL() || token->IsEOS()) in ParsePipelineAttach()
714 if (token->IsIdentifier()) in ParsePipelineAttach()
715 return Result("unknown ATTACH parameter: " + token->AsString()); in ParsePipelineAttach()
717 token->ToOriginalString()); in ParsePipelineAttach()
723 auto token = tokenizer_->NextToken(); in ParseShaderSpecialization() local
724 if (!token->IsInteger()) in ParseShaderSpecialization()
727 auto spec_id = token->AsUint32(); in ParseShaderSpecialization()
729 token = tokenizer_->NextToken(); in ParseShaderSpecialization()
730 if (!token->IsIdentifier() || token->AsString() != "AS") in ParseShaderSpecialization()
731 return Result("expected AS as next token"); in ParseShaderSpecialization()
733 token = tokenizer_->NextToken(); in ParseShaderSpecialization()
734 if (!token->IsIdentifier()) in ParseShaderSpecialization()
737 auto type = ToType(token->AsString()); in ParseShaderSpecialization()
739 return Result("invalid data type '" + token->AsString() + "' provided"); in ParseShaderSpecialization()
745 token = tokenizer_->NextToken(); in ParseShaderSpecialization()
749 value = token->AsUint32(); in ParseShaderSpecialization()
751 Result r = token->ConvertToDouble(); in ParseShaderSpecialization()
759 u.f = token->AsFloat(); in ParseShaderSpecialization()
772 auto token = tokenizer_->NextToken(); in ParsePipelineShaderOptimizations() local
773 if (!token->IsIdentifier()) in ParsePipelineShaderOptimizations()
776 auto* shader = script_->GetShader(token->AsString()); in ParsePipelineShaderOptimizations()
780 token = tokenizer_->NextToken(); in ParsePipelineShaderOptimizations()
781 if (!token->IsEOL()) in ParsePipelineShaderOptimizations()
783 token->ToOriginalString()); in ParsePipelineShaderOptimizations()
787 token = tokenizer_->NextToken(); in ParsePipelineShaderOptimizations()
788 if (token->IsEOL()) in ParsePipelineShaderOptimizations()
790 if (token->IsEOS()) in ParsePipelineShaderOptimizations()
792 if (!token->IsIdentifier()) in ParsePipelineShaderOptimizations()
794 if (token->AsString() == "END") in ParsePipelineShaderOptimizations()
797 optimizations.push_back(token->AsString()); in ParsePipelineShaderOptimizations()
808 auto token = tokenizer_->NextToken(); in ParsePipelineShaderCompileOptions() local
809 if (!token->IsIdentifier()) in ParsePipelineShaderCompileOptions()
812 auto* shader = script_->GetShader(token->AsString()); in ParsePipelineShaderCompileOptions()
820 token = tokenizer_->NextToken(); in ParsePipelineShaderCompileOptions()
821 if (!token->IsEOL()) in ParsePipelineShaderCompileOptions()
823 token->ToOriginalString()); in ParsePipelineShaderCompileOptions()
827 token = tokenizer_->NextToken(); in ParsePipelineShaderCompileOptions()
828 if (token->IsEOL()) in ParsePipelineShaderCompileOptions()
830 if (token->IsEOS()) in ParsePipelineShaderCompileOptions()
832 if (token->AsString() == "END") in ParsePipelineShaderCompileOptions()
835 options.push_back(token->AsString()); in ParsePipelineShaderCompileOptions()
846 auto token = tokenizer_->NextToken(); in ParsePipelineSubgroup() local
847 if (!token->IsIdentifier()) in ParsePipelineSubgroup()
850 auto* shader = script_->GetShader(token->AsString()); in ParsePipelineSubgroup()
855 token = tokenizer_->NextToken(); in ParsePipelineSubgroup()
856 if (token->IsEOL()) in ParsePipelineSubgroup()
858 if (token->IsEOS()) in ParsePipelineSubgroup()
860 if (!token->IsIdentifier()) in ParsePipelineSubgroup()
862 if (token->AsString() == "END") in ParsePipelineSubgroup()
865 if (token->AsString() == "FULLY_POPULATED") { in ParsePipelineSubgroup()
870 token = tokenizer_->NextToken(); in ParsePipelineSubgroup()
871 if (token->IsEOL() || token->IsEOS()) in ParsePipelineSubgroup()
874 if (token->AsString() == "on") { in ParsePipelineSubgroup()
876 } else if (token->AsString() == "off") { in ParsePipelineSubgroup()
885 } else if (token->AsString() == "VARYING_SIZE") { in ParsePipelineSubgroup()
890 token = tokenizer_->NextToken(); in ParsePipelineSubgroup()
891 if (token->IsEOL() || token->IsEOS()) in ParsePipelineSubgroup()
894 if (token->AsString() == "on") { in ParsePipelineSubgroup()
896 } else if (token->AsString() == "off") { in ParsePipelineSubgroup()
904 } else if (token->AsString() == "REQUIRED_SIZE") { in ParsePipelineSubgroup()
909 token = tokenizer_->NextToken(); in ParsePipelineSubgroup()
910 if (token->IsEOL() || token->IsEOS()) in ParsePipelineSubgroup()
913 if (token->IsInteger()) { in ParsePipelineSubgroup()
914 r = pipeline->SetShaderRequiredSubgroupSize(shader, token->AsUint32()); in ParsePipelineSubgroup()
915 } else if (token->AsString() == "MIN") { in ParsePipelineSubgroup()
917 } else if (token->AsString() == "MAX") { in ParsePipelineSubgroup()
925 return Result("SUBGROUP invalid value for SUBGROUP " + token->AsString()); in ParsePipelineSubgroup()
933 auto token = tokenizer_->NextToken(); in ParsePipelineFramebufferSize() local
934 if (token->IsEOL() || token->IsEOS()) in ParsePipelineFramebufferSize()
936 if (!token->IsInteger()) in ParsePipelineFramebufferSize()
939 pipeline->SetFramebufferWidth(token->AsUint32()); in ParsePipelineFramebufferSize()
941 token = tokenizer_->NextToken(); in ParsePipelineFramebufferSize()
942 if (token->IsEOL() || token->IsEOS()) in ParsePipelineFramebufferSize()
944 if (!token->IsInteger()) in ParsePipelineFramebufferSize()
947 pipeline->SetFramebufferHeight(token->AsUint32()); in ParsePipelineFramebufferSize()
985 auto token = tokenizer_->NextToken(); in ParsePipelineBind() local
987 if (!token->IsIdentifier()) { in ParsePipelineBind()
993 auto object_type = token->AsString(); in ParsePipelineBind()
997 token = tokenizer_->NextToken(); in ParsePipelineBind()
998 if (!token->IsIdentifier()) in ParsePipelineBind()
1001 auto* buffer = script_->GetBuffer(token->AsString()); in ParsePipelineBind()
1003 return Result("unknown buffer: " + token->AsString()); in ParsePipelineBind()
1008 token = tokenizer_->PeekNextToken(); in ParsePipelineBind()
1009 while (token->IsIdentifier() && token->AsString() != "AS" && in ParsePipelineBind()
1010 token->AsString() != "KERNEL" && in ParsePipelineBind()
1011 token->AsString() != "DESCRIPTOR_SET") { in ParsePipelineBind()
1013 buffer = script_->GetBuffer(token->AsString()); in ParsePipelineBind()
1015 return Result("unknown buffer: " + token->AsString()); in ParsePipelineBind()
1017 token = tokenizer_->PeekNextToken(); in ParsePipelineBind()
1025 token = tokenizer_->NextToken(); in ParsePipelineBind()
1026 if (token->IsIdentifier() && token->AsString() == "AS") { in ParsePipelineBind()
1027 token = tokenizer_->NextToken(); in ParsePipelineBind()
1028 if (!token->IsIdentifier()) in ParsePipelineBind()
1029 return Result("invalid token for BUFFER type"); in ParsePipelineBind()
1031 Result r = ToBufferType(token->AsString(), &buffer_type); in ParsePipelineBind()
1036 token = tokenizer_->NextToken(); in ParsePipelineBind()
1037 if (!token->IsIdentifier() || token->AsString() != "LOCATION") in ParsePipelineBind()
1040 token = tokenizer_->NextToken(); in ParsePipelineBind()
1041 if (!token->IsInteger()) in ParsePipelineBind()
1043 auto location = token->AsUint32(); in ParsePipelineBind()
1046 token = tokenizer_->PeekNextToken(); in ParsePipelineBind()
1047 if (token->IsIdentifier() && token->AsString() == "BASE_MIP_LEVEL") { in ParsePipelineBind()
1049 token = tokenizer_->NextToken(); in ParsePipelineBind()
1051 if (!token->IsInteger()) in ParsePipelineBind()
1054 base_mip_level = token->AsUint32(); in ParsePipelineBind()
1058 "base mip level (now " + token->AsString() + in ParsePipelineBind()
1078 token = tokenizer_->NextToken(); in ParsePipelineBind()
1079 if (!token->IsIdentifier() || token->AsString() != "SAMPLER") in ParsePipelineBind()
1082 token = tokenizer_->NextToken(); in ParsePipelineBind()
1083 if (!token->IsIdentifier()) in ParsePipelineBind()
1086 auto* sampler = script_->GetSampler(token->AsString()); in ParsePipelineBind()
1088 return Result("unknown sampler: " + token->AsString()); in ParsePipelineBind()
1108 // and have to advance to the next token. Otherwise, we're already on in ParsePipelineBind()
1109 // the next token and don't want to advance. in ParsePipelineBind()
1111 token = tokenizer_->NextToken(); in ParsePipelineBind()
1114 if (token->IsIdentifier() && token->AsString() == "DESCRIPTOR_SET") { in ParsePipelineBind()
1115 token = tokenizer_->NextToken(); in ParsePipelineBind()
1116 if (!token->IsInteger()) in ParsePipelineBind()
1118 uint32_t descriptor_set = token->AsUint32(); in ParsePipelineBind()
1120 token = tokenizer_->NextToken(); in ParsePipelineBind()
1121 if (!token->IsIdentifier() || token->AsString() != "BINDING") in ParsePipelineBind()
1124 token = tokenizer_->NextToken(); in ParsePipelineBind()
1125 if (!token->IsInteger()) in ParsePipelineBind()
1128 auto binding = token->AsUint32(); in ParsePipelineBind()
1134 token = tokenizer_->PeekNextToken(); in ParsePipelineBind()
1135 if (token->IsIdentifier() && token->AsString() == "BASE_MIP_LEVEL") { in ParsePipelineBind()
1137 token = tokenizer_->NextToken(); in ParsePipelineBind()
1139 if (!token->IsInteger()) in ParsePipelineBind()
1142 base_mip_level = token->AsUint32(); in ParsePipelineBind()
1145 return Result("base mip level (now " + token->AsString() + in ParsePipelineBind()
1155 token = tokenizer_->NextToken(); in ParsePipelineBind()
1156 if (!token->IsIdentifier() || token->AsString() != "OFFSET") in ParsePipelineBind()
1160 token = tokenizer_->NextToken(); in ParsePipelineBind()
1162 if (!token->IsInteger()) { in ParsePipelineBind()
1171 dynamic_offsets[i] = token->AsUint32(); in ParsePipelineBind()
1180 } else if (token->IsIdentifier() && token->AsString() == "KERNEL") { in ParsePipelineBind()
1181 token = tokenizer_->NextToken(); in ParsePipelineBind()
1182 if (!token->IsIdentifier()) in ParsePipelineBind()
1185 if (token->AsString() == "ARG_NAME") { in ParsePipelineBind()
1186 token = tokenizer_->NextToken(); in ParsePipelineBind()
1187 if (!token->IsIdentifier()) in ParsePipelineBind()
1190 pipeline->AddBuffer(buffer, buffer_type, token->AsString()); in ParsePipelineBind()
1191 } else if (token->AsString() == "ARG_NUMBER") { in ParsePipelineBind()
1192 token = tokenizer_->NextToken(); in ParsePipelineBind()
1193 if (!token->IsInteger()) in ParsePipelineBind()
1196 pipeline->AddBuffer(buffer, buffer_type, token->AsUint32()); in ParsePipelineBind()
1206 token = tokenizer_->NextToken(); in ParsePipelineBind()
1207 if (!token->IsIdentifier()) in ParsePipelineBind()
1210 auto* sampler = script_->GetSampler(token->AsString()); in ParsePipelineBind()
1212 return Result("unknown sampler: " + token->AsString()); in ParsePipelineBind()
1217 token = tokenizer_->PeekNextToken(); in ParsePipelineBind()
1218 while (token->IsIdentifier() && token->AsString() != "KERNEL" && in ParsePipelineBind()
1219 token->AsString() != "DESCRIPTOR_SET") { in ParsePipelineBind()
1221 sampler = script_->GetSampler(token->AsString()); in ParsePipelineBind()
1223 return Result("unknown sampler: " + token->AsString()); in ParsePipelineBind()
1225 token = tokenizer_->PeekNextToken(); in ParsePipelineBind()
1232 token = tokenizer_->NextToken(); in ParsePipelineBind()
1233 if (!token->IsIdentifier()) in ParsePipelineBind()
1234 return Result("expected a string token for BIND command"); in ParsePipelineBind()
1236 if (token->AsString() == "DESCRIPTOR_SET") { in ParsePipelineBind()
1237 token = tokenizer_->NextToken(); in ParsePipelineBind()
1238 if (!token->IsInteger()) in ParsePipelineBind()
1240 uint32_t descriptor_set = token->AsUint32(); in ParsePipelineBind()
1242 token = tokenizer_->NextToken(); in ParsePipelineBind()
1243 if (!token->IsIdentifier() || token->AsString() != "BINDING") in ParsePipelineBind()
1246 token = tokenizer_->NextToken(); in ParsePipelineBind()
1247 if (!token->IsInteger()) in ParsePipelineBind()
1250 uint32_t binding = token->AsUint32(); in ParsePipelineBind()
1255 } else if (token->AsString() == "KERNEL") { in ParsePipelineBind()
1256 token = tokenizer_->NextToken(); in ParsePipelineBind()
1257 if (!token->IsIdentifier()) in ParsePipelineBind()
1260 if (token->AsString() == "ARG_NAME") { in ParsePipelineBind()
1261 token = tokenizer_->NextToken(); in ParsePipelineBind()
1262 if (!token->IsIdentifier()) in ParsePipelineBind()
1265 pipeline->AddSampler(sampler, token->AsString()); in ParsePipelineBind()
1266 } else if (token->AsString() == "ARG_NUMBER") { in ParsePipelineBind()
1267 token = tokenizer_->NextToken(); in ParsePipelineBind()
1268 if (!token->IsInteger()) in ParsePipelineBind()
1271 pipeline->AddSampler(sampler, token->AsUint32()); in ParsePipelineBind()
1286 auto token = tokenizer_->NextToken(); in ParsePipelineVertexData() local
1287 if (!token->IsIdentifier()) in ParsePipelineVertexData()
1290 auto* buffer = script_->GetBuffer(token->AsString()); in ParsePipelineVertexData()
1292 return Result("unknown buffer: " + token->AsString()); in ParsePipelineVertexData()
1294 token = tokenizer_->NextToken(); in ParsePipelineVertexData()
1295 if (!token->IsIdentifier() || token->AsString() != "LOCATION") in ParsePipelineVertexData()
1298 token = tokenizer_->NextToken(); in ParsePipelineVertexData()
1299 if (!token->IsInteger()) in ParsePipelineVertexData()
1301 const uint32_t location = token->AsUint32(); in ParsePipelineVertexData()
1308 token = tokenizer_->PeekNextToken(); in ParsePipelineVertexData()
1309 while (token->IsIdentifier()) { in ParsePipelineVertexData()
1310 if (token->AsString() == "RATE") { in ParsePipelineVertexData()
1312 token = tokenizer_->NextToken(); in ParsePipelineVertexData()
1313 if (!token->IsIdentifier()) in ParsePipelineVertexData()
1315 if (token->AsString() == "instance") { in ParsePipelineVertexData()
1317 } else if (token->AsString() != "vertex") { in ParsePipelineVertexData()
1320 } else if (token->AsString() == "OFFSET") { in ParsePipelineVertexData()
1322 token = tokenizer_->NextToken(); in ParsePipelineVertexData()
1323 if (!token->IsInteger()) in ParsePipelineVertexData()
1325 offset = token->AsUint32(); in ParsePipelineVertexData()
1326 } else if (token->AsString() == "STRIDE") { in ParsePipelineVertexData()
1328 token = tokenizer_->NextToken(); in ParsePipelineVertexData()
1329 if (!token->IsInteger()) in ParsePipelineVertexData()
1331 stride = token->AsUint32(); in ParsePipelineVertexData()
1334 } else if (token->AsString() == "FORMAT") { in ParsePipelineVertexData()
1336 token = tokenizer_->NextToken(); in ParsePipelineVertexData()
1337 if (!token->IsIdentifier()) in ParsePipelineVertexData()
1339 auto type = script_->ParseType(token->AsString()); in ParsePipelineVertexData()
1347 token->ToOriginalString()); in ParsePipelineVertexData()
1350 token = tokenizer_->PeekNextToken(); in ParsePipelineVertexData()
1365 auto token = tokenizer_->NextToken(); in ParsePipelineIndexData() local
1366 if (!token->IsIdentifier()) in ParsePipelineIndexData()
1369 auto* buffer = script_->GetBuffer(token->AsString()); in ParsePipelineIndexData()
1371 return Result("unknown buffer: " + token->AsString()); in ParsePipelineIndexData()
1387 auto token = tokenizer_->NextToken(); in ParsePipelineSet() local
1388 if (!token->IsIdentifier() || token->AsString() != "KERNEL") in ParsePipelineSet()
1391 token = tokenizer_->NextToken(); in ParsePipelineSet()
1392 if (!token->IsIdentifier()) in ParsePipelineSet()
1397 if (token->AsString() == "ARG_NAME") { in ParsePipelineSet()
1398 token = tokenizer_->NextToken(); in ParsePipelineSet()
1399 if (!token->IsIdentifier()) in ParsePipelineSet()
1402 arg_name = token->AsString(); in ParsePipelineSet()
1403 } else if (token->AsString() == "ARG_NUMBER") { in ParsePipelineSet()
1404 token = tokenizer_->NextToken(); in ParsePipelineSet()
1405 if (!token->IsInteger()) in ParsePipelineSet()
1408 arg_no = token->AsUint32(); in ParsePipelineSet()
1413 token = tokenizer_->NextToken(); in ParsePipelineSet()
1414 if (!token->IsIdentifier() || token->AsString() != "AS") in ParsePipelineSet()
1417 token = tokenizer_->NextToken(); in ParsePipelineSet()
1418 if (!token->IsIdentifier()) in ParsePipelineSet()
1421 auto type = ToType(token->AsString()); in ParsePipelineSet()
1423 return Result("invalid data type '" + token->AsString() + "' provided"); in ParsePipelineSet()
1428 token = tokenizer_->NextToken(); in ParsePipelineSet()
1429 if (!token->IsInteger() && !token->IsDouble()) in ParsePipelineSet()
1435 value.SetDoubleValue(token->AsDouble()); in ParsePipelineSet()
1437 value.SetIntValue(token->AsUint64()); in ParsePipelineSet()
1452 auto token = tokenizer_->NextToken(); in ParsePipelinePolygonMode() local
1453 if (!token->IsIdentifier()) in ParsePipelinePolygonMode()
1456 auto mode = token->AsString(); in ParsePipelinePolygonMode()
1472 auto token = tokenizer_->NextToken(); in ParsePipelineDepth() local
1473 if (token->IsEOL()) in ParsePipelineDepth()
1475 if (token->IsEOS()) in ParsePipelineDepth()
1477 if (!token->IsIdentifier()) in ParsePipelineDepth()
1479 if (token->AsString() == "END") in ParsePipelineDepth()
1482 if (token->AsString() == "TEST") { in ParsePipelineDepth()
1483 token = tokenizer_->NextToken(); in ParsePipelineDepth()
1485 if (!token->IsIdentifier()) in ParsePipelineDepth()
1488 if (token->AsString() == "on") in ParsePipelineDepth()
1490 else if (token->AsString() == "off") in ParsePipelineDepth()
1493 return Result("invalid value for TEST: " + token->AsString()); in ParsePipelineDepth()
1494 } else if (token->AsString() == "CLAMP") { in ParsePipelineDepth()
1495 token = tokenizer_->NextToken(); in ParsePipelineDepth()
1497 if (!token->IsIdentifier()) in ParsePipelineDepth()
1500 if (token->AsString() == "on") in ParsePipelineDepth()
1502 else if (token->AsString() == "off") in ParsePipelineDepth()
1505 return Result("invalid value for CLAMP: " + token->AsString()); in ParsePipelineDepth()
1506 } else if (token->AsString() == "WRITE") { in ParsePipelineDepth()
1507 token = tokenizer_->NextToken(); in ParsePipelineDepth()
1509 if (!token->IsIdentifier()) in ParsePipelineDepth()
1512 if (token->AsString() == "on") in ParsePipelineDepth()
1514 else if (token->AsString() == "off") in ParsePipelineDepth()
1517 return Result("invalid value for WRITE: " + token->AsString()); in ParsePipelineDepth()
1518 } else if (token->AsString() == "COMPARE_OP") { in ParsePipelineDepth()
1519 token = tokenizer_->NextToken(); in ParsePipelineDepth()
1521 if (!token->IsIdentifier()) in ParsePipelineDepth()
1524 CompareOp compare_op = StrToCompareOp(token->AsString()); in ParsePipelineDepth()
1528 return Result("invalid value for COMPARE_OP: " + token->AsString()); in ParsePipelineDepth()
1530 } else if (token->AsString() == "BOUNDS") { in ParsePipelineDepth()
1531 token = tokenizer_->NextToken(); in ParsePipelineDepth()
1532 if (!token->IsIdentifier() || token->AsString() != "min") in ParsePipelineDepth()
1535 token = tokenizer_->NextToken(); in ParsePipelineDepth()
1536 if (!token->IsDouble()) in ParsePipelineDepth()
1538 pipeline->GetPipelineData()->SetMinDepthBounds(token->AsFloat()); in ParsePipelineDepth()
1540 token = tokenizer_->NextToken(); in ParsePipelineDepth()
1541 if (!token->IsIdentifier() || token->AsString() != "max") in ParsePipelineDepth()
1544 token = tokenizer_->NextToken(); in ParsePipelineDepth()
1545 if (!token->IsDouble()) in ParsePipelineDepth()
1547 pipeline->GetPipelineData()->SetMaxDepthBounds(token->AsFloat()); in ParsePipelineDepth()
1548 } else if (token->AsString() == "BIAS") { in ParsePipelineDepth()
1551 token = tokenizer_->NextToken(); in ParsePipelineDepth()
1552 if (!token->IsIdentifier() || token->AsString() != "constant") in ParsePipelineDepth()
1555 token = tokenizer_->NextToken(); in ParsePipelineDepth()
1556 if (!token->IsDouble()) in ParsePipelineDepth()
1558 pipeline->GetPipelineData()->SetDepthBiasConstantFactor(token->AsFloat()); in ParsePipelineDepth()
1560 token = tokenizer_->NextToken(); in ParsePipelineDepth()
1561 if (!token->IsIdentifier() || token->AsString() != "clamp") in ParsePipelineDepth()
1564 token = tokenizer_->NextToken(); in ParsePipelineDepth()
1565 if (!token->IsDouble()) in ParsePipelineDepth()
1567 pipeline->GetPipelineData()->SetDepthBiasClamp(token->AsFloat()); in ParsePipelineDepth()
1569 token = tokenizer_->NextToken(); in ParsePipelineDepth()
1570 if (!token->IsIdentifier() || token->AsString() != "slope") in ParsePipelineDepth()
1573 token = tokenizer_->NextToken(); in ParsePipelineDepth()
1574 if (!token->IsDouble()) in ParsePipelineDepth()
1576 pipeline->GetPipelineData()->SetDepthBiasSlopeFactor(token->AsFloat()); in ParsePipelineDepth()
1578 return Result("invalid value for DEPTH: " + token->AsString()); in ParsePipelineDepth()
1586 auto token = tokenizer_->NextToken(); in ParsePipelineStencil() local
1587 if (!token->IsIdentifier()) in ParsePipelineStencil()
1593 if (token->AsString() == "front") { in ParsePipelineStencil()
1595 } else if (token->AsString() == "back") { in ParsePipelineStencil()
1597 } else if (token->AsString() == "front_and_back") { in ParsePipelineStencil()
1601 return Result("STENCIL invalid face: " + token->AsString()); in ParsePipelineStencil()
1605 token = tokenizer_->NextToken(); in ParsePipelineStencil()
1606 if (token->IsEOL()) in ParsePipelineStencil()
1608 if (token->IsEOS()) in ParsePipelineStencil()
1610 if (!token->IsIdentifier()) in ParsePipelineStencil()
1612 if (token->AsString() == "END") in ParsePipelineStencil()
1615 if (token->AsString() == "TEST") { in ParsePipelineStencil()
1616 token = tokenizer_->NextToken(); in ParsePipelineStencil()
1618 if (!token->IsIdentifier()) in ParsePipelineStencil()
1621 if (token->AsString() == "on") in ParsePipelineStencil()
1623 else if (token->AsString() == "off") in ParsePipelineStencil()
1626 return Result("STENCIL invalid value for TEST: " + token->AsString()); in ParsePipelineStencil()
1627 } else if (token->AsString() == "FAIL_OP") { in ParsePipelineStencil()
1628 token = tokenizer_->NextToken(); in ParsePipelineStencil()
1630 if (!token->IsIdentifier()) in ParsePipelineStencil()
1633 StencilOp stencil_op = StrToStencilOp(token->AsString()); in ParsePipelineStencil()
1636 token->AsString()); in ParsePipelineStencil()
1642 } else if (token->AsString() == "PASS_OP") { in ParsePipelineStencil()
1643 token = tokenizer_->NextToken(); in ParsePipelineStencil()
1645 if (!token->IsIdentifier()) in ParsePipelineStencil()
1648 StencilOp stencil_op = StrToStencilOp(token->AsString()); in ParsePipelineStencil()
1651 token->AsString()); in ParsePipelineStencil()
1657 } else if (token->AsString() == "DEPTH_FAIL_OP") { in ParsePipelineStencil()
1658 token = tokenizer_->NextToken(); in ParsePipelineStencil()
1660 if (!token->IsIdentifier()) in ParsePipelineStencil()
1663 StencilOp stencil_op = StrToStencilOp(token->AsString()); in ParsePipelineStencil()
1666 token->AsString()); in ParsePipelineStencil()
1672 } else if (token->AsString() == "COMPARE_OP") { in ParsePipelineStencil()
1673 token = tokenizer_->NextToken(); in ParsePipelineStencil()
1675 if (!token->IsIdentifier()) in ParsePipelineStencil()
1678 CompareOp compare_op = StrToCompareOp(token->AsString()); in ParsePipelineStencil()
1681 token->AsString()); in ParsePipelineStencil()
1687 } else if (token->AsString() == "COMPARE_MASK") { in ParsePipelineStencil()
1688 token = tokenizer_->NextToken(); in ParsePipelineStencil()
1690 if (!token->IsInteger()) in ParsePipelineStencil()
1694 pipeline->GetPipelineData()->SetFrontCompareMask(token->AsUint32()); in ParsePipelineStencil()
1696 pipeline->GetPipelineData()->SetBackCompareMask(token->AsUint32()); in ParsePipelineStencil()
1697 } else if (token->AsString() == "WRITE_MASK") { in ParsePipelineStencil()
1698 token = tokenizer_->NextToken(); in ParsePipelineStencil()
1700 if (!token->IsInteger()) in ParsePipelineStencil()
1704 pipeline->GetPipelineData()->SetFrontWriteMask(token->AsUint32()); in ParsePipelineStencil()
1706 pipeline->GetPipelineData()->SetBackWriteMask(token->AsUint32()); in ParsePipelineStencil()
1707 } else if (token->AsString() == "REFERENCE") { in ParsePipelineStencil()
1708 token = tokenizer_->NextToken(); in ParsePipelineStencil()
1710 if (!token->IsInteger()) in ParsePipelineStencil()
1714 pipeline->GetPipelineData()->SetFrontReference(token->AsUint32()); in ParsePipelineStencil()
1716 pipeline->GetPipelineData()->SetBackReference(token->AsUint32()); in ParsePipelineStencil()
1718 return Result("STENCIL invalid value for STENCIL: " + token->AsString()); in ParsePipelineStencil()
1726 auto token = tokenizer_->NextToken(); in ParseStruct() local
1727 if (!token->IsIdentifier()) in ParseStruct()
1730 auto struct_name = token->AsString(); in ParseStruct()
1741 token = tokenizer_->NextToken(); in ParseStruct()
1742 if (token->IsIdentifier()) { in ParseStruct()
1743 if (token->AsString() != "STRIDE") in ParseStruct()
1744 return Result("invalid token in STRUCT definition"); in ParseStruct()
1746 token = tokenizer_->NextToken(); in ParseStruct()
1747 if (token->IsEOL() || token->IsEOS()) in ParseStruct()
1749 if (!token->IsInteger()) in ParseStruct()
1752 type->SetStrideInBytes(token->AsUint32()); in ParseStruct()
1753 token = tokenizer_->NextToken(); in ParseStruct()
1755 if (!token->IsEOL()) { in ParseStruct()
1756 return Result("extra token " + token->ToOriginalString() + in ParseStruct()
1762 token = tokenizer_->NextToken(); in ParseStruct()
1763 if (!token->IsIdentifier()) in ParseStruct()
1765 if (token->AsString() == "END") in ParseStruct()
1768 if (token->AsString() == struct_name) in ParseStruct()
1771 type::Type* member_type = script_->GetType(token->AsString()); in ParseStruct()
1773 auto t = ToType(token->AsString()); in ParseStruct()
1775 return Result("unknown type '" + token->AsString() + in ParseStruct()
1783 token = tokenizer_->NextToken(); in ParseStruct()
1784 if (token->IsEOL()) in ParseStruct()
1786 if (!token->IsIdentifier()) in ParseStruct()
1789 auto member_name = token->AsString(); in ParseStruct()
1798 token = tokenizer_->NextToken(); in ParseStruct()
1799 while (token->IsIdentifier()) { in ParseStruct()
1800 if (token->AsString() == "OFFSET") { in ParseStruct()
1801 token = tokenizer_->NextToken(); in ParseStruct()
1802 if (token->IsEOL()) in ParseStruct()
1804 if (!token->IsInteger()) in ParseStruct()
1807 m->offset_in_bytes = token->AsInt32(); in ParseStruct()
1808 } else if (token->AsString() == "ARRAY_STRIDE") { in ParseStruct()
1809 token = tokenizer_->NextToken(); in ParseStruct()
1810 if (token->IsEOL()) in ParseStruct()
1812 if (!token->IsInteger()) in ParseStruct()
1817 m->array_stride_in_bytes = token->AsInt32(); in ParseStruct()
1818 } else if (token->AsString() == "MATRIX_STRIDE") { in ParseStruct()
1819 token = tokenizer_->NextToken(); in ParseStruct()
1820 if (token->IsEOL()) in ParseStruct()
1822 if (!token->IsInteger()) in ParseStruct()
1827 m->matrix_stride_in_bytes = token->AsInt32(); in ParseStruct()
1829 return Result("unknown param '" + token->AsString() + in ParseStruct()
1833 token = tokenizer_->NextToken(); in ParseStruct()
1836 if (!token->IsEOL()) in ParseStruct()
1844 auto token = tokenizer_->NextToken(); in ParseBuffer() local
1845 if (!token->IsIdentifier()) in ParseBuffer()
1848 auto name = token->AsString(); in ParseBuffer()
1852 token = tokenizer_->NextToken(); in ParseBuffer()
1853 if (!token->IsIdentifier()) in ParseBuffer()
1857 auto& cmd = token->AsString(); in ParseBuffer()
1865 token = tokenizer_->NextToken(); in ParseBuffer()
1866 if (!token->IsIdentifier()) in ParseBuffer()
1871 auto type = script_->ParseType(token->AsString()); in ParseBuffer()
1879 token = tokenizer_->PeekNextToken(); in ParseBuffer()
1880 while (token->IsIdentifier()) { in ParseBuffer()
1881 if (token->AsString() == "MIP_LEVELS") { in ParseBuffer()
1883 token = tokenizer_->NextToken(); in ParseBuffer()
1885 if (!token->IsInteger()) in ParseBuffer()
1888 buffer->SetMipLevels(token->AsUint32()); in ParseBuffer()
1889 } else if (token->AsString() == "FILE") { in ParseBuffer()
1895 } else if (token->AsString() == "SAMPLES") { in ParseBuffer()
1897 token = tokenizer_->NextToken(); in ParseBuffer()
1898 if (!token->IsInteger()) in ParseBuffer()
1901 const uint32_t samples = token->AsUint32(); in ParseBuffer()
1903 return Result("invalid sample count: " + token->ToOriginalString()); in ParseBuffer()
1909 token = tokenizer_->PeekNextToken(); in ParseBuffer()
1924 auto token = tokenizer_->NextToken(); in ParseImage() local
1925 if (!token->IsIdentifier()) in ParseImage()
1928 auto name = token->AsString(); in ParseImage()
1938 token = tokenizer_->PeekNextToken(); in ParseImage()
1939 while (token->IsIdentifier()) { in ParseImage()
1940 if (token->AsString() == "FILL" || token->AsString() == "SERIES_FROM" || in ParseImage()
1941 token->AsString() == "DATA") { in ParseImage()
1947 if (token->AsString() == "DATA_TYPE") { in ParseImage()
1948 token = tokenizer_->NextToken(); in ParseImage()
1949 if (!token->IsIdentifier()) in ParseImage()
1952 auto type = script_->ParseType(token->AsString()); in ParseImage()
1958 auto new_type = ToType(token->AsString()); in ParseImage()
1960 return Result("invalid data type '" + token->AsString() + in ParseImage()
1969 } else if (token->AsString() == "FORMAT") { in ParseImage()
1970 token = tokenizer_->NextToken(); in ParseImage()
1971 if (!token->IsIdentifier()) in ParseImage()
1974 auto type = script_->ParseType(token->AsString()); in ParseImage()
1981 } else if (token->AsString() == "MIP_LEVELS") { in ParseImage()
1982 token = tokenizer_->NextToken(); in ParseImage()
1984 if (!token->IsInteger()) in ParseImage()
1987 buffer->SetMipLevels(token->AsUint32()); in ParseImage()
1988 } else if (token->AsString() == "DIM_1D") { in ParseImage()
1990 } else if (token->AsString() == "DIM_2D") { in ParseImage()
1992 } else if (token->AsString() == "DIM_3D") { in ParseImage()
1994 } else if (token->AsString() == "WIDTH") { in ParseImage()
1995 token = tokenizer_->NextToken(); in ParseImage()
1996 if (!token->IsInteger() || token->AsUint32() == 0) in ParseImage()
1999 buffer->SetWidth(token->AsUint32()); in ParseImage()
2001 } else if (token->AsString() == "HEIGHT") { in ParseImage()
2002 token = tokenizer_->NextToken(); in ParseImage()
2003 if (!token->IsInteger() || token->AsUint32() == 0) in ParseImage()
2006 buffer->SetHeight(token->AsUint32()); in ParseImage()
2008 } else if (token->AsString() == "DEPTH") { in ParseImage()
2009 token = tokenizer_->NextToken(); in ParseImage()
2010 if (!token->IsInteger() || token->AsUint32() == 0) in ParseImage()
2013 buffer->SetDepth(token->AsUint32()); in ParseImage()
2015 } else if (token->AsString() == "SAMPLES") { in ParseImage()
2016 token = tokenizer_->NextToken(); in ParseImage()
2017 if (!token->IsInteger()) in ParseImage()
2020 const uint32_t samples = token->AsUint32(); in ParseImage()
2022 return Result("invalid sample count: " + token->ToOriginalString()); in ParseImage()
2027 token->ToOriginalString()); in ParseImage()
2029 token = tokenizer_->PeekNextToken(); in ParseImage()
2048 token = tokenizer_->NextToken(); in ParseImage()
2049 if (token->IsIdentifier()) { in ParseImage()
2050 if (token->AsString() == "DATA") { in ParseImage()
2061 } else if (token->AsString() == "FILL") { in ParseImage()
2065 } else if (token->AsString() == "SERIES_FROM") { in ParseImage()
2070 return Result("unexpected IMAGE token: " + token->AsString()); in ParseImage()
2072 } else if (!token->IsEOL() && !token->IsEOS()) { in ParseImage()
2073 return Result("unexpected IMAGE token: " + token->ToOriginalString()); in ParseImage()
2084 auto token = tokenizer_->NextToken(); in ParseBufferInitializer() local
2085 if (!token->IsIdentifier()) in ParseBufferInitializer()
2088 auto type = script_->ParseType(token->AsString()); in ParseBufferInitializer()
2094 auto new_type = ToType(token->AsString()); in ParseBufferInitializer()
2096 return Result("invalid data type '" + token->AsString() + "' provided"); in ParseBufferInitializer()
2105 token = tokenizer_->NextToken(); in ParseBufferInitializer()
2106 if (!token->IsIdentifier()) in ParseBufferInitializer()
2109 if (token->AsString() == "STD140") { in ParseBufferInitializer()
2111 token = tokenizer_->NextToken(); in ParseBufferInitializer()
2112 } else if (token->AsString() == "STD430") { in ParseBufferInitializer()
2114 token = tokenizer_->NextToken(); in ParseBufferInitializer()
2117 if (!token->IsIdentifier()) in ParseBufferInitializer()
2120 if (token->AsString() == "SIZE") in ParseBufferInitializer()
2122 if (token->AsString() == "WIDTH") { in ParseBufferInitializer()
2123 token = tokenizer_->NextToken(); in ParseBufferInitializer()
2124 if (!token->IsInteger()) in ParseBufferInitializer()
2126 const uint32_t width = token->AsUint32(); in ParseBufferInitializer()
2132 token = tokenizer_->NextToken(); in ParseBufferInitializer()
2133 if (token->AsString() != "HEIGHT") in ParseBufferInitializer()
2135 token = tokenizer_->NextToken(); in ParseBufferInitializer()
2136 if (!token->IsInteger()) in ParseBufferInitializer()
2138 const uint32_t height = token->AsUint32(); in ParseBufferInitializer()
2143 token = tokenizer_->NextToken(); in ParseBufferInitializer()
2146 if (token->AsString() == "FILL") in ParseBufferInitializer()
2148 if (token->AsString() == "SERIES_FROM") in ParseBufferInitializer()
2152 if (token->AsString() == "DATA") in ParseBufferInitializer()
2159 auto token = tokenizer_->NextToken(); in ParseBufferInitializerSize() local
2160 if (token->IsEOS() || token->IsEOL()) in ParseBufferInitializerSize()
2162 if (!token->IsInteger()) in ParseBufferInitializerSize()
2165 uint32_t size_in_items = token->AsUint32(); in ParseBufferInitializerSize()
2168 token = tokenizer_->NextToken(); in ParseBufferInitializerSize()
2169 if (!token->IsIdentifier()) in ParseBufferInitializerSize()
2172 if (token->AsString() == "FILL") in ParseBufferInitializerSize()
2174 if (token->AsString() == "SERIES_FROM") in ParseBufferInitializerSize()
2176 if (token->AsString() == "FILE") in ParseBufferInitializerSize()
2184 auto token = tokenizer_->NextToken(); in ParseBufferInitializerFill() local
2185 if (token->IsEOS() || token->IsEOL()) in ParseBufferInitializerFill()
2187 if (!token->IsInteger() && !token->IsDouble()) in ParseBufferInitializerFill()
2200 values[i].SetDoubleValue(token->AsDouble()); in ParseBufferInitializerFill()
2202 values[i].SetIntValue(token->AsUint64()); in ParseBufferInitializerFill()
2213 auto token = tokenizer_->NextToken(); in ParseBufferInitializerSeries() local
2214 if (token->IsEOS() || token->IsEOL()) in ParseBufferInitializerSeries()
2216 if (!token->IsInteger() && !token->IsDouble()) in ParseBufferInitializerSeries()
2230 counter.SetDoubleValue(token->AsDouble()); in ParseBufferInitializerSeries()
2232 counter.SetIntValue(token->AsUint64()); in ParseBufferInitializerSeries()
2235 token = tokenizer_->NextToken(); in ParseBufferInitializerSeries()
2236 if (!token->IsIdentifier()) in ParseBufferInitializerSeries()
2238 if (token->AsString() != "INC_BY") in ParseBufferInitializerSeries()
2241 token = tokenizer_->NextToken(); in ParseBufferInitializerSeries()
2242 if (token->IsEOS() || token->IsEOL()) in ParseBufferInitializerSeries()
2244 if (!token->IsInteger() && !token->IsDouble()) in ParseBufferInitializerSeries()
2254 counter.SetDoubleValue(value + token->AsDouble()); in ParseBufferInitializerSeries()
2258 counter.SetIntValue(value + token->AsUint64()); in ParseBufferInitializerSeries()
2278 auto token = tokenizer_->NextToken(); in ParseBufferInitializerFile() local
2280 if (!token->IsIdentifier()) in ParseBufferInitializerFile()
2285 if (token->AsString() == "TEXT") { in ParseBufferInitializerFile()
2287 token = tokenizer_->NextToken(); in ParseBufferInitializerFile()
2288 } else if (token->AsString() == "BINARY") { in ParseBufferInitializerFile()
2290 token = tokenizer_->NextToken(); in ParseBufferInitializerFile()
2291 } else if (token->AsString() == "PNG") { in ParseBufferInitializerFile()
2292 token = tokenizer_->NextToken(); in ParseBufferInitializerFile()
2295 if (!token->IsIdentifier()) in ParseBufferInitializerFile()
2302 Result r = delegate_->LoadBufferData(token->AsString(), file_type, &info); in ParseBufferInitializerFile()
2332 auto token = tokenizer_->NextToken(); in ParseRun() local
2333 if (!token->IsIdentifier()) in ParseRun()
2338 auto* pipeline = script_->GetPipeline(token->AsString()); in ParseRun()
2340 return Result("unknown pipeline for RUN command: " + token->AsString()); in ParseRun()
2342 token = tokenizer_->NextToken(); in ParseRun()
2343 if (token->IsEOL() || token->IsEOS()) in ParseRun()
2346 if (token->IsInteger()) { in ParseRun()
2352 cmd->SetX(token->AsUint32()); in ParseRun()
2354 token = tokenizer_->NextToken(); in ParseRun()
2355 if (!token->IsInteger()) { in ParseRun()
2357 token->ToOriginalString()); in ParseRun()
2359 cmd->SetY(token->AsUint32()); in ParseRun()
2361 token = tokenizer_->NextToken(); in ParseRun()
2362 if (!token->IsInteger()) { in ParseRun()
2364 token->ToOriginalString()); in ParseRun()
2366 cmd->SetZ(token->AsUint32()); in ParseRun()
2372 if (!token->IsIdentifier()) in ParseRun()
2373 return Result("invalid token in RUN command: " + token->ToOriginalString()); in ParseRun()
2375 if (token->AsString() == "DRAW_RECT") { in ParseRun()
2385 token = tokenizer_->NextToken(); in ParseRun()
2386 if (token->IsEOS() || token->IsEOL()) in ParseRun()
2389 if (!token->IsIdentifier() || token->AsString() != "POS") { in ParseRun()
2390 return Result("invalid token in RUN command: " + in ParseRun()
2391 token->ToOriginalString() + "; expected POS"); in ParseRun()
2394 token = tokenizer_->NextToken(); in ParseRun()
2395 if (!token->IsInteger()) in ParseRun()
2403 Result r = token->ConvertToDouble(); in ParseRun()
2406 cmd->SetX(token->AsFloat()); in ParseRun()
2408 token = tokenizer_->NextToken(); in ParseRun()
2409 if (!token->IsInteger()) in ParseRun()
2412 r = token->ConvertToDouble(); in ParseRun()
2415 cmd->SetY(token->AsFloat()); in ParseRun()
2417 token = tokenizer_->NextToken(); in ParseRun()
2418 if (!token->IsIdentifier() || token->AsString() != "SIZE") { in ParseRun()
2419 return Result("invalid token in RUN command: " + in ParseRun()
2420 token->ToOriginalString() + "; expected SIZE"); in ParseRun()
2423 token = tokenizer_->NextToken(); in ParseRun()
2424 if (!token->IsInteger()) in ParseRun()
2427 r = token->ConvertToDouble(); in ParseRun()
2430 cmd->SetWidth(token->AsFloat()); in ParseRun()
2432 token = tokenizer_->NextToken(); in ParseRun()
2433 if (!token->IsInteger()) in ParseRun()
2436 r = token->ConvertToDouble(); in ParseRun()
2439 cmd->SetHeight(token->AsFloat()); in ParseRun()
2445 if (token->AsString() == "DRAW_GRID") { in ParseRun()
2455 token = tokenizer_->NextToken(); in ParseRun()
2456 if (token->IsEOS() || token->IsEOL()) in ParseRun()
2459 if (!token->IsIdentifier() || token->AsString() != "POS") { in ParseRun()
2460 return Result("invalid token in RUN command: " + in ParseRun()
2461 token->ToOriginalString() + "; expected POS"); in ParseRun()
2464 token = tokenizer_->NextToken(); in ParseRun()
2465 if (!token->IsInteger()) in ParseRun()
2472 Result r = token->ConvertToDouble(); in ParseRun()
2475 cmd->SetX(token->AsFloat()); in ParseRun()
2477 token = tokenizer_->NextToken(); in ParseRun()
2478 if (!token->IsInteger()) in ParseRun()
2481 r = token->ConvertToDouble(); in ParseRun()
2484 cmd->SetY(token->AsFloat()); in ParseRun()
2486 token = tokenizer_->NextToken(); in ParseRun()
2487 if (!token->IsIdentifier() || token->AsString() != "SIZE") { in ParseRun()
2488 return Result("invalid token in RUN command: " + in ParseRun()
2489 token->ToOriginalString() + "; expected SIZE"); in ParseRun()
2492 token = tokenizer_->NextToken(); in ParseRun()
2493 if (!token->IsInteger()) in ParseRun()
2496 r = token->ConvertToDouble(); in ParseRun()
2499 cmd->SetWidth(token->AsFloat()); in ParseRun()
2501 token = tokenizer_->NextToken(); in ParseRun()
2502 if (!token->IsInteger()) in ParseRun()
2505 r = token->ConvertToDouble(); in ParseRun()
2508 cmd->SetHeight(token->AsFloat()); in ParseRun()
2510 token = tokenizer_->NextToken(); in ParseRun()
2511 if (!token->IsIdentifier() || token->AsString() != "CELLS") { in ParseRun()
2512 return Result("invalid token in RUN command: " + in ParseRun()
2513 token->ToOriginalString() + "; expected CELLS"); in ParseRun()
2516 token = tokenizer_->NextToken(); in ParseRun()
2517 if (!token->IsInteger()) in ParseRun()
2520 cmd->SetColumns(token->AsUint32()); in ParseRun()
2522 token = tokenizer_->NextToken(); in ParseRun()
2523 if (!token->IsInteger()) in ParseRun()
2526 cmd->SetRows(token->AsUint32()); in ParseRun()
2532 if (token->AsString() == "DRAW_ARRAY") { in ParseRun()
2539 token = tokenizer_->NextToken(); in ParseRun()
2540 if (!token->IsIdentifier() || token->AsString() != "AS") in ParseRun()
2543 token = tokenizer_->NextToken(); in ParseRun()
2544 if (!token->IsIdentifier()) { in ParseRun()
2546 token->ToOriginalString()); in ParseRun()
2549 Topology topo = NameToTopology(token->AsString()); in ParseRun()
2551 return Result("invalid topology for RUN command: " + token->AsString()); in ParseRun()
2559 token = tokenizer_->PeekNextToken(); in ParseRun()
2561 while (!token->IsEOS() && !token->IsEOL()) { in ParseRun()
2562 token = tokenizer_->NextToken(); in ParseRun()
2564 if (!token->IsIdentifier()) in ParseRun()
2567 if (token->AsString() == "INDEXED") { in ParseRun()
2574 } else if (token->AsString() == "START_IDX") { in ParseRun()
2575 token = tokenizer_->NextToken(); in ParseRun()
2576 if (!token->IsInteger()) { in ParseRun()
2578 token->ToOriginalString()); in ParseRun()
2580 if (token->AsInt32() < 0) in ParseRun()
2582 start_idx = token->AsUint32(); in ParseRun()
2583 } else if (token->AsString() == "COUNT") { in ParseRun()
2584 token = tokenizer_->NextToken(); in ParseRun()
2585 if (!token->IsInteger()) { in ParseRun()
2587 token->ToOriginalString()); in ParseRun()
2589 if (token->AsInt32() <= 0) in ParseRun()
2592 count = token->AsUint32(); in ParseRun()
2593 } else if (token->AsString() == "INSTANCE_COUNT") { in ParseRun()
2594 token = tokenizer_->NextToken(); in ParseRun()
2595 if (!token->IsInteger()) { in ParseRun()
2597 token->ToOriginalString()); in ParseRun()
2599 if (token->AsInt32() <= 0) in ParseRun()
2602 instance_count = token->AsUint32(); in ParseRun()
2603 } else if (token->AsString() == "START_INSTANCE") { in ParseRun()
2604 token = tokenizer_->NextToken(); in ParseRun()
2605 if (!token->IsInteger()) { in ParseRun()
2607 token->ToOriginalString()); in ParseRun()
2609 if (token->AsInt32() < 0) in ParseRun()
2611 start_instance = token->AsUint32(); in ParseRun()
2614 token->ToOriginalString()); in ParseRun()
2617 token = tokenizer_->PeekNextToken(); in ParseRun()
2652 return Result("invalid token in RUN command: " + token->AsString()); in ParseRun()
2672 for (auto token = tokenizer_->NextToken();; token = tokenizer_->NextToken()) { in ParseDebug() local
2673 if (token->IsEOL()) in ParseDebug()
2675 if (token->IsEOS()) in ParseDebug()
2677 if (token->IsIdentifier() && token->AsString() == "END") in ParseDebug()
2680 if (token->AsString() == "THREAD") { in ParseDebug()
2686 return Result("invalid token in DEBUG command: " + token->AsString()); in ParseDebug()
2696 auto token = tokenizer_->NextToken(); in ParseDebugThread() local
2697 if (token->AsString() == "GLOBAL_INVOCATION_ID") { in ParseDebugThread()
2704 token = tokenizer_->NextToken(); in ParseDebugThread()
2705 if (!token->IsInteger()) in ParseDebugThread()
2707 invocation[i] = token->AsUint32(); in ParseDebugThread()
2718 } else if (token->AsString() == "VERTEX_INDEX") { in ParseDebugThread()
2725 token = tokenizer_->NextToken(); in ParseDebugThread()
2726 if (!token->IsInteger()) in ParseDebugThread()
2728 auto vertex_index = token->AsUint32(); in ParseDebugThread()
2737 } else if (token->AsString() == "FRAGMENT_WINDOW_SPACE_POSITION") { in ParseDebugThread()
2744 token = tokenizer_->NextToken(); in ParseDebugThread()
2745 if (!token->IsInteger()) in ParseDebugThread()
2747 auto x = token->AsUint32(); in ParseDebugThread()
2749 token = tokenizer_->NextToken(); in ParseDebugThread()
2750 if (!token->IsInteger()) in ParseDebugThread()
2752 auto y = token->AsUint32(); in ParseDebugThread()
2769 for (auto token = tokenizer_->NextToken();; token = tokenizer_->NextToken()) { in ParseDebugThreadBody() local
2770 if (token->IsEOL()) { in ParseDebugThreadBody()
2773 if (token->IsEOS()) { in ParseDebugThreadBody()
2776 if (token->IsIdentifier() && token->AsString() == "END") { in ParseDebugThreadBody()
2780 if (token->AsString() == "EXPECT") { in ParseDebugThreadBody()
2781 token = tokenizer_->NextToken(); in ParseDebugThreadBody()
2782 if (token->AsString() == "LOCATION") { in ParseDebugThreadBody()
2784 token = tokenizer_->NextToken(); in ParseDebugThreadBody()
2785 if (!token->IsString()) { in ParseDebugThreadBody()
2788 location.file = token->AsString(); in ParseDebugThreadBody()
2790 token = tokenizer_->NextToken(); in ParseDebugThreadBody()
2791 if (!token->IsInteger()) { in ParseDebugThreadBody()
2794 location.line = token->AsUint32(); in ParseDebugThreadBody()
2797 token = tokenizer_->NextToken(); in ParseDebugThreadBody()
2798 if (token->IsString()) { in ParseDebugThreadBody()
2799 line_source = token->AsString(); in ParseDebugThreadBody()
2803 } else if (token->AsString() == "LOCAL") { in ParseDebugThreadBody()
2823 } else if (token->AsString() == "CALLSTACK") { in ParseDebugThreadBody()
2857 } else if (token->AsString() == "STEP_IN") { in ParseDebugThreadBody()
2859 } else if (token->AsString() == "STEP_OUT") { in ParseDebugThreadBody()
2861 } else if (token->AsString() == "STEP_OVER") { in ParseDebugThreadBody()
2863 } else if (token->AsString() == "CONTINUE") { in ParseDebugThreadBody()
2866 return Result("invalid token in THREAD block: " + token->AsString()); in ParseDebugThreadBody()
2873 auto token = tokenizer_->NextToken(); in ParseClear() local
2874 if (!token->IsIdentifier()) in ParseClear()
2879 auto* pipeline = script_->GetPipeline(token->AsString()); in ParseClear()
2881 return Result("unknown pipeline for CLEAR command: " + token->AsString()); in ParseClear()
2897 auto token = tokenizer_->NextToken(); in ParseValues() local
2900 while (!token->IsEOL() && !token->IsEOS()) { in ParseValues()
2910 if (!token->IsInteger() && !token->IsDouble() && !token->IsHex()) { in ParseValues()
2912 " command: " + token->ToOriginalString()); in ParseValues()
2915 Result r = token->ConvertToDouble(); in ParseValues()
2919 v.SetDoubleValue(token->AsDouble()); in ParseValues()
2921 if (!token->IsInteger() && !token->IsHex()) { in ParseValues()
2923 " command: " + token->ToOriginalString()); in ParseValues()
2926 uint64_t val = token->IsHex() ? token->AsHex() : token->AsUint64(); in ParseValues()
2934 token = tokenizer_->NextToken(); in ParseValues()
2940 auto token = tokenizer_->NextToken(); in ParseExpect() local
2941 if (!token->IsIdentifier()) in ParseExpect()
2944 if (token->AsString() == "IDX") in ParseExpect()
2946 if (token->AsString() == "EQ_BUFFER") in ParseExpect()
2948 if (token->AsString() == "RMSE_BUFFER") in ParseExpect()
2950 if (token->AsString() == "EQ_HISTOGRAM_EMD_BUFFER") { in ParseExpect()
2956 auto* buffer = script_->GetBuffer(token->AsString()); in ParseExpect()
2959 token->AsString()); in ParseExpect()
2961 token = tokenizer_->NextToken(); in ParseExpect()
2963 if (!token->IsIdentifier()) in ParseExpect()
2966 if (token->AsString() == "EQ_BUFFER" || token->AsString() == "RMSE_BUFFER" || in ParseExpect()
2967 token->AsString() == "EQ_HISTOGRAM_EMD_BUFFER") { in ParseExpect()
2968 auto type = token->AsString(); in ParseExpect()
2970 token = tokenizer_->NextToken(); in ParseExpect()
2971 if (!token->IsIdentifier()) in ParseExpect()
2974 auto* buffer_2 = script_->GetBuffer(token->AsString()); in ParseExpect()
2977 " command: " + token->AsString()); in ParseExpect()
3003 token = tokenizer_->NextToken(); in ParseExpect()
3004 if (!token->IsIdentifier() && token->AsString() == "TOLERANCE") in ParseExpect()
3007 token = tokenizer_->NextToken(); in ParseExpect()
3008 if (!token->IsInteger() && !token->IsDouble()) in ParseExpect()
3011 Result r = token->ConvertToDouble(); in ParseExpect()
3015 cmd->SetTolerance(token->AsFloat()); in ParseExpect()
3019 token = tokenizer_->NextToken(); in ParseExpect()
3020 if (!token->IsIdentifier() && token->AsString() == "TOLERANCE") in ParseExpect()
3023 token = tokenizer_->NextToken(); in ParseExpect()
3024 if (!token->IsInteger() && !token->IsDouble()) in ParseExpect()
3027 Result r = token->ConvertToDouble(); in ParseExpect()
3031 cmd->SetTolerance(token->AsFloat()); in ParseExpect()
3040 if (token->AsString() != "IDX") in ParseExpect()
3043 token = tokenizer_->NextToken(); in ParseExpect()
3044 if (!token->IsInteger() || token->AsInt32() < 0) in ParseExpect()
3046 token->ConvertToDouble(); in ParseExpect()
3047 float x = token->AsFloat(); in ParseExpect()
3051 token = tokenizer_->NextToken(); in ParseExpect()
3052 if (token->IsInteger()) { in ParseExpect()
3055 if (token->AsInt32() < 0) in ParseExpect()
3057 token->ConvertToDouble(); in ParseExpect()
3058 y = token->AsFloat(); in ParseExpect()
3060 token = tokenizer_->NextToken(); in ParseExpect()
3063 if (token->IsIdentifier() && token->AsString() == "SIZE") { in ParseExpect()
3073 token = tokenizer_->NextToken(); in ParseExpect()
3074 if (!token->IsInteger() || token->AsInt32() <= 0) in ParseExpect()
3076 token->ConvertToDouble(); in ParseExpect()
3077 probe->SetWidth(token->AsFloat()); in ParseExpect()
3079 token = tokenizer_->NextToken(); in ParseExpect()
3080 if (!token->IsInteger() || token->AsInt32() <= 0) in ParseExpect()
3082 token->ConvertToDouble(); in ParseExpect()
3083 probe->SetHeight(token->AsFloat()); in ParseExpect()
3085 token = tokenizer_->NextToken(); in ParseExpect()
3086 if (!token->IsIdentifier()) { in ParseExpect()
3087 return Result("invalid token in EXPECT command:" + in ParseExpect()
3088 token->ToOriginalString()); in ParseExpect()
3091 if (token->AsString() == "EQ_RGBA") { in ParseExpect()
3093 } else if (token->AsString() != "EQ_RGB") { in ParseExpect()
3095 token->ToOriginalString()); in ParseExpect()
3098 token = tokenizer_->NextToken(); in ParseExpect()
3099 if (!token->IsInteger() || token->AsInt32() < 0 || token->AsInt32() > 255) in ParseExpect()
3101 token->ConvertToDouble(); in ParseExpect()
3102 probe->SetR(token->AsFloat() / 255.f); in ParseExpect()
3104 token = tokenizer_->NextToken(); in ParseExpect()
3105 if (!token->IsInteger() || token->AsInt32() < 0 || token->AsInt32() > 255) in ParseExpect()
3107 token->ConvertToDouble(); in ParseExpect()
3108 probe->SetG(token->AsFloat() / 255.f); in ParseExpect()
3110 token = tokenizer_->NextToken(); in ParseExpect()
3111 if (!token->IsInteger() || token->AsInt32() < 0 || token->AsInt32() > 255) in ParseExpect()
3113 token->ConvertToDouble(); in ParseExpect()
3114 probe->SetB(token->AsFloat() / 255.f); in ParseExpect()
3117 token = tokenizer_->NextToken(); in ParseExpect()
3118 if (!token->IsInteger() || token->AsInt32() < 0 || token->AsInt32() > 255) in ParseExpect()
3120 token->ConvertToDouble(); in ParseExpect()
3121 probe->SetA(token->AsFloat() / 255.f); in ParseExpect()
3124 token = tokenizer_->NextToken(); in ParseExpect()
3125 if (token->IsIdentifier() && token->AsString() == "TOLERANCE") { in ParseExpect()
3147 token = tokenizer_->NextToken(); in ParseExpect()
3150 if (!token->IsEOL() && !token->IsEOS()) { in ParseExpect()
3152 token->ToOriginalString()); in ParseExpect()
3163 if (token->IsIdentifier() && token->AsString() == "TOLERANCE") { in ParseExpect()
3177 token = tokenizer_->NextToken(); in ParseExpect()
3180 if (!token->IsIdentifier() || !IsComparator(token->AsString())) { in ParseExpect()
3181 return Result("unexpected token in EXPECT command: " + in ParseExpect()
3182 token->ToOriginalString()); in ParseExpect()
3188 auto cmp = ToComparator(token->AsString()); in ParseExpect()
3215 auto token = tokenizer_->NextToken(); in ParseCopy() local
3216 if (token->IsEOL() || token->IsEOS()) in ParseCopy()
3218 if (!token->IsIdentifier()) in ParseCopy()
3223 auto name = token->AsString(); in ParseCopy()
3231 token = tokenizer_->NextToken(); in ParseCopy()
3232 if (token->IsEOL() || token->IsEOS()) in ParseCopy()
3234 if (!token->IsIdentifier()) in ParseCopy()
3237 name = token->AsString(); in ParseCopy()
3241 token = tokenizer_->NextToken(); in ParseCopy()
3242 if (token->IsEOL() || token->IsEOS()) in ParseCopy()
3244 if (!token->IsIdentifier()) in ParseCopy()
3247 name = token->AsString(); in ParseCopy()
3268 auto token = tokenizer_->NextToken(); in ParseClearColor() local
3269 if (!token->IsIdentifier()) in ParseClearColor()
3274 auto* pipeline = script_->GetPipeline(token->AsString()); in ParseClearColor()
3277 token->AsString()); in ParseClearColor()
3286 token = tokenizer_->NextToken(); in ParseClearColor()
3287 if (token->IsEOL() || token->IsEOS()) in ParseClearColor()
3289 if (!token->IsInteger() || token->AsInt32() < 0 || token->AsInt32() > 255) { in ParseClearColor()
3291 token->ToOriginalString()); in ParseClearColor()
3293 token->ConvertToDouble(); in ParseClearColor()
3294 cmd->SetR(token->AsFloat() / 255.f); in ParseClearColor()
3296 token = tokenizer_->NextToken(); in ParseClearColor()
3297 if (token->IsEOL() || token->IsEOS()) in ParseClearColor()
3299 if (!token->IsInteger() || token->AsInt32() < 0 || token->AsInt32() > 255) { in ParseClearColor()
3301 token->ToOriginalString()); in ParseClearColor()
3303 token->ConvertToDouble(); in ParseClearColor()
3304 cmd->SetG(token->AsFloat() / 255.f); in ParseClearColor()
3306 token = tokenizer_->NextToken(); in ParseClearColor()
3307 if (token->IsEOL() || token->IsEOS()) in ParseClearColor()
3309 if (!token->IsInteger() || token->AsInt32() < 0 || token->AsInt32() > 255) { in ParseClearColor()
3311 token->ToOriginalString()); in ParseClearColor()
3313 token->ConvertToDouble(); in ParseClearColor()
3314 cmd->SetB(token->AsFloat() / 255.f); in ParseClearColor()
3316 token = tokenizer_->NextToken(); in ParseClearColor()
3317 if (token->IsEOL() || token->IsEOS()) in ParseClearColor()
3319 if (!token->IsInteger() || token->AsInt32() < 0 || token->AsInt32() > 255) { in ParseClearColor()
3321 token->ToOriginalString()); in ParseClearColor()
3323 token->ConvertToDouble(); in ParseClearColor()
3324 cmd->SetA(token->AsFloat() / 255.f); in ParseClearColor()
3331 auto token = tokenizer_->NextToken(); in ParseClearDepth() local
3332 if (!token->IsIdentifier()) in ParseClearDepth()
3337 auto* pipeline = script_->GetPipeline(token->AsString()); in ParseClearDepth()
3340 token->AsString()); in ParseClearDepth()
3349 token = tokenizer_->NextToken(); in ParseClearDepth()
3350 if (token->IsEOL() || token->IsEOS()) in ParseClearDepth()
3352 if (!token->IsDouble()) { in ParseClearDepth()
3354 token->ToOriginalString()); in ParseClearDepth()
3356 cmd->SetValue(token->AsFloat()); in ParseClearDepth()
3363 auto token = tokenizer_->NextToken(); in ParseClearStencil() local
3364 if (!token->IsIdentifier()) in ParseClearStencil()
3369 auto* pipeline = script_->GetPipeline(token->AsString()); in ParseClearStencil()
3372 token->AsString()); in ParseClearStencil()
3381 token = tokenizer_->NextToken(); in ParseClearStencil()
3382 if (token->IsEOL() || token->IsEOS()) in ParseClearStencil()
3384 if (!token->IsInteger() || token->AsInt32() < 0 || token->AsInt32() > 255) { in ParseClearStencil()
3386 token->ToOriginalString()); in ParseClearStencil()
3388 cmd->SetValue(token->AsUint32()); in ParseClearStencil()
3395 auto token = tokenizer_->NextToken(); in ParseDeviceFeature() local
3396 if (token->IsEOS() || token->IsEOL()) in ParseDeviceFeature()
3398 if (!token->IsIdentifier()) in ParseDeviceFeature()
3400 if (!script_->IsKnownFeature(token->AsString())) in ParseDeviceFeature()
3403 script_->AddRequiredFeature(token->AsString()); in ParseDeviceFeature()
3409 auto token = tokenizer_->NextToken(); in ParseRepeat() local
3410 if (token->IsEOL() || token->IsEOL()) in ParseRepeat()
3412 if (!token->IsInteger()) { in ParseRepeat()
3414 token->ToOriginalString()); in ParseRepeat()
3416 if (token->AsInt32() <= 0) in ParseRepeat()
3419 uint32_t count = token->AsUint32(); in ParseRepeat()
3424 for (token = tokenizer_->NextToken(); !token->IsEOS(); in ParseRepeat()
3425 token = tokenizer_->NextToken()) { in ParseRepeat()
3426 if (token->IsEOL()) in ParseRepeat()
3428 if (!token->IsIdentifier()) in ParseRepeat()
3431 std::string tok = token->AsString(); in ParseRepeat()
3435 return Result("unknown token: " + tok); in ParseRepeat()
3441 if (!token->IsIdentifier() || token->AsString() != "END") in ParseRepeat()
3454 auto token = tokenizer_->NextToken(); in ParseDerivePipelineBlock() local
3455 if (!token->IsIdentifier() || token->AsString() == "FROM") in ParseDerivePipelineBlock()
3458 std::string name = token->AsString(); in ParseDerivePipelineBlock()
3462 token = tokenizer_->NextToken(); in ParseDerivePipelineBlock()
3463 if (!token->IsIdentifier() || token->AsString() != "FROM") in ParseDerivePipelineBlock()
3466 token = tokenizer_->NextToken(); in ParseDerivePipelineBlock()
3467 if (!token->IsIdentifier()) in ParseDerivePipelineBlock()
3470 Pipeline* parent = script_->GetPipeline(token->AsString()); in ParseDerivePipelineBlock()
3485 auto token = tokenizer_->NextToken(); in ParseDeviceExtension() local
3486 if (token->IsEOL() || token->IsEOS()) in ParseDeviceExtension()
3488 if (!token->IsIdentifier()) { in ParseDeviceExtension()
3490 token->ToOriginalString()); in ParseDeviceExtension()
3493 script_->AddRequiredDeviceExtension(token->AsString()); in ParseDeviceExtension()
3499 auto token = tokenizer_->NextToken(); in ParseInstanceExtension() local
3500 if (token->IsEOL() || token->IsEOS()) in ParseInstanceExtension()
3502 if (!token->IsIdentifier()) { in ParseInstanceExtension()
3504 token->ToOriginalString()); in ParseInstanceExtension()
3507 script_->AddRequiredInstanceExtension(token->AsString()); in ParseInstanceExtension()
3513 auto token = tokenizer_->NextToken(); in ParseSet() local
3514 if (!token->IsIdentifier() || token->AsString() != "ENGINE_DATA") in ParseSet()
3517 token = tokenizer_->NextToken(); in ParseSet()
3518 if (token->IsEOS() || token->IsEOL()) in ParseSet()
3521 if (!token->IsIdentifier()) in ParseSet()
3522 return Result("SET invalid variable to set: " + token->ToOriginalString()); in ParseSet()
3524 if (token->AsString() != "fence_timeout_ms") in ParseSet()
3525 return Result("SET unknown variable provided: " + token->AsString()); in ParseSet()
3527 token = tokenizer_->NextToken(); in ParseSet()
3528 if (token->IsEOS() || token->IsEOL()) in ParseSet()
3530 if (!token->IsInteger()) in ParseSet()
3533 script_->GetEngineData().fence_timeout_ms = token->AsUint32(); in ParseSet()
3539 auto token = tokenizer_->NextToken(); in ParseSampler() local
3540 if (!token->IsIdentifier()) in ParseSampler()
3541 return Result("invalid token when looking for sampler name"); in ParseSampler()
3544 sampler->SetName(token->AsString()); in ParseSampler()
3546 token = tokenizer_->NextToken(); in ParseSampler()
3547 while (!token->IsEOS() && !token->IsEOL()) { in ParseSampler()
3548 if (!token->IsIdentifier()) in ParseSampler()
3549 return Result("invalid token when looking for sampler parameters"); in ParseSampler()
3551 auto param = token->AsString(); in ParseSampler()
3553 token = tokenizer_->NextToken(); in ParseSampler()
3555 if (!token->IsIdentifier()) in ParseSampler()
3556 return Result("invalid token when looking for MAG_FILTER value"); in ParseSampler()
3558 auto filter = token->AsString(); in ParseSampler()
3567 token = tokenizer_->NextToken(); in ParseSampler()
3569 if (!token->IsIdentifier()) in ParseSampler()
3570 return Result("invalid token when looking for MIN_FILTER value"); in ParseSampler()
3572 auto filter = token->AsString(); in ParseSampler()
3581 token = tokenizer_->NextToken(); in ParseSampler()
3583 if (!token->IsIdentifier()) in ParseSampler()
3584 return Result("invalid token when looking for ADDRESS_MODE_U value"); in ParseSampler()
3586 auto mode_str = token->AsString(); in ParseSampler()
3594 token = tokenizer_->NextToken(); in ParseSampler()
3596 if (!token->IsIdentifier()) in ParseSampler()
3597 return Result("invalid token when looking for ADDRESS_MODE_V value"); in ParseSampler()
3599 auto mode_str = token->AsString(); in ParseSampler()
3607 token = tokenizer_->NextToken(); in ParseSampler()
3609 if (!token->IsIdentifier()) in ParseSampler()
3610 return Result("invalid token when looking for ADDRESS_MODE_W value"); in ParseSampler()
3612 auto mode_str = token->AsString(); in ParseSampler()
3620 token = tokenizer_->NextToken(); in ParseSampler()
3622 if (!token->IsIdentifier()) in ParseSampler()
3623 return Result("invalid token when looking for BORDER_COLOR value"); in ParseSampler()
3625 auto color_str = token->AsString(); in ParseSampler()
3642 token = tokenizer_->NextToken(); in ParseSampler()
3644 if (!token->IsDouble()) in ParseSampler()
3645 return Result("invalid token when looking for MIN_LOD value"); in ParseSampler()
3647 sampler->SetMinLOD(token->AsFloat()); in ParseSampler()
3649 token = tokenizer_->NextToken(); in ParseSampler()
3651 if (!token->IsDouble()) in ParseSampler()
3652 return Result("invalid token when looking for MAX_LOD value"); in ParseSampler()
3654 sampler->SetMaxLOD(token->AsFloat()); in ParseSampler()
3665 token = tokenizer_->NextToken(); in ParseSampler()
3676 auto token = tokenizer_->PeekNextToken(); in ParseTolerances() local
3677 while (!token->IsEOL() && !token->IsEOS()) { in ParseTolerances()
3678 if (!token->IsInteger() && !token->IsDouble()) in ParseTolerances()
3681 token = tokenizer_->NextToken(); in ParseTolerances()
3682 Result r = token->ConvertToDouble(); in ParseTolerances()
3686 double value = token->AsDouble(); in ParseTolerances()
3687 token = tokenizer_->PeekNextToken(); in ParseTolerances()
3688 if (token->IsIdentifier() && token->AsString() == "%") { in ParseTolerances()
3691 token = tokenizer_->PeekNextToken(); in ParseTolerances()
3701 auto token = tokenizer_->NextToken(); in ParseVirtualFile() local
3702 if (!token->IsIdentifier() && !token->IsString()) in ParseVirtualFile()
3705 auto path = token->AsString(); in ParseVirtualFile()
3713 token = tokenizer_->NextToken(); in ParseVirtualFile()
3714 if (!token->IsIdentifier() || token->AsString() != "END") in ParseVirtualFile()