summaryrefslogtreecommitdiff
path: root/sc/sc.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'sc/sc.cpp')
-rw-r--r--sc/sc.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/sc/sc.cpp b/sc/sc.cpp
index de39187..143c408 100644
--- a/sc/sc.cpp
+++ b/sc/sc.cpp
@@ -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";
}
}