summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorYONGH\yongh <yonghe@outlook.com>2017-10-19 18:18:21 -0400
committerYONGH\yongh <yonghe@outlook.com>2017-10-19 18:18:21 -0400
commit8ff7412f988c77f21196b907820b94aa67eb6f21 (patch)
tree27bea95dec68c42e5d3dd924da0cd8fa74f0d9e4 /source
parent88023aea669f258d66e53eab10215337a7f72853 (diff)
Support running and comparing execution results of compute shaders in testing framework.
Diffstat (limited to 'source')
-rw-r--r--source/core/text-io.h22
1 files changed, 22 insertions, 0 deletions
diff --git a/source/core/text-io.h b/source/core/text-io.h
index c914e340a..e4bdc6e2d 100644
--- a/source/core/text-io.h
+++ b/source/core/text-io.h
@@ -311,6 +311,28 @@ namespace Slang
stream = 0;
}
};
+
+ inline List<String> Split(String text, char c)
+ {
+ List<String> result;
+ StringBuilder sb;
+ for (int i = 0; i < text.Length(); i++)
+ {
+ if (text[i] == c)
+ {
+ auto str = sb.ToString();
+ if (str.Length() != 0)
+ result.Add(str);
+ sb.Clear();
+ }
+ else
+ sb << text[i];
+ }
+ auto lastStr = sb.ToString();
+ if (lastStr.Length())
+ result.Add(lastStr);
+ return result;
+ }
}
#endif