Carl Worth [Thu, 16 Aug 2012 18:33:45 +0000 (11:33 -0700)]
trim: Never trim any glBindTexture calls.
This shouldn't be necessary. I've got a case where trimming out the
glBindTexture of an unused texture changes the behavoir, which
shouldn't be the case.
While I'll still try to track down that bug, this patch provides
conservative behavior that hopefully won't break anything. (The only
real downside is the potential of an implementation getting confused
by a glBindTexture with a value that was not returned by
glGenTextures).
Carl Worth [Fri, 17 Aug 2012 03:32:32 +0000 (20:32 -0700)]
trim: Never trim any textures bound within a display list.
This is conservative. The more efficient approach would create a
resource link from the display list to the texture, but that will wait
for when we actually have display-list resources.
Carl Worth [Fri, 17 Aug 2012 01:29:43 +0000 (18:29 -0700)]
trim: Add support for display lists.
The calls specified between glNewList and glEndList need to have
special treatment. For now we do the simplest thing and
unconditionally include all such calls in the trim output.
Eventually we will want to track display-list resources similar to
textures and trim away unused display lists.
Carl Worth [Fri, 17 Aug 2012 15:09:19 +0000 (08:09 -0700)]
trim: Conservatively make shader programs depend on textures
Some shader programs sample textures, so if the shader is included in
the trimmed output the texture needs to be included as well.
We don't have support inside of "apitrace trim" to parse GLSL to find
names of samplers to find these dependencies. Instead, we provide here
a simple heuristic:
In order to sample a texture, the OpenGL program must associate the
name of a texture unit with a location in the shader by calling
glUniform1i (or glUniform1iv). So we can notice whenever texture-unit
names are being passed and create a dependency from the shader to all
texture targets for that unit.
This is conservative on two fronts:
1. The value being passed to glUniformi might only be coincidentally
the same as a texture-unit name and be actually unrelated to
texture sampling.
2. The shader likely doesn't depend on all texture targets, but
again we can't know which without looking inside the shader, so
we associate all of them.
Carl Worth [Fri, 17 Aug 2012 15:06:51 +0000 (08:06 -0700)]
trim: Perform correct state tracking for glActiveTexture
Not all glBindTexture calls are created equal. With calls to
glActiveTexture intervening, calls to glBindTexture are actually
operating on indenpendent texture units.
It's actually quite easy to simple insert the number of the currently
active texture unit into the name of the texture target resource.
Carl Worth [Wed, 15 Aug 2012 23:35:38 +0000 (16:35 -0700)]
trim: Add a new --print-callset option.
This is useful whenever one has a need to manually tweak the trim operation.
Simply run:
apitrace trim --print-callset --frames=<whatever> --calls=<whatever>
as desired. Then take the resulting callset that is printed and run:
apitrace trim --calls=<callset> --exact
This should yield an identical trimming operation. Then this operation
can be tweaked by appending call ranges to the --calls option,
deleting rangess from the --calls option, or by appending a new
--frames option.
Carl Worth [Wed, 15 Aug 2012 05:32:29 +0000 (22:32 -0700)]
trim: Add a --frames option for selecting frames to trim.
This accepts a "frame set" which has syntax identical to the "call
set" of the existing --calls option. So, one could trim to just the
drawing operations of the first 10 frames of a trace with
--frames=0-9/draw.
Carl Worth [Wed, 15 Aug 2012 00:13:30 +0000 (17:13 -0700)]
trim: Abstract common stringstream idioms into shared functions.
Using the new providef, linkf, and unlinkf functions shrinks the code
a bit. It's tempting to provide <stdargs> functions with full
printf-like formatting, but it's really not necessary as of yet.
Carl Worth [Tue, 4 Sep 2012 18:49:13 +0000 (11:49 -0700)]
trim: Fix bug linking incorrect programs to shaders through samplers.
Previously, the code was mapping locations returned by
glGetUniformLocation and looking in the location map to try ot
determine which program to link in a glUniform1i call. This was
entirely bogus, as distinct programs do not have distinct location
spaces.
The correct answer is to simply track the currently active program and
link it to textures being bound to shaders.
Carl Worth [Tue, 14 Aug 2012 22:20:56 +0000 (15:20 -0700)]
trim: Add support for trimming out unused shaders.
The provide/consume analysis framework is finally starting to show
dividends. This is a fairly significant amount of new functionality
for "apitrace trim" yet it requires relatively little new code.
Carl Worth [Tue, 14 Aug 2012 21:11:19 +0000 (14:11 -0700)]
trim: Drop unused textures while trimming.
We introduce a new dependencies map so that some resources can depend
on other resources, effectively providing a tree of calls that need to
be included when the user requests a particular call be preserved in
the trim.
For example, a SwapBuffers call depends on the "framebuffer".
A rendering operation makes "framebuffer" depend on "render-state".
Enabling texturing makes "render-state" depend on "texture-target-FOO".
Binding a texture makes "texture-target-FOO" depend on "texture-X".
Uploading a texture makes the current call provide "texture-X".
Creating a texture makes the current call provide "texture-X".
This way, if a particular SwapBuffers call is included in the trimmed
output, all of the above will be included. Otherwise, if a SwapBuffers
is trimmed, then the "framebuffer" dependencies will be cleared and
none of the above calls will be included in the trimmed output.
Carl Worth [Tue, 14 Aug 2012 17:26:11 +0000 (10:26 -0700)]
trim: Close some memory leaks.
The parse_call() function allocates an object and returns a pointer,
so we need to explicitly call delete on that object.
Carl Worth [Mon, 13 Aug 2012 21:35:43 +0000 (14:35 -0700)]
trim: Trim most drawing operations outside of the user-specified range
Care is taken to consider a glBegin/glEnd block as a single drawing
operation, (so that it will enitrely included or entirely trimmed).
We're also careful to avoid trimming any drawing operation when there
are active side effects (other than rendering to the default
framebuffer). For example, if there is an active binding of
GL_FRAMEBUFFER or GL_DRAW_FRAMEBUFFER to any buffer object, or if we
are withing a glBeginTransformFeedback/glEndTransformFeedback block;
in any of these cases the drawing operation will not be trimmed.
Carl Worth [Mon, 13 Aug 2012 03:41:50 +0000 (20:41 -0700)]
trim: Avoid doing any analysis past the end of the user-specified range.
This doesn't actually change any results, (the dependency analysis
already ensures that calls beyond the range won't get included).
But this is a nice optimization to prevent wasted time and memory
analyzing these calls that are really easy to reject.
Carl Worth [Sat, 11 Aug 2012 18:46:54 +0000 (11:46 -0700)]
trim: Add a more condensed usage message for error cases.
When explicitly asking for help, ("apitrace help trim" or "apitrace
trim --help"), the complete help message is still provided.
But when an error case triggers a usage message, (such as an invalid
command-line argument), a more compact usage message is provided so as
to not overwhelm the error message (such as "invalid argument:
--foo").
Carl Worth [Sat, 11 Aug 2012 18:33:12 +0000 (11:33 -0700)]
trim: Prune uninteresting calls while trimming (unless --no-prune is passed)
Examine the CALL_FLAG_UNINTERESTING flag and leave out these calls
when trimming. These calls are generally the calls that have no side
effects, (such as query functions). Some calls without side effects
might be considered interesting, (such as glGetError returning a
non-zero error).
This pruning behavior can be avoided by passing the new --no-prune
option (or the new --exact option which is identical to passing both
--no-prune and -no-deps).
Carl Worth [Tue, 4 Sep 2012 23:48:00 +0000 (16:48 -0700)]
trim: Complain if given extraneous arguments.
Previously additional arguments were silently ignored, (which can lead
to confusion if the user expects to be able to specify a bare callset
on the command line rather than specifying a --calls option).
Carl Worth [Fri, 10 Aug 2012 17:15:30 +0000 (10:15 -0700)]
trim: Add framework for performing dependency analysis while trimming
The current analysis is as brain-dead as possible. All calls are
interpreted as affecting the current "state" resource, and all calls
are also interpreted as depending on the current "state". In other
words, no calls at all will be trimmed. Obviously, this is not useful
analysis, but all the framewok is now present for easily doing more
interesting things.
A new --no-deps option is now made available to "apitrace trim" so
that users can avoid all dependency analysis and still get the prior
behavior where only calls explicitly included in the --calls option
are included in the trim output.
José Fonseca [Wed, 21 Nov 2012 09:19:19 +0000 (09:19 +0000)]
docs: Eliminate most references to glretrace.
José Fonseca [Wed, 21 Nov 2012 09:13:32 +0000 (09:13 +0000)]
cli_retrace: Forward all options to retrace program.
José Fonseca [Wed, 21 Nov 2012 08:58:42 +0000 (08:58 +0000)]
cli: Auto-detect retrace for dump-images too.
José Fonseca [Wed, 21 Nov 2012 01:18:49 +0000 (01:18 +0000)]
cli: Guess the retrace excutable adequate for the trace.
José Fonseca [Tue, 20 Nov 2012 21:17:56 +0000 (21:17 +0000)]
d3d10,d3d11: Take the UpdateSubresource box in full consideration.
José Fonseca [Tue, 20 Nov 2012 17:04:39 +0000 (17:04 +0000)]
Merge branch 'union-type'
José Fonseca [Tue, 20 Nov 2012 17:04:24 +0000 (17:04 +0000)]
dump: Pretty print anonymous structure members.
José Fonseca [Tue, 20 Nov 2012 17:03:43 +0000 (17:03 +0000)]
d3d10/d3d11: Complete union support.
José Fonseca [Tue, 20 Nov 2012 15:23:14 +0000 (15:23 +0000)]
d3d10: Add missing flags.
José Fonseca [Tue, 20 Nov 2012 14:48:31 +0000 (14:48 +0000)]
dxgi: Support tracng DWM process.
José Fonseca [Tue, 20 Nov 2012 14:47:03 +0000 (14:47 +0000)]
d3dretrace: Dump d3d10 snapshots too.
José Fonseca [Mon, 19 Nov 2012 19:30:31 +0000 (19:30 +0000)]
d3d10/d3d10_1: Expose DXGI entrypoints.
José Fonseca [Tue, 20 Nov 2012 11:08:08 +0000 (11:08 +0000)]
specs: Initial attempt to support unions.
José Fonseca [Tue, 20 Nov 2012 10:47:10 +0000 (10:47 +0000)]
d3d10/d3d11: Use consistent members for buffer views.
José Fonseca [Sun, 18 Nov 2012 15:45:27 +0000 (15:45 +0000)]
cli: Rename replay -> retrace.
For consistency with the current terminology.
José Fonseca [Sun, 18 Nov 2012 15:45:27 +0000 (15:45 +0000)]
cli: Rename replay -> retrace.
For consistency with the current terminology.
Carl Worth [Mon, 20 Aug 2012 16:45:27 +0000 (09:45 -0700)]
cli: Add a simple "apitrace replay" sub-command.
This calls out to glretrace in order to replay a trace. Currently it
only supports the -w,--wait option, (and not yet any of the profiling
support).
With this command and the existing "apitrace dump-images", we're quite
close to being able to relegate glretrace to an implementation detail
used by the apitrace program, (such that soon, it won't be necessary
to provide glretrace on the user's PATH).
Carl Worth [Sun, 12 Aug 2012 23:36:48 +0000 (16:36 -0700)]
dump-images: Execute glretrace from source dir when running uninstalled
Previously, we've had code to carefully find wrappers and scripts
relative to an apitrace binary being run from an uninstalled
directory. This is extremely useful while testing an experimental
feature before installing said experimental code.
Similarly, provide a findProgram function to do the same thing for an
executable program and use it within "apitrace dump-images" when
invoking glretrace.
Carl Worth [Sun, 12 Aug 2012 23:01:09 +0000 (16:01 -0700)]
Move trace::findWrapper to trace_resource.cpp
It's not actually used outside of trace_tools_trace.cpp, but it is so
similar to the existing trace::findScript in trace_resource.cpp that
there are benefits to having them defined in the same file.
José Fonseca [Sun, 18 Nov 2012 11:57:56 +0000 (11:57 +0000)]
d3d: And d3dcommonsize.hpp too.
sigh..
José Fonseca [Sun, 18 Nov 2012 10:58:56 +0000 (10:58 +0000)]
d3d8: Add missing d3d8size.hpp file.
José Fonseca [Sun, 18 Nov 2012 09:21:48 +0000 (09:21 +0000)]
d3d8: Update specs to match d3d9.
And vice versa.
José Fonseca [Sat, 17 Nov 2012 11:44:43 +0000 (11:44 +0000)]
pickle: Try to silence clang warnings.
José Fonseca [Sat, 17 Nov 2012 11:44:28 +0000 (11:44 +0000)]
gltrace: Rely on polymorphism for indices instead of special case.
José Fonseca [Sat, 17 Nov 2012 10:18:08 +0000 (10:18 +0000)]
gltrace: Respect length argument in glShaderSource(ARB)
José Fonseca [Fri, 16 Nov 2012 22:19:10 +0000 (22:19 +0000)]
tracediff: Merge tracediff2.py and tracediff.py
José Fonseca [Fri, 16 Nov 2012 21:29:40 +0000 (21:29 +0000)]
doc: Update examples to use call 0.
Call numbers start from 0, but examples gave the impression it started
from call 1.
José Fonseca [Fri, 16 Nov 2012 20:06:20 +0000 (20:06 +0000)]
d3d11: Ensure IDXGIFactory1 interface is not forgotten.
José Fonseca [Fri, 16 Nov 2012 20:05:54 +0000 (20:05 +0000)]
specs: Mark CheckMultisampleQualityLevels as no side effects / verbose.
José Fonseca [Fri, 16 Nov 2012 19:13:20 +0000 (19:13 +0000)]
d3d11: Several spec fixes.
José Fonseca [Thu, 15 Nov 2012 13:36:09 +0000 (13:36 +0000)]
retrace: Use different methods for writing int/floats.
More efficient code, less compiler warnings.
José Fonseca [Thu, 15 Nov 2012 13:35:22 +0000 (13:35 +0000)]
gui: Silence unused var warning.
José Fonseca [Thu, 15 Nov 2012 13:35:08 +0000 (13:35 +0000)]
os: Fix thread copy constructor.
José Fonseca [Wed, 14 Nov 2012 14:47:51 +0000 (14:47 +0000)]
retrace: Fix MSVC build.
José Fonseca [Wed, 14 Nov 2012 14:02:35 +0000 (14:02 +0000)]
d3dretrace: More robust against DXGI missing calls.
José Fonseca [Wed, 14 Nov 2012 14:01:56 +0000 (14:01 +0000)]
parse: More flags.
José Fonseca [Wed, 14 Nov 2012 11:46:58 +0000 (11:46 +0000)]
d3dretrace: Basic D3D11 snap-shooting.
José Fonseca [Wed, 14 Nov 2012 11:46:11 +0000 (11:46 +0000)]
parse: recognize more rendering calls.
José Fonseca [Wed, 14 Nov 2012 09:17:35 +0000 (09:17 +0000)]
retrace: Allow multiple dumpers to co-exist.
José Fonseca [Wed, 14 Nov 2012 08:45:58 +0000 (08:45 +0000)]
d3d11: Fix map swizlling.
José Fonseca [Wed, 14 Nov 2012 07:23:22 +0000 (07:23 +0000)]
Merge branch 'modules'
José Fonseca [Wed, 14 Nov 2012 07:21:01 +0000 (07:21 +0000)]
Update use/mention of options.
Carl Worth [Sun, 12 Aug 2012 19:44:50 +0000 (12:44 -0700)]
glretrace: Use getopt rather than manual parsing of command-line options
This allows for better consistency with other apitrace command-line
interface. It also provids for several new full-name options where
previously only a single-letter option was available,
(--snapshot-prefix for -s, --verbose for -v, et.).
We use getopt_long_only here to maintain compatibility with the older
style of long options with one dash (-core) as well as providing the
double-dash version )--core).
It would now be quite convenient to regularize the command-line
interface to glretrace in several ways. None of these are performed in
this commit to avoid breaking compatibility with existing scripts,
etc.:
* Give multi-letter, abbreviated options (--pcpu, etc.) proper
long-form names (--profile-cpu).
* Combine related options under a single name (--pcpu and --pgpu
could be something like --profile=cpu,gpu).
* Combine options with the same meaning that would never be used
independently. Snapshot generation and snapshot comparison are
different modes. Meanwhile, prefix selection and call selection
should apply identically to either mode. So both modes can use a
single set of options (--prefix and --calls) rather than having
separate --snapshot-prefix and --snapshot options.
Carl Worth [Sun, 12 Aug 2012 23:48:10 +0000 (16:48 -0700)]
Move static boolOption function to trace::boolOption
Other programs will also want to be able to parse Boolean command-line
options, so we should share this code in order to easily get
consistent behavior.
José Fonseca [Tue, 13 Nov 2012 22:58:07 +0000 (22:58 +0000)]
wrappers: Cleanup .def files formating.
José Fonseca [Tue, 13 Nov 2012 22:55:40 +0000 (22:55 +0000)]
d3d11: Export DXGI entrypoints.
Some apps use them.
José Fonseca [Tue, 13 Nov 2012 22:38:34 +0000 (22:38 +0000)]
d2d: Silence MinGW linker warnings.
José Fonseca [Tue, 13 Nov 2012 21:37:42 +0000 (21:37 +0000)]
retrace: More diagnostic information.
José Fonseca [Tue, 13 Nov 2012 21:37:24 +0000 (21:37 +0000)]
d3dretrace: Handle Software devices.
José Fonseca [Tue, 13 Nov 2012 19:53:47 +0000 (19:53 +0000)]
d2d: Make it actually work.
José Fonseca [Tue, 13 Nov 2012 11:13:38 +0000 (11:13 +0000)]
trace: Fix thinko on error checking.
José Fonseca [Tue, 13 Nov 2012 09:28:23 +0000 (09:28 +0000)]
d3dretrace: Merge d3d9 and d3d10 retracing.
José Fonseca [Tue, 13 Nov 2012 08:21:15 +0000 (08:21 +0000)]
d2d1,dwrite: Trace both APIs together.
José Fonseca [Sun, 11 Nov 2012 16:11:26 +0000 (16:11 +0000)]
d3dretrace: Drop retraceModule helper
José Fonseca [Sun, 11 Nov 2012 10:05:09 +0000 (10:05 +0000)]
d3dretrace: Single retrace for d3d10 and higher
José Fonseca [Sun, 11 Nov 2012 09:45:06 +0000 (09:45 +0000)]
d3dretrace: Eliminate dependencies from d3d9state.
José Fonseca [Sun, 11 Nov 2012 09:15:09 +0000 (09:15 +0000)]
d3dretrace: Allow multiple dispatches in the same file.
José Fonseca [Sun, 11 Nov 2012 08:48:35 +0000 (08:48 +0000)]
os: DLL abstraction.
José Fonseca [Sun, 11 Nov 2012 00:58:21 +0000 (00:58 +0000)]
gl: Handle ClearBufferData blobs.
José Fonseca [Sun, 11 Nov 2012 00:39:53 +0000 (00:39 +0000)]
d3dretrace: Eliminate differences between d3d9/d3d10.
José Fonseca [Sun, 11 Nov 2012 00:22:33 +0000 (00:22 +0000)]
ddraw: Remove custom tracer.
José Fonseca [Sun, 11 Nov 2012 00:17:00 +0000 (00:17 +0000)]
d2d: Eliminate custom tracers.
José Fonseca [Sun, 11 Nov 2012 00:10:20 +0000 (00:10 +0000)]
specs: Allow an API to spread across multiple modules.
José Fonseca [Sat, 10 Nov 2012 09:50:10 +0000 (09:50 +0000)]
d3d1x: Cleanup specs.
José Fonseca [Sat, 10 Nov 2012 09:29:38 +0000 (09:29 +0000)]
specs: Use StdMethod accurately.
José Fonseca [Sat, 10 Nov 2012 09:14:13 +0000 (09:14 +0000)]
Merge branch 'd2d'
José Fonseca [Sat, 10 Nov 2012 09:11:42 +0000 (09:11 +0000)]
gltrace: Don't use struct for Context.
José Fonseca [Sat, 10 Nov 2012 09:11:19 +0000 (09:11 +0000)]
snappy: Always build with NDEBUG define.
José Fonseca [Sat, 10 Nov 2012 09:11:01 +0000 (09:11 +0000)]
gui: Make FrameDataProvider destructor virtual.
José Fonseca [Thu, 8 Nov 2012 12:29:02 +0000 (12:29 +0000)]
d3dretrace: Fix MSVC build.
José Fonseca [Thu, 8 Nov 2012 10:47:18 +0000 (10:47 +0000)]
d3d11: Trace UpdateSubresource blobs.
José Fonseca [Thu, 8 Nov 2012 10:46:57 +0000 (10:46 +0000)]
retrace: More useful warnings for object mismatches.
José Fonseca [Thu, 8 Nov 2012 10:46:03 +0000 (10:46 +0000)]
d3d10,d3d11: Rudimentary retrace support.
Doesn't work often, in practice because dxgi calls are missing from traces.
José Fonseca [Thu, 8 Nov 2012 10:24:45 +0000 (10:24 +0000)]
d3d10/d3d11: Add sideeffects/internal attributes to specs.
José Fonseca [Thu, 8 Nov 2012 10:23:40 +0000 (10:23 +0000)]
Don't defer arguments when functions fail.
José Fonseca [Wed, 7 Nov 2012 20:00:46 +0000 (20:00 +0000)]
d3dretrace: Basic d3d10 support.
José Fonseca [Wed, 7 Nov 2012 19:31:20 +0000 (19:31 +0000)]
d3dretrace: Add d3d9 prefix to d3d9 specific files.
José Fonseca [Wed, 7 Nov 2012 19:22:20 +0000 (19:22 +0000)]
d3d11: Trace initial data blobs.
José Fonseca [Wed, 7 Nov 2012 19:15:39 +0000 (19:15 +0000)]
d3d1x: Rename d3d10shader -> d3dcommonshader.
José Fonseca [Wed, 7 Nov 2012 19:11:20 +0000 (19:11 +0000)]
d3d11: Catch up with d3d10.
José Fonseca [Wed, 7 Nov 2012 19:10:31 +0000 (19:10 +0000)]
d3d10: Fallback to D3D10DisassembleShader.
Should be always present.
José Fonseca [Wed, 7 Nov 2012 10:20:28 +0000 (10:20 +0000)]
dxva: Fix build for older dxsdk