Commit Graph

307 Commits

Author SHA1 Message Date
Michael Fabian 'Xaymar' Dirks 3952c33c60 filter-blur: Add Directional Blur (Motion Blur) and Step Scaling
Directional Blur (also known as Motion Blur in some art software) enables full control over the direction the passes are applied in, which can further be combined with the scaling option. With this very simple blur effects can have a massively bigger influence.

Step Scaling allows for improved control over individual Blur passes and can be combined with Directional Blur to imitate certain effects. It also allows smaller Blur sizes to cover a larger area, although with a drastic loss in final quality. For example, if someone is streaming at 720p and wants to have their dynamic 2160p background blurry to a very high degree, this option would allow that at next to no quality loss in the final stream. The actual values that need to be used vary for each source and encoder however, so they will have to be chosen carefully.
2018-12-23 19:54:57 +01:00
Michael Fabian 'Xaymar' Dirks ad97eeebe7 filter-blur: Fix translucent source rendering and modernize code
Translucent sources previously rendered with wrong alpha, which caused sources to look different than they should. With the new code, this is no longer the case and instead now renders the source correctly.

Additionally the modernized code should reduce any problems with rendering by reducing the amount of duplicated manually written code and instead using classes.
2018-12-23 18:27:24 +01:00
Michael Fabian 'Xaymar' Dirks fd14fd62a6 gs-rendertarget: Add function to get texture directly 2018-12-23 17:56:52 +01:00
Michael Fabian 'Xaymar' Dirks a6f9451654 filter-blur: Switch to Kernel Array instead of Kernel Texture
This speeds up Gaussian Blur and Linear Gaussian Blur drastically reduces time spent reading textures and instead uses existing registers - maximizing time spent reading the actual image texture.

See Also: #21 Blur Quality
2018-12-23 02:00:30 +01:00
Michael Fabian 'Xaymar' Dirks 92c4b54177 filter-blur: Add Linear Gaussian Blur
Similar to Linear Box Blur, this version of Gaussian Blur reduces the total number of sample by up to n. This results in a total sample count (per pass) of O(n+1) for even radii and O(n+2) for odd radii. The quality sacrificed to do this is higher this time, though careful adjustment of the halfTexelDelta value can bring it much closer to normal Gaussian Blur. The current offset however had no noticable effects on visual quality.

See Also: #21 Blur Quality
2018-12-22 22:54:30 +01:00
Michael Fabian 'Xaymar' Dirks 93df9b50b8 filter-blur: Add Linear Box Blur and combine all effects
Linear Box Blur abuses the fact that with Linear Sampling we can sample up to four adjacent texels at the same time and get a correct result for Box Blur back. Using this the total number of sample for Box Blur is reduced by n, making the total either n+1 (Even Radius) or n (Odd Radius).

Additionally all blur effect files have been merged into a single blur.effect file to reduce the time required to change a single parameter name. New blur effects should be added as a new technique instead of as a new effect file.

See Also: #21 Blur Quality
2018-12-22 22:08:55 +01:00
Michael Fabian 'Xaymar' Dirks 0c92f3dbf5 filter-shadow-sdf: Inner/Outer shadow based on signed distance fields
Adds Inner/Outer Shadows for dynamic sources based on signed distance field generation. This is fast, but does add a bit of latency when it comes to updates - which means that moving objects will leave a trail before the generator has a chance to update.

