Commit Graph
75 Commits
Author SHA1 Message Date
baldurk 079a44b4a9 Speculative fix - try to avoid crashes if hooked dlopen is called early
* This isn't particularly stable/nice, probably needs a complete rethink
2015-10-01 00:51:22 +02:00
baldurk 62f7362e92 Move dlopen to be hooked centrally on linux, to be multi-API friendly 2015-08-23 22:23:53 +02:00
baldurk bde6fabf7d Rearrange project structure, so that drivers can be easily disabled
* This is kind of arbitrary at the moment, but in future when D3D12 and
  Vulkan drivers appear, not everyone who builds RenderDoc will want to
  build all drivers, so making them separate projects makes it more easy
  to disable/remove them.
2015-06-29 20:04:47 +02:00
baldurk adaf3b25e6 Remove orphaned file 2015-06-19 22:37:30 +02:00
baldurk 1d96ac2b05 Simplify renderdoc_app.h to remove typedefs and dependency on stl 2015-06-19 22:34:57 +02:00
baldurk 6993052c31 Linux compile fixes 2015-04-14 08:05:13 +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 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 6cd1f70bb6 Fix several warnings for compiling on VS2015
* Note at the time of committing there are still some warnings in MS
  headers that you might need to suppress in a couple of files.
* 3rd party code just has the warnings suppressed for ease of merging.
* The majority of warning fixes were for local variables shadowing
  other locals, function parameters, or members. In most cases they
  weren't a problem, but in some cases it was potentially dangerous!
2015-03-13 10:16:19 +00:00
baldurk 446d7d6da5 Take our own copy of the X connection that we are passed
* We need to copy the X display (by fetching its connection string and
  calling XOpenDisplay), so that if the Display* we had gets closed then
  nothing will crash.
2015-02-25 22:26:45 +00:00
baldurk c9c52537f1 ARB_dsa part 1 - hook DSA functions, implement all but tex* & create*
* Doesn't compile yet! Just splitting this up logically so the change is
  a bit easier to digest.
* I've commented and organised a bit better the gl_hookset.h hook list.
* The function hooks are set up for all of the ARB_dsa entry points.
  Those that are semnatically identical to EXT_dsa are set up as aliases
  (with EXT_ being canonical, so we can fall back if ARB_dsa isn't
  supported - see comments in gl_hookset.h).
* Implemented the new functions except for the glTexture* family and the
  glCreate* family. No deduplication of code yet.
* As with EXT_dsa we "promote" to the DSA function for serialisation,
  but since unlike EXT_dsa we can't assume ARB_dsa is present, instead
  we emulate those functions that we might use unconditionally but may
  not be present.
2015-02-22 23:36:33 +00:00
baldurk ee37bca573 Implement Process::CreateAndInjectIntoProcess on linux
* It's not exactly feature parity but it's a start, and any UI would use
  this under the hood.
* This means at least linux has a semi user-friendly way to launch and
  capture programs - it's limited but you can just use
  $ ./bin/renderdoccmd -c /path/to/program "argument string"
  from the root of the repository.
* Logfile and capture options (which can't be set yet, but you could easily
  hack in something to set them in renderdoccmd.cpp) are passed via
  environment variables to the child process.
2015-01-04 01:02:05 +00:00
baldurk f1f72ec8ff Add process for programs to voluntarily remove renderdoc. Refs #115
* To remove renderdoc (e.g. if the API version doesn't match what is
  expected), user code can call RENDERDOC_Shutdown() to remove the running
  thread and undo any library hooks, then unload the dynamic library.
* This still isn't recommended as there could be unexpected side-effects,
  and it will definitely break if this happens after any APIs have been
  initialised, but it's an option.
2014-12-21 11:30:29 +00:00
baldurk de702ac1d9 Stop filtering wgl extensions, just return all we don't hook as-is
* I will assume for now that any wgl functions I don't explicitly hook have
  no effect on the captured frame and we can safely just let them straight
  through to the real function.
