mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-11 21:58:31 +09:00
Revert "[Chore] (MG_Util/Program): use SPIRV-Cross C++ API instead of C ones"
This reverts commit 8e0284faec.
This commit is contained in:
@@ -27,8 +27,10 @@ namespace MobileGL {
|
||||
WideCharToMultiByte(CP_UTF8, 0, desc, -1, buffer, sizeof(buffer), nullptr, nullptr);
|
||||
LocalFree(desc);
|
||||
}
|
||||
#elif defined(__ANDROID__) || defined(__linux__) || defined(__APPLE__)
|
||||
#elif defined(__ANDROID__) || defined(__linux__)
|
||||
pthread_getname_np(pthread_self(), buffer, sizeof(buffer));
|
||||
#elif defined(__APPLE__)
|
||||
pthread_getname_np(buffer, sizeof(buffer));
|
||||
#endif
|
||||
return buffer[0] ? buffer : "UnknownThread";
|
||||
}
|
||||
|
||||
@@ -207,37 +207,18 @@ namespace MobileGL {
|
||||
const char *result = nullptr;
|
||||
session.Compile(&result);
|
||||
|
||||
// if (!result) {
|
||||
// ResultInfo r;
|
||||
// r.log += "Failed to compile the shader to GLSL: \n";
|
||||
// r.log += session.GetLastErrorString();
|
||||
// r.errc = -5;
|
||||
// return std::unexpected(r);
|
||||
// }
|
||||
if (!result) {
|
||||
ResultInfo r;
|
||||
r.log += "Failed to compile the shader to GLSL: \n";
|
||||
r.log += session.GetLastErrorString();
|
||||
r.errc = -5;
|
||||
return std::unexpected(r);
|
||||
}
|
||||
|
||||
std::string glsl = result;
|
||||
|
||||
return glsl;
|
||||
}
|
||||
|
||||
Result<String> ShaderCompiler::DecompileShader(spirv_cross::CompilerGLSL& compiler) {
|
||||
try {
|
||||
spirv_cross::CompilerGLSL::Options options;
|
||||
options.version = 450;
|
||||
options.es = false;
|
||||
options.vulkan_semantics = true;
|
||||
compiler.set_common_options(options);
|
||||
|
||||
auto result = compiler.compile();
|
||||
return result;
|
||||
} catch (const spirv_cross::CompilerError& e) {
|
||||
ResultInfo r;
|
||||
r.log += "Failed to compile the shader to GLSL: \n";
|
||||
r.log += e.what();
|
||||
r.errc = -5;
|
||||
return std::unexpected(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ namespace ShaderTranspiler {
|
||||
static Result<SharedPtr<glslang::TShader>> CompileShader(const ShaderAttrib& attrib);
|
||||
static Result<Vector<Vector<unsigned>>> LinkProgram(const ProgramAttrib& attrib);
|
||||
static Result<String> DecompileShader(SpvcSession& session);
|
||||
static Result<String> DecompileShader(spirv_cross::CompilerGLSL& compiler);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user