]> git.sesse.net Git - movit/blobdiff - dither_effect.h
Fix an issue where a (cached) shader program could be used from multiple
[movit] / dither_effect.h
index f9f371c0c5f5f2025761164bc386ec42665e7fdf..921a1ef5e1130ca6184e401fe06e8b267b4c67e2 100644 (file)
 // like many LCD monitors do, but it starts to get very hairy, again, for limited gains.)
 // The dither is also deterministic across runs.
 
 // like many LCD monitors do, but it starts to get very hairy, again, for limited gains.)
 // The dither is also deterministic across runs.
 
-#include <GL/glew.h>
+#include <epoxy/gl.h>
 #include <string>
 
 #include "effect.h"
 
 #include <string>
 
 #include "effect.h"
 
+namespace movit {
+
 class DitherEffect : public Effect {
 private:
        // Should not be instantiated by end users;
 class DitherEffect : public Effect {
 private:
        // Should not be instantiated by end users;
@@ -64,6 +66,7 @@ public:
        // premultiplied error. However, we need to do dithering in the same
        // space as quantization, whether that be pre- or postmultiply.
        virtual AlphaHandling alpha_handling() const { return DONT_CARE_ALPHA_TYPE; }
        // premultiplied error. However, we need to do dithering in the same
        // space as quantization, whether that be pre- or postmultiply.
        virtual AlphaHandling alpha_handling() const { return DONT_CARE_ALPHA_TYPE; }
+       virtual bool one_to_one_sampling() const { return true; }
 
        void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num);
 
 
        void set_gl_state(GLuint glsl_program_num, const std::string &prefix, unsigned *sampler_num);
 
@@ -75,7 +78,11 @@ private:
        int texture_width, texture_height;
 
        GLuint texnum;
        int texture_width, texture_height;
 
        GLuint texnum;
-       bool need_texture_update;
+       float uniform_round_fac, uniform_inv_round_fac;
+       float uniform_tc_scale[2];
+       GLint uniform_dither_tex;
 };
 
 };
 
+}  // namespace movit
+
 #endif // !defined(_MOVIT_DITHER_EFFECT_H)
 #endif // !defined(_MOVIT_DITHER_EFFECT_H)