[Fix] (Diligent/Shader): Rename glsl builtins for Vulkan.

This commit is contained in:
BZLZHH
2025-06-09 19:10:01 +08:00
parent 2fb0690804
commit 836c169100
5 changed files with 45 additions and 8 deletions
@@ -371,6 +371,7 @@ namespace MG_Diligent {
shaderSource = MG_Util::Program::BindInputLayoutLocationsForGLSL(spirv,
programObj.attribLocations);
MG_Util::Program::RenameGLSLBuiltinsForVulkan(shaderSource);
} else {
shaderSource = it->second.source;
}
@@ -277,6 +277,7 @@ namespace MG_GL::GL {
} else {
shaderSource = it->second.source;
}
MG_Util::Program::RenameGLSLBuiltinsForVulkan(shaderSource);
shaderSources[it->first] = shaderSource;
}
}
+18 -2
View File
@@ -176,9 +176,25 @@ GLint ProgramState::QueryProgramAttributeLocation(GLuint program, const GLchar*
GLint loc = it->second;
MG_Util::Debug::LogD("MG_State: Program: QueryProgramAttributeLocation success: %s -> %d", name, loc);
return loc;
} else {
MG_Util::Debug::LogW("MG_State: Program: QueryProgramAttributeLocation warning: name '%s' not found, generating new one...", name);
// Find the next available location
GLint loc = (GLint)prog.attribLocations.size();
bool locInUse;
do {
locInUse = false;
for (const auto& pair : prog.attribLocations) {
if (pair.second == loc) {
locInUse = true;
loc++;
break;
}
}
} while (locInUse);
prog.attribLocations[name] = loc;
MG_Util::Debug::LogD("MG_State: Program: QueryProgramAttributeLocation success: %s -> %d", name, loc);
return prog.attribLocations[name];
}
MG_Util::Debug::LogW("MG_State: Program: QueryProgramAttributeLocation warning: name '%s' not found", name);
return -1;
}
GLenum ProgramState::QueryProgramStateIntVector(GLuint program, GLenum pname, GLint* params) {