]> git.cworth.org Git - apitrace-tests/blobdiff - cli/cli-trim-unused-textures.script
Add test to ensure that unused textures are dropped from a trace.
[apitrace-tests] / cli / cli-trim-unused-textures.script
diff --git a/cli/cli-trim-unused-textures.script b/cli/cli-trim-unused-textures.script
new file mode 100644 (file)
index 0000000..42ce30f
--- /dev/null
@@ -0,0 +1,26 @@
+# Generate reference images from unmodified trace.
+
+# We carefully generate images only for desired frames (dropping the
+# first frame that draws using textures).
+
+rm_and_mkdir glxsimple-ref
+apitrace dump-images --calls=10,31,50,71,87,88 --call-nos=no -o ./glxsimple-ref/ glxsimple.trace
+
+# Trim to the same callset used to generate reference images
+
+apitrace trim --calls=10,31,50,71,87,88 glxsimple.trace
+
+# Verify that we actually trimmed what we wanted to
+
+apitrace diff --diff=diff glxsimple.trace glxsimple-trim.trace
+expect "44,46d43\n< glGenTextures(1, &1)\n< glBindTexture(GL_TEXTURE_2D, 1)\n< glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, blob(3))\n48,57d44\n< glBegin(GL_QUADS)\n< glTexCoord2f(0, 0)\n< glVertex2f(0, 0)\n< glTexCoord2f(1, 0)\n< glVertex2f(64, 0)\n< glTexCoord2f(1, 1)\n< glVertex2f(64, 64)\n< glTexCoord2f(0, 1)\n< glVertex2f(0, 64)\n< glEnd()\n59,60d45\n< glXSwapBuffers(0x236a280, 41943041)\n< \n"
+
+# Generate output images for all frames in the trimmed trace
+
+rm_and_mkdir glxsimple-out
+apitrace dump-images --call-nos=no -o ./glxsimple-out/ glxsimple-trim.trace
+
+# Compare output to reference images
+
+apitrace diff-images -v ./glxsimple-ref ./glxsimple-out
+expect "Comparing ./glxsimple-ref/0000000000.png and ./glxsimple-out/0000000000.png ... MATCH\nComparing ./glxsimple-ref/0000000001.png and ./glxsimple-out/0000000001.png ... MATCH\nComparing ./glxsimple-ref/0000000002.png and ./glxsimple-out/0000000002.png ... MATCH\nComparing ./glxsimple-ref/0000000003.png and ./glxsimple-out/0000000003.png ... MATCH\nComparing ./glxsimple-ref/0000000004.png and ./glxsimple-out/0000000004.png ... MATCH\n"