proper final change

This commit is contained in:
Matthew 2025-08-16 09:36:52 +10:00
parent fce5f7ee8f
commit 5dd2a43799

View File

@ -1,31 +1,35 @@
import std.file; version(VULKAN_CODEGEN)
import std.string;
import std.path;
import std.stdio;
void main(string[] argv)
{ {
assert(argv.length > 1, "No argument provided"); import std.file;
import std.string;
import std.path;
import std.stdio;
ubyte[] shader_bytes = cast(ubyte[])read(argv[1]); void main(string[] argv)
string p = __FILE__.absolutePath;
string codegen_name = chomp(p, baseName(p)) ~ "vulkan_shader.d";
auto f = File(codegen_name, "w");
f.write("ubyte[] CONVERT_SHADER_BYTES = [");
foreach(i, b; shader_bytes)
{ {
if (i % 50 == 0) assert(argv.length > 1, "No argument provided");
ubyte[] shader_bytes = cast(ubyte[])read(argv[1]);
string p = __FILE__.absolutePath;
string codegen_name = chomp(p, baseName(p)) ~ "vulkan_shader.d";
auto f = File(codegen_name, "w");
f.write("ubyte[] CONVERT_SHADER_BYTES = [");
foreach(i, b; shader_bytes)
{ {
f.write("\n\t"); if (i % 50 == 0)
{
f.write("\n\t");
}
f.writef("%d, ", b);
} }
f.writef("%d, ", b); f.writeln("\n];");
f.close();
} }
f.writeln("\n];");
f.close();
} }