summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-12-19 19:20:50 +1100
committerquou <quou@disroot.org>2024-12-19 19:22:20 +1100
commitbec7a1c90f7cda0a9e7d2e2628ac69b645108dc4 (patch)
tree830660aab41d90c24302d2c64e096292b62a4394 /sc
parent73744341846d4e76d6910dc5a15dff6d74586e39 (diff)
basic vulkan setup
Diffstat (limited to 'sc')
-rw-r--r--sc/sc.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/sc/sc.cpp b/sc/sc.cpp
index a385619..617d5ce 100644
--- a/sc/sc.cpp
+++ b/sc/sc.cpp
@@ -314,14 +314,17 @@ void write_csh(
const Desc& d,
const std::vector<uint32_t>* stages
) {
- int hsize = 8, i, coff;
+ int hsize = 16, i, coff;
FILE* f = fopen(fname, "wb");
if (!f) {
print_err("Failed to open %s\n", fname);
pbreak(500);
}
+ int c;
fwrite("CSH2", 4, 1, f);
fwrite(&d.type, 4, 1, f);
+ c = d.attrs.size(); fwrite(&c, 4, 1, f);
+ c = d.trgts.size(); fwrite(&c, 4, 1, f);
for (const auto& a : d.attrs) {
char buf[28];
memset(buf, 0, sizeof buf);
@@ -338,14 +341,18 @@ void write_csh(
fwrite(&t.type, 4, 1, f);
hsize += 32;
}
+ hsize += shader_type_count * 8;
for (i = 0, coff = 0; i < shader_type_count; i++) {
int o = 0;
- if (d.entrypoints[i].empty())
+ if (d.entrypoints[i].empty()) {
fwrite(&o, 4, 1, f);
- else {
+ fwrite(&o, 4, 1, f);
+ } else {
+ int size = stages[i].size() * sizeof(uint32_t);
o = hsize + coff;
fwrite(&o, 4, 1, f);
- coff += stages[i].size() * sizeof(uint32_t);
+ fwrite(&size, 4, 1, f);
+ coff += size;
}
}
for (i = 0; i < shader_type_count; i++)