summaryrefslogtreecommitdiff
path: root/tools/gfx-unit-test/gfx-test-util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gfx-unit-test/gfx-test-util.cpp')
-rw-r--r--tools/gfx-unit-test/gfx-test-util.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/tools/gfx-unit-test/gfx-test-util.cpp b/tools/gfx-unit-test/gfx-test-util.cpp
index fa0745872..116b4222a 100644
--- a/tools/gfx-unit-test/gfx-test-util.cpp
+++ b/tools/gfx-unit-test/gfx-test-util.cpp
@@ -72,6 +72,21 @@ namespace gfx_test
return SLANG_OK;
}
+ Slang::Result loadComputeProgramFromSource(
+ gfx::IDevice* device,
+ Slang::ComPtr<gfx::IShaderProgram>& outShaderProgram,
+ Slang::String source)
+ {
+ Slang::ComPtr<slang::IBlob> diagnosticsBlob;
+
+ gfx::IShaderProgram::CreateDesc2 programDesc = {};
+ programDesc.sourceType = gfx::ShaderModuleSourceType::SlangSource;
+ programDesc.sourceData = (void*)source.getBuffer();
+ programDesc.sourceDataSize = source.getLength();
+
+ return device->createProgram2(programDesc, outShaderProgram.writeRef(), diagnosticsBlob.writeRef());
+ }
+
Slang::Result loadGraphicsProgram(
gfx::IDevice* device,
Slang::ComPtr<gfx::IShaderProgram>& outShaderProgram,