Commit Graph

148 Commits

Author SHA1 Message Date
baldurk edc8fb6bd6 Be more precise with texture remapping to handle integer textures 2019-11-26 17:38:26 +00:00
Steve Karolewics 9b141086c0 Move some functions to common locations for upcoming D3D12 usage.
Some work for shader debugging is identical to setting up the quad
overlay, so I've moved that logic to their own functions.
Some portions of creating a global shader debug state, and the
entirety of the initial shader debug state were agnostic of D3D API,
so they now exist in DXBC code.
2019-11-12 12:33:03 +00:00
baldurk 0bcf9a4e2d Update DX headers to 10.0.18362.0, add new interfaces
* ID3D12GraphicsCommandList5 and ID3D12Device6
2019-09-19 20:09:38 +01:00
baldurk a965a3a703 Remove 'using std::string'
* This will make it easier to replace std::string with rdcstr in future
2019-05-17 16:32:56 +01:00
baldurk 2dc37ac232 Handle creating backbuffer views with non-NULL non-typed descriptor
* We already handle the case where e.g. D3D12_RENDER_TARGET_VIEW_DESC is NULL
  and we need to substitute in a typed descriptor for backbuffers. We didn't
  handle the case where
2019-02-25 15:31:43 +00:00
baldurk e01bc4c734 Implement untested support for D3D12.3/D3D12.4 interfaces. Closes #1268
* Most of the interfaces are not supported - protected sessions, raytracing,
  etc.
* We also split apart the 1/2/3/4 wrapped implementations to avoid uber files.
2019-02-19 17:54:53 +00:00
baldurk 11819ed3be Refactor and clean up internal shaders to be better organised
* Split up old uber-cbuffers used for unrelated shaders into shader-specific
  cbuffers (DebugPixelCBufferData -> TexDisplayPSCBuffer / CheckerboardCBuffer /
  MeshPixelCBuffer).
* Split up HLSL files so not everything is lumped into 'debugdisplay.hlsl' but
  has separate files as appropriate.
* Use #include in GLSL and HLSL to better organise shader code together rather
  than relying on lumping files together on the C++ side.
* Renamed files like 'debugcbuffers.h' to 'hlsl_cbuffers.h'.
* Trimmed out some extensions/cruft that isn't needed in the GLSL side since we
  no longer use separable shaders.
* Combine some shaders like Outline/Checkerboard that were similar into central
  place.
2019-02-13 18:50:53 +00:00
baldurk e79b2d16b2 Tidy up FillCBufferVariables across APIs and share implementations
* On D3D the implementation was severely complicated by two parallel paths - one
  that 'flattened' vec4s out into easy-to-consume format for debugging. Instead
  we do this as a post-process transformation now in the debugging itself.
* Similarly D3D's implementation used DXBC data directly to fetch data, when all
  of the information needed is in the ShaderConstant arrays and used by Vulkan.
  This allows us to share the implementation.
* Only GL still needs its own implementation since it needs to query the API for
  offsets etc as it can change unreliably and can't easily produce a standard
  reflection data. We do share the 'read from buffer data' implementation
  though.
2019-02-07 15:23:06 +00:00
baldurk 351c75e006 Fix some cases handling arrays of matrices
* We also pick the output pixel in the CBuffer_Zoo tests to ensure the API
  agrees with our interpretation of the data.
* Follow-up commit will tidy D3D cbuffer code that needs it.
2019-02-07 15:23:05 +00:00
baldurk 86ff87863e Update copyright years to 2019 2019-02-01 18:32:13 +00:00
baldurk 217b584d15 Fix D3D12 internal refcounting to ensure D3D12 device doesn't leak 2018-12-04 23:54:39 +00:00
baldurk 6a9f74cddb Add some missing refcount releases in D3D12 driver 2018-12-04 23:54:39 +00:00
baldurk 57caf01394 Refactor heatmap for quad overdraw/triangle size to be applied late
* Instead of baking these into the overlay texture and trying to decode them
  afterwards, we instead write a grayscale 16F value into the overlay texture,
  and add a special decode display mode that will use the heatmap and bucketing
  provided.
* This means that saving these overlay textures now saves grayscale. When saving
  to an 8-bit format, we remap to 0-255 so that greater than 1.0 values are
  mapped lower.
2018-11-01 12:23:12 +00:00
baldurk 7115fdd2ef Add missing align to array elements in D3D12 cbuffer decomposition 2018-11-01 12:23:10 +00:00
baldurk d06ea5b8a4 Implement texture remapping to RGBA16/RGBA32 for D3D11/D3D12 2018-10-17 12:48:18 +01:00
baldurk 159a67b853 Implement MSAA to Array colour copies. Closes #1023 2018-10-05 18:16:59 +01:00
baldurk 8d520cd1fb Use non-shader visible descriptor for temp descriptors
* Although not documented or mentioned in the debug layers, when getting a temp
  descriptor for a UAV clear, it must be from a non-shader visible heap.
2018-07-17 20:16:27 +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 72b40769b5 Add support for D3D12 up to D3D12.3. Closes #966 2018-06-07 14:49:07 +01:00
baldurk 1c75a63176 Handle NULL descriptor structs used to init CPU-side descriptors 2018-05-15 19:44:17 +01:00
baldurk a77e6a0acd Read & Serialise D3D12 CPU descriptor contents immediately
* For Clear*View and OMSetRenderTargetViews, the CPU descriptor handles
  used are read immediately, the heap can be modified or even deleted
  after the call.
* So we save the contents of the descriptor, ignore the heap, and then
  fill a temporary heap with the descriptor whenever it's needed.
