Skip to content

Commit 66a4760

Browse files
committed
unconditionally write the embedded shader cpp output
1 parent 29c768d commit 66a4760

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

ggml/src/ggml-vulkan/vulkan-shaders/vulkan-shaders-gen.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,16 +263,16 @@ std::vector<unsigned char> read_binary_file(const std::string& path, bool may_no
263263
return data;
264264
}
265265

266-
void write_binary_file(const std::string& path, const unsigned char * data, size_t size) {
266+
void write_binary_file(const std::string& path, const std::string& content) {
267267
FILE* f = fopen(path.c_str(), "wb");
268268
if (!f) {
269269
std::cerr << "Error opening file for writing: " << path << " (" << strerror(errno) << ")\n";
270270
return;
271271
}
272272

273-
size_t write_size = fwrite(data, 1, size, f);
273+
size_t write_size = fwrite(content.data(), 1, content.size(), f);
274274
fclose(f);
275-
if (write_size != size) {
275+
if (write_size != content.size()) {
276276
std::cerr << "Error writing file: " << path << " (" << strerror(errno) << ")\n";
277277
return;
278278
}
@@ -281,7 +281,7 @@ void write_binary_file(const std::string& path, const unsigned char * data, size
281281
void write_file_if_changed(const std::string& path, const std::string& content) {
282282
std::vector<unsigned char> existing = read_binary_file(path, true);
283283
if (existing.size() != content.size() || memcmp(existing.data(), content.data(), content.size()) != 0) {
284-
write_binary_file(path, (const unsigned char *)content.data(), content.size());
284+
write_binary_file(path, content);
285285
}
286286
}
287287

@@ -1034,7 +1034,7 @@ void write_output_files() {
10341034
write_file_if_changed(target_hpp, hdr.str());
10351035
}
10361036
if (target_cpp != "") {
1037-
write_file_if_changed(target_cpp, src.str());
1037+
write_binary_file(target_cpp, src.str());
10381038
}
10391039
}
10401040

0 commit comments

Comments
 (0)