This commit fixes a bug that occurs on Windows 8+ when two or more
"Display Capture" sources are active that are configured to capture the
same monitor. Only one display capture would show, while all subsequent
display captures would display nothing.
Closesjp9000/obs-studio#1142
(Note: This commit also modifies libobs-d3d11 and libobs-opengl)
Allows the ability to flush data directly without having to use the
buffer's internal data.
Allows the caller to manage his/her own vertex/index buffer data if
desired, working around the design flaw of having to rely on a
vertex/index buffer's internal data.
It looks like the link between the gs layer rgba enable flags and the
underlying D3D states never got fully implemented.
This change adds the missing piece, fixing an issue I had in a plugin
wherein I couldn't write a blended value to a RGBA render target without
also changing the alpha of the dest pixel. Debugging that led to the
missing gs_enable_color functionality.
Closesjp9000/obs-studio#1064
Prevents an issue where the output duplicator would cause the program to
crash if the graphics driver crashes and the graphics subsystem needs to
be rebuilt.
Sometimes when rebuilding a texture, it often has to fall back and
create a temporary texture, but it'll fail when trying to create a
shader resource for it. The suspicion is because it's due to not having
the proper shader binding flag when creating that temporary texture, so
this fixes that possible loophole.
There's no need to reset vertex buffers like this anymore. This would
unintentionally cause certain things (such as the freetype text source
on windows) to stop rendering properly.
Fixes a bug where loading vertex shaders could cause error messages
about mismatching vertex buffer data to appear because the vertex shader
would try to reload the previously used vertex buffer.
When rebuilding the graphics subsystem, it's possible a shared texture
may no longer be available. In this case, just soft fail and allow the
texture to be rebuilt rather than crash the entire program over it.
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.
When DirectX throws error 0x887A0005 (DXGI_ERROR_DEVICE_REMOVED),
Microsoft recommends calling ID3D11Device::GetDeviceRemovedReason to
retrieve a more precise error code.
Closesjp9000/obs-studio#652
This allows the ability to separate the blend states of color and alpha.
The default blend state has also changed so that alpha is always added
together to ensure that the destination image always gets an alpha value
that is actually usable after the operation (for render targets).
Old default state:
color source: GS_BLEND_SRCALPHA, color dest: GS_BLEND_INVSRCALPHA
alpha source: GS_BLEND_SRCALPHA, alpha dest: GS_BLEND_INVSRCALPHA
New default state:
color source: GS_BLEND_SRCALPHA, color dest: GS_BLEND_INVSRCALPHA
alpha source: GS_BLEND_ONE, alpha dest: GS_BLEND_ONE
Someone's going to yell at me about this, but fix vertical alignment for
certain member variables in the main header.
For future reference, if you must use vertical alignment, always give it
plenty of space for the type names to grow in case you need to
add/change variables in the future; don't just align to the 'longest'
value, give it an extra 8-16 spaces for potential future variables.
This is done to prevent having to make commits like this in the future
that sort of pollute the history.