From 6a1b1a5ed956d5647d69245d1ebb77d712e39d44 Mon Sep 17 00:00:00 2001 From: BZLZHH Date: Sun, 15 Jun 2025 11:52:34 +0800 Subject: [PATCH] [Fix] (Diligent/PSO): Miscellaneous fix. --- MG/MG_GL/Implementations/EGL/Diligent/EGL_impl.cpp | 14 +++++--------- MG/MG_GL/State/Program/ProgramState.cpp | 2 +- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/MG/MG_GL/Implementations/EGL/Diligent/EGL_impl.cpp b/MG/MG_GL/Implementations/EGL/Diligent/EGL_impl.cpp index 63291cae..80a6aa4d 100644 --- a/MG/MG_GL/Implementations/EGL/Diligent/EGL_impl.cpp +++ b/MG/MG_GL/Implementations/EGL/Diligent/EGL_impl.cpp @@ -371,7 +371,7 @@ namespace MG_Diligent { shaderSource = MG_Util::Program::BindInputLayoutLocationsForGLSL(spirv, programObj.attribLocations); - MG_Util::Program::RenameGLSLBuiltinsForVulkan(shaderSource); + // MG_Util::Program::RenameGLSLBuiltinsForVulkan(shaderSource); } else { shaderSource = it->second.source; } @@ -381,17 +381,13 @@ namespace MG_Diligent { MG_Util::Program::GenerateDefaultUBOForGLSL_Multi(shaderSourcesMap, programInfo.uniformBufferNames); - for (auto shader : programInfo.AttachedShaders) { - GLuint shaderId = 0; - for (auto const& [key, val] : MG_Diligent::g_ShaderMap) { - if (val == shader) { - shaderId = key; - break; - } - } + for (auto shaderId : programInfo.AttachedShadersID) { + auto shader = MG_Diligent::g_ShaderMap[shaderId]; MG_Util::Debug::LogD("Processing shader ID: %u", shaderId); auto& shaderObj = MG_State_T::programState->shaders_[shaderId]; + MG_Util::Debug::LogD("Shader source for %u before SPIR-V compilation:\n%s", shaderId, + shaderSourcesMap[shaderId].c_str()); std::string compilationLog; auto spirv = diff --git a/MG/MG_GL/State/Program/ProgramState.cpp b/MG/MG_GL/State/Program/ProgramState.cpp index 87ad9be9..84fc50f1 100644 --- a/MG/MG_GL/State/Program/ProgramState.cpp +++ b/MG/MG_GL/State/Program/ProgramState.cpp @@ -465,7 +465,7 @@ void ProgramState::CleanupShaders_() { } if (!inUse) { MG_Util::Debug::LogD("MG_State: Program: CleanupShaders_ deleting shader %u", it->first); - freeShaderIds_.insert(it->first); + // freeShaderIds_.insert(it->first); it = shaders_.erase(it); continue; }