X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglsl%2Fbuiltin.cpp;h=c9483151823f973088229cbbab9f2307c0a21816;hb=085ebad01690fafedeafe4bfe8421c9588f0238e;hp=3800e14bbc0d412552e679f3e2697c514d1deba4;hpb=69680f4d284cdf7b16a2966250a88ab1257862f3;p=libs%2Fgl.git diff --git a/source/glsl/builtin.cpp b/source/glsl/builtin.cpp index 3800e14b..c9483151 100644 --- a/source/glsl/builtin.cpp +++ b/source/glsl/builtin.cpp @@ -1,6 +1,7 @@ #include #include #include "builtin.h" +#include "generate.h" #include "parser.h" using namespace std; @@ -24,6 +25,40 @@ Module *get_builtins_module() Parser parser; Module *module = new Module(parser.parse(*io, "", BUILTIN_SOURCE)); + NodeList &shared_body = module->shared.content.body; + NodeList::iterator insert_point = shared_body.begin(); + + RefPtr type = new BasicTypeDeclaration; + type->source = BUILTIN_SOURCE; + type->name = "void"; + type->kind = BasicTypeDeclaration::VOID; + shared_body.insert(insert_point, type); + + type = new BasicTypeDeclaration; + type->source = BUILTIN_SOURCE; + type->name = "bool"; + type->size = 1; + type->kind = BasicTypeDeclaration::BOOL; + shared_body.insert(insert_point, type); + + type = new BasicTypeDeclaration; + type->source = BUILTIN_SOURCE; + type->name = "int"; + type->size = 32; + type->kind = BasicTypeDeclaration::INT; + shared_body.insert(insert_point, type); + + type = new BasicTypeDeclaration; + type->source = BUILTIN_SOURCE; + type->name = "float"; + type->size = 32; + type->kind = BasicTypeDeclaration::FLOAT; + shared_body.insert(insert_point, type); + + TypeResolver().apply(module->shared); + for(list::iterator i=module->stages.begin(); i!=module->stages.end(); ++i) + TypeResolver().apply(*i); + builtins_module = module; } return builtins_module.get();