diff options
Diffstat (limited to 'sc/sc.cpp')
-rw-r--r-- | sc/sc.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -255,6 +255,7 @@ struct Desc { return &b; } void read_texture(cfg_Object* desc) { + const char* sdem; const char* sname = find_string_default(desc, "name", 0); if (!sname) { print_err("%s must have a name.\n", desc->name); @@ -276,9 +277,12 @@ struct Desc { t.stage = 0; t.dimension = 0; } + sdem = find_string_default(desc, "dimension", 0); Texture& t = textures[n]; t.stage |= 1 << stage_from_string(sstage); - t.dimension = find_int_default(desc, "dimension", 2); + t.dimension = + sdem && string_equal(sdem, "cube")? -6: + find_int_default(desc, "dimension", 2); } cfg_Object* read_struct(cfg_Object* desc) { const char* sname = find_string_default(desc, "name", 0); @@ -437,7 +441,11 @@ struct Desc { Descriptor* d = find_desc(it.first.c_str()); assert(d != 0); ss << "layout (binding = " << d->slot << ") "; - ss << "uniform sampler" << texture.dimension << "D "; + ss << "uniform sampler"; + if (texture.dimension == -6) + ss << "Cube "; + else + ss << texture.dimension << "D "; ss << it.first << ";\n"; } } |