CompilerMSL fix func_call_arg() cast error when not passed SPIRVariable type.
CompilerGLSL allow retrieval of partial source if an error occurs.
This commit is contained in:
parent
9075262787
commit
c5c073699e
@ -289,6 +289,11 @@ string CompilerGLSL::compile()
|
||||
return buffer->str();
|
||||
}
|
||||
|
||||
std::string CompilerGLSL::get_partial_source()
|
||||
{
|
||||
return buffer->str();
|
||||
}
|
||||
|
||||
void CompilerGLSL::emit_header()
|
||||
{
|
||||
auto &execution = get_entry_point();
|
||||
@ -2128,7 +2133,7 @@ string CompilerGLSL::legacy_tex_op(const std::string &op, const SPIRType &imgtyp
|
||||
break;
|
||||
}
|
||||
|
||||
if (op == "textureLod" || op == "textureProjLod")
|
||||
if (op == "textureLod" || op == "textureProjLod")
|
||||
{
|
||||
if (is_legacy_es())
|
||||
require_extension("GL_EXT_shader_texture_lod");
|
||||
|
@ -115,8 +115,13 @@ public:
|
||||
{
|
||||
options = opts;
|
||||
}
|
||||
|
||||
std::string compile() override;
|
||||
|
||||
// Returns the current string held in the conversion buffer. Useful for
|
||||
// capturing what has been converted so far when compile() throws an error.
|
||||
std::string get_partial_source();
|
||||
|
||||
// Adds a line to be added right after #version in GLSL backend.
|
||||
// This is useful for enabling custom extensions which are outside the scope of SPIRV-Cross.
|
||||
// This can be combined with variable remapping.
|
||||
|
@ -1118,11 +1118,15 @@ string CompilerMSL::to_func_call_arg(uint32_t id)
|
||||
{
|
||||
string arg_str = CompilerGLSL::to_func_call_arg(id);
|
||||
|
||||
// Manufacture automatic sampler arg for SampledImage texture.
|
||||
auto &var = get<SPIRVariable>(id);
|
||||
auto &type = get<SPIRType>(var.basetype);
|
||||
if (type.basetype == SPIRType::SampledImage)
|
||||
arg_str += ", " + to_sampler_expression(id);
|
||||
// Manufacture automatic sampler arg if the arg is a SampledImage texture.
|
||||
Variant &id_v = ids[id];
|
||||
if (id_v.get_type() == TypeVariable)
|
||||
{
|
||||
auto &var = id_v.get<SPIRVariable>();
|
||||
auto &type = get<SPIRType>(var.basetype);
|
||||
if (type.basetype == SPIRType::SampledImage)
|
||||
arg_str += ", " + to_sampler_expression(id);
|
||||
}
|
||||
|
||||
return arg_str;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user