Commit graph

491 commits

Author SHA1 Message Date
Michael Fabian 'Xaymar' Dirks
570b70479f gs-effect-technique: Fix possible crash 2019-12-18 06:39:06 +01:00
Michael Fabian 'Xaymar' Dirks
47dc948861 gfx-blur-gaussian: Remove left over obs_enter_graphics (#83)
This single line causes OBS to freeze in place, and is not needed as the Graphics Context is already locked by gs::context().

Fixes #83
2019-12-17 23:53:21 +01:00
Michael Fabian 'Xaymar' Dirks
16347beb87 filter-*, source-*: Fix rendering of filters and duplication of sources 2019-12-17 23:52:10 +01:00
Michael Fabian 'Xaymar' Dirks
1c7fd1495c source-mirror: Fix potential lockup and rescaling with original size
Getting the resolution of a source is very expensive in libOBS, as libOBS does not cache it and instead always calls into the filters and sources to determine the actual source. This also leads to potential lockups due to the filter list mutex being locked for the target source.

Therefore instead of calling it multiple times, cache the result of the call, if that result is even necessary. This reduces the need to synchronize lightly parallelized work (UI and libOBS code) and helps against the potential race condition in libOBS.
2019-12-16 23:53:20 +01:00
Michael Fabian 'Xaymar' Dirks
01f23e17fe gs-effect: Also override finalizer for the stored ptr 2019-12-16 23:07:49 +01:00
Michael Fabian 'Xaymar' Dirks
e7b46063aa gs-effect: Fix typo from refactor 2019-12-16 22:53:25 +01:00
Michael Fabian 'Xaymar' Dirks
b54e95527a gs-effect*: Finish up refactoring onto std::shared_ptr
This is most likely not the last refactor, the entire obs/gs stuff is very very basic right now and likely needs a complete rewrite.
2019-12-15 12:55:19 +01:00
Michael Fabian 'Xaymar' Dirks
11a2329519 gs-effect: Refactor onto std::shared_ptr 2019-12-15 11:13:47 +01:00
Michael Fabian 'Xaymar' Dirks
1f25b56579 gs-effect-technique: Return nullptr instead of throwing exception 2019-12-15 10:37:57 +01:00
Michael Fabian 'Xaymar' Dirks
ef76e353d3 gs-effect-pass/technique: Change to protected inheritance
Prevents the use of get() and reset() where not actually needed and forces us to actually implement all of the methods needed to interface with the object, leading to cleaner and safer code.
2019-12-15 10:37:41 +01:00
Michael Fabian 'Xaymar' Dirks
50ac6893bf gs-effect-parameter: Refactor effect_parameter onto std::shared_ptr
Prevents problems further down the line and supports multiple types of parents to ensure that lifetime is guaranteed.
2019-12-15 10:35:29 +01:00
Michael Fabian 'Xaymar' Dirks
0ad896e905 gfx-shader: Rename from gfx-effect-source 2019-12-15 09:09:11 +01:00
Michael Fabian 'Xaymar' Dirks
738b08de36 gs-effect-pass/technique: Implement wrapper code based on std::shared_ptr
These two wrap the underlying gs_epass and gs_effect_technique objects, to allow direct and improved access to them without relying on the libobs API to provide this access for us. Additionally these make it safe for us to use them instead of relying on C-like code to deal with it.
2019-12-15 09:05:23 +01:00
Michael Fabian 'Xaymar' Dirks
d53e9eeadf filter-sdf-effects: Restore compatibility with 24.0.3 and earlier 2019-12-14 21:33:32 +01:00
Michael Fabian 'Xaymar' Dirks
01895c1ccc filter-dynamic-mask: Restore compatibility with 24.0.3 and earlier 2019-12-14 21:33:25 +01:00
Michael Fabian 'Xaymar' Dirks
af78c177ad filter-displacement: Restore compatibility with 24.0.3 and earlier 2019-12-14 21:33:16 +01:00
Michael Fabian 'Xaymar' Dirks
a24e0d2c10 filter-blur: Restore compatibility with 24.0.3 and earlier 2019-12-14 21:33:06 +01:00
Michael Fabian 'Xaymar' Dirks
d8e1c7c779 filter-transform: Restore compatibility with 24.0.3 and earlier 2019-12-14 21:32:48 +01:00
Michael Fabian 'Xaymar' Dirks
b311d79e50 source-mirror: Remove OBS_SOURCE_CUSTOM_DRAW 2019-12-14 02:37:04 +01:00
Michael Fabian 'Xaymar' Dirks
66abaac67b filter-color-grade: Refactor onto obs::source_factory
Related: #90
2019-12-14 02:34:48 +01:00
Michael Fabian 'Xaymar' Dirks
7e98df0d1c obs-source-factory: Add helper functionality to make things easier to use 2019-12-14 02:34:48 +01:00
Michael Fabian 'Xaymar' Dirks
5be2941299 filter-sdf-effects: Move factory to bottom of the file 2019-12-03 20:38:34 +01:00
Michael Fabian 'Xaymar' Dirks
59878b62d0 filter-dynamic-mask: Fix nonstandard use of va_start 2019-12-03 20:38:14 +01:00
Michael Fabian 'Xaymar' Dirks
d9f43ec2e8 filter-blur: Refactor onto obs::source_factory 2019-12-03 20:37:57 +01:00
Michael Fabian 'Xaymar' Dirks
4e1dcb533c filter-dynamic-mask: Rebase onto obs::source_factory 2019-12-03 20:11:27 +01:00
Michael Fabian 'Xaymar' Dirks
0e425ab48f source-mirror: Fix missing input selection 2019-12-03 20:08:16 +01:00
Michael Fabian 'Xaymar' Dirks
efb6b0b9be filter-transform: Further refactoring 2019-12-03 18:28:42 +01:00
Michael Fabian 'Xaymar' Dirks
48e17ad562 filter-sdf-effects: Refactor onto obs::source_factory
Also replaces the global effect objects with per-source ones
2019-12-03 17:47:39 +01:00
Michael Fabian 'Xaymar' Dirks
df8ebd94ea filter-displacement: Refactor onto obs::source_factory
This drastically improves stability and prevents all exceptions from leaking into libobs C code, which prevents crashes and unexpected freezes from exception handlers further down the stack.

Additionally minor work was done to further improve the quality and user experience for the filter.
2019-11-18 03:03:11 +01:00
Michael Fabian 'Xaymar' Dirks
6efdb1950b obs-source-factory: Fix typo and missing return 2019-11-18 03:03:11 +01:00
Michael Fabian 'Xaymar' Dirks
db85883821 obs/obs-source-factory: Fix potential null-pointer-dereference 2019-11-17 14:07:54 +01:00
Michael Fabian 'Xaymar' Dirks
87f83738c3 gs-helper: Add common debug colors 2019-10-31 05:59:16 +01:00
Michael Fabian 'Xaymar' Dirks
10681d30c8 gs-helper: Remove unused constructor 2019-10-18 23:04:23 +02:00
Michael Fabian 'Xaymar' Dirks
90cdc30ef1 gs-helper: Add class for managed debug markers 2019-10-18 22:59:30 +02:00
Michael Fabian 'Xaymar' Dirks
9b0ea98243 filter-transform: Add GPU debug markers 2019-10-18 22:42:07 +02:00
Michael Fabian 'Xaymar' Dirks
ba71b43a39 gfx-source-texture: Add debug markers 2019-10-18 22:32:54 +02:00
Michael Fabian 'Xaymar' Dirks
141a5efd00 filter-transform: Refactor onto obs::source_factory 2019-10-18 22:32:54 +02:00
Michael Fabian 'Xaymar' Dirks
bacf52f9b6 source-mirror: Refactor to improve performance
Caching the output of a source is only necessary for really expensive to render sources, so it is disabled by default now. Thanks to that, most Source Mirrors are now "free" instead of requiring two context switches and a texture, while those really expensive can be manually set to cache.

The scaling mode is also set to disabled instead of point when rescaling is off to further improve performance. The previous method would incorrectly cause an extra texture to be used.

Additionally we now have support for debug markers for graphics debugging, allowing us to exactly tell apart improvements in rendering cost for this source.
2019-10-18 22:32:54 +02:00
Michael Fabian 'Xaymar' Dirks
52c9e372ba source-mirror: Refactor onto obs::source_factory 2019-10-18 22:31:53 +02:00
Michael Fabian 'Xaymar' Dirks
d47ab0570f obs-source-factory: Barebone Source Factory and Instance
This class and template should be used to reduce the code clutter from repeatedly doing the same thing. It requires OBS v24.0 or newer since the get_properties2 and get_defaults2 API were fully implemented with it.
2019-10-18 22:31:52 +02:00
Michael Fabian 'Xaymar' Dirks
6db575c9cf source-mirror: Add debug markers 2019-10-16 04:54:40 +02:00
Michael Fabian 'Xaymar' Dirks
03c2a68846 gfx-effect-source: Catch exceptions as const 2019-10-13 07:28:59 +02:00
Michael Fabian 'Xaymar' Dirks
e832dbd628 filter-sdf-effects: Fix and improve various problematic locations 2019-10-13 07:28:29 +02:00
Michael Fabian 'Xaymar' Dirks
4fe76a85ae filter-blur: Fix some warnings 2019-10-13 07:28:12 +02:00
Michael Fabian 'Xaymar' Dirks
bbcbd0fa1e filter-color-grade: Fix and improve various problematic locations 2019-10-13 07:27:59 +02:00
Michael Fabian 'Xaymar' Dirks
e07d7c01fc filter-displacement: Fix and improve various problematic locations 2019-10-13 07:27:42 +02:00
Michael Fabian 'Xaymar' Dirks
ef5e6ac896 filter-dynamic-mask: Catch const exceptions 2019-10-13 07:08:56 +02:00
Michael Fabian 'Xaymar' Dirks
06d9a3d2f5 filter-transform: Catch and log exceptions 2019-10-13 07:08:02 +02:00
Michael Fabian 'Xaymar' Dirks
96466100b4 obs-source: Ensure that exceptions are const 2019-10-13 07:07:31 +02:00
Michael Fabian 'Xaymar' Dirks
b5d3131203 filter-dynamic-mask: Fix some crashy locations 2019-10-13 07:02:04 +02:00
Michael Fabian 'Xaymar' Dirks
0ef94aad0f gs-vertexbuffer: Fix and improve various problematic locations 2019-10-13 06:38:15 +02:00
Michael Fabian 'Xaymar' Dirks
45d2431ef5 source-mirror: Fix and improve various problematic locations 2019-10-13 06:20:41 +02:00
Michael Fabian 'Xaymar' Dirks
fd0b79e97d utility-event: Remove unused event handler 2019-10-13 05:58:53 +02:00
Michael Fabian 'Xaymar' Dirks
f1a376d44b cmake: Add commit to version.hpp template
Switches out the `const uint16_t` for actual defines, which are easier to deal with and work in C out of the box.
2019-10-13 05:54:20 +02:00
Michael Fabian 'Xaymar' Dirks
e02225262c obs-source: Add noexcept try-catch to C facing callbacks 2019-09-07 21:35:32 +02:00
Michael Fabian 'Xaymar' Dirks
d6f1979dee project: Fix missing returns 2019-09-07 21:28:54 +02:00
Michael Fabian 'Xaymar' Dirks
5a4d38d249 project: Fix a massive list of dangerous warnings
This is a massive improvement to stability and safety when using the plugin, as all exceptions should now no longer be leaked into C controlled code, which can't actually handle exceptions at all.

Warnings fixed:

* Potentially throwing exception during library load.
* Possibly throwing function passed to C.
* Statement does nothing.
* Variable is initialized but not referenced.
* Variable overloads variable in parent scope.
2019-09-05 18:42:28 +02:00
Michael Fabian 'Xaymar' Dirks
2a4a3bf501 util-memory: Cast to intptr_t 2019-09-05 18:09:33 +02:00
Michael Fabian 'Xaymar' Dirks
4c44496b87 source-mirror: Handle uncaught exceptions in C callbacks
Fixes various crashes and undefined behavior due to exceptions falling into C code where they now wreak havoc with the current stack.
2019-09-04 20:52:37 +02:00
Michael Fabian 'Xaymar' Dirks
f65dfcbbf0 filter-blur: Don't throw exceptions into C code
It is extremely problematic to throw C++ exceptions into C code, especially because C code usually does not handle C++ exceptions at all. Therefore we have to prevent any exception from leaving the function and define it as noexcept.
2019-09-04 20:43:40 +02:00
Michael Fabian 'Xaymar' Dirks
f61cdeb582 utility-event: Fix compile errors 2019-09-04 20:30:16 +02:00
Michael Fabian 'Xaymar' Dirks
29ab00633c utility-event: Safer event handling with proper lifetime
The util::event code suffers from the problem that it could call into a class that no longer exists, corrupting memory or even crashing. By tracking lifetime using std::weak_ptr<void> this can be avoided and the dead listeners can be automatically removed.
2019-09-04 16:36:32 +02:00
Michael Fabian 'Xaymar' Dirks
da9124fc1a util-memory: Avoid MSVC specific C++ and use Std++ if available 2019-09-04 03:22:05 +02:00
Michael Fabian 'Xaymar' Dirks
82faab4380 project: Re-apply formatting 2019-09-04 03:03:41 +02:00
Michael Fabian 'Xaymar' Dirks
ce7e4c97d4 project: Don't use non-standard strcmpi 2019-09-04 03:02:19 +02:00
Michael Fabian 'Xaymar' Dirks
03c704de1a project: Correct usage of exceptions and include stdexcept 2019-09-04 02:59:04 +02:00
Michael Fabian 'Xaymar' Dirks
4765c57828 filter-sdf-effects: Don't define structs in nameless unions 2019-09-04 02:49:04 +02:00
Michael Fabian 'Xaymar' Dirks
f27320c6c9 project: Remove use of P_INITIALIZER
Does not support cross-platform very well and breaks on Apple for no apparent reason.

Add resolution scale to shader filter.
2019-09-04 02:47:27 +02:00
Michael Fabian 'Xaymar' Dirks
9ace96285d filter-dynamic-mask: Use snprintf instead of sprintf_s 2019-09-04 02:39:59 +02:00
Michael Fabian 'Xaymar' Dirks
2e98c2e754 color-grade: Fix and improve advanced options
These new options allow further control over the Tint tool in Color grading.
2019-09-04 02:18:40 +02:00
Michael Fabian 'Xaymar' Dirks
781307fbe6 color-grade: Add further Tint options 2019-09-04 01:41:15 +02:00
Michael Fabian 'Xaymar' Dirks
deeb6719c4 project: Apply formatting 2019-08-24 12:59:32 +02:00
Michael Fabian 'Xaymar' Dirks
250dc97603 gfx-effect-source: enumerate child sources correctly 2019-08-07 20:40:04 +02:00
Michael Fabian 'Xaymar' Dirks
a04d102568 gfx-effect-source: Support for textures and some crash resistance 2019-08-07 20:22:12 +02:00
Michael Fabian 'Xaymar' Dirks
f945f08ab0 strings: Texture formats 2019-08-07 20:21:39 +02:00
Michael Fabian 'Xaymar' Dirks
d7e66b17f1 filter-shader: Don't ignore all properties 2019-08-07 19:22:10 +02:00
Michael Fabian 'Xaymar' Dirks
b8fc0d5284 source-shader: Fix rendering 2019-08-07 19:20:44 +02:00
Michael Fabian 'Xaymar' Dirks
7fdd9498a0 filter-shader: Fix blending 2019-08-07 19:20:32 +02:00
Michael Fabian 'Xaymar' Dirks
90699f6b6f gfx-effect-source: Implement defaults for bool, value and matrix 2019-08-07 19:19:56 +02:00
Michael Fabian 'Xaymar' Dirks
39e6959c67 source-shader: Fix rendering and reapply parameters on change 2019-08-07 18:43:34 +02:00
Michael Fabian 'Xaymar' Dirks
181df6e3d9 filter-shader: Reapply parameters if there was a change 2019-08-07 18:43:19 +02:00
Michael Fabian 'Xaymar' Dirks
9be36d5ec4 gfx-effect-source: Add function to get "default" value 2019-08-07 18:42:54 +02:00
Michael Fabian 'Xaymar' Dirks
2b2f87e6fc gfx-effect-source: Fix validity check
Had the check inverted oops.
2019-08-07 18:16:20 +02:00
Michael Fabian 'Xaymar' Dirks
c88535c7ab gfx-effect-source: Remove/replace old defines 2019-08-07 18:11:46 +02:00
Michael Fabian 'Xaymar' Dirks
c670ab60a1 source-shader: Use custom draw video_render 2019-08-07 18:10:44 +02:00
Michael Fabian 'Xaymar' Dirks
8cb2ddaa82 source-shader, cmake: 'Shader' source 2019-08-07 18:06:48 +02:00
Michael Fabian 'Xaymar' Dirks
1b34e5210a gfx-effect-source: Expose defines to set default file and technique 2019-08-07 18:06:24 +02:00
Michael Fabian 'Xaymar' Dirks
9ad93c0ee9 filter-shader: Rename from Custom shader 2019-08-07 18:05:49 +02:00
Michael Fabian 'Xaymar' Dirks
98a18480d0 gfx-effect-source: Fix UI mode detection 2019-08-07 17:45:32 +02:00
Michael Fabian 'Xaymar' Dirks
8ec8a22928 filter-custom-shader: Add new callbacks 2019-08-07 17:37:52 +02:00
Michael Fabian 'Xaymar' Dirks
335847945d gfx-effect-source: Allow overriding value and visibility of parameters 2019-08-07 17:37:34 +02:00
Michael Fabian 'Xaymar' Dirks
ff4a556f3f filter-custom-shader: Update to use new gfx::effect_source::effect_source 2019-08-07 17:15:46 +02:00
Michael Fabian 'Xaymar' Dirks
bde4e278bf gfx-effect-source: Further work on rewrite
This partially implements most behavior to an acceptable degree for use right now.
2019-08-07 17:14:44 +02:00
Michael Fabian 'Xaymar' Dirks
845a2cbb21 gs-effect: Don't include the null character in strings 2019-08-07 17:14:14 +02:00
Michael Fabian 'Xaymar' Dirks
b88cc0fe01 gs-effect: Check correct size in get_default_string 2019-08-07 17:07:54 +02:00
Michael Fabian 'Xaymar' Dirks
8603fef897 gs-effect: Fix get_string and get_default_string 2019-08-07 16:41:26 +02:00
Michael Fabian 'Xaymar' Dirks
c6559d84ba gs-effect: Check if effect is nullptr, not if its a valid ptr
Woops, that somehow went completely by me without checking.
2019-08-07 16:17:12 +02:00
Michael Fabian 'Xaymar' Dirks
7b0159947e gs-effect: Add helpers and fix bad enable_shared_from_this 2019-08-07 16:11:09 +02:00
Michael Fabian 'Xaymar' Dirks
e59bc2fdd2 filter-custom-shader: Rewrite from scratch 2019-08-07 12:43:23 +02:00
Michael Fabian 'Xaymar' Dirks
1092dc1de1 gfx-effect-source: Complete rewrite from scratch 2019-08-07 12:42:25 +02:00