Commit Graph

8610 Commits

Author SHA1 Message Date
baldurk f8d490d9e6 Add newline to end of file to satisfy gcc 2019-02-13 21:21:23 +00:00
baldurk 03a786c8ba Fix missing calling convention on ID3DInclude implementations 2019-02-13 21:04:34 +00:00
baldurk 96d43b6875 Only include glsl_shaders code when building a driver that needs it 2019-02-13 21:03:48 +00:00
baldurk 57b703d2ab Fix compilation on windows with missing calling convention specifier 2019-02-13 20:57:25 +00:00
baldurk b41eb9b91b Remove WireframePS that's no longer used or defined 2019-02-13 18:50:56 +00:00
baldurk bbc2f47fa8 Centralise generation of buffer format strings for struct buffers
* We also fix a number of issues that could cause incorrect formats to be
  generated.
* Test cases added for D3D11/GL/Vulkan to test different struct types. These
  aren't automated at the moment because most of the code they're testing is in
  the UI itself.
2019-02-13 18:50:56 +00:00
baldurk 166bd285ae Add help output when running demos program 2019-02-13 18:50:56 +00:00
baldurk 28e0e17d16 Enable scalar block layout feature in VK_Adv_CBuffer_Zoo 2019-02-13 18:50:56 +00:00
baldurk 014619eaf9 Add D3D11_RESOURCE_MISC_SHARED in GL/DX interop tests
* Necessary for it to work correctly on AMD
2019-02-13 18:50:55 +00:00
baldurk 5e62d828d7 Add support for EGL_EXT/KHR_swap_buffers_with_damage 2019-02-13 18:50:55 +00:00
baldurk 35294607f5 Update docs with new GL extension requirements 2019-02-13 18:50:55 +00:00
baldurk deb3f4d92c On macOS call glFinish before changing away from any context 2019-02-13 18:50:55 +00:00
baldurk eccf1add8a Don't try to compile quadwrite shader if required extensions are missing 2019-02-13 18:50:55 +00:00
baldurk 0df9e33b6b Bind a dummy texbuffer for GL render texture, as macOS seems to need it 2019-02-13 18:50:55 +00:00
baldurk 766c1a9bb9 When patching shaders for separability, declare the extension 2019-02-13 18:50:55 +00:00
baldurk fe0be58908 Implement CGLPlatform using CGL and NSOpenGLContext
* On replay on macOS we use NSOpenGLContext so we can render to windows.
* We have two windowing systems on mac - one for Metal compatible outputs and
  one for OpenGL compatible outputs.
2019-02-13 18:50:54 +00:00
baldurk 69c668c27c Suppress GL hooks on apple while in CGLFlushDrawable 2019-02-13 18:50:54 +00:00
baldurk f250f19e02 Ensure apple hooks work for unsupported functions
* dlsym() seems unreliable if we've interposed the function, so instead fetch
  the function at compile time which works better.
2019-02-13 18:50:54 +00:00
baldurk 9a50a151d0 Use CGL queries to fetch pixelformat details and backbuffer dimensions 2019-02-13 18:50:54 +00:00
baldurk 9ff90117f8 Add glBlendEquationARB alias for glBlendEquation 2019-02-13 18:50:54 +00:00
baldurk d289d3ac20 Remove requirement for ARB_sampler_objects
* We just modify the texture sampler parameters temporarily and restoring them
  when we're done
2019-02-13 18:50:54 +00:00
baldurk f2d092640f Emulate ARB_vertex_attrib_binding on replay if it's not available
* Fortunately the extension doesn't add any functionality that can't be achieved
  through the old bindings, it's just better decoupled.
* What we do is set up our own VAO attrib/binding tracking, and translate all
  the functions (old and new style) into the equivalent modifications of that
  state, then each time a change happens we flush out the attribs and bindings
  using the old attrib functions.
