From dc6d0417b137c8ecdcb3b99b7624358bba7fefa8 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Mon, 19 Aug 2019 14:08:57 -0400 Subject: WIP: Compute test running on CPU (#1023) * * Simplify some of test code around CPPCompiler * Test using 'callable' with pass-through * Small cpu doc improvements * Improvements to Clang output parsing. * Remove temporary file (base filename) . * Improve handling of external errors - handle severity. * On error dumping out to 'actual' file for runCPPCompilerCompile. * Small fixes. Set the source language type correctly for pass thru. * Remove warning for test for clang backend c * Preliminary work around making render-test compute potentiall work with CPU. Made ShaderCompiler -> a stateless ShaderCompilerUtil. Means we don't require a Renderer interface to do shader compilation. * Refactor such that CPU test can take place in without Window or Renderer. * Hack to look for prelude in source file directory. Fix bug returning the SharedLibrary for HostCallable. * Compute test running on CPU. * Need the prelude currently in same directly as test. * Hack to remove warning - that then produces an error on appveyor build. Disable running render CPU test on non-windows. * Improve handling of disabling CPU tests on linux. * Added bit-cast.slang working on CPU. --- tools/render-test/slang-support.h | 55 ++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 10 deletions(-) (limited to 'tools/render-test/slang-support.h') diff --git a/tools/render-test/slang-support.h b/tools/render-test/slang-support.h index a9b8c8871..662098546 100644 --- a/tools/render-test/slang-support.h +++ b/tools/render-test/slang-support.h @@ -9,17 +9,52 @@ namespace renderer_test { -struct ShaderCompiler +struct ShaderCompilerUtil { - RefPtr renderer; - SlangCompileTarget target; - SlangSourceLanguage sourceLanguage; - SlangPassThrough passThrough; - char const* profile; - SlangSession* slangSession; - - RefPtr compileProgram( - ShaderCompileRequest const& request); + struct Input + { + SlangCompileTarget target; + SlangSourceLanguage sourceLanguage; + SlangPassThrough passThrough; + char const* profile; + const char** args; + int argCount; + }; + + struct Output + { + void set(PipelineType pipelineType, const ShaderProgram::KernelDesc* inKernelDescs, int kernelDescCount) + { + kernelDescs.clear(); + kernelDescs.addRange(inKernelDescs, kernelDescCount); + desc.pipelineType = pipelineType; + desc.kernels = kernelDescs.getBuffer(); + desc.kernelCount = kernelDescCount; + } + void reset() + { + kernelDescs.clear(); + if (request && session) + { + spDestroyCompileRequest(request); + } + session = nullptr; + request = nullptr; + } + ~Output() + { + if (request && session) + { + spDestroyCompileRequest(request); + } + } + List kernelDescs; + ShaderProgram::Desc desc; + SlangCompileRequest* request = nullptr; + SlangSession* session = nullptr; + }; + + static SlangResult compileProgram(SlangSession* session, const Input& input, const ShaderCompileRequest& request, Output& out); }; -- cgit v1.2.3