2018-05-10 15:17:54 +01:00
baldurk 2eb56e4279 Display matrix memory order in cbuffer type column. Refs #800 2018-02-19 11:53:20 +00:00
baldurk f05cfe9454 Fix mesh picking in cases with index/vertex offsets 2018-01-24 15:45:46 +00:00
baldurk 02155f4953 Fix debug initialisation for D3D12 2018-01-16 21:00:18 +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 67835c4d54 Split shader caching and text rendering out of debug manager classes 2018-01-16 16:29:36 +00:00
baldurk f87d058cfb Split out texture rendering and preparation into separate files 2018-01-12 10:55:17 +00:00
baldurk 013457ab5f Split out mesh rendering to separate files 2018-01-12 10:55:16 +00:00
baldurk 635a58280e Split output window handling out of debug files 2018-01-12 10:55:15 +00:00
baldurk db59ffddc6 Split overlay rendering out into separate files in each driver 2018-01-12 10:55:13 +00:00
baldurk 60ed3e2867 Split PostVS implementation out into separate files in each driver 2018-01-12 10:55:12 +00:00
baldurk e305029ddd Update copyright years to 2018 2018-01-01 17:55:29 +00:00
baldurk 6572cd97f5 Tidy up handling of windowing data, make it a bit more type safe 2018-01-01 17:31:19 +00:00
baldurk ed98925eef Generalise progress tracking to allow multiple progress updates
* We track the progress through making a capture as well as the progress
  we already tracked loading a capture.
* Also incidentally fix a copy-paste bug that was calculating the wrong
  progress for loading captures by applying FileInitialRead instead of
  FrameEventsRead for the frame replay.
2017-12-29 18:30:40 +00:00
baldurk ebaefc82a9 Normalise and make python/public interface more consistent
* We enforce a naming scheme more strongly - types, member functions,
  and enum values must be UpperCaseCamel, and member variables must be
  lowerCaseCamel. No underscores allowed.
* eventId not eventID or EID, and Id preferred to ID in general. Also
  for resourceId.
* Removed some lingering hungarian m_Foo naming.
* Some pipeline state structs that are almost identical between the
  different APIs are pulled out into common structs. Where something
  doesn't make sense (e.g. viewport enable for vulkan) it will just be
  set to a sensible default (in that case always true).
* Changed scissors to be x/y & width/height instead of sometimes
  left/top/right/bottom
* Abbreviations are discouraged, e.g. operation not op, function not
  func.
2017-12-22 13:02:36 +00:00
baldurk 1c44f91cb8 Change vulkan/D3D12 to always re-record any cmd buffers being submitted
* Previously we'd cache a copy of each command buffer at load time, and
  submit it any time we're not partially re-recording. This has a couple
  of drawbacks though:
  - Technically we do some things that invalidate those command buffers,
    like updating descriptor sets (with initial state application) and
    so for 100% correctness we'd need to re-record.
  - It also means that any edits we apply, like modified shaders, don't
    properly apply to the whole frame, they only apply to whichever
    command buffer is currently being partially recorded.
* We refactor out the 're-record all commands' behaviour previously
  reserved just for applying GPU counters, and use that for re-recording
  any command buffers that are wholly or partially submitted. Note that
  it's still true that only one primary and one secondary at most are
  actually *partially* re-recorded. The others are re-recorded in their
  entirety.
2017-12-11 19:37:40 +00:00
baldurk 1743424f02 Use bytebuf consistently instead of vector<byte> in driver interfaces 2017-11-27 11:00:42 +00:00
baldurk f7816eb32e Use ToStr for HRESULT/VkResult printing 2017-11-24 18:14:22 +00:00
baldurk 74e25673d2 Fix some integer sign extension/potential overflow issues.
* Reported by Coverity Scan. In all cases, should not be a problem, but
  with an upcast happening anyway we might as well ensure calculation
  happens at a higher precision.
2017-11-22 19:11:22 +00:00
baldurk 203f6b5255 Silence some warnings about casting from one enum type to another
* Reported by Coverity Scan - I don't think any of these were actually
  a problem since the enum definitions all matched.
2017-11-22 19:11:19 +00:00
baldurk 9e5cfa8b96 Add safety to satisfy Coverity on some errors that are likely impossible
* Reported by Coverity Scan
2017-11-22 19:11:14 +00:00
baldurk 25ea14c965 Fix possible division by zero in edge cases
* Reported by Coverity Scan
2017-11-22 12:05:59 +00:00
baldurk c860d8baa3 Fix uninitialized variable warnings from static analysis
* Reported by Coverity Scan
2017-11-22 11:31:07 +00:00
baldurk 8133188a4c Make mesh viewer more robust if no ibuffer is bound on indexed draw 2017-11-10 18:36:05 +00:00
baldurk 3504d2741a Clear PostVS cache when a resource is replaced. Refs #729
* For now, resource replacement implicitly means shader edits, but other
  replacements could also affect the results of PostVS (e.g. buffer or
  state changes). Trying to capture all this state in the cache key is
  not very useful.
* The PostVS cache will be re-filled immediately after, as any
  replacement does a force-refresh of the current event.
2017-11-10 13:01:40 +00:00
baldurk 3aa8398ec2 Update D3D12 command list wrapping code to new serialisation 2017-11-08 18:24:47 +00:00
baldurk dcd22abd13 Update D3D12Replay and initialisation to new code & RDCFile based system 2017-11-08 18:24:43 +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 276783b948 Move custom printf & string_utils out of serialise/ folder 2017-11-03 16:07:46 +00:00
baldurk 5e59616a8c Update rdctype::array to have a more stl-like mutable interface
* For the most part the interface is stl-compatible, but we have a few
  little changes of our own for convenience.
* This class is still needed after deleting the C# UI, because we don't
  want to pass C++ stl structs over module boundaries and possibly run
  into hard to diagnose incompatibilities.
2017-11-03 16:01:58 +00:00