]> git.cworth.org Git - apitrace/blobdiff - retrace/retrace_swizzle.hpp
Rescale the image pixels using the full precision.
[apitrace] / retrace / retrace_swizzle.hpp
index bab6d562e077dedbdd875eb181e1dcce51fda56b..f013b6a0697bbf3ba9eb8ab24675d20342c4fdd0 100644 (file)
@@ -74,6 +74,27 @@ public:
         }
         return it->second;
     }
+
+    /*
+     * Handle situations where the application declares an array like
+     *
+     *   uniform vec4 myMatrix[4];
+     *
+     * then calls glGetUniformLocation(..., "myMatrix") and then infer the slot
+     * numbers rather than explicitly calling glGetUniformLocation(...,
+     * "myMatrix[0]"), etc.
+     */
+    T lookupUniformLocation(const T &key) {
+        typename base_type::const_iterator it;
+        it = base.upper_bound(key);
+        if (it != base.begin()) {
+            --it;
+        } else {
+            return (base[key] = key);
+        }
+        T t = it->second + (key - it->first);
+        return t;
+    }
 };
 
 
@@ -88,7 +109,7 @@ toPointer(trace::Value &value, bool bind = false);
 
 
 void
-addObj(trace::Value &value, void *obj);
+addObj(trace::Call &call, trace::Value &value, void *obj);
 
 void
 delObj(trace::Value &value);
@@ -100,3 +121,4 @@ toObjPointer(trace::Call &call, trace::Value &value);
 } /* namespace retrace */
 
 #endif /* _RETRACE_SWIZZLE_HPP_ */
+