Commit graph

209 commits

Author SHA1 Message Date
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