Commit Graph

461 Commits

Author SHA1 Message Date
baldurk cbc27222e2 Add qrenderdoc python SWIG bindings, for the stable/clean interface 2017-04-18 14:57:43 +01:00
baldurk 7a5bf26325 Add conversions for certain Qt types to/from python native types 2017-04-18 14:57:43 +01:00
baldurk 094c4164dc Refactor qrenderdoc to provide stable, clean and deliberate API
* Note, this API is still in-flux and beta, so there may still be some
  more changes before it's 'stable', and even then it will still be
  subject to some amount of change.
* This API is then exposed to python via SWIG bindings and hides
  internals that don't need to be visible, and means the actual API is
  easier to work with.
* We also use this API to reduce inter-dependencies between different
  windows that need to interact with each other at a high level.
* The naming is python/standard RenderDoc TitleCase method names, not
  Qt style camelCase methods.

# Conflicts:
#	qrenderdoc/Windows/PipelineState/D3D11PipelineStateViewer.cpp
#	qrenderdoc/Windows/TextureViewer.cpp
2017-04-18 14:57:43 +01:00
baldurk 6969b5b677 Fix refcounting and lifetime management around async python callbacks
* We need to keep a PythonContext (and its globals Dict) around while
  we still have some pending callbacks happening. So now the external
  code creates a PythonContext and then releases it when it's done, but
  the context will hang around until the global redirector object is
  destructed, which is responsible for deleting the context.
* The global redirector is deleted when a refcounting cycle is detected
  and the dict is unreachable, which only happens after the context is
  released.
* Any time a callback is passed to something and converted to a
  std::function we add a reference on the global redirector to keep it
  alive. When the callback has finished executing we remove the ref.
* This way, any pending callbacks that have been called but not finished
  or converted (queued) and not called yet asynchronously will keep the
  context object alive to be able to output, handle exceptions, etc.
* Additionally we need to detect when we're being called asynchronously
  and handle exceptions separately instead of trying to propagate up the
  call chain, because there might not be any more python code up the
  chain (e.g. the render manager calling a python callback).
2017-04-18 14:57:42 +01:00
baldurk c49670cfad Add a __str__ function for ResourceId 2017-04-18 14:57:42 +01:00
baldurk 3e1275ed50 Pass PyObject *self along with conversion functions
* We need this object to properly convert any object/pointer to a new
  python owned instance of that type.
2017-04-18 14:57:42 +01:00
baldurk c698fe194e Generalise rdctype typemaps so they can be invoked for multiple types 2017-04-18 14:57:42 +01:00
baldurk dc1ee62730 Generalise function ConvertList to ConvertInPlace
* We'll use the same function for maps and we want to be able to reuse
  the typemaps and things there.
2017-04-18 14:57:42 +01:00
baldurk ab6a868057 Don't rely on TypeName just for error messages calling python callbacks 2017-04-18 14:57:42 +01:00
baldurk 6e1ebf2978 Convert strings directly without using SWIG_AsCharPtrAndSize
* This function is optionally compiled into bindings files so it might
  not be present, there's no need to depend upon it.
2017-04-18 14:57:42 +01:00
baldurk 8c5a2ca34e Remove unused /MANIFESTDEPENDENCY option 2017-04-18 14:57:41 +01:00
baldurk 5adce29b44 Add support for documenting bindings API directly in code 2017-04-18 14:57:41 +01:00
baldurk 2e2a58950a Integrate pyside2/shiboken2 to be able to bind Qt to python
* On linux we make it optional since it's too large a project to add
  as a build step via ExternalProject_add.
2017-04-18 14:57:41 +01:00
baldurk 849f5b443d Change python handling from sub-interpreters to per-context globals
* Using a separate dict for globals/locals for each interpreter means we
  still get separation of variables and no persistence where we don't
  want it, but removing sub-interpreters means pyside can work as it
  uses the PyGILState_ APIs which do not support sub-interpreters.
* We import everything up front then duplicate the __main__ each time we
  create a new context so we keep the __main__ pristine and muck up an
  individual copy.
