- string type = var.type;
- if(!type.compare(0, 3, "vec") || !type.compare(0, 3, "mat"))
- type = "float";
- else if(!type.compare(0, 3, "ivec") || type=="uint")
- type = "int";
+ const char *default_prec = (stage->type==Stage::FRAGMENT ? "mediump" : "highp");
+ const TypeDeclaration *type = var.type_declaration;
+ while(type)
+ {
+ if(dynamic_cast<const ImageTypeDeclaration *>(type))
+ {
+ default_prec = "lowp";
+ break;
+ }
+ else if(const BasicTypeDeclaration *basic = dynamic_cast<const BasicTypeDeclaration *>(type))
+ {
+ if(basic->kind==BasicTypeDeclaration::INT || basic->kind==BasicTypeDeclaration::FLOAT)
+ break;
+ type = basic->base_type;
+ }
+ else
+ return;
+ }
+ if(!type)
+ return;