X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fbuiltin.cpp;h=12602707db80ca5043b6582f5b6917422cb2f477;hb=91e65bc9e24a6889995081035f6f6f0a78a6c20e;hp=c9483151823f973088229cbbab9f2307c0a21816;hpb=c2aa5271db88180d995d5c456dc3a6aa9dc24c24;p=libs%2Fgl.git diff --git a/source/glsl/builtin.cpp b/source/glsl/builtin.cpp index c9483151..12602707 100644 --- a/source/glsl/builtin.cpp +++ b/source/glsl/builtin.cpp @@ -1,7 +1,6 @@ #include #include #include "builtin.h" -#include "generate.h" #include "parser.h" using namespace std; @@ -10,6 +9,13 @@ namespace Msp { namespace GL { namespace SL { +void populate_types(Stage &stage) +{ + for(NodeList::const_iterator i=stage.content.body.begin(); i!=stage.content.body.end(); ++i) + if(TypeDeclaration *type = dynamic_cast(i->get())) + stage.types[type->name] = type; +} + Module *get_builtins_module() { static RefPtr builtins_module; @@ -48,6 +54,14 @@ Module *get_builtins_module() type->kind = BasicTypeDeclaration::INT; shared_body.insert(insert_point, type); + type = new BasicTypeDeclaration; + type->source = BUILTIN_SOURCE; + type->name = "uint"; + type->size = 32; + type->sign = false; + type->kind = BasicTypeDeclaration::INT; + shared_body.insert(insert_point, type); + type = new BasicTypeDeclaration; type->source = BUILTIN_SOURCE; type->name = "float"; @@ -55,9 +69,9 @@ Module *get_builtins_module() type->kind = BasicTypeDeclaration::FLOAT; shared_body.insert(insert_point, type); - TypeResolver().apply(module->shared); + populate_types(module->shared); for(list::iterator i=module->stages.begin(); i!=module->stages.end(); ++i) - TypeResolver().apply(*i); + populate_types(*i); builtins_module = module; }