# 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 --auto -o glxsimple-trim-unused-textures.trace --calls=10,31,50,71,87,88 glxsimple.trace # Verify that we actually trimmed what we wanted to apitrace diff --diff=python glxsimple.trace glxsimple-trim-unused-textures.trace expect r""" glXChooseVisual(37134976, 0, (GLX_RGBA, GLX_RED_SIZE, GLX_RED_SIZE, GLX_GREEN_SIZE, GLX_RED_SIZE, GLX_BLUE_SIZE, GLX_RED_SIZE, GLX_ALPHA_SIZE, GLX_RED_SIZE, GLX_DOUBLEBUFFER, GLX_DEPTH_SIZE, 24, GLX_STENCIL_SIZE, GLX_RED_SIZE, GLX_X_VISUAL_TYPE, GLX_DIRECT_COLOR, 0)) = ([37179128, 34, 0, 24, 5, 16711680, 65280, 255, 256, 8]) glXCreateContext(37134976, ([37179128, 34, 0, 24, 5, 16711680, 65280, 255, 256, 8]), 0, True) = 37241648 glXMakeCurrent(37134976, 41943041, 37241648) = True glViewport(0, 0, 64, 64) glMatrixMode(GL_PROJECTION) glLoadIdentity() glOrtho(0.0, 64.0, 64.0, 0.0, 0.0, 1.0) glMatrixMode(GL_MODELVIEW) glClearColor(0.0, 0.0, 1.0, 1.0) glClear((GL_COLOR_BUFFER_BIT)) glXSwapBuffers(37134976, 41943041) glCreateShader(GL_VERTEX_SHADER) = 7 glShaderSource(7, 1, ('void main()\n{\n gl_Position = ftransform();\n}\n'), 0) glCompileShader(7) glCreateShader(GL_FRAGMENT_SHADER) = 8 glShaderSource(8, 1, ('#version 120\nuniform vec4 color;\nvoid main()\n{\n gl_FragColor = color;\n}\n'), 0) glCompileShader(8) glCreateProgram() = 9 glAttachShader(9, 7) glAttachShader(9, 8) glLinkProgram(9) glUseProgram(9) glGetUniformLocation(9, color) = 0 glUniform4f(0, 0.0, 1.0, 0.0, 1.0) glBegin(GL_QUADS) glVertex2f(0.0, 0.0) glVertex2f(64.0, 0.0) glVertex2f(64.0, 64.0) glVertex2f(0.0, 64.0) glEnd() glUseProgram(0) glXSwapBuffers(37134976, 41943041) - glGenTextures(1, (1)) glBindTexture(GL_TEXTURE_2D, 1) - glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, blob(3)) glEnable(GL_TEXTURE_2D) - glBegin(GL_QUADS) - glTexCoord2f(0.0, 0.0) - glVertex2f(0.0, 0.0) - glTexCoord2f(1.0, 0.0) - glVertex2f(64.0, 0.0) - glTexCoord2f(1.0, 1.0) - glVertex2f(64.0, 64.0) - glTexCoord2f(0.0, 1.0) - glVertex2f(0.0, 64.0) - glEnd() glDisable(GL_TEXTURE_2D) - glXSwapBuffers(37134976, 41943041) glClearColor(1.0, 0.0, 0.0, 1.0) glClear((GL_COLOR_BUFFER_BIT)) glXSwapBuffers(37134976, 41943041) glCreateShader(GL_VERTEX_SHADER) = 10 glShaderSource(10, 1, ('void main()\n{\n gl_Position = ftransform();\n}\n'), 0) glCompileShader(10) glCreateShader(GL_FRAGMENT_SHADER) = 11 glShaderSource(11, 1, ('#version 120\nuniform vec4 color;\nvoid main()\n{\n gl_FragColor = color;\n}\n'), 0) glCompileShader(11) glCreateProgram() = 12 glAttachShader(12, 10) glAttachShader(12, 11) glLinkProgram(12) glUseProgram(12) glGetUniformLocation(12, color) = 0 glUniform4f(0, 1.0, 0.0, 1.0, 1.0) glBegin(GL_QUADS) glVertex2f(0.0, 0.0) glVertex2f(64.0, 0.0) glVertex2f(64.0, 64.0) glVertex2f(0.0, 64.0) glEnd() glUseProgram(0) glXSwapBuffers(37134976, 41943041) glGenTextures(1, (2)) glBindTexture(GL_TEXTURE_2D, 2) glTexImage2D(GL_TEXTURE_2D, 0, GL_COMPRESSED_RGBA, 1, 1, 0, GL_RGB, GL_UNSIGNED_BYTE, blob(3)) glEnable(GL_TEXTURE_2D) glBegin(GL_QUADS) glTexCoord2f(0.0, 0.0) glVertex2f(0.0, 0.0) glTexCoord2f(1.0, 0.0) glVertex2f(64.0, 0.0) glTexCoord2f(1.0, 1.0) glVertex2f(64.0, 64.0) glTexCoord2f(0.0, 1.0) glVertex2f(0.0, 64.0) glEnd() glDisable(GL_TEXTURE_2D) glXSwapBuffers(37134976, 41943041) glXDestroyContext(37134976, 37241648) """ # 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-unused-textures.trace # Compare output to reference images apitrace diff-images -v ./glxsimple-ref ./glxsimple-out expect r"""Comparing ./glxsimple-ref/0000000000.png and ./glxsimple-out/0000000000.png ... MATCH Comparing ./glxsimple-ref/0000000001.png and ./glxsimple-out/0000000001.png ... MATCH Comparing ./glxsimple-ref/0000000002.png and ./glxsimple-out/0000000002.png ... MATCH Comparing ./glxsimple-ref/0000000003.png and ./glxsimple-out/0000000003.png ... MATCH Comparing ./glxsimple-ref/0000000004.png and ./glxsimple-out/0000000004.png ... MATCH """