[Fix] (Diligent/PSO): Avoid adding duplicate shader resources.

This commit is contained in:
BZLZHH
2025-06-09 00:25:50 +08:00
parent b73c6e749e
commit 0c4a5f54f2
@@ -214,7 +214,7 @@ namespace MG_Diligent {
PSOKey key{program, currentStateHash}; PSOKey key{program, currentStateHash};
auto it = psoCache.find(key); auto it = psoCache.find(key);
if (it != psoCache.end()) { if (it != psoCache.end() && it->second) {
return it->second; return it->second;
} }
@@ -302,6 +302,8 @@ namespace MG_Diligent {
static std::vector<Diligent::ShaderResourceVariableDesc> Variables; static std::vector<Diligent::ShaderResourceVariableDesc> Variables;
static std::vector<Diligent::ImmutableSamplerDesc> ImmutableSamplers; static std::vector<Diligent::ImmutableSamplerDesc> ImmutableSamplers;
Variables.clear();
ImmutableSamplers.clear();
MG_Global::unordered_map<GLuint, std::string> shaderSourcesMap; MG_Global::unordered_map<GLuint, std::string> shaderSourcesMap;