]> git.cworth.org Git - apitrace/blobdiff - helpers/glsize.hpp
gltrace: Handle negative lengths in glShaderSource* (issue #116).
[apitrace] / helpers / glsize.hpp
index c4fe9bf9c866b5aa19c0b4283a9acf3998c39102..2da217f123a24ba3ce3058548f7886c9eb23640c 100644 (file)
@@ -815,6 +815,22 @@ _glClearBuffer_size(GLenum buffer)
     }
 }
 
+
+/**
+ * Helper function for determining the string lengths for glShaderSource and
+ * glShaderSourceARB, which is a tad too complex to inline in the specs.
+ */
+template<class T>
+static inline size_t
+_glShaderSource_length(const T * const * string, const GLint *length, GLsizei index)
+{
+    if (length != NULL && length[index] >= 0) {
+        return (size_t)length[index];
+    } else {
+        return strlen(string[index]);
+    }
+}
+
 /* 
  * attribute list, terminated by the given terminator.
  */