Commit Graph

108 Commits

Author SHA1 Message Date
Michael Fabian 'Xaymar' Dirks 29bbe22bec obs/gs/effect: Preprocess shaders to improve platform compatibility
Improves cross-platform compatibility of Shaders written for StreamFX through the use of preprocessing to make things a bit more compatible. While we don't perform any proper parsing, this will be able to prevent basic issues.
2023-04-05 18:51:38 +02:00
Michael Fabian 'Xaymar' Dirks 12f976fde3 obs/encoder-factory: Don't require implementing all virtual functions
As not all encoders need all functions, classes inheriting from this should not need to implement all of them as no-ops. Instead the header should take care of this, which reduces duplicated empty code paths.
2023-04-05 18:51:14 +02:00
Michael Fabian 'Xaymar' Dirks c84c301d49 obs/gs: Apply coding guidelines 2023-04-05 18:50:59 +02:00
Michael Fabian 'Xaymar' Dirks 015fac588b obs: Apply coding guidelines 2023-04-05 18:50:58 +02:00
Michael Fabian 'Xaymar' Dirks d62da72ce5 util: Apply coding guidelines 2023-04-05 18:50:57 +02:00
Michael Fabian 'Xaymar' Dirks 96c7b101e5 obs/gs/texture: Add new flags and fix flag decoding 2023-04-05 18:50:53 +02:00
Michael Fabian 'Xaymar' Dirks 1909ee01d6 obs/gs/vertex: Don't include unused headers 2023-03-28 13:11:12 +02:00
Michael Fabian 'Xaymar' Dirks 716da4f6cc obs/tools: Add active_source and visible_source helpers
These classes help us manage active and showing references to a source, which seem to be necessary for filters.
2023-03-28 13:11:05 +02:00
Michael Fabian 'Xaymar' Dirks aacb1d41bc obs/gs/effect: Fix unicode support
Related: #359
2023-03-28 13:11:04 +02:00
Michael Fabian 'Xaymar' Dirks cc1b9c1559 obs/gs/mipmapper: Fix unicode support
Related: #359
2023-03-28 13:11:04 +02:00
Michael Fabian 'Xaymar' Dirks 032a3c6deb obs/source-factory: Skip broken filter rendering by default
Fixes a black screen issue if a filter happens to run into an unexpected issue which it considers unrecoverable.
2023-03-28 13:11:03 +02:00
Michael Fabian 'Xaymar' Dirks 63a5873413 project: Remove non-standard std:: prefix from types 2023-03-28 12:52:22 +02:00
Michael Fabian 'Xaymar' Dirks f9f25dbd8a obs/gs/effect: Use the actual shared_ptr, not a pointer to it
Fixes several warnings and potential memory corruptions that could happen. Also makes the entire thing easier to read.
2023-03-28 12:52:20 +02:00
Michael Fabian 'Xaymar' Dirks dbb71cf801 project: Code cleanup and reapply formatting
Changes applied:

* Moved utility files to /util/.
* Removed unused #includes.
* Removed unused ::ffmpeg::tools function.
* Removed unused variables.
* Fixed missing parentheses in the version macro.
* Fixed missing override on virtual function overrides and removed unnecessary virtual keyword from them.
* Disabled additional warning for ATL headers on MSVC only.
* Replaced direct printf parameters with their macro equivalent.
* Replaced C-style casts with C++-style casts.
* Applied clang-format again after an earlier change to the CMake file broke the integration for it.
2023-03-28 12:52:20 +02:00
Michael Fabian 'Xaymar' Dirks a7ac58aba6 obs/encoder-factory: Fix encoder rerouting not working properly
Due to an oversight in the code, the fallback code would simply fail to work as the encoder was always the zero-copy version. This resulted in weird crashes and encoders not working that used to work before.

Fixes #295
2023-03-28 12:52:18 +02:00
Michael Fabian 'Xaymar' Dirks 81a8a25d4a obs/gs/vertexbuffer: Cleanup and add workaround for OBS Studio memory leak 2023-03-28 12:52:18 +02:00
Michael Fabian 'Xaymar' Dirks 07034c0e6e obs/gs/helper: Throw exception if we aren't in a context 2023-03-28 12:52:18 +02:00
Michael Fabian 'Xaymar' Dirks 68a49498e6 common: Rename LOG_ to DLOG_ to avoid macro confusion 2023-03-28 12:52:17 +02:00
Michael Fabian 'Xaymar' Dirks f98319dee7 obs/source-tracker: Don't leak pointers to sources 2023-03-28 12:52:17 +02:00
Michael Fabian 'Xaymar' Dirks 411b716402 obs/encoder-factory: Fix incorrect proxy registration 2023-03-28 12:52:12 +02:00
Michael Fabian 'Xaymar' Dirks 203581f30c obs/source-factory: Add function to register proxy objects
Proxies allow for older configurations to work fine on newer versions, without having to manually adjust the scene collection to match the new ids at all. Thanks to the migration system we can freely support any number of old versions, as long as we write migration code.
2023-03-28 12:52:12 +02:00
Michael Fabian 'Xaymar' Dirks d3c2f288b4 obs/encoder-factory: Factory to create encoder instances 2023-03-28 12:52:11 +02:00
Michael Fabian 'Xaymar' Dirks 3a40a63832 obs/gs/effect-parameter: Use string_view over std::string
Using std::string_view over std::string (and const std::string&) has the advantage that we skip potential temporary std::string objects that are immediately thrown away, thus slowing down the code. It can also be implicitly cast to std::string, which makes it compatible with existing code that uses std::string.
2023-03-28 12:40:45 +02:00
Michael Fabian 'Xaymar' Dirks 1951fb62ee obs/gs-helper: Optimize performance with inline 2023-03-28 12:40:43 +02:00
Michael Fabian 'Xaymar' Dirks a9bb56c5ee project: Optimize to use single fullscreen tri instead 2023-03-28 12:40:42 +02:00
Michael Fabian 'Xaymar' Dirks 775e27caff gs-helper: Only include debug markers if profiling is enabled 2023-03-28 12:40:42 +02:00
Michael Fabian 'Xaymar' Dirks 49f1cbc15e project: Improve performance profiling support
Adds a new CMake option "ENABLE_PROFILING" which enables all CPU and GPU performance profiling available in StreamFX for tracking what's actually causing things to be slow.
2023-03-28 12:40:41 +02:00
Michael Fabian 'Xaymar' Dirks 4947d46aa1 gs-mipmapper: Update API usage, remove broken options and optimize
The new libOBS API allows us to directly access the underlying API instead of having to mess around in memory. By using it we can avoid crashing in case the compiler for it is different, or in case the actual back end structure changes.