* Because sys is now shared, the output redirectors that overwrite
  sys.stdout and sys.stderr have a NULL context, and instead they look
  up a specific global which contains the actual context pointer.
2017-04-18 14:57:41 +01:00
baldurk cb510298d8 Add wrapper around tracking a python context and executing scripts 2017-04-18 14:57:41 +01:00
baldurk 12472d93bc Link against python in qrenderdoc 2017-04-18 14:57:41 +01:00
baldurk 66353de7fb Add support for SWIG wrapping python callbacks as std::functions 2017-04-18 14:57:41 +01:00
baldurk 940d3662eb Add SWIG file to generate python bindings for internal replay API
* SWIG outputs two files - renderdoc_python.cpp with the main actual
  wrapping code, and renderdoc.py a small module that does some
  bootstrapping on python side.
* We use a custom version of SWIG that generates strong/typed enums in
  python based on enum classes, so in cmake we add this custom swig
  fork as an external project and compile it before generating the
  wrappers. On windows there's a committed version of the SWIG binary
  that gets run directly from the .pro or .vcxproj.
* The renderdoc.py gets embedded as a resource on windows or as a C
  generated unsigned char array via include-bin on other platforms, so
  that we can insert it into the python context without needing it to
  sit around on disk somewhere in sys.path
2017-04-18 14:57:40 +01:00
baldurk 7c45218df9 Since we no longer use anything from qmake on windows, don't set dirs 2017-04-18 14:57:40 +01:00
baldurk 3e74683a70 Fix qrenderdoc compilation on Win32 2017-04-18 14:57:40 +01:00
baldurk 2e87ca4531 Require qt creator to locate the cmake project to build on non-windows
* Previously the cmake build would put librenderdoc.so in a /bin folder
  in the source folder so the qt creator project could link against a
  fixed path when just opening the project solo.
* This won't scale though for fetching the SWIG outputs from cmake, and
  it's ugly to modify the source folder for out-of-source builds.
* Instead we have cmake generate a qt creator include file with all of
  the settings and paths needed, and pass the CMAKE_BINARY_DIR into
  qmake when building. This does mean that when opening the project in
  qt creator you need to specify CMAKE_DIR=/path/to/build though.
* As a bonus, this means we can let cmake identify where python is and
  have qt creator link against it rather than having to hardcode include
  paths etc.
2017-04-18 14:57:40 +01:00
baldurk fd6fce7a78 Refactor pipeline states to expose opaque string properties as enums.
* Things like addressing modes, stencil operations, and other things the
  UI didn't need to know about previously were only exposed as string
  values to be passed through and displayed.
* Now we describe these with enums so the API can be properly
  introspected and used by consumers that might want to know the actual
  values of these states.
2017-04-18 14:57:40 +01:00
baldurk 8262bd2770 Refactor viewport to have X/Y separate members instead of TopLeft[2] 2017-04-18 14:57:38 +01:00
baldurk f1df7423e2 Standardise pipeline object names with name/customName where relevant 2017-04-18 14:57:38 +01:00
baldurk 587fba0b68 Rename DirectoryFile/FileProperty to Path, and re-use struct in OS code
* They describe directories or files, and really describe a single path
  on the remote system.
2017-04-18 14:57:38 +01:00
baldurk 637d4089e2 Rename colour to color in public API code
* Following the principle of least surprise, color tends to be more
  commonly used in APIs and graphics code even outside the USA.
2017-04-18 14:57:37 +01:00
baldurk 4887ecc851 Remove InvocationIndex shader builtin and remap it
* We map it to either GSInstanceIndex or OutputControlPointIndex
2017-04-18 14:57:36 +01:00
baldurk 0ad5709df3 Remove poorly chosen 'Fetch' prefix from a few data structures.
* This goes all the way back to the first iterations where these were
  the only structures and 'Fetch' referred to them returning data from
  the core code to the UI.
