]> git.sesse.net Git - movit/commitdiff
Remove the support for 1D textures as parameters.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 14 Jan 2014 21:48:42 +0000 (22:48 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Tue, 14 Jan 2014 21:48:42 +0000 (22:48 +0100)
This isn't required anymore after the Gamma{Compression,Expansion}Effect
stopped using it; and after seeing how it was easy to missample them
with regards to texture coordinates, I'm not honestly so sure anymore
they were a good idea in the first place.

effect.cpp
effect.h

index 483828bda88fcabb03b1da4ec23946f4ccab274e..b17c0d62c6d524aa8909ad619c03f228f5b322d4 100644 (file)
@@ -83,34 +83,6 @@ void Effect::register_vec4(const std::string &key, float *values)
        params_vec4[key] = values;
 }
 
-void Effect::register_1d_texture(const std::string &key, float *values, size_t size)
-{
-       assert(params_tex_1d.count(key) == 0);
-
-       Texture1D tex;
-       tex.values = values;
-       tex.size = size;
-       tex.needs_update = false;
-       glGenTextures(1, &tex.texture_num);
-
-       glBindTexture(GL_TEXTURE_1D, tex.texture_num);
-       check_error();
-       glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-       check_error();
-       glTexParameteri(GL_TEXTURE_1D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
-       check_error();
-       glTexImage1D(GL_TEXTURE_1D, 0, GL_LUMINANCE16F_ARB, size, 0, GL_LUMINANCE, GL_FLOAT, values);
-       check_error();
-
-       params_tex_1d[key] = tex;
-}
-
-void Effect::invalidate_1d_texture(const std::string &key)
-{
-       assert(params_tex_1d.count(key) != 0);
-       params_tex_1d[key].needs_update = true;
-}
-
 // Output convenience uniforms for each parameter.
 // These will be filled in per-frame.
 std::string Effect::output_convenience_uniforms() const
@@ -144,13 +116,6 @@ std::string Effect::output_convenience_uniforms() const
                sprintf(buf, "uniform vec4 PREFIX(%s);\n", it->first.c_str());
                output.append(buf);
        }
-       for (std::map<std::string, Texture1D>::const_iterator it = params_tex_1d.begin();
-            it != params_tex_1d.end();
-            ++it) {
-               char buf[256];
-               sprintf(buf, "uniform sampler1D PREFIX(%s);\n", it->first.c_str());
-               output.append(buf);
-       }
        return output;
 }
 
@@ -176,24 +141,6 @@ void Effect::set_gl_state(GLuint glsl_program_num, const std::string& prefix, un
             ++it) {
                set_uniform_vec4(glsl_program_num, prefix, it->first, it->second);
        }
-
-       for (std::map<std::string, Texture1D>::iterator it = params_tex_1d.begin();
-            it != params_tex_1d.end();
-            ++it) {
-               glActiveTexture(GL_TEXTURE0 + *sampler_num);
-               check_error();
-               glBindTexture(GL_TEXTURE_1D, it->second.texture_num);
-               check_error();
-
-               if (it->second.needs_update) {
-                       glTexImage1D(GL_TEXTURE_1D, 0, GL_LUMINANCE16F_ARB, it->second.size, 0, GL_LUMINANCE, GL_FLOAT, it->second.values);
-                       check_error();
-                       it->second.needs_update = false;
-               }
-
-               set_uniform_int(glsl_program_num, prefix, it->first, *sampler_num);
-               ++*sampler_num;
-       }
 }
 
 void Effect::clear_gl_state() {}
index 9d4f247632449cbb2cccaf44000d75343b4b147c..4f740f3cec0015910b4977642b1467570751c5e6 100644 (file)
--- a/effect.h
+++ b/effect.h
@@ -257,31 +257,12 @@ protected:
        void register_vec3(const std::string &key, float *values);
        void register_vec4(const std::string &key, float *values);
 
-       // This will register a 1D texture, which will be bound to a sampler
-       // when your GLSL code runs (so it corresponds 1:1 to a sampler2D uniform
-       // in GLSL).
-       //
-       // Note that if you change the contents of <values>, you will need to
-       // call invalidate_1d_texture() to have the picture re-uploaded on the
-       // next frame. This is in contrast to all the other parameters, which are
-       // set anew every frame.
-       void register_1d_texture(const std::string &key, float *values, size_t size);
-       void invalidate_1d_texture(const std::string &key);
-       
 private:
-       struct Texture1D {
-               float *values;
-               size_t size;
-               bool needs_update;
-               GLuint texture_num;
-       };
-
        std::map<std::string, int *> params_int;
        std::map<std::string, float *> params_float;
        std::map<std::string, float *> params_vec2;
        std::map<std::string, float *> params_vec3;
        std::map<std::string, float *> params_vec4;
-       std::map<std::string, Texture1D> params_tex_1d;
 };
 
 #endif // !defined(_MOVIT_EFFECT_H)