Copy the blobs from binary targets to outputs

Related work item: Github #36
This commit is contained in:
Minmin Gong 2019-02-10 21:02:29 -08:00
Родитель 50e27738c4
Коммит 852d52179b
1 изменённых файлов: 22 добавлений и 3 удалений

Просмотреть файл

@ -755,13 +755,13 @@ namespace ShaderConductor
}
}
ResultDesc dxilBinaryResult;
ResultDesc dxilBinaryResult{};
if (hasDxil)
{
dxilBinaryResult = CompileToBinary(sourceOverride, options, ShadingLanguage::Dxil);
}
ResultDesc spirvBinaryResult;
ResultDesc spirvBinaryResult{};
if (hasSpirV)
{
spirvBinaryResult = CompileToBinary(sourceOverride, options, ShadingLanguage::SpirV);
@ -769,7 +769,15 @@ namespace ShaderConductor
for (uint32_t i = 0; i < numTargets; ++i)
{
ResultDesc& binaryResult = targets[i].language == ShadingLanguage::Dxil ? dxilBinaryResult : spirvBinaryResult;
ResultDesc binaryResult = targets[i].language == ShadingLanguage::Dxil ? dxilBinaryResult : spirvBinaryResult;
if (binaryResult.target)
{
binaryResult.target = CreateBlob(binaryResult.target->Data(), binaryResult.target->Size());
}
if (binaryResult.errorWarningMsg)
{
binaryResult.errorWarningMsg = CreateBlob(binaryResult.errorWarningMsg->Data(), binaryResult.errorWarningMsg->Size());
}
if (!binaryResult.hasError)
{
switch (targets[i].language)
@ -796,6 +804,17 @@ namespace ShaderConductor
results[i] = binaryResult;
}
}
if (hasDxil)
{
DestroyBlob(dxilBinaryResult.target);
DestroyBlob(dxilBinaryResult.errorWarningMsg);
}
if (hasSpirV)
{
DestroyBlob(spirvBinaryResult.target);
DestroyBlob(spirvBinaryResult.errorWarningMsg);
}
}
Compiler::ResultDesc Compiler::Disassemble(const DisassembleDesc& source)