Commit Graph
69 Commits
Author SHA1 Message Date
baldurk 92e2899ca3 Add support for DXGI desktop duplication API
* We treat it the same as OpenSharedResource/Handle, an opaque resource fetched
  from elsewhere and wrapped, instantly treated as dirty.
2019-10-22 13:13:36 +01:00
baldurk 24d55fde9f Don't crash in CreateUnorderedAccessView if a NULL descriptor is passed 2019-06-27 10:22:13 +01:00
baldurk 699f8753af Convert ToStr, Serialise, and TypeName to use literal strings 2019-05-15 14:12:17 +01:00
baldurk 0ae245c4a8 Refactor initial state callbacks to always allow deleted resources
* Instead of passing the resource handle itself to GetSize_InitialState or
  Serialise_InitialState, we pass the Id, ResourceRecord, and prepared initial
  contents. All of these can survive past the destruction of the resource.
* Removes the need for AllowDeletedResource_InitialState() - it's always allowed
  now.
* Need_InitialStateChunk is also refactored but it's only used on D3D11
  currently and potentially will be removed in future.
2019-05-14 17:13:22 +01:00
baldurk 0fd6b0c546 Remove forced initial states for resources
* This was used for two things:
  - UAVs on D3D11, which we can just mark dirty at creation as we do
   with things on D3D12/Vulkan where we know we'll always want initial
   states.
  - Texture views/Texture buffers on GL, where we check if the texture
   was referenced and force initial states for the underlying data
   store. This requires a bit more work but can still be achieved by a
   GL-specific force-inclusion pass on the frame references.
2019-05-14 15:30:55 +01:00
baldurk 86ff87863e Update copyright years to 2019 2019-02-01 18:32:13 +00:00
baldurk b3458ad940 Use special GetRowPitch calculation when pitch is needed on D3D
* GetByteSize(width, 1, 1) is normally the right thing except for planar YUV
  formats, where the planes messes up the calculation.
2018-12-12 23:53:35 +00:00
baldurk f75b5e235e Change verify map writes capture option to verify buffer access.
* This option will now toggle on the behaviour to fill undefined buffer contents
  with a marker value, both if they're created without data (it will be zero
  filled instead) or mapped with discard (it will keep the old contents
  instead).
* There were too many hard to find problems or misconceptions about the buffer
  filling for it to be useful. Now it will be opt-in instead.
2018-11-23 11:25:39 +00:00
baldurk 1f961f44d1 Apply backbuffer view format fixup to UAVs. Closes #1104 2018-10-05 18:17:00 +01:00
baldurk 41ba4be01e Don't serialise anything in between serialising buffer & fetching offset 2018-02-16 13:15:22 +00:00
baldurk 919c0f11dd Override type for structured data when directly serialising a ResourceId 2018-02-15 10:57:31 +00:00
baldurk 1ee01e1f82 Apply a normalisation pass over the serialised data
* This is a backwards-incompatible change, so it's done here before v1.0
  so that we can freely break compatibility and not need to define a lot
  of ugly compatibility code.
* The primary motivation is to make the serialised data more uniform
  and have fewer special cases where the serialised form is naturally
  defined from the functions/structs in question.
* There are still some special cases or variances but they should be
  more isolated and only where really necessary.
* Remove some cases in the D3D12 struct serialising where we were
  directly serialising child struct members in the parent struct.
* We now try to match argument/struct member order as closely as
  possible.
* Serialising an array with a count no longer reads the count back out
  into that variable, counts must be serialised separately. This means
  all members/arguments are explicitly present in the structured data
  and also eliminates the awkward case where a count needed to be
  serialised separately after an array if we want to have the count be
  a valid number even if the array could be NULL. It also means we don't
  need the FIXED_COUNT() macro since array lengths can be plain values
  and don't have to be a reference type.
2018-02-14 15:57:53 +00:00
baldurk bdb8c21c81 Give state objects their own resource records
* If we don't track their lifetimes specifically, then we can end up
  with the situation where an application makes more state objects over
  the course of its rendering than is legal (there can only be a max
  4096 unique state objects of each time). This could happen if an
  application creates state objects each frame with slight variances,
  but then releases them again.
2018-02-06 00:21:09 +00:00
baldurk 55ebe38044 Fix replay of ID3D11Device::CreateInputLayout with no input elements
* ID3D11Device::CreateInputLayout will fail if we pass a NULL descriptor
  array pointer, even though 0xdeadbeef will work so it doesn't actually
  use the pointer at all.
2018-02-06 00:21:09 +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 a69efa1702 Refactor debug manager, reducing duplication and better organisation
* In many cases (particularly on D3D11/D3D12) the replay would simply
  forward functions as-is to the debug manager for implementation. This
  meant that change any of those function signatures required more
  tedious copy-pasting than was necessary, and didn't make much sense.
* Now the replay class is responsible for implementing all the
  functionality and owns any debug-only API resources, but can still use
  the debug manager for any indirect utility functions like caching,
  etc.
* The API resources are better organised by task in the replay class
  rather than being all over the place.
