From: Carl Worth Date: Tue, 14 Aug 2012 20:16:05 +0000 (-0700) Subject: Add test to ensure that unused textures are dropped from a trace. X-Git-Url: https://git.cworth.org/git?p=apitrace-tests;a=commitdiff_plain;h=04d4ccf9e644676a9b693f30a4e6a4aaf1fca7df Add test to ensure that unused textures are dropped from a trace. This tests functionality recently added to "apitrace trim". --- diff --git a/cli/.gitignore b/cli/.gitignore index 422bc84..64d0e40 100644 --- a/cli/.gitignore +++ b/cli/.gitignore @@ -1,3 +1,5 @@ !*.trace tri-trim.trace tri-out +glxsimple-ref + diff --git a/cli/CMakeLists.txt b/cli/CMakeLists.txt index b36669c..ba58df5 100644 --- a/cli/CMakeLists.txt +++ b/cli/CMakeLists.txt @@ -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-trim-unused-textures.script") diff --git a/cli/cli-trim-unused-textures.script b/cli/cli-trim-unused-textures.script new file mode 100644 index 0000000..42ce30f --- /dev/null +++ b/cli/cli-trim-unused-textures.script @@ -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"