mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 06:08:30 +09:00
[Fix] (MG_Util/GLSLTool): actually linking & mapping IO?
This commit is contained in:
@@ -658,6 +658,21 @@ namespace MG_Util::Program {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<glslang::TIoMapResolver> resolver;
|
||||||
|
for (unsigned stage = 0; stage < EShLangCount; stage++) {
|
||||||
|
auto* pResolver = program.getGlslIoResolver((EShLanguage)stage);
|
||||||
|
if (pResolver) {
|
||||||
|
resolver = std::unique_ptr<glslang::TIoMapResolver>(pResolver);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
auto ioMapper = std::unique_ptr<glslang::TIoMapper>(glslang::GetGlslIoMapper());
|
||||||
|
|
||||||
|
if (!program.mapIO(resolver.get(), ioMapper.get())) {
|
||||||
|
infoLog = "Error: [glslang] Cannot mapIO:\n" + std::to_string(program.getInfoLog());
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
SpvOptions spvOptions;
|
SpvOptions spvOptions;
|
||||||
spvOptions.disableOptimizer = false;
|
spvOptions.disableOptimizer = false;
|
||||||
|
|
||||||
@@ -785,8 +800,9 @@ namespace MG_Util::Program {
|
|||||||
GLint final_location;
|
GLint final_location;
|
||||||
|
|
||||||
if (spirv_location > 0) {
|
if (spirv_location > 0) {
|
||||||
if (used_locations.find(spirv_location) != used_locations.end()) {
|
auto it = used_locations.find(spirv_location);
|
||||||
infoLog += "\nLocation conflict for uniform: " + std::string(name);
|
if (it != used_locations.end()) {
|
||||||
|
infoLog += "\nLocation conflict for uniform: " + std::string(name) + " at location " + std::to_string(spirv_location) + "\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
final_location = spirv_location;
|
final_location = spirv_location;
|
||||||
@@ -797,6 +813,7 @@ namespace MG_Util::Program {
|
|||||||
final_location = auto_location;
|
final_location = auto_location;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MG_Util::Debug::LogD("%s: location = %d", name, final_location);
|
||||||
used_locations.insert(final_location);
|
used_locations.insert(final_location);
|
||||||
|
|
||||||
spvc_type_id type_id = res.type_id;
|
spvc_type_id type_id = res.type_id;
|
||||||
|
|||||||
Reference in New Issue
Block a user