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
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.
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
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).
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.
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>.
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.
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.
- 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.
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.
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
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.
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.
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
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.
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
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
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
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.
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
- 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.
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
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.
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.
* Added a 'Bilateral' de-noising blur, currently very resource hungry. It also has two extra sliders called 'Smoothing' and 'Sharpness', the former controls how smooth the output is
* Updated effect loading to be global instead of per instance.
* Changed default blur size to 5px.
* Simplified render loop (see previous effect commit).
This is not very optimized at the moment and will take quite a bit of GPU time. Will have to spend some time later to optimize it and perhaps add directional blur ("Motion Blur" to it).
* Fixed the perspective mesh not filling the entire frame with the default settings.
* Changed the maximum range of 'Field of View' to 179 degrees instead of 180 degrees.
* Changed the direction the perspective camera looks at to +Z instead of -Z. This should feel more natural for users of other 3D programs.
* Changed the 'Position (Z)' default to 0.
* Added translation strings for 'Field Of View', 'Position', 'Scale' and 'Rotation'.
FOV for the perspective camera was previously set to 180° (or more) resulting in really small images. Also added proper rotation support with options to choose which axis to rotate first.