From: Mikko Rasa Date: Fri, 5 Mar 2021 21:06:45 +0000 (+0200) Subject: Tweak the builtin type generation X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=c2aa5271db88180d995d5c456dc3a6aa9dc24c24;p=libs%2Fgl.git Tweak the builtin type generation Give bool a size and insert the types in the order they're defined in. --- diff --git a/source/glsl/builtin.cpp b/source/glsl/builtin.cpp index 670cfc2d..c9483151 100644 --- a/source/glsl/builtin.cpp +++ b/source/glsl/builtin.cpp @@ -26,32 +26,34 @@ Module *get_builtins_module() 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(shared_body.begin(), type); + 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(shared_body.begin(), type); + 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(shared_body.begin(), type); + 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(shared_body.begin(), type); + shared_body.insert(insert_point, type); TypeResolver().apply(module->shared); for(list::iterator i=module->stages.begin(); i!=module->stages.end(); ++i)