0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 21:13:04 +02:00
Commit Graph

175 Commits

Author SHA1 Message Date
jp9000
f53df7da64 clang-format: Apply formatting
Code submissions have continually suffered from formatting
inconsistencies that constantly have to be addressed.  Using
clang-format simplifies this by making code formatting more consistent,
and allows automation of the code formatting so that maintainers can
focus more on the code itself instead of code formatting.
2019-06-23 23:49:10 -07:00
jp9000
53615ee10f clang-format: Add clang-format files 2019-06-23 01:53:56 -07:00
Jim
4991113abc
Merge pull request #1852 from jpark37/blend-alpha-attempt-two
libobs: libobs-d3d11: Fix alpha blend
2019-05-08 23:37:10 -07:00
James Park
ba21fb947e libobs: Fix various alpha issues
There are cases where alpha is multiplied unnecessarily. This change
attempts to use premultiplied alpha blending for composition.

To keep this change simple, The filter chain will continue to use
straight alpha. Otherwise, every source would need to modified to output
premultiplied, and every filter modified for premultiplied input.

"DrawAlphaDivide" shader techniques have been added to convert from
premultiplied alpha to straight alpha for final output. "DrawMatrix"
techniques ignore alpha, so they do not appear to need changing.

One remaining issue is that scale effects are set up here to use the
same shader logic for both scale filters (straight alpha - incorrectly),
and output composition (premultiplied alpha - correctly). A fix could be
made to add additional shaders for straight alpha, but the "real" fix
may be to eliminate the straight alpha path at some point.

For graphics, SrcBlendAlpha and DestBlendAlpha were both ONE, and could
combine together to form alpha values greater than one. This is not as
noticeable of a problem for UNORM targets because the channels are
clamped, but it will likely become a problem in more situations if FLOAT
targets are used.

This change switches DestBlendAlpha to INVSRCALPHA. The blending
behavior of stacked transparents is preserved without overflowing the
alpha channel.

obs-transitions: Use premultiplied alpha blend, and simplify shaders
because both inputs and outputs use premultiplied alpha now.

Fixes https://obsproject.com/mantis/view.php?id=1108
2019-05-08 20:26:52 -07:00
Jim
c396a30de7
Merge pull request #1819 from Xaymar/patch-add-effect-debug-info
libobs: Add additional effect debugging information
2019-05-08 17:56:07 -07:00
jp9000
f109d1c2bf Revert "libobs: libobs-d3d11: obs-filters: No excess alpha"
This reverts commit d91bd327d7, which
broke alpha with sources, scenes, and filter, causing them all to become
opaque unintentionally.
2019-04-25 08:36:41 -07:00
James Park
8bafa51d3b libobs: Fix GS_UNSIGNED_LONG definition
GS_UNSIGNED_LONG is defined as sizeof(long) in some places, making it 8
outside of Windows instead of 4 as it should be.

Fixes https://obsproject.com/mantis/view.php?id=1444
2019-04-21 21:25:35 -07:00
Jim
9480cc4fd2
Merge pull request #1675 from admshao/clear-linux-compiling-warnings
Clear linux compiling warnings
2019-04-14 04:21:21 -07:00
Jim
f1399b6d18
Merge pull request #1765 from jpark37/blend-alpha
libobs: libobs-d3d11: Fix blend alpha overflow
2019-04-14 00:22:20 -07:00
Michael Fabian 'Xaymar' Dirks
195b11341f libobs: Add additional effect debugging information
Adds more log information for effects, such as the reformatted effect code, parameters, techniques and passes. This is useful for tracking down issues and what actually ends up being compiled in the end, without having to guess where the error is actually at, as what is compiled and what was originally there usually differ by a lot.

This information is only logged if libobs is compiled in debug and _DEBUG_SHADERS is defined and not compiled if either of those are not the case.
2019-04-08 21:07:28 +02:00
James Park
2996a6c06b libobs/graphics: Support debug markers
Add support for debug markers via D3DPERF API and KHR_debug. This makes
it easier to understand RenderDoc captures.

D3DPERF is preferred to ID3DUserDefinedAnnotation because it supports
colors. d3d9.lib is now linked in to support this.

This feature is disabled by default, and is controlled by
GS_USE_DEBUG_MARKERS.

