X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=effect_chain_test.cpp;h=70701b35095511d19c45a5bf39a7e14668d004a0;hp=cf725f1131bb1eae8a1722c1e2989893d8c178be;hb=de9c0e36aae9272c57596541de19790686669b25;hpb=cfc161e0289c2169d4835c48751ff56b97355eb2 diff --git a/effect_chain_test.cpp b/effect_chain_test.cpp index cf725f1..70701b3 100644 --- a/effect_chain_test.cpp +++ b/effect_chain_test.cpp @@ -2,7 +2,7 @@ // // Note that this also contains the tests for some of the simpler effects. -#include +#include #include #include "effect.h" @@ -522,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) { @@ -992,7 +1002,7 @@ TEST(EffectChainTest, IdentityWithOwnPool) { check_error(); glBindTexture(GL_TEXTURE_2D, texnum); check_error(); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, width, height, 0, GL_RGBA, GL_FLOAT, NULL); check_error(); glGenFramebuffers(1, &fbo);