1304 Commits

Author SHA1 Message Date
baldurk fc831982eb Add a 'garbage collection' for cached state objects
* In extreme cases a program can create lots and lots of unique short-
  lived state objects, we cache them all and run out of the 4096 state
  objects that can be around, then further creates fail out.
* To handle this, if we have 4000 total state objects, we release any
  that are purely being held by us (not the program). This isn't an
  ideal solution but it's quite simple and non-invasive, and only has
  a slight impact on rare Create calls.
* Most programs will either create a few up-front (as intended), or at
  worst create a few dozen or even few hundred then re-use them as they
  are cached.
v0.24
2015-04-28 13:42:50 +02:00
baldurk 3dac5fe624 Fix calculation for aligning next serialised buffer. Refs #133 2015-04-28 12:21:36 +02:00
baldurk c58c406b20 Mark subresources with data as having data in serialiser
* This means that Map() calls won't redundantly generate more data on
  top of the data serialised with the texture creation chunk.
2015-04-28 12:17:02 +02:00
baldurk 6ce04a391e Fix comparisons being wrong in previous commit 9273a5b. Refs #123
* Thanks to @loosche for catching this mistake!
2015-04-28 10:34:11 +02:00
baldurk 88da82baa7 Actually handle serialised case of program=0 on replay 2015-04-26 21:04:49 +02:00
baldurk ab876ad78f Allow glUseProgramStages program parameter to be 0, unbinding program(s) 2015-04-26 20:17:16 +02:00
baldurk 2dde5ee52d Make sure MultiDraw calls properly create timeline bar sections 2015-04-25 15:59:58 +02:00
baldurk 63824680ea GS output never uses an index buffer (so mesh preview wasn't rendering) 2015-04-25 13:48:57 +02:00
baldurk 5392fc5c4b Make sure buffer alignment happens everywhere serialising needs to match 2015-04-25 13:44:32 +02:00
baldurk 23404656ce Make sure not to try to set empty text to clipboard 2015-04-25 13:19:48 +02:00
baldurk 7339be3c00 Fix crash if Ctrl-C is pressed while no log is loaded 2015-04-25 13:19:37 +02:00
baldurk 1ba89e4b16 Add Ctrl-C copy-paste handler to GL pipeline viewer
* Also fix a crash if ctrl-c is pressed while no log is loaded
2015-04-25 13:14:20 +02:00
baldurk 5279d58781 Update GL supported features in the documentation 2015-04-24 22:12:30 +02:00
baldurk 2558b2cdea Add ways to detect RenderDoc being injected in D3D11 and OpenGL
* D3D11 you query for interface with UUID of
  {A7AA6116-9C8D-4BBA-9083-B4D816B71B78}. It's just IUnknown*
* GL implements GL_EXT_debug_tool with spec here:
  https://renderdoc.org/debug_tool.txt
  with DEBUG_TOOL_EXT #define'd to 0x6789, DEBUG_TOOL_NAME_EXT to 0x678A
  and DEBUG_TOOL_PURPOSE_EXT to 0x678B. For now, reporting this ext is
  enough to identify RenderDoc.
2015-04-24 22:12:30 +02:00
baldurk f576a80cf7 Update Khronos GL header files, change function signatures to match 2015-04-24 22:12:29 +02:00
baldurk 584d439620 Add util function to align serialised buffers in chunks. Refs #133
* To align a buffer inside a chunk to a wider boundary like 32-bytes in
  this case, the chunk needs to be aligned and the buffer within it also
  needs to be aligned.
* The utility function accounts for the buffer serialised having a
  uint32 length in front of it, so it pads out until that will be at
  the desired boundary. This is a bit of a messy solution, but the
  easiest way to ensure the padding is there while being easily
  backwards compatible with old logs without the padding.
* D3D11 and GL serialise versions are bumped, D3D11 version is backwards
  compatible, GL breaks compatibility.
2015-04-24 11:07:02 +02:00
baldurk 24df051659 Skip any empty-named serialised items in serialiser debug text string 2015-04-24 10:21:04 +02:00
baldurk e35fc400dd Make sure to handle debugging 'invalid' indices
* Crash upload fix
* If a vertex is the strip restart index (displayed as "-1") or is
  reading out of bounds of the index buffer (displayed as "-") then we
  should still allow vertex debugging to go ahead, as if the index were
  just 0.
2015-04-21 21:00:51 +02:00
baldurk 392f9b7f2d Clamp texture view slice to number of slices (sanity checking)
* This should in theory be impossible as you can't create a view that
  points to after the number of slices, and we always make a list of all
  slices, but there was a crash report here so for now we'll just clamp
  so that it doesn't crash completely.
2015-04-21 21:00:51 +02:00
baldurk 3701b46611 Handle glGetIntermalformativ being missing
* Fixes a reported crash.
* This function was only core in 4.2 so it's perfectly valid for it to
  be missing - if so then we just skip using it to determine the size of
  a format and default to 8-bit colour or 32-bit depth/stencil formats.
2015-04-21 21:00:50 +02:00
baldurk 49b2cfc8f6 Compile fix for 53a6a94 2015-04-21 21:00:37 +02:00
baldurk 53a6a94af4 Ensure that texture Map() pointers are aligned to 32 bytes. Refs #133 2015-04-21 20:22:03 +02:00
baldurk c12df371d0 Handle shader filenames that are invalid paths
* If shaders are compiled directly via D3DCompile, the source filename
  can be anything, not necessarily a valid path, so need to handle this
  case.
2015-04-21 20:01:21 +02:00
Baldur Karlsson 33b636658b Merge pull request #135 from valeriog-crytek/master
Some GL fixes
2015-04-20 22:20:46 +02:00
valeriog@crytek.com 218f893be1 Clean up pointers to a GL resource record on buffer destruction.
Fixes potential access violation when glMemoryBarrier is called after a persistently mapped buffer is destroyed.
2015-04-20 16:49:32 +02:00
valeriog@crytek.com e989d50a99 Do not treat output window contexts as legacy.
Avoids using GL_LUMINANCE instead of GL_R8 for glyph texture.
2015-04-20 16:49:31 +02:00
baldurk 7245e9a606 Report WGL_EXT_swap_control in the normal GL extension string 2015-04-20 14:05:31 +02:00
baldurk 8b773afe71 Align D3D buffer memory to 32-byte boundary, for AVX instrs. Refs #133 2015-04-20 13:46:27 +02:00
baldurk 7f61f85201 Fix tooltip on "Allow global process hooking" option. Closes #132 2015-04-20 13:40:35 +02:00
baldurk 6993052c31 Linux compile fixes 2015-04-14 08:05:13 +01:00
baldurk f06964ea23 Clean up folder structure a bit, move .NET 3rdparty under renderdocui/ 2015-04-13 12:46:30 +01:00
baldurk b41b5242d1 Support switching between multiple APIs in the same program. Closes #124
* The core class is now responsible for tracking the active window and
  cycling through, so it can cycle through multiple APIs.
* For GL we only set up associations for capturable windows, and only
  those that present (since helper windows are often created). Since
  GL doesn't really have a 'this window is done rendering' call, we just
  decay old windows that haven't presented in >5 seconds.
* Also on GL, legacy/uncapturable windows aren't associated so they will
  not cycle to at all.
* The embedding API now expects a device pointer and window handle to
  set active window or start/end a capture. You can still pass NULLs if
  there is only one API active.
2015-04-13 11:31:30 +01:00
baldurk d91f36281b Make sure only to delete GL objects that were created in the first place 2015-04-13 10:57:05 +01:00
baldurk 7a1cc84f41 Keep temporary log around to be able to save multiple times. Closes #130
* Previously if a temporary log was saved once, it would be moved there,
  so the user could in theory delete it and lose the only copy of the
  log.
* Now the temporary log is held until it's closed in the UI, to be able
  to be saved again. If the user saves the log though, this will stop
  any "unsaved log" prompts in the main UI window, so there is nothing
  stopping the user from saving the log, deleting that copy, then
  closing and they'll lose the log without prompt.
2015-04-12 18:37:16 +01:00
baldurk 54b2ba86a3 Change function to take const ref instead of copying whole vector 2015-04-11 17:52:08 +01:00
baldurk a5cc19ccc6 Implement replay-side resource tracking for OpenGL
* This means that the timeline bar will show use as read/write/clear etc
  and that right clicking on textures in the texture viewer will show
  the events where that texture is used for rendering, for reading, and
  so on.
2015-04-11 11:03:19 +01:00
baldurk e0e345abd7 Bump GL file serialise version for previous commit 2015-04-11 01:09:28 +01:00
baldurk 3ca65bd632 Allow glDrawElements and friends to pass indices as memory. Closes #127
* This is a concession towards non-core capturing, as it's fairly easy
  to support this fallback case without having a negative effect on the
  proper path.
* We serialise out whether an index buffer was bound, and if it wasn't
  we serialise the array passed as a parameter, and upload it into a
  temporary index buffer we generate (so that the replay is correct at
  least).
* I think technically the indirect parameter for glDrawElementsIndirect
  can point to client memory, and the elements array-of-arrays in
  glMultiDrawElements can definitely point to client memory, but I'm
  assuming that no-one would do that. I certainly hope they wouldn't!
2015-04-10 19:05:21 +01:00
baldurk 95f4011bcb Add option to favour monospaced font for all data. Refs #118
* The option will enable monospaced fonts for all data displays, like
  the list of events, API calls, etc as well as pipeline displays, entry
  of filename/directory in the capture window and many other places.
  Pure UI labelling etc mostly still stays as a serif font.
* A few sizes of controls were tweaked (like headers in the pipeline
  windows) so that they didn't just barely overflow with the larger
  font.
* While looking at this, it became obvious that buffer viewers and
  constant bufferviewers should always display in monospaced regardless,
  so that has been changed.
2015-04-09 21:49:03 +01:00
baldurk 35fa1ce2bf Refuse to capture on old contexts, warn on compat profiles. Closes #125
* If CreateContextAttribs is not used to create the context, the overlay
  will run in super-duper old mode using immediate mode calls and fixed
  function pipeline. This way it should display on (in theory) any GL
  app. Capturing will be prevented.
* Compatibility profile contexts are still allowed, but a warning is
  displayed in the overlay.
* If CreateContextAttribs is used to create a < 3.2 version context, we
  go down the same path as for legacy contexts, except with an accurate
  overlay message (just that the version isn't supported).
2015-04-08 21:43:04 +01:00
baldurk 6fa7d47097 Use CPP variable in makefiles so it can be overridden, rather than g++ 2015-04-08 21:43:03 +01:00
Baldur Karlsson af13f1236e Minor update to COMPILE.md to mention VS2015 working
* At the same time, update the linux compile requirements slightly.
2015-04-07 00:17:07 +01:00
baldurk d8bc653edb Fix infinite loop toggling breakpoint
* Also we don't set the custom assembly context menu when there is no
  trace to debug.
2015-04-06 15:16:53 +01:00
baldurk 3d6c992465 Add a custom right-click menu for disassembly scintilla. Refs #128
* This lets us add custom right-click options like run to cursor, toggle
  breakpoint and toggling between integer and float register display.
2015-04-06 15:10:30 +01:00
baldurk a4c705288c Return a wrapped ID3D11Debug interface when requested
* This prevents the app requesting an ID3D11Debug, getting the *real*
  one, and then escaping our little jail of QueryInterface interfaces.
  In particular, an app is likely to ask for ID3D11Debug then ask for
  ID3D11InfoQueue and we want to control use of that ourselves,
  particularly when we're tracking debug device messages.
2015-04-05 17:33:24 +01:00
baldurk 741d061985 Make sure texture is mipmap complete for min/max and histogram fetch
* If the app hasn't set max level appropriately, we will need to, to be
  sure that filtering doesn't come back just with black.
2015-04-02 17:40:26 +01:00
baldurk 8e7d5382c4 Linux compile fix 2015-04-02 09:41:35 +01:00
baldurk 4f8544e7c6 Handle matrices as shader outputs in GL
* We handle them mostly as a series of rows, adding only the first row
  as a varying name, but incrementing the stride for each to account for
  the space taken up by a matrix.
2015-04-02 00:05:37 +01:00
baldurk c049c37b86 Fix run to instruction checking instruction number vs. trace count
* The trace count could be less than the number of instructions if flow
  control causes some instructions to be skipped (and higher if some
  were repeated!). There's no need to validate this value anyway, RunTo
  will bail when it hits the end of the trace if the number is too high.
2015-04-01 23:43:08 +01:00
baldurk 05dc259656 Make sure popups don't appear outside the controls. Refs #128 2015-04-01 23:42:49 +01:00