修复shader_type读取不正确

This commit is contained in:
Nanako 2024-02-02 01:03:08 +08:00
parent 2f6c08adb2
commit 983de38c36

View File

@ -32,22 +32,21 @@ bool slang_handle::init_slang_module(const std::string& module_name, const std::
spdlog::error("slang: create composite component type failed");
return false;
}
// get entry point index
for (int i = 0; i < module->getDefinedEntryPointCount(); ++i)
slang::ProgramLayout* layout = program->getLayout(target_index);
// get entry point index and shader type
for (int i = 0; i < layout->getEntryPointCount(); ++i)
{
Slang::ComPtr<slang::IEntryPoint> temp_entry_point;
module->getDefinedEntryPoint(i, temp_entry_point.writeRef());
if (temp_entry_point == entry_point)
const auto entry_reflection = layout->getEntryPointByIndex(i);
if (strcmp(entry_reflection->getName(), entry_name.c_str()) == 0)
{
entry_point_index_ = i;
shader_type_ = entry_reflection->getStage();
break;
}
}
slang::ProgramLayout* layout = program->getLayout(target_index);
const auto entry_reflection = layout->getEntryPointByIndex(entry_point_index_);
shader_type_ = entry_reflection->getStage();
#if _DEBUG
spdlog::info("slang: shader type: {}", shader_type_);
spdlog::info("================parameters================");