summaryrefslogtreecommitdiff
path: root/tools/render-test/slang-support.h
diff options
context:
space:
mode:
Diffstat (limited to 'tools/render-test/slang-support.h')
-rw-r--r--tools/render-test/slang-support.h55
1 files changed, 45 insertions, 10 deletions
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> renderer;
- SlangCompileTarget target;
- SlangSourceLanguage sourceLanguage;
- SlangPassThrough passThrough;
- char const* profile;
- SlangSession* slangSession;
-
- RefPtr<ShaderProgram> 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<ShaderProgram::KernelDesc> kernelDescs;
+ ShaderProgram::Desc desc;
+ SlangCompileRequest* request = nullptr;
+ SlangSession* session = nullptr;
+ };
+
+ static SlangResult compileProgram(SlangSession* session, const Input& input, const ShaderCompileRequest& request, Output& out);
};