2014-12-20 19:54:46 +00:00
baldurk 3298905d1d Optimise/improve hookset.pl, return dummy function pointers
* Now instead of returning NULL for entry points that we don't support and
  hoping the application will handle that or error out, instead we return
  a function that will log an error if it is ever called, and then pass
  through to the real function. In most cases, the capture will probably be
  broken as whichever function isn't saved.
* hookset.pl is much faster too, it outputs the whole gl_hookset_defs.h
  file and doesn't do multiple searches over the whole set of headers in
  official/ for each function.
2014-12-20 19:54:46 +00:00
baldurk 652f3529a3 Track if a context is core or not, re-check vendor checks on core
* When a compatibility context is created (via the old CreateContext, or
  via an appropriate CreateContextAttribs call), we can still do the vendor
  checks but we want to make sure we perform them again if we ever create a
  core profile context. Note that actually *using* a compatibility context
  isn't supported at the moment, but this won't explicitly break that.
2014-12-14 12:17:41 +00:00
baldurk 2c12423975 Return some WGL extensions that we can easily support. 2014-12-14 00:29:16 +00:00
baldurk c207391b54 Linux compile fixes. 2014-12-12 00:15:45 +00:00
baldurk 5fe0354ce4 Drop use of CONTEXT_FORWARD_COMPATIBLE_BIT, add CORE_PROFILE_BIT 2014-12-11 22:41:11 +00:00
baldurk 12af78d535 Print out the attribs a context is created with 2014-12-11 22:39:35 +00:00
baldurk 11df77cdff Return wglGetSwapIntervalEXT straight 2014-12-11 21:08:19 +00:00
baldurk 9be802082f Add a vendor check to detect if FBOs or VAOs are actually shared
* This lets us detect if the FBO/VAO behaviour is different from the main
  spec, and so we won't miss deletes or other events if the context is
  different since we'll treat them as shared like any other object.
2014-12-11 20:30:34 +00:00
baldurk bda809f9dc Allow GL driver to switch current contexts when really necessary 2014-12-06 20:25:48 +00:00
baldurk 1d0ba67331 Fix for fetching "dll export" functions via getprocaddress on linux 2014-12-05 23:49:50 +00:00
baldurk d30ce5d6b2 Fixes for replay, and populating hooks (call through hooked func) 2014-12-03 18:16:06 +00:00
baldurk 185df924dc Use proper wglGetProcAddress hook 2014-12-03 16:52:37 +00:00
baldurk 2f48158a89 Add some extensions that we already support, and ARB func aliases 2014-12-03 16:03:19 +00:00
baldurk 1061948185 Implement AllowFullscreen (or rather, !AllowFullscreen) for win32 GL 2014-12-03 10:41:37 +00:00
baldurk 4aab1172a4 Save out multisample count on default framebuffer 2014-12-02 23:27:03 +00:00
baldurk 9369c85953 Mute the spam about supported extension functions not being returned 2014-12-02 01:31:35 +00:00
baldurk 15e9b58317 Linux fixes for switch to UTF-8 strings. 2014-12-01 21:40:43 +00:00
baldurk 50d6b62adf Proper SRGB handling in opengl. See gl-320-fbo-srgb
* We create fake backbuffer as SRGB if the original default backbuffer was
  SRGB in the program.
* All of our output backbuffers are also SRGB, and we enable
  GL_FRAMEBUFFER_SRGB when writing to them.
* Add the 'fake' srgb curve applied to linear data to display it as if it
  were srgb, which tends to look intuitively correct even if it's not 100%
  accurate. See the behaviour existing in D3D11 already.
2014-12-01 17:13:30 +00:00
baldurk 2484bc8bc7 Use UTF-8 everywhere possible and only use wchar_t where required.
* This means that all APIs pass byte string types. ALL strings everywhere
  in the entire codebase must be assumed to be and treated as UTF-8 content
  not ASCII.
