Merge pull request #39 from KTXSoftware/master
Change variable names beginning with gl_ in GLSL
This commit is contained in:
commit
1c78f353a4
@ -1017,6 +1017,26 @@ void CompilerGLSL::emit_uniform(const SPIRVariable &var)
|
||||
statement(layout_for_variable(var), "uniform ", variable_decl(var), ";");
|
||||
}
|
||||
|
||||
void CompilerGLSL::replace_illegal_names()
|
||||
{
|
||||
for (auto &id : ids)
|
||||
{
|
||||
if (id.get_type() == TypeVariable)
|
||||
{
|
||||
auto &var = id.get<SPIRVariable>();
|
||||
|
||||
if (!is_builtin_variable(var) && !var.remapped_variable)
|
||||
{
|
||||
auto &m = meta[var.self].decoration;
|
||||
if (m.alias.compare(0, 3, "gl_") == 0)
|
||||
{
|
||||
m.alias = join("_", m.alias);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CompilerGLSL::replace_fragment_output(SPIRVariable &var)
|
||||
{
|
||||
auto &m = meta[var.self].decoration;
|
||||
@ -1101,6 +1121,8 @@ void CompilerGLSL::emit_resources()
|
||||
{
|
||||
auto &execution = get_entry_point();
|
||||
|
||||
replace_illegal_names();
|
||||
|
||||
// Legacy GL uses gl_FragData[], redeclare all fragment outputs
|
||||
// with builtins.
|
||||
if (execution.model == ExecutionModelFragment && is_legacy())
|
||||
|
@ -308,6 +308,8 @@ protected:
|
||||
// and force recompile.
|
||||
bool check_atomic_image(uint32_t id);
|
||||
|
||||
void replace_illegal_names();
|
||||
|
||||
void replace_fragment_output(SPIRVariable &var);
|
||||
void replace_fragment_outputs();
|
||||
std::string legacy_tex_op(const std::string &op, const SPIRType &imgtype);
|
||||
|
Loading…
Reference in New Issue
Block a user