* Finally on vulkan, added some helper functions to reduce the
  boilerplate involved in initialising objects.
2018-01-16 16:29:39 +00:00
baldurk e305029ddd Update copyright years to 2018 2018-01-01 17:55:29 +00:00
baldurk b070a371e2 Improve D3D11 predication handling, and track other asyncs independently
* Instead of replaying predication, we now always skip it during replay,
  so all objects will render. This is much more consistent and
  understandable behaviour instead of things mysteriously disappearing
  with no obvious reason why.
* We track the predication that would have happened and replay Begin/End
  pairs so that we can know if the predication *would* have failed.
* This is displayed in the UI (currently in the raster state, for lack
  of a better location) with the pass/fail that would have happened.
* This information can feed into other places for analysis like the
  pixel history.
2017-12-20 23:41:08 +00:00
baldurk d9e3829138 Snoop and disable requests for intel DX11 extensions. Refs #816 2017-12-07 17:57:57 +00:00
baldurk a0063d5dbf Revert debug print that was accidentally committed 2017-11-29 19:01:23 +00:00
baldurk a6ebf09785 Add analytics system - disabled for now
* This is a *very* light-touch analytics system that will track the
  simplest and most anonymous statistics that can be useful in
  determining which features are most used or perhaps underused, and
  where it's best to direct development attention.
* It is entirely implemented in the UI layer, no analytics-gathering
  code exists in the library that's injected into programs, and of
  course no capture data (screenshots, resource contents, shaders, etc
  etc) is transmitted.
* Once it's turned on, it will apply to both development and release
  builds. It tracks stats over a month, and then at the beginning of a
  new month it sends the previous data.
* When the user first starts up a build with analytics if there's no
  previous analytics database then they are informed of the new code and
  asked to approve it. They have the option of selecting to manually
  verify any sent reports, or just opt-ing out entirely.
2017-11-29 19:01:22 +00:00
baldurk 15ddb868e1 Record chunk thread IDs, timestamps and durations 2017-11-24 18:14:23 +00:00
baldurk 1b0fafc872 Fail out of chunk serialisation if API calls fail
* For a few primary cases, we check to see if the API call failed (or is
  looking like it will fail, in the case of vulkan) and bail out. This
  will cause the capture to fail to load.
2017-11-24 18:14:22 +00:00
baldurk 1a879a261b Check for serialisation success in chunk serialise functions
* In each function, we check that serialisation succeeded before going
  on to actually call into the API. If something went wrong, then we
  bail out and fail to load the capture.
2017-11-24 18:14:22 +00:00
baldurk 43d561a4c0 Fix NULL checking and NULL dereferencing issues
* Reported by Coverity Scan - most of these are not an issue and a
  couple of them are coverity getting really confused (like seeing a
  pointer being assigned to NULL and a count to 0, then a few lines
  later declaring that a loop 0..count will dereference the pointer).
* However it's harmless in all cases to add a bit of robustness to keep
  the analysis happy.
2017-11-22 19:11:21 +00:00
baldurk 7a122ac592 Fix some inherited class destruction issues
* Reported by Coverity Scan as non-virtual parent class destructors, but
  the fix didn't need to add virtual functions.
2017-11-22 19:11:16 +00:00
baldurk 4c67de2995 Fix copy-paste errors reported by Coverity Scan 2017-11-22 11:50:37 +00:00
baldurk 3ac3e6c3f1 Fill out resource descriptions in each driver
* For Vulkan and D3D12, we now create a dummy command buffer to ensure
  that there's actually a chunk available to correspond to the command
  buffer that gets submitted or recorded to.
2017-11-17 16:30:50 +00:00
baldurk 0027ff1a10 Change D3D11 device wrappers to new serialisation method 2017-11-07 19:51:46 +00:00
baldurk 9194157eec Add explicit template instantiation of serialise functions 2017-11-07 19:51:45 +00:00
baldurk 3aa3262089 Expose ToStr interface publicly, split out into separate files
* Note that while this is public and uses std::string, because it's a
  template with specialisations in a .inl the string never crosses a
  module boundary - each including module has its own implementation.
* This will be used as part of the upcoming serialisation refactor.
* Some POD structs are still given ToStr implementations as we haven't
  yet switched over the serialisation system to expect all structs to
  have serialise functions.
2017-11-03 16:23:02 +00:00
baldurk 8994bc0fb8 Store resource type with initial contents data 2017-08-31 10:48:16 +01:00
baldurk 5b828c8f9d Add template specialisations for GetIDForResource for most types
* This avoids having to go throug the pool checking when we know
  concretely what type we're looking up, we just need to cast to the
  wrapped type and fetch it.
2017-07-27 16:17:24 +01:00
baldurk bdf2a68c71 Add shader's ID and entry point to the shader reflection struct
* This allows better identification of a shader from its reflection
  bundle. The entry point was already 'optionally' in the debug info
  struct which is no longer a great location for it.
* For APIs where the entry point isn't contractual and it might not be
  listed, instead we just fall back to 'main'. This means that the UI
  or anyone fetching the info can be guaranteed that some sensible entry
  point will be listed.
