X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=effect_chain_test.cpp;h=b1f0815cc62d80b604ca5a4fc0f1618d941ca913;hp=25cd50a26839ba5942998d13b872f42ea13225ef;hb=14d06ca86d428e95becfb6bbc8af467d060148b3;hpb=03b416172e9db37845b8c897d51064cbc6b3aa3f diff --git a/effect_chain_test.cpp b/effect_chain_test.cpp index 25cd50a..b1f0815 100644 --- a/effect_chain_test.cpp +++ b/effect_chain_test.cpp @@ -19,6 +19,8 @@ using namespace std; +namespace movit { + TEST(EffectChainTest, EmptyChain) { float data[] = { 0.0f, 0.25f, 0.3f, @@ -520,17 +522,27 @@ class MipmapNeedingEffect : public Effect { 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) { @@ -1019,3 +1031,5 @@ TEST(EffectChainTest, IdentityWithOwnPool) { // Reset the debug status again. movit_debug_level = MOVIT_DEBUG_OFF; } + +} // namespace movit