Commit Graph

74 Commits

Author SHA1 Message Date
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
Michael Fabian 'Xaymar' Dirks 578c963a02 filter-blur: Code cleanup, fixes and more
- Fixed Gaussian Blur having color issues with radii that aren't a power of 2.
- Improved error reporting to better debug problems where Blur doesn't render.
- Switched from manual object management to managed classes.
- Lots of code cleanup for maintainability.
2017-12-14 01:39:33 +01:00
Michael Fabian 'Xaymar' Dirks 408481c22d util-math: Functions to calculate nearest power of two values 2017-12-14 01:36:07 +01:00
Michael Fabian 'Xaymar' Dirks d78d3024cc util-math: Add commonly used mathematical functions 2017-12-14 00:28:35 +01:00
Michael Fabian 'Xaymar' Dirks 61f20a83ad filter-blur: Use self-registration feature 2017-12-14 00:24:37 +01:00
Michael Fabian 'Xaymar' Dirks 9e813d98f1 gs-vertexbuffer: Update to new API adding flush_direct functionality
This fixes the crashes on deleting a filter without requiring painful memory editing.
2017-12-14 00:22:27 +01:00
Michael Fabian 'Xaymar' Dirks 71900e6752 gs-effect: Allow retrieving effect parameter name 2017-11-05 21:50:38 +01:00
Michael Fabian 'Xaymar' Dirks 4b364865a1 gs-effect: Allow empty effect and check errorMessage validity 2017-11-05 21:31:05 +01:00
Michael Fabian 'Xaymar' Dirks fc02f3fdad plugin: Allow new filters and transitions to self-register 2017-11-05 20:05:48 +01:00
Michael Fabian 'Xaymar' Dirks a9b13787be gs-effect: Provide parameter count and index access 2017-11-05 16:47:36 +01:00
Michael Fabian 'Xaymar' Dirks c7cfbff7dd gs-vertexbuffer: Workaround for a foreign deallocation bug in libobs
The graphics subsystem in OBS is freeing memory it didn't allocate, resulting in stack/heap corruption and other kinds of messy situations. The official "fix" for this is to use bmalloc, but then you lose any kind of ability to re-use the same buffer for multiple vertex buffers or update on the fly without adjusting code that is possibly outside of your control (such as in libraries).

This works around the issues by "patching" the gs_vertexbuffer object to no longer hold a reference to the gs_vb_data object. Currently only D3D11 is supported for this kind of hack and it might break in a future obs-studio release.

PR fixing this Issue: https://github.com/jp9000/obs-studio/pull/993
2017-11-03 00:13:07 +01:00
Michael Fabian 'Xaymar' Dirks 3450c149aa filter-displacement: Fix loading displacement filter 2017-11-02 17:57:52 +01:00
Xaymar c0aa79abbe filter-blur: Faster initialization for Gaussian Blur 2017-10-22 19:04:41 +02:00
Xaymar b266af1044 gs: Fix some type conversion warnings 2017-10-22 18:58:38 +02:00
Xaymar 6a208ed215 gs: Leave GS context and then return texture
This fixes a hang when calling GetTextureObject() on a GS::RenderTarget.
2017-10-22 18:57:28 +02:00
Michael Fabian Dirks 3899476a7f filter-transform: Actually include new C++ class header 2017-09-18 00:16:46 +02:00
Michael Fabian Dirks 27744f8b2a gs: Fix commit eb1612c6ee 2017-09-18 00:15:57 +02:00
Michael Fabian Dirks 90563e6b31 filter-transform: Add shearing support 2017-09-18 00:05:55 +02:00
Michael Fabian Dirks b07b5b1a0a filter-transform: Update code and fix camera and scaling 2017-09-18 00:05:54 +02:00
Michael Fabian Dirks 4de0a0ca16 filter-transform: Move translation strings to code 2017-09-18 00:05:54 +02:00
Michael Fabian Dirks 88cc142afb gs, effects: Anisotropic Mipmapper Class
End goal of this is to be an anisotropic filtering purely on the GPU without any actual mipmaps in the graphics subsystem. The basic idea behind it is that we can create all possible mipmaps in a twice as big texture as the original and then can efficiently render it no matter the GPU features as it will only consume one sampler.

The texture that it outputs will have both horizontal, vertical and full mipmaps in it. Horizontal mipmaps reduce Width, Vertical mipmaps reduce Height and full mipmaps reduce both. This means that LoD levels are both possible in the X and Y direction, allowing for much greater precision mipmapping on all GPUs.

This is a temporary solution until we can directly copy updated textures to a mipmap level.
2017-09-18 00:05:54 +02:00
Michael Fabian Dirks fce3fb8977 filter-shape: Use new GS classes 2017-09-18 00:05:53 +02:00
Michael Fabian Dirks e619f03217 filter-blur: Remove unused and duplicate functions 2017-09-18 00:05:40 +02:00
Michael Fabian Dirks eb1612c6ee gs: Wrap OBS Graphics Subsystem in proper C++ classes 2017-09-18 00:05:28 +02:00
Michael Fabian Dirks 607c8bf170 filter-transform: Formatting, Camera improvements and general fixes 2017-08-20 00:31:19 +02:00
Michael Fabian Dirks 4dbf414214 effects, filter-blur: Precalculated Kernel, Formatting, Rendering and more
Filter:
* Massively improved Rendering loop to reduce overhead and provide cleaner code.

Gaussian Blur:
* Added precalculated Kernels using Textures. Slightly reduced GPU load.
* Added basic attempt at a Nvidia o(n/2+1) gaussian blur implementation.
* Fix up LOD for texture sampling.

Box Blur:
* Halved loop count.
2017-08-20 00:25:05 +02:00
Michael Fabian Dirks 374d1183ea filter-shape: Formatting improvements 2017-08-19 23:56:53 +02:00
Michael Fabian Dirks 9c8778b6f6 filter-displacement: Formatting improvements 2017-08-19 23:56:05 +02:00
Michael Fabian Dirks 1b58632a3f plugin: Formatting 2017-08-19 23:47:54 +02:00
Michael Fabian Dirks 90138ef636 project: Update Copyright Notice 2017-08-19 23:41:53 +02:00
Michael Fabian Dirks 52c3a0171e filter-blur: Initial work on optimization 2017-07-18 16:50:30 +02:00
Michael Fabian Dirks 9c56898842 plugin: Formatting 2017-07-18 16:45:30 +02:00
Michael Fabian Dirks 58deaa9408 filter-displacement: Move effects to 'data/effects' 2017-07-06 06:23:06 +02:00
Michael Fabian Dirks 9967a6ebf0 filter-blur: Add Color Format option
This option allows applying the blur to other color formats such as YUV. Bilateral Blur benefits the most from this, resulting in smoother images at lower kernel sizes.
2017-07-06 06:02:41 +02:00