]> git.cworth.org Git - apitrace-tests/commitdiff
Add test to ensure that unused textures are dropped from a trace.
authorCarl Worth <cworth@cworth.org>
Tue, 14 Aug 2012 20:16:05 +0000 (13:16 -0700)
committerJosé Fonseca <jose.r.fonseca@gmail.com>
Sat, 1 Dec 2012 10:15:48 +0000 (10:15 +0000)
This tests functionality recently added to "apitrace trim".

cli/.gitignore
cli/CMakeLists.txt
cli/cli-trim-unused-textures.script [new file with mode: 0644]

index 422bc8407ef1f1e3303a6c743b88423a061753c6..64d0e40eec460417b053620f39ff418d713f759d 100644 (file)
@@ -1,3 +1,5 @@
 !*.trace
 tri-trim.trace
 tri-out
 !*.trace
 tri-trim.trace
 tri-out
+glxsimple-ref
+
index b36669cc52e86b1eed54fb3b86a30c8dd1d993ef..ba58df56d827c3583b028a1af6bee23a0fa280da 100644 (file)
@@ -25,3 +25,4 @@ endfunction ()
 add_cli_test(NAME "cli-diff-images.script")
 add_cli_test(NAME "cli-diff-images-mismatch.script")
 add_cli_test(NAME "cli-trim-single-swapbuffers.script")
 add_cli_test(NAME "cli-diff-images.script")
 add_cli_test(NAME "cli-diff-images-mismatch.script")
 add_cli_test(NAME "cli-trim-single-swapbuffers.script")
+add_cli_test(NAME "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"