Commit Graph

143 Commits (b8c78a340d12cecad290c16688cbd12c842a7983)

Author SHA1 Message Date
jp9000 cea0a1e73a libobs-d3d11: Disable NV12 textures if NVENC unavailable
On NVIDIA devices, disable NV12 textures if NVENC unavailable just as a
safety precaution.
2019-02-26 12:09:00 -08:00
jp9000 ccd801b03e libobs-d3d11: Blacklist certain adapters from NV12
Some older adapters apparently can't handle NV12 properly.  Wonderful.
2019-02-26 08:37:55 -08:00
jp9000 28860411dd libobs-d3d11: Improve check for NV12 texture support
Checks to make sure that DXGI_FORMAT_NV12 is actually supported by the
GPU.
2019-02-25 23:02:54 -08:00
jp9000 925f72c8c3 libobs-d3d11: Fix rebuild of NV12 textures
When NV12 textures were added, driver crashes and their rebuild process
was not taken in to consideration.  This fixes that by adding explicit
NV12 rebuild functions.
2019-02-17 17:42:48 -08:00
jp9000 86f82c952a libobs-d3d11: Actually use paired NV12 member variable 2019-02-17 17:42:48 -08:00
jp9000 e09c63914e libobs-d3d11: Don't inline rebuild funcs
Inlining these functions is pretty pointless.
2019-02-17 17:42:48 -08:00
jp9000 93fc61fa82 libobs/graphics: Add NV12 texture support 2019-02-07 17:00:46 -08:00
jp9000 b64d7d71d0 libobs/graphics: Add texture sharing functions 2019-02-07 17:00:46 -08:00
jp9000 35dc89f5ca libobs-d3d11: Use mip levels are used in resource view 2018-09-28 16:37:48 -07:00
Alex Anderson af67086912 libobs: Add HLSL annotation parsing
Gives the ability to retrieve param annotations. Blocks wrapped in <>
following a parameter.

For example:
float slider < float max_value = 10.0; float min_value = 0.0; >;

These blocks are not for shading purposes but to help describe the
shader's gui as in the example above.

Adds graphics api functions for retrieving annotations:
size_t gs_param_get_num_annotations(const gs_eparam_t *param);

gs_eparam_t *gs_param_get_annotation_by_idx(const gs_eparam_t *param,
		size_t annotation);

gs_eparam_t *gs_param_get_annotation_by_name(const gs_eparam_t *param,
		const char *name);
2018-09-08 05:22:12 -07:00
SuslikV dbfcbac3e4 libobs-d3d11: Do not allow Alt+Enter interception
Prevents Alt-Enter from attempting to automatically fullscreen an OBS
graphics display.

Closes obsproject/obs-studio#1248
2018-04-20 22:34:22 -07:00
Wouter 65f81105f5 libobs-d3d11: Allow multiple display captures of same monitor
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.