Fixes #3
2018-11-08 13:52:43 +01:00
Michael Fabian 'Xaymar' Dirks c0cb20300b filter-blur: Rename factory and instance to blur_* 2018-11-08 11:16:55 +01:00
Michael Fabian 'Xaymar' Dirks 1aa42c58f0 plugin: Fix double plugin name in log line 2018-11-08 11:16:33 +01:00
Michael Fabian 'Xaymar' Dirks 844fcee0bd source-mirror: Additional protections against crashes on impossible behavior 2018-11-08 08:17:04 +01:00
Michael Fabian 'Xaymar' Dirks ac06ff48bc source-mirror: Fix crash caused by source renames and forced destroy of a source 2018-11-08 08:08:38 +01:00
Michael Fabian 'Xaymar' Dirks 9ffe53754b obs-source: Add support for all signals on a source 2018-11-08 08:08:06 +01:00
Michael Fabian 'Xaymar' Dirks 79daeb5a75 util-event: Template event handler class 2018-11-08 08:07:49 +01:00
Michael Fabian 'Xaymar' Dirks e4a5b34745 gfx-source-texture: Check for valid child and parent 2018-11-08 04:26:01 +01:00
Michael Fabian 'Xaymar' Dirks 6d25342302 obs-source: Check for early source destruction
This should prevent problems where the source is destroyed but a pointer is still around to it.
2018-11-08 04:25:21 +01:00
Michael Fabian 'Xaymar' Dirks 11fc32f935 source-mirror: Fix crash with audio mirroring
Fixes #23
2018-11-07 15:29:24 +01:00
Michael Fabian 'Xaymar' Dirks b87ca70796 project: Formatting 2018-11-07 15:24:25 +01:00
Michael Fabian 'Xaymar' Dirks 16f55ca583 source-mirror: Fix crash with audio data on obs_shutdown (#22)
Due to the lack of checking aud and aoi, a rare race condition crash can be observed with audio mirroring enabled on closing OBS. In this case, aoi is used even though it is null, causing OBS to crash instead of closing normally.

Fixes #22
2018-11-07 14:44:07 +01:00
Michael Fabian 'Xaymar' Dirks b5339b4429 source-mirror: Add support for scenes and fix last commit 2018-11-07 14:44:07 +01:00
Michael Fabian 'Xaymar' Dirks c084a0bfd0 source-mirror: Use a private scene source for rendering 2018-11-07 14:44:07 +01:00
Michael Fabian 'Xaymar' Dirks 0be79842e7 filter-transform: Fix various warnings 2018-11-07 14:44:07 +01:00
Michael Fabian 'Xaymar' Dirks eef9f0697d gfx-effect-source: Fix various warnings 2018-11-07 14:44:07 +01:00
Michael Fabian 'Xaymar' Dirks 55abc87126 plugin: extern "C" around obs includes 2018-11-07 14:44:07 +01:00
Michael Fabian 'Xaymar' Dirks f54efe7704 gfx-source-texture: Support for new obs-source managed class
This also adds support for proper source management in unmanaged cases.
2018-11-07 14:44:06 +01:00
Michael Fabian 'Xaymar' Dirks 234cbf5dab obs-tools: Various obs related tools 2018-11-07 14:44:06 +01:00
Michael Fabian 'Xaymar' Dirks 9c0761adde obs-source: Managed class for obs_source_t 2018-11-07 14:44:06 +01:00
Michael Fabian 'Xaymar' Dirks daad792eda filter-blur: Add support for scene as mask input (#14)
Adds full support for Scenes as mask input so that you can re-use your overlay scene as a blur input and have the blur follow behind your overlay.

Closes #14
2018-10-01 01:03:48 +02:00
Michael Fabian 'Xaymar' Dirks 382a217f06 filter-blur: Add support for image and source masks (#14) 2018-10-01 01:00:00 +02:00
Michael Fabian 'Xaymar' Dirks ebbc0cb1ce filter-blur: Fix Mask Type and split Color into Color and Alpha 2018-10-01 00:57:22 +02:00
Michael Fabian 'Xaymar' Dirks 999df5e6e5 gfx-source-texture: Refactoring 2018-10-01 00:54:18 +02:00
Michael Fabian 'Xaymar' Dirks d56f4f9eac filter-blur: Add proper mask options
* Removes the old 'Region' fields and places them under a 'Mask' option that can do much more.
* Supported Mask types: Region, Image, Source.
* Image and Source mask types allow for a color filter and multiplier.
2018-09-30 22:48:47 +02:00
Michael Fabian 'Xaymar' Dirks cfaa7eb1b9 strings: Add translated File Filters for Images 2018-09-30 21:55:13 +02:00
Michael Fabian 'Xaymar' Dirks f327f4ccc6 util-math: Undefine macro 2018-09-30 21:44:00 +02:00
Michael Fabian 'Xaymar' Dirks 3135214a03 filter-blur: Refactor and formatting
* Now using a Factory and Instance approach to simplify and beautify the code at the same time.
* Additionally we now keep track of created filters and only load data if there is a filter active, and unload data if there are no more filters. This reduces memory and GPU overhead when no filter is active, but adds a first time filter creation overhead.
* Variables and functions now use snake_case.
2018-09-30 20:50:00 +02:00
Michael Fabian 'Xaymar' Dirks 354445bc81 strings: Remove plugin:: namespace 2018-09-30 20:18:13 +02:00
Michael Fabian 'Xaymar' Dirks 8296af68c6 project: Rename 'Filter' to 'filter' 2018-09-30 18:49:52 +02:00
Michael Fabian 'Xaymar' Dirks da22e72da7 filter-transform: Fix mipmapping for npot input
The filter will now automatically rescale the parent stack into the next best power of two size. With this, even non-power-of-two sources can now be mipmapped semi-correctly.

To accurately support mipmapping even for npot textures, this feature would have to be built into OBS and OBS would have to stop refusing to create textures with mipmaps that are not a power of two in size. Almost all common Direct3D 11 (except Intel) are capable of npot mipmaps at full speed, while OpenGL usually depends on the GPU and Driver used.
2018-09-29 17:05:58 +02:00
Michael Fabian 'Xaymar' Dirks 6561ea9b3c util-math: Rename get_power_of_two to get_power_of_two_exponent 2018-09-29 16:57:41 +02:00
Michael Fabian 'Xaymar' Dirks 9a8a44045b gs-mipmapper: Fix support for very small mipmaps
This fixes the final mip map of a texture being empty, in cases where either width or height is reduced to just a single pixel.
2018-09-29 16:57:17 +02:00
Michael Fabian 'Xaymar' Dirks 0a7283b2ba filter-transform: more Formatting, add mipmap options 2018-09-29 15:57:25 +02:00
Michael Fabian 'Xaymar' Dirks dbe577e372 filter-transform: Formatting, refactoring and mipmapping
The '3D Transform' filter now support mipmapping using the Linear generator. This results in smoother images when the shape is squished or distant, instead of a pixelated mess.
2018-09-29 01:07:38 +02:00
Michael Fabian 'Xaymar' Dirks 7c520ae9ee gs-mipmapper: Implement actual mipmap generation
This enables full mipmapping support for textures with a shader view that allows accessing different mip levels. In order to access mip levels, you have to specify gs::texture:🎏:BuildMipMaps when creating the texture, as OBS currently forces the maximum mip level to 1 even if you actually have mip data available.
2018-09-29 01:06:30 +02:00
Michael Fabian 'Xaymar' Dirks c591902fea gs-texture: Allow texture creation without data
This is a valid operation and allows for creation of uninitialized textures, which can be copied to but should not be read from until that moment.
2018-09-28 23:34:43 +02:00
Michael Fabian 'Xaymar' Dirks 95018868dc gs-mipmapper: Formatting and refactoring 2018-09-28 23:32:35 +02:00
Michael Fabian 'Xaymar' Dirks bb5c1f80b5 gfx-source-texture: Formatting and refactoring 2018-09-28 23:31:21 +02:00
Michael Fabian 'Xaymar' Dirks bc89eaf33a util-math: Fix is_power_of_two_loop for non-64-bit types 2018-09-28 21:21:40 +02:00
Michael Fabian 'Xaymar' Dirks 6e03f2334d gs-mipmapper: Textures with no mip level do not exist 2018-09-28 21:21:24 +02:00
Michael Fabian 'Xaymar' Dirks f78be9c387 gs-texture: Undo removal of mip_data check 2018-09-28 21:21:04 +02:00
Michael Fabian 'Xaymar' Dirks 04d7379ff1 filter-transform: Formatting 2018-09-28 14:49:59 +02:00
Michael Fabian 'Xaymar' Dirks b5746e473b gfx-effect-source: Remove mipmapper 2018-09-28 14:26:06 +02:00
Michael Fabian 'Xaymar' Dirks ff8618c339 gs-mipmapper: Specify source and target and remove Bilinear 2018-09-28 14:24:30 +02:00
Michael Fabian 'Xaymar' Dirks afc04a5d0e gs-texture: Use util::math functions 2018-09-28 14:23:47 +02:00
Michael Fabian 'Xaymar' Dirks 528d36a13f util-math: Fix compile error and add get_power_of_two_* 2018-09-28 14:23:26 +02:00
Michael Fabian 'Xaymar' Dirks 391fca7497 gs-effect: Formatting 2018-09-28 14:18:09 +02:00
Michael Fabian 'Xaymar' Dirks 1923a724d7 util-math: Formatting and is_power_of_two templates 2018-09-28 14:17:43 +02:00
Michael Fabian 'Xaymar' Dirks db13c50ec5 gfx-effect-source: Add initial code for texture support 2018-09-28 11:55:55 +02:00
Michael Fabian 'Xaymar' Dirks 7b995cf50b gs-vertexbuffer: Fix heap corruption 2018-09-28 11:47:50 +02:00
Michael Fabian 'Xaymar' Dirks 72d15bad31 gs-mipmapper: Slight formatting changes 2018-09-27 06:21:39 +02:00
Michael Fabian 'Xaymar' Dirks bc63696306 gs-mipmapper: Early attempts at proper mipmap rendering
This class is an attempt at adding dynamic mipmapping support to OBS, which is lacking this feature. It is pretty much a hack until I figure out how to do it for both d3d11 and opengl and can make a PR for obs-studio to include this ability by default.
2018-09-27 06:09:43 +02:00
Michael Fabian 'Xaymar' Dirks 14b370a7a5 gs-texture: Remove accidentally added enum 2018-09-27 05:36:49 +02:00
Michael Fabian 'Xaymar' Dirks fb77cc90a6 gs-rendertarget: Allow retrieving color and zstencil format 2018-09-27 05:23:14 +02:00
Michael Fabian 'Xaymar' Dirks faeb5af45b gs-rendertarget: Formatting and refactoring 2018-09-27 05:17:08 +02:00
Michael Fabian 'Xaymar' Dirks ded5896fca gs-texture: Add get_color_format method 2018-09-27 05:11:37 +02:00
Michael Fabian 'Xaymar' Dirks 52cb7a6d20 gs-texture: Formatting, refactoring and cleanup 2018-09-27 05:09:38 +02:00
Michael Fabian 'Xaymar' Dirks 4c1e66e27b gs-vertexbuffer: Remove #pragma region 2018-09-27 03:11:04 +02:00
Michael Fabian 'Xaymar' Dirks 8a897c8898 gs-vertex: Formatting and fix constructors 2018-09-27 03:07:38 +02:00
Michael Fabian 'Xaymar' Dirks 431fee7b9b gs-vertexbuffer: Do not assign uv layers that do not exist 2018-09-27 03:00:17 +02:00
Michael Fabian 'Xaymar' Dirks cace17a817 gs-vertexbuffer: Allow specifying amount of UV layers
This should reduce GPU memory usage for vertex buffers that need less UV information than the maximum allowed UV layers possible.
2018-09-27 02:57:53 +02:00
Michael Fabian 'Xaymar' Dirks c3e67bad97 gs-vertexbuffer: Formatting and various fixes
With the addition of clang-format and cppcheck, and the changes to .editorconfig, various changes need to be added.
2018-09-27 02:49:00 +02:00
Michael Fabian 'Xaymar' Dirks a54a526c4b plugin: Write plugin version to log file on load and unload 2018-08-13 01:01:15 +02:00
Michael Fabian 'Xaymar' Dirks e8da137ab6 filter-custom-shader: Basic custom shader support
The Custom Shader Filter is now capable of rendering a custom shader using the gfx::effect_source class as a backend. An example shader is provided for starting off, more advanced examples may come later.

Related: #5
2018-04-29 03:07:26 +02:00
Michael Fabian 'Xaymar' Dirks 0957ce0bb9 gfx-effect-source: Implement basic functionality
Rendering is now possible, although some parameter types are not yet supported. So far, booleans and floats will work fine, integers will cause an error in OBS Studios rendering code for an unknown reason.
2018-04-29 03:05:53 +02:00
Michael Fabian 'Xaymar' Dirks b4de874ec9 gs-effect: Work around for an obs-studio issue with Integer parameters 2018-04-29 03:01:20 +02:00
Michael Fabian 'Xaymar' Dirks 6057101f26 gs-vertexbuffer: Fix usage of gs_vertexbuffer_get_data() 2018-04-29 03:00:40 +02:00
Michael Fabian 'Xaymar' Dirks e200127595 source-mirror: Fix compiler warnings 2018-04-29 03:00:04 +02:00
Michael Fabian 'Xaymar' Dirks c9ed74a3f9 gs-texture: Additional type safety and new methods 2018-04-29 02:59:51 +02:00
Michael Fabian 'Xaymar' Dirks d59b54811f utility: Code for using enumerations as flags/bitsets
It baffles me that this is not just part of the language itself from the beginning, it's used nearly everywhere and is needed for type safety.
2018-04-29 01:02:05 +02:00
Michael Fabian 'Xaymar' Dirks af71a7cc1d filter-blur: Allow applying Blur to a sub-region of the source only
The Blur Filter can now be applied to a region inside the source itself, the inverse of that region, and/or a feathered version of that region. This allows for easier scene setups where only some parts need to be blurred, but the rest can be left as is.

Fixes #12
2018-04-29 00:14:29 +02:00
Michael Fabian 'Xaymar' Dirks 1ba9145fbd filter-blur: Use only a single Gaussian Kernel Texture 2018-04-28 14:41:18 +02:00
Michael Fabian 'Xaymar' Dirks 6c1e874369 filter-blur: Refactoring, formatting and copyright 2018-04-28 13:59:54 +02:00
Michael Fabian 'Xaymar' Dirks 0cd4520774 util-math: Bilateral Blur 2018-04-28 12:45:23 +02:00
Michael Fabian 'Xaymar' Dirks c4942da235 source-mirror: Refactoring 2018-04-28 12:45:11 +02:00
Michael Fabian 'Xaymar' Dirks 410ba9df88 source-mirror: Implement mirroring of Source Audio
From this point on, Source Mirror is now capable of real-time mirroring of Video and Audio. This can help if you need different filters per scene for your microphone or voice chat, depending on the scene (audio ducking for pause scene, no audio ducking for live gaming).
2018-04-27 23:38:49 +02:00
Michael Fabian 'Xaymar' Dirks 57c2daa80c obs-audio-capture: Helper class for automated capture of source audio 2018-04-27 23:34:26 +02:00
Michael Fabian 'Xaymar' Dirks e621b69aa2 source-mirror: Ensure that we have a source on video_tick 2018-04-24 17:07:06 +02:00
Michael Fabian 'Xaymar' Dirks 5e4a781912 source-mirror: Ensure that we have a proper source on activate() 2018-04-24 15:31:51 +02:00
Michael Fabian 'Xaymar' Dirks d8d60f7a21 gfx-effect-source: Check for effect == nullptr in test_for_updates 2018-04-24 13:58:07 +02:00
Michael Fabian 'Xaymar' Dirks 49964e15be gfx-source-texture, source-mirror: Prevent recursion caused by Source Mirror 2018-04-24 13:48:42 +02:00
Michael Fabian 'Xaymar' Dirks ec19f44f96 project: Don't prefix includes with "libobs/" 2018-04-23 17:53:27 +02:00
Michael Fabian 'Xaymar' Dirks 0b5a848c32 cmake: Improve automatic versioning 2018-04-23 17:52:40 +02:00
Michael Fabian 'Xaymar' Dirks fc78bd83a6 filter-custom-shader: Initial version based on gfx::effect_source 2018-04-09 13:28:13 +02:00
Michael Fabian 'Xaymar' Dirks 9f91039ca0 util-memory: Don't use _dbg versions for aligned_alloc/free 2018-04-09 13:27:51 +02:00
Michael Fabian 'Xaymar' Dirks 5e9f113553 gfx-effect-source: Base class for Custom Shaders
gfx::effect_source is the base class for all Custom Shader Sources and Transitions, which reduces the overall workload to a single file, but unfortunately also reducing the effective customization per source a bit.
2018-04-09 13:27:22 +02:00
Michael Fabian 'Xaymar' Dirks 9ae8ecc3e1 source-mirror: Fix crashes caused by uncaught exception 2018-04-09 13:23:57 +02:00
Michael Fabian 'Xaymar' Dirks fe05dca51e gfx, gs: Fix commits 9f518764b6 & 2adfa5765c 2018-03-20 12:50:17 +01:00
Michael Fabian 'Xaymar' Dirks 22eb53a856 gfx: Initial code for an Effect Source (Custom Shader)
This class will be used by any Custom Shader type (Filter, Source, Transition) and as such is pretty much used as the basis for all of it.
2018-03-20 12:45:41 +01:00
Michael Fabian 'Xaymar' Dirks 2adfa5765c gs: Rename to snake_case instead of PascalCase
This should prevent mishaps with upper/lowercase typos and fits in better with the C++ standard code, which is also in snake_case.
2018-03-20 12:44:02 +01:00
Michael Fabian 'Xaymar' Dirks 9f518764b6 gfx: Move util::SourceTexture to gfx::SourceTexture
'gfx' is the new preview for Graphics utilities that do not act as a wrapper around the Graphics Subsystem directly.
2018-03-08 11:28:23 +01:00
Michael Fabian 'Xaymar' Dirks 53073660c0 Merge branch 'filter-custom-shader' 2018-03-05 16:50:57 +01:00
Michael Fabian 'Xaymar' Dirks 65a7ac696b source-mirror: Use util:SourceTexture instead of custom code 2018-03-05 16:50:19 +01:00
Michael Fabian 'Xaymar' Dirks 304db23335 util-math: Add SizeFromString method
Converts a String to an std::pair of int64_t (long long), which contain the size or 0 if none could be parsed. Any delimiter except digits(0-9), a minus sign(-) or a plus sign(+) between width and height are allowed. If a plus or minus sign is used as a delimiter, it must immediately be followed by the second size number. This allows for formats such as: 100x100, 100:100, 100p100, 100@100, 100+100 and so on, but not formats such as 100+:100, 100ThisIsSomeReall+yLongText100, etc.

The parameter 'allowSquare' also determines what to do when the height parameter is not found. A value of true will have the function return <width,width> instead of <width,0>.
2018-03-05 16:36:20 +01:00
Michael Fabian 'Xaymar' Dirks 1f60e3d56f util-source-texture: Fix commit 75aeb561bd
Including obs.h directly is not compatible with CPack installations of libobs.
2018-03-05 16:21:30 +01:00
Michael Fabian 'Xaymar' Dirks 224544efff util-source-texture: Add method to retrieve obs_source_t* obejct 2018-03-05 16:19:42 +01:00
Michael Fabian 'Xaymar' Dirks 75aeb561bd util: Add SourceTexture utility
This utility class is used to quickly render and retrieve a Texture from a source. It should be used in place of manual rendering since it can be updated quickly, fixing outstanding issue in all places of the plugin instead of just one.
2018-03-05 15:17:34 +01:00
Michael Fabian 'Xaymar' Dirks cc68e2864f gs-rendertarget: Add and implement GetTexture(...) methods 2018-03-05 15:10:51 +01:00
Michael Fabian 'Xaymar' Dirks 7d065c131d gs-texture: Allow creation from existing gs_texture_t* 2018-03-05 15:10:19 +01:00
Michael Fabian 'Xaymar' Dirks 01bf510a28 util-memory: Use standard alloc/free and fix incorrect aligned length
The custom allocator occasionally returned memory that was aligned, but did not have enough space to store the actual size due to a calculation error in the size. This resulted in situations where allocating 1022 bytes would give you a writable buffer of only 1020 bytes or less, or also known as writing into unknown memory, possibly even the heap. This is now fixed by doubling the padding used.

Additionally it will now default to using standard allocators, which should work better and rely on the Compiler.
2018-02-24 04:35:49 +01:00
Michael Fabian 'Xaymar' Dirks eccd95c68c filter-custom-shader: First working version with several fixes
- Shaders now have all promised special variables available to them.
- 'Pass' (int) is no longer a special variable.
- Files should now properly update every half second.
- Fixed a ton of compiler warnings.
- Forced loading shaders from text instead of files to avoid caching.
- Fixed file modification tests always failing.
- Actually renders shaders now.

Known issues:
- Parameters aren't updated with file modifications unless the file is actually changed in the UI.
2018-01-25 10:26:09 +01:00
Michael Fabian 'Xaymar' Dirks 107103001b gs-effect: Add HasParameter and fix Set*Array
HasParameter can be used to safely check if a parameter exists and such should be preferred over try-catch blocks. Additionally, SetFloat2, SetFloat3, SetFloat4, SetFloatArray, SetInteger2, SetInteger3, SetInteger4 and SetIntegerArray should no longer cause rendering issues due to invalid buffer sizes.
2018-01-25 09:12:47 +01:00
Michael Fabian 'Xaymar' Dirks b4eadc2995 filter-blur: Don't override blend mode of original source
This causes a black square to appear, since the blend mode should ideally match what the original source thought it would be.
2018-01-25 05:11:15 +01:00
Michael Fabian 'Xaymar' Dirks 080048a471 filter-custom-shader: UI improvements and initial rendering code 2018-01-19 20:46:54 +01:00
Michael Fabian 'Xaymar' Dirks 26b447901c filter-custom-shader: Implement new Filter 'Custom Shader'
Custom Shader allows you to write your own effect files and just have them applied to your source(s). It will dynamically update the properties to match the parameters in the source as well as offer some special parameters to the shader.

# Conflicts:
#	CMakeLists.txt
#	data/locale/en-US.ini

# Conflicts:
#	data/locale/en-US.ini
2018-01-19 20:46:54 +01:00
Michael Fabian 'Xaymar' Dirks adafbf40ca util-memory: Expose aligned_offset to code 2018-01-19 20:46:22 +01:00
Michael Fabian 'Xaymar' Dirks 67099c2b23 gs-effect: Fix assigning of Integer and Float arrays 2018-01-19 20:46:21 +01:00
Michael Fabian 'Xaymar' Dirks 734ea577b8 source-mirror: Release source and fix compiler warnings 2018-01-19 20:46:21 +01:00
Michael Fabian 'Xaymar' Dirks a307283349 gs-effect: Allow directly assigning OBS GS objects 2018-01-19 20:46:21 +01:00
Michael Fabian 'Xaymar' Dirks 0565065c2b source-mirror: 'Point' rescale should use point sampling 2018-01-19 05:10:42 +01:00
Michael Fabian 'Xaymar' Dirks 102e4e5eeb gs-effect: Implement method to override the next sampler 2018-01-19 05:10:10 +01:00
Michael Fabian 'Xaymar' Dirks 36cd5bbf21 gs-sampler: Add wrapper for gs_samplerstate_t
Simple manager with automatic updating whenever the object is requested.
2018-01-19 05:06:42 +01:00
Michael Fabian 'Xaymar' Dirks 662199fb4a source-mirror: Fix scaling issues and allow keeping original size
Scaling was previously incorrectly rendering the source with another effect forced onto it, resulting in slower rendering and some sources that would no longer render properly.

Additionally the new option allows the user to have the source render at the original resolution in order to allow previously applied transform to stay identical. The rescaling however will no longer apply to filters after this source then, thus the speed bonus is lost.

Also categorized the localization file and adds descriptions for existing and new properties for Source Mirror.
2018-01-19 04:15:40 +01:00
Michael Fabian 'Xaymar' Dirks 5e0b387dc1 gs-vertexbuffer: Functions to directly access internal buffers
Skips the previously necessary step to call At(0) and use the pointers stored in GS::Vertex to directly write to the buffers.
2018-01-19 03:15:12 +01:00
Michael Fabian 'Xaymar' Dirks fe3186220c gs-vertexbuffer: Slight Refactor to unify code style 2018-01-19 03:13:02 +01:00
Michael Fabian 'Xaymar' Dirks 3a05c08daf gs-vertexbuffer: Implement copy and move constructor/assignment 2018-01-19 03:05:24 +01:00
Michael Fabian 'Xaymar' Dirks b4d63e919e gs-vertex: Allocate memory if none is assigned
Allows code to directly use GS::Vertex for their own purposes without having to rely on GS::VertexBuffer, which comes with the added overhead of allocating GPU memory.
2018-01-19 03:01:54 +01:00
Michael Fabian 'Xaymar' Dirks 82ec6b93ec gs-vertexbuffer: Also free layer data
Fixes a tiny memory leak caused by a missing free.

Related: #9
2018-01-18 05:22:57 +01:00
Michael Fabian 'Xaymar' Dirks 1ebb0beac4 gs-vertexbuffer: Avoid relying on std for aligned types
Changes the GS::VertexBuffer storage to be one continuous buffer that is properly aligned and is also now used for GS::Vertex. This halves the necessary memory, removes reallocation cost and removes the copy necessary to get things onto the GPU.

Related: #9
2018-01-18 05:02:10 +01:00
Michael Fabian 'Xaymar' Dirks 4983e0ca06 gs: Define shared limits and exclude mipmapper
This unifies the logic in GS::IndexBuffer and GS::VertexBuffer so that both can take the same amount of vertices. Additionally the limit for vertices was increased to 16777216 from 65536 to allow for proper models to be stored.
2018-01-18 05:02:10 +01:00
Michael Fabian 'Xaymar' Dirks 53568d445b gs-vertex: Hint VS2013/2015 at proper alignment
The previous fix unfortunately didn't actually fix it and instead made the crash invisible at first and then corrupt the heap at a later point. With this, VS2013 and VS2015 create code identical to what VS2017 creates, and no longer seem to crash.

Related: #9
2018-01-18 03:12:52 +01:00
Michael Fabian 'Xaymar' Dirks e9fc9e89f2 plugin: Use self-registration code everywhere 2018-01-16 11:47:24 +01:00
Michael Fabian 'Xaymar' Dirks cb1ae28b07 gs-vertexbuffer: Use aligned memory and fix null pointer
This fixes the crash on creation issues, but a crash on exit still happens with the plugin installed. Unsure what exactly is causing it but it looks like something is writing into heap memory.

Related: #9
2018-01-08 19:08:49 +01:00
Michael Fabian 'Xaymar' Dirks 1e2cff48c9 util-memory: Implement aligned std::allocator 2018-01-08 19:01:26 +01:00
Michael Fabian 'Xaymar' Dirks 8a595501b3 gs-vertex, util-math: Use _aligned_malloc instead of util::malloc_aligned 2018-01-08 17:41:26 +01:00
Michael Fabian 'Xaymar' Dirks 1993c42ea6 filter-transform: Use 16-byte aligned vec3 & vec4 2018-01-08 17:31:50 +01:00
Michael Fabian 'Xaymar' Dirks 3e97906b32 gs-vertex: Always align to 16-byte 2018-01-08 17:30:33 +01:00
Michael Fabian 'Xaymar' Dirks f721ad0f19 util-math: Fix standalone compilation issues
All libobs files must be loaded with libobs/... instead of directly.
2018-01-08 16:47:39 +01:00
Michael Fabian 'Xaymar' Dirks 08c088ce5a util-math, util-memory: Formatting 2018-01-08 16:14:54 +01:00
Michael Fabian 'Xaymar' Dirks a3d859fb4f util-math: Implement aligned vec3 and vec4 versions
A bug in Visual C++ 2013 32-bit & 2015 32-bit causes the C++ compiler to incorrectly align the vec3 and vec4 structs to 8-byte instead of 16-byte, resulting in a crash if the target PC supports SSE. Visual Studio 2017 and 64-bit builds are not affected.

Related: #9
2018-01-08 15:29:42 +01:00
Michael Fabian 'Xaymar' Dirks cf17cdab19 util-memory: Rename aligned_malloc 2018-01-08 11:35:05 +01:00
Michael Fabian 'Xaymar' Dirks 32ed7b645a util-memory: Memory utility functions 2018-01-08 10:52:53 +01:00
Michael Fabian 'Xaymar' Dirks add8012549 source-mirror: Add a Source Mirror source
The source allows you to apply effects to the same source without requiring a new instance of the source. Any changes done to the original source also apply to the mirror, so there is less total work that needs to be done.

It can also rescale the source, allowing you to use the same source as a cheap instant backdrop with Blur for example. What you do in the end is completely unwritten and up to you to decide.
2017-12-14 08:46:36 +01:00
Michael Fabian 'Xaymar' Dirks 78ccd94639 filter-blur: Ensure that the initializer is unique 2017-12-14 08:05:06 +01:00
Michael Fabian 'Xaymar' Dirks f5fca108d7 gs-rendertarget: Fix missing initialization 2017-12-14 08:04:54 +01:00
Michael Fabian 'Xaymar' Dirks e7bbb213a4 filter-blur: Fix Blur filter occasionally not rendering
An earlier commit changed how Blur filter rendered and thus m_technique was no longer being initialized, resulting in the check randomly failing if the memory was just right.

This also adds some more extra logging to the instance creation in case things fail and fixed one MSVC warning.

Fixes #1
2017-12-14 03:52:29 +01:00
Michael Fabian 'Xaymar' Dirks 9ab06e7368 gs-mipmapper: Fix type conversion warnings 2017-12-14 03:12:24 +01:00
Michael Fabian 'Xaymar' Dirks 762c961ed3 gs-vertexbuffer: Fix incorrect vertex buffer size on GPU crash 2017-12-14 03:09:02 +01:00
Michael Fabian 'Xaymar' Dirks 0d794254be util-math: Fix MSVC 2013 errors 2017-12-14 03:00:31 +01:00
Michael Fabian 'Xaymar' Dirks 6c4b8bbf12 filter-blur: Fix up some MSVC warnings 2017-12-14 03:00:08 +01:00
Michael Fabian 'Xaymar' Dirks 09d5ac4635 gs-vertexbuffer: Fix support for 20.x graphics API
Reverts an earlier change that made the plugin rely on 21.x features.
2017-12-14 02:59:50 +01:00
Michael Fabian 'Xaymar' Dirks 911f7696bb filter-blur: Reduce log spam on error 2017-12-14 02:35:47 +01:00
Michael Fabian 'Xaymar' Dirks 9d4314141a gs-texture: Remove unused function 2017-12-14 01:39:43 +01:00