Additionally the mostly unimplemented and unused options have also been removed, which streamlines the use of this class even further and reduces both shader and code complexity.

Finally by optimizing the use of the internal render target we can achieve a speed up of up to 3000% over the old way, allowing for many more mipmapped filters.
2023-03-28 12:40:40 +02:00
Michael Fabian 'Xaymar' Dirks 47a22ce462 gs-vertexbuffer: Initialize memory to 0 2023-03-28 12:40:40 +02:00
Michael Fabian 'Xaymar' Dirks 6cbfee4579 obs-tools: Add OBS data deleter 2020-04-22 23:15:32 +02:00
Michael Fabian 'Xaymar' Dirks 97e1846156 obs-tools: Add deleter for obs_weak_source_t 2020-04-17 11:44:37 +02:00
Michael Fabian 'Xaymar' Dirks e4b4dc23e8 gs-helper: Define extra debug colors 2020-04-17 11:44:37 +02:00
Michael Fabian 'Xaymar' Dirks 908d1f0a20 project: Modernize code to proper C++ 2020-04-09 00:17:25 +02:00
Michael Fabian 'Xaymar' Dirks cd5acd42f4 obs-source-factory: Add settings migration code
Previously sources had to manually implement migration code, which resulted in unresolvable regression issues due to the lack of version and commit tagging. With the new migration code, all sources automatically have this version and commit tagging at all times, and as such can now have a temporary regression fixed without the user needing to change any values manually.
2020-04-05 07:28:10 +02:00
Michael Fabian 'Xaymar' Dirks cc9d3486b2 project: Fix Linux support by fixing errors and warnings
With this, GCC 8 and above should now be able to compile the project both in obs-studio and as a standalone install. Some features are currently still not fully supported and require extra work, but the majority of things are supported and work out of the box. Exact feature parity can be looked up here on the wiki: https://github.com/Xaymar/obs-StreamFX/wiki/Platform-Feature-Parity

Related: #119 #98 #30
2020-04-02 20:37:45 +02:00
Michael Fabian 'Xaymar' Dirks 59fa1d36d7 common: Common header include for improved platform support
This header includes all common data between headers used in the plugin. This should improve cross-platform compiling support whenever possible, as all platform-dependent common includes and defines can be done here.
2020-04-02 17:02:01 +02:00
Michael Fabian 'Xaymar' Dirks 451d31546f gs-effect-*: Replace strnlen_s with strnlen 2020-04-02 16:21:42 +02:00
Michael Fabian 'Xaymar' Dirks 2e250ad826 obs-source-factory: Fix support for transitions
Transitions always require audio and video rendering.
2020-03-28 18:37:20 +01:00
Michael Fabian 'Xaymar' Dirks 87e6767033 gs-mipmapper: Fix some warnings 2020-03-27 20:10:17 +01:00
Michael Fabian 'Xaymar' Dirks 4baa2360c5 obs-source: Disallow copy constructor 2020-02-14 07:52:28 +01:00
Michael Fabian 'Xaymar' Dirks baf265fd5b obs-signal-handler: Fix possible crash 2020-02-14 07:31:30 +01:00
Michael Fabian 'Xaymar' Dirks 326fa68d9f obs-signal-handler: Helper classes for signals and audio 2020-02-14 07:30:46 +01:00
Michael Fabian 'Xaymar' Dirks 42c9375333 obs-tools: Fix obs::tools::child_source not checking return value 2020-02-14 07:29:31 +01:00
Michael Fabian 'Xaymar' Dirks 40369bf72d obs-tools: Add child_source helper class 2020-02-13 10:34:26 +01:00
Michael Fabian 'Xaymar' Dirks f8ee95d71c obs-*: Cleanup 2020-02-13 05:09:14 +01:00
Michael Fabian 'Xaymar' Dirks b306cebd6b project: More warnings fixed 2020-01-14 01:39:13 +01:00
Michael Fabian 'Xaymar' Dirks ebc50dcefe utility: Merge util-math and util-memory 2020-01-14 01:11:08 +01:00
Michael Fabian 'Xaymar' Dirks 0a16ce07dc project: Merged FFmpeg Encoders Step 2 2020-01-13 22:40:15 +01:00
Michael Fabian 'Xaymar' Dirks 17ee2d713c gs-effect-parameter: Implement copy and move 2019-12-25 19:09:13 +01:00
Michael Fabian 'Xaymar' Dirks 1ff6c0cf41 obs-tools: Add work around for property memory corruption
The current implementation of obs_properties_remove_by_name corrupts the obs_properties_t object whenever it is called on the first or last property in the list. This leads to rapid unscheduled disassembly, and therefore must be fixed in order for this function to be used.

Fixed by upstream PR https://github.com/obsproject/obs-studio/pull/2257.
2019-12-22 06:07:07 +01:00