From ac886fd3e329a9599ed1ac7a6d8b26ca5821046c Mon Sep 17 00:00:00 2001 From: Yong He Date: Wed, 4 Oct 2023 11:20:35 -0700 Subject: 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 --- source/slang/slang-spirv-val.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'source/slang/slang-spirv-val.cpp') 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& 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 outData; + List 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 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& spirv) } fwrite(outData.getBuffer(), outData.getCount(), 1, stderr); + fwrite(errData.getBuffer(), errData.getCount(), 1, stderr); return ret == 0 ? SLANG_OK : SLANG_FAIL; } -- cgit v1.2.3