2017-04-18 14:57:36 +01:00
baldurk 1be8c70da6 Make ResourceId::id member private, add ResourceId::Null() 2017-04-18 14:57:35 +01:00
baldurk ce4a99b7b8 Rename ShaderResource::IsSRV to a more generic IsReadOnly property 2017-04-18 14:57:35 +01:00
baldurk 96f11095da Change type of FrameStatistics::recorded to bool32 to be more accurate 2017-04-18 14:57:35 +01:00
baldurk 018dcb073c Rename uavWrite to more generic directShaderWrite 2017-04-18 14:57:35 +01:00
baldurk 36ed9fdc70 Remove unused rawType from SpecialFormat 2017-04-18 14:57:34 +01:00
baldurk c44f355380 Remove nested structs from D3D12 pipeline state and move to namespace 2017-04-18 14:57:34 +01:00
baldurk af33e5d296 Remove nested structs from Vulkan pipeline state and move to namespace 2017-04-18 14:57:34 +01:00
baldurk 9e23443356 Remove nested structs from GL pipeline state and move to namespace 2017-04-18 14:57:34 +01:00
baldurk b4d3401866 Remove nested structs from D3D11 pipeline state and move to namespace
* Moving into a namespace makes it easier to give the structs non-clumsy
  names while still being unique and not overlapping with the other API
  pipeline states.
2017-04-18 14:57:33 +01:00
baldurk d40fc8471d Change API enums to enum class, remove now redundant prefixing
* This gives a little nicer syntax, a bit better type safety, and also
  reflects better for SWIG bindings. Overall it's a minor change but
  better.
* We don't update the C# UI at all, since it's soon to be removed and
  not worth the effort/code churn.
* For now so we're ABI compatible with C#, all enums are uint32_t, but
  that is an obvious optimisation in future to reduce struct packing.
* We avoid 'None' as an enum value, because it's a reserved word in
  python so will cause problems generating bindings.
2017-04-18 14:57:33 +01:00
Peter Gal 588eb083db Remove obsolete workarounds to force shared library linking
As the --no-as-needed linker option was added there is now
no need to force link to GL/EGL shared libraries via
extern methods.
2017-04-17 02:39:29 -07:00
Peter Gal 081f65dff1 Disallow the linker to ingore shared libraries during linking
In some cases when the renderdoccmd/qrenderdoc is linked the linker
ignores the libEGL.so and only uses the librenderdoc.so.
This is because the renderdoc shared library provides the
same symbols as the libEGL.so. However we need to keep the
libEGL.so as we are using RTLD_NEXT in the renderdoc shared
library.
2017-04-17 02:39:29 -07:00
Michael Rennie 3b8aefa061 Make filename column resize to text, needed for long package names.
Previously the empty Size & Date columns resize to their headers, and the
Filename column gets squashed. Also made the dialog wide enough.
2017-04-08 08:12:14 -07:00
baldurk 2978755d54 On D3D11, any non-CS stage can access OM UAVs. Refs #564 2017-04-06 11:46:44 +01:00
baldurk 5f3b75739d Don't try to view buffers with ViewTexture 2017-04-06 11:46:44 +01:00
Dimitris Kapnopoulos 6e06eb5164 Added tooltips for all QToolButtons. RDSplitter checks for valid index.
handleDoubleClicked in RDSplitter checks if the index argument is less than zero or bigger than count
2017-03-28 02:54:15 -07:00
Dimitris Kapnopoulos d3faa58a78 Added Tips Dialog. Changed Tips_SeenFirst to Tips_HasSeenFirst 2017-03-21 04:09:47 -07:00
baldurk d2d86b5726 Add 'floateleven' buffer format for R11G11B10 packed data, fix unpacking 2017-03-20 13:02:20 +00:00
baldurk 8016dea558 Add RDSplitter to project filters file as well as the project proper 2017-03-20 12:13:19 +00:00
baldurk 487a1b7903 Start moving towards C++ only UI code. Assume C++ for the replay API
* The C# P/Invoke stuff doesn't directly use the header, and we are soon
  going to deprecate the C interface entirely.
2017-03-13 17:56:00 +00:00
baldurk 705462b43c Add RDSplitter to visual studio project 2017-03-13 17:23:38 +00:00
Dimitris Kapnopoulos 4ab61286e4 Added custom Splitter class, RDSplitter, with titles in the handles 2017-03-13 10:02:43 -07:00