From c2aa5271db88180d995d5c456dc3a6aa9dc24c24 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Fri, 5 Mar 2021 23:06:45 +0200 Subject: [PATCH] Tweak the builtin type generation Give bool a size and insert the types in the order they're defined in. --- source/glsl/builtin.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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) -- 2.45.2