Read binary file into vector.
854{
855 std::ifstream file(filepath, std::ios::binary | std::ios::ate);
856 if (!file.is_open()) {
858 "Failed to open SPIR-V file: '{}'", filepath);
859 return {};
860 }
861
862 size_t file_size = static_cast<size_t>(file.tellg());
863 if (file_size == 0) {
865 "SPIR-V file is empty: '{}'", filepath);
866 return {};
867 }
868
869 if (file_size % sizeof(uint32_t) != 0) {
871 "SPIR-V file size ({} bytes) is not multiple of 4: '{}'",
872 file_size, filepath);
873 return {};
874 }
875
876 std::vector<uint32_t>
buffer(file_size /
sizeof(uint32_t));
877 file.seekg(0);
878 file.read(
reinterpret_cast<char*
>(
buffer.data()), file_size);
879
880 if (!file) {
882 "Failed to read SPIR-V file: '{}'", filepath);
883 return {};
884 }
885
887}
#define MF_ERROR(comp, ctx,...)
std::shared_ptr< NetworkGeometryBuffer > buffer
@ GraphicsBackend
Graphics/visual rendering backend (Vulkan, OpenGL)
@ Core
Core engine, backend, subsystems.