X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=futatabi%2Fflow_main.cpp;h=ef3b5bf976a8417f22b36ea995763987701a3edf;hb=02ea864dc5a6dde7450c497581ff18d784ab832c;hp=dc82d229ca8b121bcb92496b7a7114ac8b06a1a6;hpb=eeda8995329601f9f4e35047358400833eeae68e;p=nageru diff --git a/futatabi/flow_main.cpp b/futatabi/flow_main.cpp index dc82d22..ef3b5bf 100644 --- a/futatabi/flow_main.cpp +++ b/futatabi/flow_main.cpp @@ -54,7 +54,7 @@ GLuint load_texture(const char *filename, unsigned *width_ret, unsigned *height_ SDL_Surface *surf = IMG_Load(filename); if (surf == nullptr) { fprintf(stderr, "IMG_Load(%s): %s\n", filename, IMG_GetError()); - exit(1); + abort(); } // For whatever reason, SDL doesn't support converting to YUV surfaces @@ -62,7 +62,7 @@ GLuint load_texture(const char *filename, unsigned *width_ret, unsigned *height_ SDL_Surface *rgb_surf = SDL_ConvertSurfaceFormat(surf, SDL_PIXELFORMAT_RGBA32, /*flags=*/0); if (rgb_surf == nullptr) { fprintf(stderr, "SDL_ConvertSurfaceFormat(%s): %s\n", filename, SDL_GetError()); - exit(1); + abort(); } SDL_FreeSurface(surf); @@ -177,7 +177,7 @@ struct RGBAType { static constexpr int num_channels = 4; }; -template +template void finish_one_read(GLuint width, GLuint height) { using T = typename Type::type; @@ -203,7 +203,7 @@ void finish_one_read(GLuint width, GLuint height) } } -template +template void schedule_read(GLuint tex, GLuint width, GLuint height, const char *filename0, const char *filename1, const char *flow_filename, const char *ppm_filename) { using T = typename Type::type; @@ -233,8 +233,8 @@ void compute_flow_only(int argc, char **argv, int optind) if (width1 != width2 || height1 != height2) { fprintf(stderr, "Image dimensions don't match (%dx%d versus %dx%d)\n", - width1, height1, width2, height2); - exit(1); + width1, height1, width2, height2); + abort(); } // Move them into an array texture, since that's how the rest of the code @@ -297,8 +297,8 @@ void compute_flow_only(int argc, char **argv, int optind) GLuint tex0 = load_texture(filename0, &width, &height, WITHOUT_MIPMAPS); if (width != width1 || height != height1) { fprintf(stderr, "%s: Image dimensions don't match (%dx%d versus %dx%d)\n", - filename0, width, height, width1, height1); - exit(1); + filename0, width, height, width1, height1); + abort(); } glCopyImageSubData(tex0, GL_TEXTURE_2D, 0, 0, 0, 0, image_tex, GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, width1, height1, 1); glDeleteTextures(1, &tex0); @@ -306,8 +306,8 @@ void compute_flow_only(int argc, char **argv, int optind) GLuint tex1 = load_texture(filename1, &width, &height, WITHOUT_MIPMAPS); if (width != width1 || height != height1) { fprintf(stderr, "%s: Image dimensions don't match (%dx%d versus %dx%d)\n", - filename1, width, height, width1, height1); - exit(1); + filename1, width, height, width1, height1); + abort(); } glCopyImageSubData(tex1, GL_TEXTURE_2D, 0, 0, 0, 0, image_tex, GL_TEXTURE_2D_ARRAY, 0, 0, 0, 1, width1, height1, 1); glDeleteTextures(1, &tex1); @@ -346,8 +346,8 @@ void interpolate_image(int argc, char **argv, int optind) if (width1 != width2 || height1 != height2) { fprintf(stderr, "Image dimensions don't match (%dx%d versus %dx%d)\n", - width1, height1, width2, height2); - exit(1); + width1, height1, width2, height2); + abort(); } // Move them into an array texture, since that's how the rest of the code @@ -428,7 +428,7 @@ int main(int argc, char **argv) enable_timing = true; - for ( ;; ) { + for (;;) { int option_index = 0; int c = getopt_long(argc, argv, "s:i:g:", long_options, &option_index); @@ -462,13 +462,13 @@ int main(int argc, char **argv) break; default: fprintf(stderr, "Unknown option '%s'\n", argv[option_index]); - exit(1); + abort(); }; } if (SDL_Init(SDL_INIT_EVERYTHING) == -1) { fprintf(stderr, "SDL_Init failed: %s\n", SDL_GetError()); - exit(1); + abort(); } SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8); SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 0); @@ -480,10 +480,10 @@ int main(int argc, char **argv) SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 5); // SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG); window = SDL_CreateWindow("OpenGL window", - SDL_WINDOWPOS_UNDEFINED, - SDL_WINDOWPOS_UNDEFINED, - 64, 64, - SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN); + SDL_WINDOWPOS_UNDEFINED, + SDL_WINDOWPOS_UNDEFINED, + 64, 64, + SDL_WINDOW_OPENGL | SDL_WINDOW_HIDDEN); SDL_GLContext context = SDL_GL_CreateContext(window); assert(context != nullptr);