summaryrefslogtreecommitdiff
path: root/source/slang/slang-spirv-val.cpp
diff options
context:
space:
mode:
authorJay Kwak <82421531+jkwak-work@users.noreply.github.com>2024-07-17 17:00:05 -0700
committerGitHub <noreply@github.com>2024-07-17 17:00:05 -0700
commit32b1e25e359f8daf5254301dca8be308e8e1e2ab (patch)
tree2dd2bf7324b771c4a0aa989194a9b1d3b219af18 /source/slang/slang-spirv-val.cpp
parent2db15080085856ed9b5f20642dbb354aac59a888 (diff)
Use slang-glslang.dll for spirv-validation (#4642)
* Use slang-glslang.dll for spirv-validation This change replaces the use of "spirv-val.exe" with an API call to "spvtools::SpirvTools::Validate()". Closes #4610
Diffstat (limited to 'source/slang/slang-spirv-val.cpp')
-rw-r--r--source/slang/slang-spirv-val.cpp41
1 files changed, 0 insertions, 41 deletions
diff --git a/source/slang/slang-spirv-val.cpp b/source/slang/slang-spirv-val.cpp
index faacb9c59..585ff5c94 100644
--- a/source/slang/slang-spirv-val.cpp
+++ b/source/slang/slang-spirv-val.cpp
@@ -38,46 +38,5 @@ SlangResult disassembleSPIRV(const List<uint8_t>& spirv, String& outErr, String&
return ret == 0 ? SLANG_OK : SLANG_FAIL;
}
-SlangResult debugValidateSPIRV(const List<uint8_t>& spirv)
-{
- // Set up our process
- CommandLine commandLine;
- commandLine.m_executableLocation.setName("spirv-val");
- commandLine.addArg("--target-env");
- commandLine.addArg("vulkan1.3");
- commandLine.addArg("--scalar-block-layout");
- RefPtr<Process> p;
- const auto createResult = Process::create(commandLine, 0, p);
- // If we failed to even start the process, then validation isn't available
- if(SLANG_FAILED(createResult))
- return SLANG_E_NOT_AVAILABLE;
- const auto in = p->getStream(StdStreamType::In);
- const auto out = p->getStream(StdStreamType::Out);
- const auto err = p->getStream(StdStreamType::ErrorOut);
-
- 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;
-
- // If we failed, dump the spirv first.
- const auto ret = p->getReturnValue();
- if(ret != 0)
- {
- String spirvDisErr;
- String spirvDis;
- disassembleSPIRV(spirv, spirvDisErr, spirvDis);
- fwrite(spirvDisErr.getBuffer(), spirvDisErr.getLength(), 1, stderr);
- fwrite(spirvDis.getBuffer(), spirvDis.getLength(), 1, stderr);
- }
-
- fwrite(outData.getBuffer(), outData.getCount(), 1, stderr);
- fwrite(errData.getBuffer(), errData.getCount(), 1, stderr);
-
- return ret == 0 ? SLANG_OK : SLANG_FAIL;
-}
}