* We also intercept the queries to the new bindings and return the right values,
  so even if loading a capture that uses ARB_vertex_attrib_binding would work as
  expected (as all the translation to old bindings happens under the emulation
  layer).
2019-02-13 18:50:53 +00:00
baldurk 180b6f7cdc Remove use of shading_language_420pack and explicit_attrib_location
* On GL we can manually set these bindings when needed, and then we don't
  require those extensions.
2019-02-13 18:50: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 ac95d0ff48 When ending partially replayed RP, set image back into layout afterwards
* If we have a renderpass that we stop replaying at subpass 0, we want to
  pretend that the image is preserved as it was at that point - layout and all.
  However since we're replaying with the original renderpass any subpass
  transitions and finalLayout transitions will take effect. When we end any
  active RP during vkEndCommandBuffer, we then undo any of these implicit
  transitions to put the image back as it was.
2019-02-13 18:50:53 +00:00
baldurk e73c3a0d6b When plt hooking on linux, need to patch all hooked functions
* If a library is loaded as RTLD_DEEPBIND it might be linked directly against
  libGL, in which case we need to plt hook the functions we care about as well
  as just dlopen.
2019-02-13 18:50:53 +00:00
baldurk 78b03633fa Even RTLD_GLOBAL loads can be linked to libraries we care about
* When a library libBlah.so is loaded, it might be linked to libGL.so. If so, we
  need to go populate our original functions and perform any callbacks when
  libGL.so gets loaded as a dependency. This is true even if the library isn't
  loaded as LOCAL.
2019-02-13 18:50:52 +00:00
baldurk 02abe02fe8 Add the option to save all selected captures at once
* The filename selected is used as a base, then -frameXYZ is appended to each
  capture.
2019-02-13 18:50:52 +00:00
Benson Joeris d438adb701 Fix bug in Intervals<T>::update
When `Intervals<T>::update` was called with `finish=UINT64_MAX`, the loop
condition `i->start() < finish` would remain true for every interval, until `i`
went past the last interval, at which point `i->start()` (and all the other
accesses to `i` within the loop) have undefined behaviuor.
2019-02-13 17:43:33 +00:00
Benson Joeris 2828232ae8 Track frame references to ranges of Vulkan VkDeviceMemorys
The current frame reference tracking handles `VkDeviceMemory`s as single
resource--e.g. if one region of the memory is read, and a disjoint region of the
memory is written, this is treated exactly the same way as if the read and write
were on the same region of the memory.

The new behaviour tracks the frame references for ranges of device memory; this
will be used to improve the detection of device memory that does not require
initialization or resetting.

The `FrameRefType` associated with the entire memory resource (e.g. through
`MarkResourceFrameReferenced`), should now keep an up-to-date maximum of the
`FrameRefType`s of all of the intervals within that memory. Maximum is used here
because `FrameRefType`s with stronger init/reset requirements have larger
values.
2019-02-13 10:59:57 +00:00
Benson Joeris 3bc53094da Add update and merge methods to Intervals<T>
Also updated build files and added tests for `Intervals<T>`.
2019-02-12 16:05:00 +00:00
Benson Joeris a6a1a76ca5 Several improvements for Intervals<T>
Previously, members were accessed as methods of the iterator (e.g.
`iter.start()`); now this becomes `iter->start()`.

This also adds const iterators for `Intervals<T>`, which allows the use of
`const Intervals<T> &`.

The bounds for intervals have been renamed `start` (inclusive lower bound) and
`finish` (exclusive upper bound), to avoid confusion with `begin` and `end`,
used for iterators.

Finally, the behaviour of the old `setValue` method was very confusing, and this
has been replaced by three methods with behaviour that is much easier to
understad: `setValue`, `split` and `mergeLeft`.
2019-02-12 16:05:00 +00:00
Benson Joeris b78f2056c4 Added Clear value to InitReqType
This value is similar to `None`, in that the resource need not be initialized
for correct replay; however, a resource with `Clear` type might be modified in
the frame, where a resource with `None` type may not be modified in the frame.

