summaryrefslogtreecommitdiff
path: root/tools/gfx/metal/metal-shader-program.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/gfx/metal/metal-shader-program.cpp')
-rw-r--r--tools/gfx/metal/metal-shader-program.cpp15
1 files changed, 9 insertions, 6 deletions
diff --git a/tools/gfx/metal/metal-shader-program.cpp b/tools/gfx/metal/metal-shader-program.cpp
index 1b998bc57..e0f973eb6 100644
--- a/tools/gfx/metal/metal-shader-program.cpp
+++ b/tools/gfx/metal/metal-shader-program.cpp
@@ -22,19 +22,22 @@ ShaderProgramImpl::~ShaderProgramImpl()
Result ShaderProgramImpl::createShaderModule(slang::EntryPointReflection* entryPointInfo, ComPtr<ISlangBlob> kernelCode)
{
- m_codeBlobs.add(kernelCode);
- const char* realEntryPointName = entryPointInfo->getNameOverride();
+ Module module;
+ module.stage = entryPointInfo->getStage();
+ module.entryPointName = entryPointInfo->getNameOverride();
+ module.code = kernelCode;
+
dispatch_data_t data = dispatch_data_create(kernelCode->getBufferPointer(), kernelCode->getBufferSize(), dispatch_get_main_queue(), NULL);
NS::Error* error;
- NS::SharedPtr<MTL::Library> library = NS::TransferPtr(m_device->m_device->newLibrary(data, &error));
- if (!library)
+ module.library = NS::TransferPtr(m_device->m_device->newLibrary(data, &error));
+ if (!module.library)
{
// TODO use better mechanism for reporting errors
std::cout << error->localizedDescription()->utf8String() << std::endl;
return SLANG_E_INVALID_ARG;
}
- m_entryPointNames.add(realEntryPointName);
- m_modules.add(library);
+
+ m_modules.add(module);
return SLANG_OK;
}