]> git.sesse.net Git - movit/blobdiff - fft_pass_effect.h
Forgot to increment version.h for bounce override; doing so now.
[movit] / fft_pass_effect.h
index f12bda7e416ce3eeefe0f02e55ea4f0bbefa59a9..53428bd8d31a3f82360615a2ec20b0cac3653cd5 100644 (file)
 // scaling), and as fp16 has quite limited range at times, this can be relevant
 // on some GPUs for larger sizes.
 
-#include <GL/glew.h>
+#include <epoxy/gl.h>
 #include <assert.h>
 #include <stdio.h>
 #include <string>
 
 #include "effect.h"
 
+namespace movit {
+
 class FFTPassEffect : public Effect {
 public:
        FFTPassEffect();
@@ -83,6 +85,7 @@ public:
        // in our own phase, which is exactly what we want.
        virtual bool needs_texture_bounce() const { return true; }
        virtual bool changes_output_size() const { return true; }
+       virtual bool sets_virtual_output_size() const { return false; }
 
        virtual void inform_input_size(unsigned input_num, unsigned width, unsigned height)
        {
@@ -96,16 +99,32 @@ public:
                *width = *virtual_width = input_width;
                *height = *virtual_height = input_height;
        }
+
+       virtual void inform_added(EffectChain *chain) { this->chain = chain; }
        
-       enum Direction { HORIZONTAL = 0, VERTICAL = 1 };
+       enum Direction { INVALID = -1, HORIZONTAL = 0, VERTICAL = 1 };
 
 private:
+       void generate_support_texture();
+
+       EffectChain *chain;
        int input_width, input_height;
        GLuint tex;
+       float uniform_num_repeats;
+       GLint uniform_support_tex;
+
        int fft_size;
        Direction direction;
        int pass_number;  // From 1..n.
        int inverse;  // 0 = forward (FFT), 1 = reverse (IFFT).
+
+       int last_fft_size;
+       Direction last_direction;
+       int last_pass_number;
+       int last_inverse;
+       int last_input_size;
 };
 
+}  // namespace movit
+
 #endif // !defined(_MOVIT_FFT_PASS_EFFECT_H)