| 1539 | |
| 1540 | template <ApiDumpFormat Format, typename T, typename DumpElement> |
| 1541 | void dump_double_pointer_array(const T *const *array, size_t len, const ApiDumpSettings &settings, const char *type_string, |
| 1542 | const char *name, const char *element_type, int indents, DumpElement dump_element) { |
| 1543 | if (array == nullptr || len == 0) { |
| 1544 | dump_nullptr<Format>(settings, type_string, name, indents); |
| 1545 | return; |
| 1546 | } |
| 1547 | dump_array_start<Format>(array, len, settings, type_string, name, indents); |
| 1548 | for (size_t i = 0; i < len; ++i) { |
| 1549 | std::stringstream stream; |
| 1550 | if constexpr (Format == ApiDumpFormat::Text || Format == ApiDumpFormat::Html) { |
| 1551 | stream << name; |
| 1552 | } |
| 1553 | stream << "[" << i << "]"; |
| 1554 | std::string indexName = stream.str(); |
| 1555 | dump_pointer<Format>(array[i], settings, element_type, indexName.c_str(), indents + (Format == ApiDumpFormat::Json ? 2 : 1), |
| 1556 | dump_element); |
| 1557 | if constexpr (Format == ApiDumpFormat::Json) { |
| 1558 | if (i < len - 1) settings.stream() << ','; |
| 1559 | settings.stream() << "\n"; |
| 1560 | } |
| 1561 | } |
| 1562 | dump_array_end<Format>(array, len, settings, indents); |
| 1563 | } |
| 1564 | |
| 1565 | // Designed to be viewed in something like https://www.khronos.org/spir/visualizer/ |
| 1566 | // There is also now support in SPIRV-Tools (https://github.com/KhronosGroup/SPIRV-Tools/pull/5870) to consume the array |