Commit Graph

499 Commits

Author SHA1 Message Date
baldurk 2bc81b8617 Don't try to recreate breakpad server if it's still running 2018-08-13 18:27:26 +01:00
baldurk 9b7581011e Add a per-capture API to target control protocol
* This means that if an application uses more than one API, the correct API is
  listed for each capture.
2018-08-13 18:27:26 +01:00
baldurk a81e4a2b45 Pass through and allow different source shader encodings when editing
* This means e.g. the D3D11 back-end can accept DXBC directly if the UI can
  provide it, or compile from HLSL as before.
* More importantly, the Vulkan back-end can take SPIR-V compiled from any
  source, or compile from GLSL as before as a fall-back.
2018-08-09 16:56:52 +01:00
baldurk a4dfad6e82 Add a backend query to check shader encodings BuildTargetShader allows
* This will allow the backend to specify both the native format (e.g. SPIR-V,
  DXBC) as well as a language it might be able to internally compile (GLSL or
  HLSL).
* The caller will then able to decide for itself whether it wants to compile to
  native format and pass that down, or pass the language down and let it be
  built internally.
* Currently BuildTargetShader still only accepts shader source.
2018-08-09 16:56:51 +01:00
baldurk 8e2a2b13c1 Clean up handling of internal resources
* This reduces code complexity and divergence between the backends, as well as
  prevents internal resources in captures from being included when 'Ref All
  Resources' is enabled.
2018-08-06 16:48:04 +01:00
baldurk 34b1d0ecf9 Fetch all samples when caching MSAA textures for replay proxy 2018-08-01 17:29:39 +01:00
baldurk c70c116bd7 Refactor hooks towards more unified/clean approach
* Hooking is now done the same way across platform, with different OS
  implementations.
* Regardless of how exactly hooks are implemented, we register libraries to hook
  and functions to hook within those libraries, and provide a location to store
  the original/onwards function pointer. This allows hooking to work whether
  it's done using import hooking that doesn't modify target libraries (so using
  dlsym or GetProcAddress will return the same value for the onwards function
  pointer) or whether it's implemented with prologue patching and trampolines,
  where we'd create an infinite loop if we did that.
* We also provide stronger guarantees - the original function pointers will
  _always_ be made available as soon as the library is loaded, whether hooked or
  not, no exceptions. This means less uncertainty in hooking code about when or
  how onward functions will be available.
* OS-specific hook functions are changed to just be implementations of
  LibraryHooks functions rather than indirected through macros and pre-processor
  definitions.
* In this commit we provide some temporary functions providing the old interface
  to reduce churn - the library-specific hook code will be updated shortly after
2018-07-06 22:44:20 +01:00
baldurk 0d329b213f Add remap for RGBA4 2018-06-21 17:46:15 +01:00
baldurk 53364adeef Support mesh output from different view indices on vulkan
* When using VK_KHR_multiview you can select which view to view the mesh data from.
2018-06-19 20:48:30 +01:00
baldurk 0dda96a045 Change previous/next/parent IDs in DrawcallDescription to pointers
* This is a legacy holdover from the C# interop not being able to preserve
  pointers easily.
2018-06-18 18:39:06 +01:00
baldurk 14e3a3d360 Move API-agnostic pipeline state wrapper into core interface
* There's no need for this to be in the UI, and moving it allows it to be used
  from script which is very useful.
2018-06-18 18:39:06 +01:00
baldurk 8024c8c342 Store and serialise resources in D3D12 descriptors by id directly
* The problem with storing resource pointers in descriptors is that it can be
  invalidated without detection - a kind of A-B-A problem - if the resource is
  deleted and then another resource is allocated with the same pointer.
* Descriptor creation in D3D12 is extremely complex and there are many ways a
  resource could become incompatible with the descriptor metadata struct.
  Detecting all possible ways a new resource could be incompatible is not
  feasible.
* As a solution, we store the ResourceId which we know is immutable, serialise
  via the pointer, and keep the live ResourceId on replay. If the resource was
  deleted, the serialisation will fail because we look up the pointer at the
  point of serialise, and a deleted resource will end up being NULL.
* To try and abstract this away and avoid potential confusion with the
  ResourceIds, we make the descriptor contents private and provide accessors.