* Also for the debug info, remove the 'entryFile' index and instead just
  guarantee that as much as possible the entry point will be in the
  first file in the list.
2017-07-05 16:29:26 +01:00
baldurk 9b913de877 Release references to duplicate states before re-using existing wrapper
* Fixes a dangling reference that ends up keeing the D3D11 device alive
  and so leaking a lot of memory each time the capture is opened.
2017-06-29 19:40:26 +01:00
baldurk 33bed23680 Use the wrapped device & context everywhere we can in D3D11DebugManager
* If we create non-wrapped objects for debugging purposes like states
  and scratch buffers, then this can interact poorly with the device
  context which expects all objects bound to it to be wrapped.
* In particular if the pixel history is running and binds an unwrapped
  rasterizer state, then tries to replay a draw which is a command list
  execute the current device context pipeline state is saved (to be
  restored at the end of the command list) and when querying the current
  state an unwrapped object is found and everything blows up.
* There wasn't really a good reason for using unwrapped objects. The
  primary reason to do so is to avoid polluting captures but little of
  this code runs at capture time. We can also filter out debug-only
  objects at replay time by ensuring only things with a valid original
  ID are returned.
* Note we also need to allow for state objects in the capture to be
  duplicates of debug states we created. We already handled this for
  blend states but apparently not for other types of states.
2017-05-31 18:22:26 +01:00
baldurk 1be2e1086a Make sure shader info search paths are always available. Refs #572
* Previously they were only set when replaying a recorded SetPrivateData
  which meant any blob paths specified in the private blob part didn't
  have the search paths configured for locating relative paths.
2017-04-17 12:28:13 +01:00
baldurk 4b60073e81 Workaround for nvidia driver bug - demote IMMUTABLE buffers to DEFAULT 2017-02-21 12:01:22 +00:00
baldurk 030cbfde9a Batch update copyright years everywhere 2017-01-06 12:13:31 +00:00
baldurk 5864c11fa2 Add support for D3D11.3 and D3D11.4 (minor). Refs #235. Refs #145
* Only one major piece of functionality is unimplemented and stubbed out
  - WriteToSubresource and ReadFromSubresource in concert with passing
  a NULL D3D11_MAPPED_SUBRESOURCE parameter to ID3D11DeviceContext::Map.
2016-06-21 21:08:26 +02:00
baldurk 2f65ba9fe8 If a def. context is created mid-capture, immediately start capturing it 2016-06-21 11:36:33 +02:00
baldurk 25d2fea3c9 Support querying for IDXGIResource in OpenSharedResource 2016-06-17 10:14:23 +02:00
baldurk 5f28b745a2 Format code according to newly added clang-format
_  /)
                 mo / )
                 |/)\)
                  /\_
                  \__|=
                 (    )
                 __)(__
           _____/      \\_____
          |  _     ___   _   ||
          | | \     |   | \  ||
          | |  |    |   |  | ||
          | |_/     |   |_/  ||
          | | \     |   |    ||
          | |  \    |   |    ||
          | |   \. _|_. | .  ||
          |                  ||
          |repository history||
          |                  ||
  *       | *   **    * **   |**      **
   \))ejm97/.,(//,,..,,\||(,,.,\\,.((//
2016-05-22 19:41:53 +02:00
baldurk 187c9c4d9f Track input layouts as their own resources 2016-03-07 22:33:47 +01:00
baldurk 3f0ef3a37a Remove INCLUDE_D3D_11_1 and INCLUDE_DXGI_1_2
* There's no longer any reason for them, as dependencies are packed in
  and you don't need the Win 8 SDK installed anymore.
2016-02-07 18:51:02 +01:00
baldurk 2e0ffa7813 Batch update copyright years everywhere 2016-02-07 18:50:45 +01:00
baldurk 607b8d48c9 Remove 'debug' serialiser that synchronously flushes out debug text 2016-02-07 18:42:15 +01:00
baldurk 219bd2d434 Refactor serialisation format with new version
* The main improvement is that instead of just callstack resolving DB
  and frame capture data, some arbtirary number of sections can be
  included, for e.g. adding notes or saving the bookmarks or whatever
  use the user wants.
* Sections (namely the frame capture data) can now be (de)compressed on
  I/O, which leads to much smaller file sizes.
* Also the default internal alignment has changed from 16 to 64 to be
  more future proof (I decided not to go with completely arbitrary
  alignment).
* A path for loading previous version logs remains and will be removed
  at some point in the future, maybe a version or two down the line.
2015-09-14 09:25:46 +02:00
baldurk 193aa5addd Do lazy disassembling of shaders, only when needed. Refs #136
* This is a slightly simpler implementation of the above pull request.
  Only the disassembly is done lazily since everything else is pretty
  much always requested during log reading.
* I didn't measure much difference of this but I think it depends on
  having a lot of shaders with heavyweight shader debug info.
2015-09-12 17:18:49 +02:00
baldurk 4f67e825cf Store DXBCs in WrappedShader for input layouts. Refs #136
* This will allow lazy shader interpretation to just happen in one place
2015-09-12 14:41:13 +02:00