From: obsproject/obs-studio#1799
2019-04-08 02:05:37 -07:00
James Park
d91bd327d7 libobs: libobs-d3d11: obs-filters: No excess alpha
Currently SrcBlendAlpha and DestBlendAlpha are both ONE, and can
combine together to form two. This is not a noticeable problem for
UNORM targets because the channels are clamped, but it will likely
become a problem if FLOAT targets are more widely used.

This change switches DestBlendAlpha to INVSRCALPHA, and starts
backgrounds as opaque black instead of transparent black. The blending
behavior of stacked transparents is preserved without overflowing the
alpha channel.
2019-04-07 18:16:56 -07:00
Shaolin
721302bf00 libobs: Clear all compiler warnings 2019-03-29 06:29:04 -03:00
jp9000
d18c62b2b5 libobs, image-source: Fix ABI break in image_file_t structure
In commit a776a6cf07, the image_file_t structure (which is a public
structure) had a member variable added to it, which broke ABI.
2019-03-28 22:30:20 -07:00
James Park
cb67192077 libobs: Fix invalid max_anisotropy value
max_anisotropy is initialized to zero, but the minimum value is 1.
2019-03-19 01:26:28 -07:00
Dmitry-Me
b835d7ec05 libobs: Fix effect parsing log specifiers
Closes #1649
2019-03-14 00:04:15 -05:00
jp9000
a776a6cf07 libobs/graphics: Add memory usage member to image file
Allows estimating the required memory usage of an image.
2019-03-13 01:11:18 -07:00
jp9000
93fc61fa82 libobs/graphics: Add NV12 texture support 2019-02-07 17:00:46 -08:00
jp9000
b64d7d71d0 libobs/graphics: Add texture sharing functions 2019-02-07 17:00:46 -08:00
Alex Anderson
fc97512f71 libobs: Fix crash when pixel or vertex shader are missing
Checks that the token is not null while looping. Logs errors when pixel
or vertex shader are missing.
2018-12-03 15:02:20 -08:00
Jim
118dbf9e67
Merge pull request #1481 from Andersama/patch-26
libobs: Export image-file to c
2018-09-12 02:05:26 -07:00
Alex Anderson
b30c843622
libobs: Export image-file to c
Wraps image-file.h in extern "C" like rest of libobs api.

Prevents unresolved external errors when using in c++.
2018-09-11 13:31:45 -07:00
Alex Anderson
e0cd45be9b libobs: Add additional gs_effect_get_ functions
Adds api functions to extract gs_eparam_t values, including
gs_effect_get_val(), gs_effect_get_val_size(),
gs_effect_get_default_val() and gs_effect_get_default_val_size()
2018-09-08 05:22:12 -07:00
Alex Anderson
af67086912 libobs: Add HLSL annotation parsing
Gives the ability to retrieve param annotations. Blocks wrapped in <>
following a parameter.

For example:
float slider < float max_value = 10.0; float min_value = 0.0; >;

These blocks are not for shading purposes but to help describe the
shader's gui as in the example above.

Adds graphics api functions for retrieving annotations:
size_t gs_param_get_num_annotations(const gs_eparam_t *param);

gs_eparam_t *gs_param_get_annotation_by_idx(const gs_eparam_t *param,
		size_t annotation);

gs_eparam_t *gs_param_get_annotation_by_name(const gs_eparam_t *param,
		const char *name);
2018-09-08 05:22:12 -07:00
nleseul
5a111cf073 libobs: Handle 'in', 'out', and 'inout' keywords in shader parsers 2018-05-28 12:07:20 -04:00
jp9000
66f993d214 libobs: Exclude certain declarations from SWIG processing
Prevents SWIG from being able to process certain declarations that would
cause binding generation errors/warnings.
2018-01-03 17:04:04 -08:00
jp9000
b56c33a260 libobs/util: Add THREAD_LOCAL macro
Adds a thread local storage macro to declare thread local storage
independent of platform.
2018-01-03 17:04:02 -08:00
jp9000
0497095f97 Fix a number of GCC warnings 2017-12-06 16:42:45 -08:00
jp9000
0d6204c8af Fix a number of MSVC warnings
Fixes a number of warnings with all modules
2017-12-05 13:53:44 -08:00
jp9000
78411de75e libobs/graphics: Add gs_effect_set_color
Convenience function for setting a color (in hex format, e.g.
0xAARRGGBB)
2017-12-01 12:05:52 -08:00
jp9000
c111fa68b8 libobs: Add vertex/index buffer "direct" flush functions
(Note: This commit also modifies libobs-d3d11 and libobs-opengl)

