summaryrefslogtreecommitdiff
path: root/source/slang/slang-spirv-val.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2023-10-04 11:20:35 -0700
committerGitHub <noreply@github.com>2023-10-04 11:20:35 -0700
commitac886fd3e329a9599ed1ac7a6d8b26ca5821046c (patch)
tree87bcafb3985775f9d90303d6a4239eb743164407 /source/slang/slang-spirv-val.cpp
parentd87493a46c00be37b820a473c0827bbb865eb222 (diff)
SPIRV compiler performance fixes. (#3258)
* SPIRV compiler performance fixes. * Cleanup. * update project files * Cleanup debug code. * Make redundancy removal non-recursive. --------- Co-authored-by: Yong He <yhe@nvidia.com>
Diffstat (limited to 'source/slang/slang-spirv-val.cpp')
-rw-r--r--source/slang/slang-spirv-val.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/source/slang/slang-spirv-val.cpp b/source/slang/slang-spirv-val.cpp
index c03102d9f..e62564cc4 100644
--- a/source/slang/slang-spirv-val.cpp
+++ b/source/slang/slang-spirv-val.cpp
@@ -55,22 +55,14 @@ SlangResult debugValidateSPIRV(const List<uint8_t>& spirv)
const auto out = p->getStream(StdStreamType::Out);
const auto err = p->getStream(StdStreamType::ErrorOut);
- // Write the assembly
- SLANG_RETURN_ON_FAIL(in->write(spirv.getBuffer(), spirv.getCount()));
- in->close();
+ List<Byte> outData;
+ List<Byte> errData;
+ SLANG_RETURN_ON_FAIL(StreamUtil::readAndWrite(in, spirv.getArrayView(), out, outData, err, errData));
// Wait for it to finish
if(!p->waitForTermination(1000))
return SLANG_FAIL;
-
- // TODO: allow inheriting stderr in Process
- List<Byte> outData;
- SLANG_RETURN_ON_FAIL(StreamUtil::readAll(out, 0, outData));
- fwrite(outData.getBuffer(), outData.getCount(), 1, stderr);
- outData.clear();
- SLANG_RETURN_ON_FAIL(StreamUtil::readAll(err, 0, outData));
-
// If we failed, dump the spirv first.
const auto ret = p->getReturnValue();
if(ret != 0)
@@ -83,6 +75,7 @@ SlangResult debugValidateSPIRV(const List<uint8_t>& spirv)
}
fwrite(outData.getBuffer(), outData.getCount(), 1, stderr);
+ fwrite(errData.getBuffer(), errData.getCount(), 1, stderr);
return ret == 0 ? SLANG_OK : SLANG_FAIL;
}