| 1501 | } |
| 1502 | |
| 1503 | ShaderViewer *ShaderViewer::LoadEditor(ICaptureContext &ctx, QVariantMap data, |
| 1504 | IShaderViewer::SaveCallback saveCallback, |
| 1505 | IShaderViewer::RevertCallback revertCallback, |
| 1506 | ModifyCallback modifyCallback, QWidget *parent) |
| 1507 | { |
| 1508 | if(data.isEmpty()) |
| 1509 | return NULL; |
| 1510 | |
| 1511 | ResourceId id; |
| 1512 | |
| 1513 | { |
| 1514 | QVariant v = data[lit("id")]; |
| 1515 | RichResourceTextInitialise(v, &ctx); |
| 1516 | id = v.value<ResourceId>(); |
| 1517 | } |
| 1518 | ShaderStage stage = (ShaderStage)data[lit("stage")].toUInt(); |
| 1519 | rdcstr entryPoint = data[lit("entryPoint")].toString(); |
| 1520 | ShaderEncoding encoding = (ShaderEncoding)data[lit("encoding")].toUInt(); |
| 1521 | QString commandLine = data[lit("commandLine")].toString(); |
| 1522 | QString toolName = data[lit("tool")].toString(); |
| 1523 | |
| 1524 | ShaderCompileFlags flags; |
| 1525 | |
| 1526 | { |
| 1527 | QVariantMap v = data[lit("flags")].toMap(); |
| 1528 | |
| 1529 | for(const QString &str : v.keys()) |
| 1530 | flags.flags.push_back({(rdcstr)str, (rdcstr)v[str].toString()}); |
| 1531 | } |
| 1532 | |
| 1533 | rdcstrpairs files; |
| 1534 | |
| 1535 | { |
| 1536 | QVariantList v = data[lit("files")].toList(); |
| 1537 | |
| 1538 | for(QVariant f : v) |
| 1539 | { |
| 1540 | QVariantMap file = f.toMap(); |
| 1541 | files.push_back( |
| 1542 | {(rdcstr)file[lit("name")].toString(), (rdcstr)file[lit("contents")].toString()}); |
| 1543 | } |
| 1544 | } |
| 1545 | |
| 1546 | rdcstr errors; |
| 1547 | |
| 1548 | if((uint32_t)encoding >= (uint32_t)ShaderEncoding::Count) |
| 1549 | { |
| 1550 | errors += tr("Unrecognised shader encoding '%1'").arg(ToStr(encoding)); |
| 1551 | // with no other information let's guess HLSL as the most likely |
| 1552 | encoding = ShaderEncoding::HLSL; |
| 1553 | } |
| 1554 | |
| 1555 | ShaderViewer *view = |
| 1556 | EditShader(ctx, id, stage, entryPoint, files, KnownShaderTool::Unknown, encoding, flags, |
| 1557 | saveCallback, revertCallback, modifyCallback, parent); |
| 1558 | |
| 1559 | int toolIndex = -1; |
| 1560 |
nothing calls this directly
no test coverage detected