Allows the ability to flush data directly without having to use the
buffer's internal data.

Allows the caller to manage his/her own vertex/index buffer data if
desired, working around the design flaw of having to rely on a
vertex/index buffer's internal data.
2017-11-27 03:00:20 -08:00
jp9000
a46f0b4808 libobs: Add option to duplicate vertex/index buffer data
Prevents from having to pass ownership of buffer data from caller when
using gs_vertexbuffer_create() or gs_indexbuffer_create() (which is a
design flaw).
2017-11-27 02:45:33 -08:00
Jimi Huotari
fef71c4b7c libobs: Fix ImageMagick header path
Since ImageMagick 7, the header path has been changed.  This commit
implements a check for the version being used, and includes the
header as is appropriate.

Special thanks to Hu.

Mantis-Bug: https://obsproject.com/mantis/view.php?id=966

Gentoo-Bug: https://bugs.gentoo.org/627520

Closes jp9000/obs-studio#1018
2017-09-15 08:23:32 -07:00
Shaolin
cb9f767e45 libobs/plugins/UI: Suppress -Wimplicit-fallthrough introduced by GCC 7
Signed-off-by: Shaolin <admshao@gmail.com>
2017-05-29 21:05:18 -03:00
Ryan Foster
be98cee2a0 Fix various typos across multiple modules 2017-04-25 22:39:42 -04:00
Autumin
0ff4feab02 libobs/graphics: Fix the 2D vector dot product func
The operators were unintentionally reversed.

Closes jp9000/obs-studio#724
2016-12-18 06:20:24 -08:00
jp9000
0bc0db1207 libobs/graphics: Add gs_draw_sprite_subregion function
Allows rendering only a subregion of a specific sprite.
2016-09-19 07:03:57 -07:00
jp9000
4dc0024198 libobs/graphics: Add ability to set shader texture sampler
(Note: This also modifies libobs-d3d11 and libobs-opengl)

Allows overriding the sampler for a specific shader parameter.
2016-06-29 04:15:38 -07:00
jp9000
a90c37987f libobs/graphics: Change BorderColor to just use number
Instead of prefixing the color with the '#' character, just take it as
an actual integer.
2016-06-28 02:46:35 -07:00
hwdro
e3847109be libobs/graphics: Add SSE intrinsics for matrix4_transpose 2016-05-26 22:13:01 -07:00
hwdro
017d77b399 libobs/graphics: Remove redundant variable assignment 2016-05-26 22:12:54 -07:00
jp9000
0c5fd7a0fb libobs/graphics: Always load gif frame if needed
Under certain circumstances it's necessary to seek, but if the frame
isn't loaded for the position that's being seeked to, it won't update
the texture.  This just ensures the texture will update when seeking.
2016-05-26 08:13:21 -07:00
Richard Stanway
65094eefe4
libobs: Don't try to keep rendering if a texture wasn't allocated
Fixes issues with invalid textures causing huge output or large black
regions to be rendered.
2016-04-21 00:21:07 +02:00
Anthony Super
1fe0743256 libobs: Remove duplicated determinant calculation 2016-04-12 14:31:52 -06:00
John Bradley
431a02459d libobs/graphics: Add int vector support to shaders 2016-03-21 21:22:28 -07:00
jp9000
85ffa10d3f libobs/graphics: Fix vec4_to_(rgba/bgra) functions
These functions were not properly shifting the bits when calculating the
output.
2016-02-22 10:47:49 -08:00
jp9000
f6728189f5 libobs: Implement BorderColor sampler state value 2016-02-21 12:06:19 -08:00
jp9000
876cc94d51 libobs: Fix bug where bool constant size would be 1
(This commit also modifies libobs-d3d11)

Boolean constant size should be 4
2016-02-21 12:05:04 -08:00
jp9000
a6c8a923e9 libobs: Remove trailing whitespace 2016-02-04 15:45:58 -08:00
jp9000
13890a46e6 libobs/graphics: Add gs_image_file_* functions (w/animated gifs)
These functions allow animated gifs and management of image files.  Uses
libnsgif to load animated gifs.
2016-01-25 17:29:08 -08:00