Closes jp9000/obs-studio#1142
2018-01-09 19:49:54 -08:00
jp9000 0d6204c8af Fix a number of MSVC warnings
Fixes a number of warnings with all modules
2017-12-05 13:53:44 -08:00
jp9000 c111fa68b8 libobs: Add vertex/index buffer "direct" flush functions
(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.
2017-11-27 03:00:20 -08:00
Micah Elizabeth Scott b55bb44845 libobs-d3d11: Fix gs_enable_color
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.

Closes jp9000/obs-studio#1064
2017-11-25 18:12:52 -08:00
jp9000 e74a007718 libobs-d3d11: Allow rebuild even if output duplicator fails
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.
2017-11-16 20:49:56 -08:00
Richard Stanway 58e2e69f81
libobs-d3d11: Better error message for missing D3DCompiler 2017-06-25 22:27:59 +02:00
jp9000 aafe08db5c libobs-d3d11: Fix potential issue rebuilding shared texture
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.
2017-06-24 05:44:32 -07:00
jp9000 b775e579cb libobs-d3d11: Fix shader const array size miscalculation
When a shader constant was an array, the size of the array wouldn't be
factored in to the actual constant size and constant buffer size.
2017-06-20 18:20:15 -07:00
jp9000 e6f9a73235 libobs-d3d11: Fix bug where vertex buffers would be reset
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.
2017-05-20 19:37:28 -07:00
jp9000 ea6efc9514 libobs-d3d11: Only load vertex buffer before drawing
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.
2017-05-15 23:57:53 -07:00
Ryan Foster be98cee2a0 Fix various typos across multiple modules 2017-04-25 22:39:42 -04:00
jp9000 8cc5f8de55 libobs-d3d11: Don't crash if unable to rebuild shared texture
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.
2016-12-21 16:09:12 -08:00
jp9000 d2bb7157c2 libobs-d3d11: Add optional macro to log shader disassembly 2016-11-25 12:01:31 -08:00
jp9000 f6fae9b7e9 libobs-d3d11: Remove possible null pointer dereference 2016-11-06 16:49:02 -08:00
jp9000 bd5de5d938 libobs-d3d11: Include GDI surface in rebuild
The GDI surface was not included in the rebuild process, therefore when
window capture is used, it would cause a crash after a rebuild.
2016-11-06 16:46:38 -08:00
jp9000 8e8834f109 libobs-d3d11: Rebuild device and assets if device removed/reset
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.
2016-11-03 09:23:24 -07:00
jp9000 5eb0c4ec83 libobs-d3d11: Add Release funtions to all GS objects
Releases references for each graphics object.
2016-11-03 09:23:23 -07:00
jp9000 54737c9c68 libobs-d3d11: Remove unused function 2016-11-03 09:23:22 -07:00
jp9000 951c6892b0 libobs-d3d11: Use linked list for all objects (for rebuilding) 2016-11-03 09:23:21 -07:00
jp9000 5c71f79d5f libobs-d3d11: Make shared texture error message less vague 2016-11-03 09:23:20 -07:00
jp9000 ecd5b4ee81 libobs-d3d11: Save all D3D11 object descriptors (for rebuilding) 2016-11-03 09:23:19 -07:00
jp9000 bab77c2afd libobs-d3d11: Store static vertex buffer data (for rebuilding)
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.
2016-11-03 09:23:18 -07:00
jp9000 61042e2bc4 libobs-d3d11: Store static textures in RAM (for rebuilding) 2016-11-03 09:23:17 -07:00
jp9000 e4900751c3 libobs-d3d11: Store device adapter index (for rebuilding) 2016-11-03 09:23:16 -07:00
jp9000 6d18ae39c5 libobs-d3d11: Store swap initialization data (for rebuilding) 2016-11-03 09:23:15 -07:00
jp9000 bc0faf9a3c libobs-d3d11: Clear device state before unloading
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.
2016-11-03 09:23:14 -07:00
jp9000 a5ed61e02e libobs-d3d11: Store index and add "Start" function
This allows restarting the duplicator at a later point in time.
2016-11-03 09:23:13 -07:00
jp9000 75cd6b4ab4 libobs-d3d11: Correct error message creating blend states 2016-11-03 09:23:12 -07:00
jp9000 66bdf43e44 libobs-d3d11: Correct error message for staging surfaces 2016-11-03 09:23:11 -07:00
jp9000 7321cc38e8 libobs-d3d11: Store shader samplers as pointers
This allows having them be a part of a linked list later.
2016-11-03 09:23:10 -07:00
jp9000 d4d0cd479d libobs-d3d11: Correct error message for pixel shaders 2016-11-03 09:23:09 -07:00
jp9000 1ecb1550af libobs-d3d11: Store compiled shader data (for rebuilding) 2016-11-03 09:23:08 -07:00
jp9000 29eea269fc libobs-d3d11: Store dxgi adapter used for device
Keeping a reference is useful, and additionally allows pruning a bit of
duplicated code in the dupicator object.
2016-11-03 09:23:07 -07:00
Ryan Foster 487ef58ee7 libobs-d3d11: Log GetDeviceRemovedReason
When DirectX throws error 0x887A0005 (DXGI_ERROR_DEVICE_REMOVED),
Microsoft recommends calling ID3D11Device::GetDeviceRemovedReason to
retrieve a more precise error code.

Closes jp9000/obs-studio#652
2016-10-07 01:07:00 -07:00
jp9000 4dc0024198 libobs/graphics: Add ability to set shader texture sampler
(Note: This also modifies libobs-d3d11 and libobs-opengl)

Allows overriding the sampler for a specific shader parameter.
2016-06-29 04:15:38 -07:00
jp9000 876cc94d51 libobs: Fix bug where bool constant size would be 1
(This commit also modifies libobs-d3d11)

Boolean constant size should be 4
2016-02-21 12:05:04 -08:00
jp9000 2a99e6ff18 libobs-d3d11: Log monitors/VRAM 2015-12-21 14:19:20 -08:00
jp9000 fd591fbd45 libobs-d3d11: Use debug log if duplicator fails to create
The duplicator is supposed to be able to safely fail to create, so using
a debug log message is more appropriate.
2015-11-16 11:11:16 -08:00
jp9000 ccfd57d100 libobs/graphics: Rename inconsistent function names
Renames functions:
gs_shader_setmatrix3 -> gs_shader_set_matrix3
gs_voltexture_getdepth -> gs_voltexture_get_depth
2015-10-21 07:46:43 -07:00