2018-06-18 15:20:08 +01:00
baldurk 4b11dce193 Fix linux compilation 2018-06-13 20:54:30 +01:00
baldurk b36b1fa453 Change remote server version to be == RenderDoc version
* Any time the replay types serialisation change, the remote server becomes
  incompatible. We're not going to add backwards compatibility to that system,
  so we need to break it every time.
* Really the version should be bumped any time renderdoc_serialise.inl changes,
  but we don't have an auto-incrementing revision to use.
2018-06-13 17:40:02 +01:00
baldurk abd67a7702 Add some DX12 performance optimisations
* Switches some contended mutexes for R/W locks
2018-06-13 09:17:03 +01:00
Amit Prakash c82ff2de93 Move DX12 debug layer flag out of common code
Change-Id: I5c0a80c772b470be7970abe428cfd2f7a7ea17dd
2018-05-24 21:42:30 +01:00
Amit Prakash 288e0239c2 Fix Baldur review
Change-Id: I4430d0ec658ec9859226086a879c3e134a20b5e4
2018-05-24 21:42:30 +01:00
baldurk 858b02480b Pass command-line args as 'intent args' when launching apk. Refs #987 2018-05-24 21:42:29 +01:00
baldurk 851a88133a Remove the 'save all initials' option. Behave as if it's always enabled
* This option has always been a mixed bag - when originally written captures
  weren't compressed at all so saving the cost of a initial contents on a
  gbuffer would have a significant savings.
* Now with compression the savings are lesser, and it's a source of
  bugs/confusion for the case where either a bug is caused by leaking data from
  the previous frame or worse still the contents are discarded incorrectly.
* D3D11 will now behave as the other APIs will - saving initial contents
  whenever needed even if they seem like they might not be used.
2018-05-23 16:08:44 +01:00
baldurk 1a5b189441 [Coverity] Fix uninitialised variable warnings 2018-05-08 12:22:45 +01:00
baldurk 6e57e17f8e Update tinyexr to 9b30f253 - latest as of the time of this commit 2018-05-07 18:42:26 +01:00
baldurk 79637f6caa Expose which drivers support RGP, and add command to create RGP profile 2018-04-25 19:10:50 +01:00
baldurk 4dca51ae0b Include EID in shader reflection cache key for GL. Closes #951
* On GL shader reflection is mutable but only between different events
  (we can expect it to be consistent/cacheable for a single event).
* We don't want to delete shader reflection pointers out from under the
  UI, and it's not feasible to invalidate all pointers it might hold at
  any point - e.g. previous to this change when a ReplayLog happens.
* Instead we just add another dimension to the cache key and allow the
  cache to bloat more on GL, preserving possibly redundant reflection
  objects.
2018-04-09 17:11:26 +01:00
Baldur Karlsson 449eef4b9b Implement query for IDXGraphicsAnalysis with DXGIGetDebugInterface1
Closes #897
2018-03-12 15:46:44 +00:00
baldurk 3fe8ad4e3f Rename 'ResourceId' structured data type to just 'Resource' 2018-02-24 23:22:24 +00:00
baldurk b74f917975 Add application API version 1.1.2, with renamed log file -> capture file 2018-02-20 20:33:30 +00:00
baldurk 13c1cf6ad4 Return ReplayStatus when launching/injecting, use to indicate JDWP error
* If android studio or other android tools are open when a package is
  launched for debugging, they greedily jump on it and connect which
  prevents us from connecting.
2018-02-20 11:54:57 +00:00
baldurk 1792673864 Show an error message if saving changes fails 2018-02-19 00:52:14 +00:00
baldurk 934800793a Improve workflow for capture import/export
* If the export doesn't need buffers, we export directly from the loaded
  capture file instead of re-loading it.
* Add progress bars for the load step so it shows what's happening
  instead of looking stalled.
* Reduce compression rate on XML+ZIP buffers as it took too long trying
  to compress when exporting large captures.
2018-02-19 00:52:13 +00:00
baldurk 64406b47a3 Add an SDBasic type for ResourceId.
* This type is core enum and used globally (not API specific) that it
  merits becoming a specific structured data type
2018-02-15 10:21:52 +00:00
baldurk 04fac1d6f8 Use android properties to pass capture options to the device 2018-02-14 19:22:23 +00:00
baldurk 8368f9b8be Stringify ResourceIds consistently as "ResourceId::12345"
* This means even strings generated in the core code will become
  richtext in the UI.