* Gets rid of all the horrible %hs specifiers that caused warnings on
  linux! Hooray.
* We convert to wide strings, or use wide characters, only when necessary
  to use the Win32 API. Some windows specific code will stay in wide chars
  just for convenience.
* Files are already serialised as UTF-8 strings for linux/windows binary
  compatibility, so this change doesn't break backwards compatibility.
2014-11-23 14:45:16 +00:00
baldurk 6afe7b7cd1 Speculative change to prevent infinite loop of renderdoccmd.exe
* There was a report of renderdoccmd.exe doing --cap32for64 in an infinite
  loop on itself (each process trying to inject the previous). I'm not sure
  how this could get started, but assuming this was happening automatically
  for 'hook into children', try to break the infinite loop by refusing to
  inject into our own exes.
2014-11-16 16:38:48 +00:00
baldurk 643447f521 Fix for hook fetching/populating on capture and replay 2014-11-16 12:34:55 +00:00
baldurk 92d77e32b3 Add missing \s 2014-11-15 00:33:11 +00:00
baldurk 29b4c65162 Work around issue where application 'exports' gl symbols
* This is a bit complex. If an application has a global symbol e.g.
  GLENABLE glEnable; as their function pointers that they fill out from
  glXGetProcAddress, then OUR glEnable global function gets replaced with
  that symbol. It's weird. But it means crashes if we try and return the
  address of that symbol as a function pointer.
* However it's also possible to get the reverse problem - if an application
  has a shared library that has those symbols expecting them to be function
  pointers, those symbols will get overridden with our global functions
  and it will mean an instant crash when they try to assign to those func
  ptrs.
* I'm not sure if there is an ideal fix to this Catch-22, as we also need
  to export these bare functions in case someone just plain links against
  libGL and expects them to be there, with no GetProcAddress/dlsym funny
  business.
2014-11-15 00:13:44 +00:00
baldurk 0f34fbd29a Check that for each new context we populate hooks to get func ptrs 2014-11-14 23:26:18 +00:00
baldurk c5e53f7473 pick up libGL dlsym handle when dlopen() is called 2014-11-14 23:25:15 +00:00
baldurk 65cee274eb Wrap/handle as appropriate new DXGI 1.2 & 1.3 ifaces. Refs #104 2014-11-12 22:55:58 +00:00
baldurk 67e5b28f3b Debug log for which extension functions the app is requesting 2014-11-11 22:54:54 +00:00
baldurk 1fc1e632b3 Just pass-through wglSwapIntervalEXT as we don't care about it 2014-11-11 17:47:55 +00:00
baldurk c406804d24 Bump D3D11 serialise version for ce0a67e8, and add backwards compat
* This is the first attempt at backwards logfile compatibility. Since most
  captures are fairly ephemeral I don't know to what degree I'll go in
  future to support old captures, but since this was a fairly trivial
  example (just skip serialising a bit of data if it's an old version
  without it), I'll test this out.
2014-11-10 17:53:31 +00:00
baldurk ea9054b752 Hack for crash in D3DGear if ppDevice pointer is NULL. 2014-11-09 11:28:48 +00:00
baldurk d3650cc73d Remove wgl/glx from hookset.pl - unused. Also skip blank lines 2014-11-08 13:48:39 +00:00
baldurk 6308d78cd4 Implement debug device/debug api message tracking for GL 2014-11-02 10:52:24 +00:00
baldurk bf46a3fd54 linux compile fixes 2014-11-01 17:04:53 +00:00
baldurk 8d8c8a7c47 Hook into platform delete context function 2014-11-01 17:04:51 +00:00
baldurk 5954f1a406 [Refs #87: Static Analysis] Handle paranoid case of dll not existing 2014-10-05 19:01:22 +01:00
baldurk efbc27909c [Refs #87: Static Analysis] Couple of cases that confused the analyser 2014-10-05 19:01:21 +01:00