From 983de38c360881892d69e2a429a66148e7033048 Mon Sep 17 00:00:00 2001 From: Nanako <469449812@qq.com> Date: Fri, 2 Feb 2024 01:03:08 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dshader=5Ftype=E8=AF=BB?= =?UTF-8?q?=E5=8F=96=E4=B8=8D=E6=AD=A3=E7=A1=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/rhi/slang_handle.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/core/rhi/slang_handle.cpp b/core/rhi/slang_handle.cpp index c615e21..783e603 100644 --- a/core/rhi/slang_handle.cpp +++ b/core/rhi/slang_handle.cpp @@ -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 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================");