Whenever a cursor is captured and the cursor icon changes, it creates a
new texture. This isn't particularly optimal, so instead just store a
cache of cursor textures (based on size), and make the textures dynamic.
Doing this will prevent unnecessary texture reallocation.
Due to an NVIDIA driver bug with the Windows 10 Anniversary Update,
there are an increasingly large number of reports of "Device Removed"
errors and TDRs. When this happens, OBS stops outputting all data
because all graphics functions are failing, and it appears to just
"freeze up" for users.
To temporarily alleviate this issue while waiting for it to be fixed,
the D3D subsystem can be rebuilt when that happens, all assets can be
reloaded to ensure that it can continue functioning (with a minor hiccup
in playback).
To allow rebuilding the entire D3D subsystem, all objects that contain
D3D references must be part of a linked list (with a few exceptions) so
we can quickly traverse them all whenever needed, and all data for those
resources (static resources primarily, such as shaders, textures, index
buffers, vertex buffers) must be stored in RAM so they can be recreated
whenever needed.
Then if D3D reports a "device removed" or "device reset" error, all D3D
references must first be fully released with no stray references; the
linked list must be fully traversed until all references are released.
Then, the linked list must once again be traversed again, and all those
D3D objects must be recreated with the same data and descriptors (which
are now saved in each object). Finally, all states need to be reset.
After that's complete, the device is able to continue functioning almost
as it was before, although the output to recording/stream may get a few
green frames due to texture data being reset.
This will temporarily alleviate the "Device Removed" issue while waiting
for a fix from NVIDIA.
Instead of letting vertex buffer data be freed immediately, store it so
it can be used for rebuilding later. Also, separate the buffer building
to a function.
Unloads all device data and clears all device references. Probably not
necessary, but it's unknown how D3D11 handles this internally so
probably best to be safe.
Branching is not recommended in shaders and only recently gained
widespread support without causing massive branch misprediction issues. Also sampling inside a branch will cause cache misses and additional texture load instructions.
QScreen::availableGeometry() does not return the full screen size on X11
if areas of the screen are reserved by the window manager. In this case
the full screen projector does not cover the whole screen. Using
QScreen::geometry() instead fixes this issue.
The original pull request that added the system tray feature was riddled
with bad pointer usage. Bare pointers that are never properly freed,
never contained within a QPointer or unique_ptr.
These have now been changed to use QPointer variables, and to always
check when the variables are valid before using. The order of
destruction for QMenu that uses the actions has now been prioritized
first before the actions.
When the system tray is not available, the system tray variables would
still be used despite not being initialized.
Fixes mantis bug 640 on linux systems in particular that may not always
have system tray available.
Although FFmpeg is installed, OBS currently fails to build on debian
(tested on Debian Jessie 8.6). It looks for libavcodec.a in
/usr/local/lib and not /usr/lib.
Closesjp9000/obs-studio#661