mirror of
https://github.com/love2d/love.git
synced 2026-08-21 21:15:09 +02:00
metal: error when generated SPIR-V shader IR can't be parsed
This commit is contained in:
@@ -30,6 +30,7 @@
|
||||
#include "libraries/spirv_cross/spirv_reflect.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
|
||||
namespace love
|
||||
{
|
||||
@@ -456,11 +457,20 @@ void Shader::compileFromGLSLang(id<MTLDevice> device, const glslang::TProgram &p
|
||||
std::string msgs = logger.getAllMessages();
|
||||
// printf("spirv length: %ld, messages:\n%s\n", spirv.size(), msgs.c_str());
|
||||
|
||||
try
|
||||
{
|
||||
// printf("GLSL INPUT SOURCE:\n\n%s\n\n", pixel->getSource().c_str());
|
||||
|
||||
CompilerMSL msl(std::move(spirv));
|
||||
std::unique_ptr<CompilerMSL> mslpointer;
|
||||
|
||||
try
|
||||
{
|
||||
mslpointer.reset(new CompilerMSL(std::move(spirv)));
|
||||
}
|
||||
catch (std::exception &e)
|
||||
{
|
||||
throw love::Exception("Error parsing SPIR-V shader source: %s", e.what());
|
||||
}
|
||||
|
||||
auto &msl = *mslpointer;
|
||||
|
||||
auto interfacevars = msl.get_active_interface_variables();
|
||||
|
||||
@@ -724,11 +734,6 @@ void Shader::compileFromGLSLang(id<MTLDevice> device, const glslang::TProgram &p
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (std::exception &e)
|
||||
{
|
||||
printf("Error parsing SPIR-V shader source: %s\n", e.what());
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize default resource bindings.
|
||||
for (auto &kvp : uniforms)
|
||||
|
||||
Reference in New Issue
Block a user