This distinction may be helpful in initializing the irrelevant initial contents
to some known value (e.g. 0), so that users inspecting these resources don't see
unexpected values (such as a value written later in the frame). `None` resources
need only set this dummy initial contents once, where `Clear` resources need to
reset this dummy initial contents every frame.
2019-02-12 10:09:55 +00:00
Benson Joeris da2375586c Rename FrameRefType values to clarify meanings 2019-02-12 10:09:55 +00:00
Benson Joeris 6fa39fbbcb Add InitReqType to classify FrameRefType by init/reset requirements.
The accumulated `FrameRefType` of the accesses to a resource within a frame
determines how the resource needs to be initialized. The possibilities are:

* `None`: The initial value of the resource is never used within the frame,
  either because it is never read, or because it is only read after being
  cleared
* `InitOnce`: The resource needs to be initialized before replaying the frame
  for the first time, but does not ever need to be reset; this occurs when a
  resource is read within the frame, but not written within the frame.
* `Reset`: The resource needs to be reset each time before replaying the frame.
  This occurs when the resource is read and later written within the frame.
2019-02-12 10:09:55 +00:00
baldurk 264fd6ac39 Fix linux build 2019-02-08 20:19:35 +00:00
baldurk c6b02c4d0c Pull adb logcat from renderdoc into log on host machine
* This makes post-mortem debugging easier. It's only active while a remote
  server connection is running, so e.g. it will miss crashes of the remote
  server itself, this could be improved by adding a margin where it will still
  check for messages after the connection is dropped - perhaps on a separate
  thread.
2019-02-08 19:16:26 +00:00
baldurk dad5d6e074 Display full name if executable has no path markers
* Most likely this executable is an android app and we should display the full
  thing
2019-02-08 19:16:25 +00:00
Haiyu Zhen ca54a910f5 Add --replayhost command line option for qrenderdoc
This allows users to specify which remote host to connect to on startup.
2019-02-07 23:46:33 +00:00
baldurk 4699b459e5 Add trailing / needed on the end of canonical_url for docs 2019-02-07 16:56:19 +00:00
baldurk 852d345bf7 Save the queued frame capture settings with settings files 2019-02-07 15:23:07 +00:00
baldurk ac357a8dec Fix handling of saturate on NaNs in DXBC.
* The definition is specifically using chained min/max which return the other
  argument if one is NaN, so a NaN being saturated is guaranteed to return 0.
2019-02-07 15:23:07 +00:00
baldurk fc9249842a Correct description of float controls - min/max is for decimal places
* This wrongly said that it controlled the number of significant figures.
2019-02-07 15:23:07 +00:00
baldurk be67e91cc7 Add testing of saturate on NaNs in D3D shader debug 2019-02-07 15:23:06 +00:00
baldurk 31fa519e72 Add support for VK_EXT_scalar_block_layout 2019-02-07 15:23:06 +00:00
baldurk fbb6b23b23 Support advanced cbuffer layouts
* This includes 8/16/64-bit integers, 16-bit/64-bit floats, and scalar block
  packing
2019-02-07 15:23:06 +00:00
baldurk 134cdfd09b Add tests to CBuffer Zoos to test alternate uniform sources on APIs
* Vulkan: Specialization constants
* OpenGL: Bare uniforms (not in a UBO)
* D3D12: Root signature constants
2019-02-07 15:23:06 +00:00
baldurk 8ca7730c65 Fixes to fetching bare uniform values 2019-02-07 15:23:06 +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 6bc6ca9557 Drop legacy ShaderRegister struct, store byte offset per constant
* For D3D11 byte offsets are always uint32 aligned, but for other APIs that's
  not guaranteed. Storing a byte offset is strictly more expressive and a lot
  simpler to reason about.
2019-02-07 15:23:06 +00:00