diff options
| author | Yong He <yonghe@outlook.com> | 2023-09-13 09:48:32 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-13 09:48:32 -0700 |
| commit | d2466a602774fcaec063e2f8cdbf86fd5e160a21 (patch) | |
| tree | 13d453cbf79c51ddba4131453da89055fe9740af /source/core/slang-stream.cpp | |
| parent | c0a77c360436c4f1ec4d284e331063c35bdf95ad (diff) | |
Add all RayQuery SPIRV Intrinsics. (#3204)
* Add all RayQuery SPIRV Intrinsics.
* Fix
* Fix.
* fix.
* Fix.
* Fix.
* Fix.
---------
Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/core/slang-stream.cpp')
| -rw-r--r-- | source/core/slang-stream.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/source/core/slang-stream.cpp b/source/core/slang-stream.cpp index 4b5d92228..6507c2e56 100644 --- a/source/core/slang-stream.cpp +++ b/source/core/slang-stream.cpp @@ -2,6 +2,7 @@ #ifdef _WIN32 #include <share.h> #endif +#include <thread> #include "slang-io.h" #include "slang-process.h" @@ -587,6 +588,33 @@ SlangResult BufferedReadStream::readUntilContains(size_t size) // !!!!!!!!!!!!!!!!!!!!!!!!!!!!! StreamUtil !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +SlangResult StreamUtil::readAndWrite( + Stream* writeStream, + ArrayView<Byte> bytesToWrite, + Stream* readStream, List<Byte>& outReadBytes, + Stream* errStream, + List<Byte>& outErrBytes) +{ + std::thread writeThread([&]() + { + writeStream->write(bytesToWrite.getBuffer(), (size_t)bytesToWrite.getCount()); + writeStream->close(); + }); + SlangResult readResult = SLANG_OK; + std::thread readThread([&]() + { + readResult = readAll(readStream, 1024, outReadBytes); + }); + std::thread readErrThread([&]() + { + readAll(errStream, 1024, outErrBytes); + }); + writeThread.join(); + readThread.join(); + readErrThread.join(); + return readResult; +} + /* static */SlangResult StreamUtil::readAll(Stream* stream, size_t readSize, List<Byte>& ioBytes) { while (!stream->isEnd()) |
