Commit 3693e631 by John Kessenich

Fix #1060: Could crash if using --source-entry-point with -e; fixed.

parent 5a57ca68
...@@ -781,8 +781,12 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits) ...@@ -781,8 +781,12 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
shader->setStringsWithLengthsAndNames(compUnit.text, NULL, compUnit.fileNameList, compUnit.count); shader->setStringsWithLengthsAndNames(compUnit.text, NULL, compUnit.fileNameList, compUnit.count);
if (entryPointName) // HLSL todo: this needs to be tracked per compUnits if (entryPointName) // HLSL todo: this needs to be tracked per compUnits
shader->setEntryPoint(entryPointName); shader->setEntryPoint(entryPointName);
if (sourceEntryPointName) if (sourceEntryPointName) {
if (entryPointName == nullptr)
printf("Warning: Changing source entry point name without setting an entry-point name.\n"
"Use '-e <name>'.\n");
shader->setSourceEntryPoint(sourceEntryPointName); shader->setSourceEntryPoint(sourceEntryPointName);
}
if (UserPreamble.isSet()) if (UserPreamble.isSet())
shader->setPreamble(UserPreamble.get()); shader->setPreamble(UserPreamble.get());
shader->addProcesses(Processes); shader->addProcesses(Processes);
......
...@@ -152,7 +152,7 @@ public: ...@@ -152,7 +152,7 @@ public:
{ {
// Replace the entry point name given in the shader with the real entry point name, // Replace the entry point name given in the shader with the real entry point name,
// if there is a substitution. // if there is a substitution.
if (name != nullptr && *name == sourceEntryPointName) if (name != nullptr && *name == sourceEntryPointName && intermediate.getEntryPointName().size() > 0)
name = NewPoolTString(intermediate.getEntryPointName().c_str()); name = NewPoolTString(intermediate.getEntryPointName().c_str());
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment