Commit graph

92 commits

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