2018-02-13 21:10:01 +00:00
baldurk 03fc5929cc Fix a typo leading to mis-reporting of import/export format capabilities 2018-02-12 20:47:55 +00:00
baldurk d3bf628394 Handle opening vulkan shaders that are not in a pipeline.
* Previously we were relying on the pipeline info create to initialise
  the reflection for an entry point, now we do it on demand wherever it
  is needed.
2018-02-09 19:03:55 +00:00
baldurk 8622471277 Reset android vulkan layer property as late as possible
* We can't reliably know when we can safely remove the layer property
  at capture time because it's impossible to know if an android app will
  use vulkan or not. So instead we fall back to unsetting it whenever we
  need to - before opening a capture or when shutting down the remote
  server (in case after capturing, no frame capture was actually opened)
* This means that if the UI crashes without unsetting it, we will poison
  the state, but this seems unavoidable.
2018-02-09 14:02:31 +00:00
baldurk 13dd17d6f2 Always 'release' the preview window even if it wasn't created.
* This helps on android where we might fail to create the preview window
  if our app isn't in the front, but we still want to let the base loop
  know that we're done previewing and let it go back to the generic
  splash screen.
2018-02-02 18:40:28 +00:00
baldurk 427a89db0b Create parent directory for file transfers to remote server 2018-02-01 18:25:31 +00:00
baldurk 627d23b937 Recreate proxy preview window if it's out of date 2018-01-31 18:24:16 +00:00
baldurk 1778e4028d Don't do any injection if the library is already present
* We assume that if the user injected libVkLayer_GLES_RenderDoc.so then
  it's either a vulkan app and that's sufficient, or they linked
  against it.
* Injecting our libraries over the top of that could cause problems -
  at worst crashes, or at best we could end up with nested hooking with
  double overhead, or the loaded renderdoc library won't be the one that
  hooks and the workflow will break.
2018-01-31 14:36:56 +00:00
baldurk 5527c57e68 Split out some miscellaneous utility functions
* We also wrap up and cache the fetching of friendly names by serial
  number to avoid some adb traffic.
2018-01-26 16:30:16 +00:00
baldurk ae7300e524 Move android files to separate subfolder 2018-01-26 15:49:09 +00:00
baldurk b22f93f458 Avoid remote server timing out if starting android packages.
* Android::StartAndroidPackageForCapture can take a long time, and we
  want to preserve the connection, so we spin up a temporary thread to
  continually Ping().
2018-01-26 15:42:15 +00:00
baldurk 24db8dbffc Add an 'internal' flag when launching processes, to reduce log spam 2018-01-26 15:33:17 +00:00
baldurk 6614c37440 fix compilation on linux/android 2018-01-26 00:55:36 +00:00
baldurk b17790e5c2 Batch vulkan initial state related allocations together
* We allocate chunks of 32MB - 256MB then suballocate as needed.
2018-01-25 18:18:47 +00:00
baldurk d452230782 Refactor resource manager initial content data to be driver-specific
* This allows more flexible construction of what params/resources need
  to be saved with initial contents data, as well as allowing better
  type safety where possible by using driver-specific types for the
  stored data.
* Especially it tidies up the ugly 'all data that tags along must be
  a written into a single allocated byte pointer'.
* The initial content struct is responsible for destroying itself and
  freeing any data.
2018-01-25 15:30:20 +00:00
baldurk 736d991d6a Pass configuration parameters to ResourceManager in struct
* Otherwise adding new parameters becomes impractical
2018-01-25 11:30:25 +00:00
baldurk 5150a9531b Allow queuing a sequence of frames both before capture, or while running
* We also make the frame counting consistent: Frame 0 is the frame from
  device initialisation to first present, Frame 1 is from first present
  to second, and so on after that.
2018-01-24 11:38:37 +00:00
baldurk 91dbfc4cc6 Ensure we tidy up progress ticker and callback even if replay fails 2018-01-22 20:04:17 +00:00
baldurk 92808efc93 If the preview window becomes available later, then init it later
* E.g. on android this can happen if we started the replay while the
  replay apk wasn't in the foreground, but then it gets raised later.
2018-01-22 20:04:17 +00:00