]> git.sesse.net Git - nageru/commitdiff
Fix a crash in the sample driver.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 23 Oct 2018 20:44:58 +0000 (22:44 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 23 Oct 2018 20:45:00 +0000 (22:45 +0200)
flow_main.cpp

index 1ef44ac55b58ab85281faf903eb18945f2e7eea5..dc82d229ca8b121bcb92496b7a7114ac8b06a1a6 100644 (file)
@@ -261,15 +261,15 @@ void compute_flow_only(int argc, char **argv, int optind)
        glCreateTextures(GL_TEXTURE_2D_ARRAY, 1, &tex_gray);
        glTextureStorage3D(tex_gray, levels, GL_R8, width1, height1, 2);
 
-       GrayscaleConversion gray;
-       gray.exec(image_tex, tex_gray, width1, height1, /*num_layers=*/2);
-       glGenerateTextureMipmap(tex_gray);
-
        OperatingPoint op = operating_point3;
        if (!enable_variational_refinement) {
                op.variational_refinement = false;
        }
-       DISComputeFlow compute_flow(width1, height1, op);
+
+       DISComputeFlow compute_flow(width1, height1, op);  // Must be initialized before gray.
+       GrayscaleConversion gray;
+       gray.exec(image_tex, tex_gray, width1, height1, /*num_layers=*/2);
+       glGenerateTextureMipmap(tex_gray);
 
        if (enable_warmup) {
                in_warmup = true;