]> git.sesse.net Git - movit/blobdiff - effect.cpp
Add output size as a uniform to compute shaders, as an integer; not just the inverse...
[movit] / effect.cpp
index 3446b42c05baab5553ae83f71c69d6ef8467774f..805138f019458320db49ab62a7f746812cdd7bd8 100644 (file)
@@ -21,6 +21,15 @@ bool Effect::set_int(const string &key, int value)
        return true;
 }
 
+bool Effect::set_ivec2(const string &key, const int *values)
+{
+       if (params_ivec2.count(key) == 0) {
+               return false;
+       }
+       memcpy(params_ivec2[key], values, sizeof(int) * 2);
+       return true;
+}
+
 bool Effect::set_float(const string &key, float value)
 {
        if (params_float.count(key) == 0) {
@@ -64,6 +73,13 @@ void Effect::register_int(const string &key, int *value)
        register_uniform_int(key, value);
 }
 
+void Effect::register_ivec2(const string &key, int *values)
+{
+       assert(params_ivec2.count(key) == 0);
+       params_ivec2[key] = values;
+       register_uniform_ivec2(key, values);
+}
+
 void Effect::register_float(const string &key, float *value)
 {
        assert(params_float.count(key) == 0);
@@ -126,6 +142,16 @@ void Effect::register_uniform_int(const std::string &key, const int *value)
        uniforms_int.push_back(uniform);
 }
 
+void Effect::register_uniform_ivec2(const std::string &key, const int *values)
+{
+       Uniform<int> uniform;
+       uniform.name = key;
+       uniform.value = values;
+       uniform.num_values = 1;
+       uniform.location = -1;
+       uniforms_ivec2.push_back(uniform);
+}
+
 void Effect::register_uniform_float(const std::string &key, const float *value)
 {
        Uniform<float> uniform;