Support '$' in identifier names (translated to '.' in DVLE)
This commit is contained in:
parent
17f18aa18d
commit
4c7129925d
@ -110,6 +110,11 @@ struct Uniform
|
||||
int pos, size;
|
||||
int type;
|
||||
|
||||
inline bool operator <(const Uniform& rhs)
|
||||
{
|
||||
return pos < rhs.pos;
|
||||
}
|
||||
|
||||
void init(const char* name, int pos, int size, int type)
|
||||
{
|
||||
this->name = name;
|
||||
|
@ -177,7 +177,7 @@ static bool validateIdentifier(const char* id)
|
||||
for (int i = 0; valid && i < len; i ++)
|
||||
{
|
||||
int c = id[i];
|
||||
valid = isalpha(c) || c == '_' || c == '.' || (i > 0 && isdigit(c));
|
||||
valid = isalpha(c) || c == '_' || c == '$' || (i > 0 && isdigit(c));
|
||||
}
|
||||
return valid;
|
||||
}
|
||||
|
@ -195,6 +195,9 @@ int main(int argc, char* argv[])
|
||||
u32 temp = f.Tell();
|
||||
f.WriteWord(dvle->symbolSize); // size of symbol table
|
||||
|
||||
// Sort uniforms by position
|
||||
std::sort(dvle->uniformTable, dvle->uniformTable + dvle->uniformCount);
|
||||
|
||||
// Write constants
|
||||
for (int i = 0; i < dvle->constantCount; i ++)
|
||||
{
|
||||
@ -241,7 +244,8 @@ int main(int argc, char* argv[])
|
||||
// Write symbols
|
||||
for (int i = 0; i < dvle->uniformCount; i ++)
|
||||
{
|
||||
std::string& u = dvle->uniformTable[i].name;
|
||||
std::string u(dvle->uniformTable[i].name);
|
||||
std::replace(u.begin(), u.end(), '$', '.');
|
||||
size_t l = u.length()+1;
|
||||
f.WriteRaw(u.c_str(), l);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user