//
// Note that this also contains the tests for some of the simpler effects.
-#include <GL/glew.h>
+#include <epoxy/gl.h>
#include <assert.h>
#include "effect.h"
#include "effect_chain.h"
#include "flat_input.h"
#include "gtest/gtest.h"
+#include "init.h"
#include "input.h"
#include "mirror_effect.h"
#include "multiply_effect.h"
using namespace std;
+namespace movit {
+
TEST(EffectChainTest, EmptyChain) {
float data[] = {
0.0f, 0.25f, 0.3f,
public:
MipmapNeedingEffect() {}
virtual bool needs_mipmaps() const { return true; }
+
+ // To be allowed to mess with the sampler state.
+ virtual bool needs_texture_bounce() const { return true; }
+
virtual string effect_type_id() const { return "MipmapNeedingEffect"; }
string output_fragment_shader() { return read_file("mipmap_needing_effect.frag"); }
+ virtual void inform_added(EffectChain *chain) { this->chain = chain; }
+
void set_gl_state(GLuint glsl_program_num, const string& prefix, unsigned *sampler_num)
{
- glActiveTexture(GL_TEXTURE0);
+ Node *self = chain->find_node_for_effect(this);
+ glActiveTexture(chain->get_input_sampler(self, 0));
check_error();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
check_error();
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
check_error();
}
+
+private:
+ EffectChain *chain;
};
TEST(EffectChainTest, MipmapGenerationWorks) {
expect_equal(data, out_data, size, size);
}
-extern bool movit_initialized;
-
// Does not use EffectChainTest, so that it can construct an EffectChain without
// a shared ResourcePool (which is also properly destroyed afterwards).
// Also turns on debugging to test that code path.
float out_data[6];
EffectChain chain(width, height);
- movit_initialized = false;
- init_movit(".", MOVIT_DEBUG_ON);
+ movit_debug_level = MOVIT_DEBUG_ON;
ImageFormat format;
format.color_space = COLORSPACE_sRGB;
expect_equal(expected_data, out_data, width, height);
// Reset the debug status again.
- movit_initialized = false;
- init_movit(".", MOVIT_DEBUG_OFF);
+ movit_debug_level = MOVIT_DEBUG_OFF;
}
+
+} // namespace movit