Commit Graph

130 Commits

Author SHA1 Message Date
Michael Fabian 'Xaymar' Dirks 08544b4116 cmake, code: Abuse pre-processor to disable/enable warnings 2023-04-05 18:58:39 +02:00
Michael Fabian 'Xaymar' Dirks 8e52bbf88b code: Ignore warnings from external code
May need to find a better solution such as disabling all warnings on third party code.
2023-04-05 18:58:38 +02:00
Michael Fabian 'Xaymar' Dirks 4fa26dd2d6 code: Always initialize or cast to correct type 2023-04-05 18:58:37 +02:00
Michael Fabian 'Xaymar' Dirks 0fe5c7e654 code: Don't use try-catch as function definition
This breaks MSVC and results in leaked exceptions.
2023-04-05 18:58:37 +02:00
Michael Fabian 'Xaymar' Dirks 8f8b8839e5 obs/weak-source: Further optimization and modernization 2023-04-05 18:58:33 +02:00
Michael Fabian 'Xaymar' Dirks 808f5c63fb obs/gs/effect: Revert #836
The use of const references breaks '#include' for relative paths.
2023-04-05 18:58:32 +02:00
lainon 6e1566386e project: Apply more C++ paradigms to the code
- Use auto in places where code clarity is improved or identical.
- Replace trivial constructors and destructors with default.
- Use true random for random generation.
- Use std::string_view where it is valid to do so.
- Apply const where it is valid to do so.
- Use references where it is valid to do so.
- Manually optimize memory usage with std::move and std::copy.
- Opt for memory efficient containers where the size is known ahead of time.

Signed-off-by: lainon <GermanAizek@yandex.ru>
2023-04-05 18:58:32 +02:00
Michael Fabian 'Xaymar' Dirks a149531fb8 cmake: Upgrade version code to shared cmake-version module
This module handles parsing, generating, modifying and comparing of versions with pure CMake.
2023-04-05 18:58:28 +02:00
Michael Fabian 'Xaymar' Dirks 3667426f49 obs/signal-handler: Update to new classes 2023-04-05 18:58:22 +02:00
Michael Fabian 'Xaymar' Dirks fc693e0210 obs/tools: Remove more legacy tools 2023-04-05 18:58:21 +02:00
Michael Fabian 'Xaymar' Dirks 39548e760d obs/tools: Replace scene_contains_source
As the recursion checking code is somewhat broken in libOBS, we need something to prevent accidental recursion from occurring. While the alternative fix is to simply make all of libOBS support recursion, unfortunately that endeavor would be too large for a single person to take on.
2023-04-05 18:58:21 +02:00
Michael Fabian 'Xaymar' Dirks e3c7b13d6f obs/source-factory: Add support for OBS Studio 27.x
Also improves the functionality logic slightly to be more in line with real behavior.
2023-04-05 18:58:21 +02:00
Michael Fabian 'Xaymar' Dirks 9bbc35b293 obs/source: Refactor old deprecated classes 2023-04-05 18:58:21 +02:00
Michael Fabian 'Xaymar' Dirks 6dd661a41c obs/source-tracker: Fix missing sources and modernize singleton design
In some rare cases, a bug is observed where some sources end up missing despite being visible in the OBS Studio UI. This is most likely related to us actually missing the events due to plugin load order. We can fix this by explicitly enumerating sources in the constructor.

Additionally in order to reduce the human error factor, we should avoid explicit initialize() and finalize() calls for our singleton. Instead the get() function should do all of the heavy lifting, including thread safety, so that the human writing the code will have next to no chances to break it.
2023-04-05 18:58:20 +02:00
Michael Fabian 'Xaymar' Dirks 0627628884 obs/tools: Remove work-around for obs_properties_remove_by_name
The bug fix to this was applied upstream, so we no longer need to support the broken behavior
2023-04-05 18:58:20 +02:00
Michael Fabian 'Xaymar' Dirks 132c58632e obs/encoder-factory: Support proper settings migration 2023-04-05 18:51:52 +02:00
Michael Fabian 'Xaymar' Dirks 4b86d67517 obs/gs/effect: Only add defines to the top level shader
Fixes certain warnings that are caused by duplicate '#define' lines.
2023-04-05 18:51:46 +02:00
Michael Fabian 'Xaymar' Dirks 2962be9d52 obs/gs/effect: gs_get_device_type() requires graphics context 2023-04-05 18:51:45 +02:00
Michael Fabian 'Xaymar' Dirks 9859b44b1c obs/gs/mipmapper: Enable support for sRGB mip-mapping 2023-04-05 18:51:45 +02:00
Michael Fabian 'Xaymar' Dirks 9f035deaaa obs/gs/mipmapper: Don't cache the "source" parameter
Fixes #721
2023-04-05 18:51:45 +02:00
Michael Fabian 'Xaymar' Dirks 6f7c03fb28 obs/gs/effect-parameter: Add support for sRGB texture inputs 2023-04-05 18:51:42 +02:00
Michael Fabian 'Xaymar' Dirks 10ec6a7ad2 obs/gs/mipmapper: Add support for OpenGL 2023-04-05 18:51:40 +02:00
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