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

1859 Commits

Author SHA1 Message Date
James Park
37f663a789 libobs: obs-ffmpeg: win-dshow: Planar 4:2:2 video
This format has been seen when using FFmpeg MJPEG decompression.
2019-07-25 20:11:37 -07:00
Jim
173eec0d6e
Merge pull request #1978 from jpark37/defer-yuv-multiply
libobs: Rework RGB to YUV conversion
2019-07-25 16:20:48 -07:00
Michael Fabian 'Xaymar' Dirks
4159477e43 libobs: Don't leak dynamic library references 2019-07-24 18:26:44 +02:00
Michael Fabian 'Xaymar' Dirks
005921c67d libobs: Return NULL if there is no get_properties callback
If there's no get_properties function, return NULL instead of uninitialized memory.
2019-07-24 18:26:44 +02:00
Michael Fabian 'Xaymar' Dirks
b31e93d59e libobs: Supress clang-tidy warning clang-tidy-cert-flp30-c 2019-07-24 18:26:43 +02:00
Jim
37072e6c97
Merge pull request #1932 from Chiitoo/libdir
cmake: Install 'libobs.pc' under the correct 'libdir'
2019-07-22 02:45:22 -07:00
jpark37
2656bf0a90 libobs: Rework RGB to YUV conversion
RGB to YUV converison was previously baked into every scale shader, but
this work has been moved to the YUV packing shaders. The scale shaders
now write RGBA instead. In the case where base and output resolutions
are identical, the render texture is forwarded directly to the YUV pack
step, skipping an entire fullscreen pass.

Intel GPA, SetStablePowerState, Intel HD Graphics 530, NV12

1920x1080, Before:
RGBA -> UYVX: ~321 us
UYVX -> Y: ~480 us
UYVX -> UV: ~127 us

1920x1080, After:
[forward render texture]
RGBA -> Y: ~487 us
RGBA -> UV: ~131 us

1920x1080 -> 1280x720, Before:
RGBA -> UYVX: ~268 us
UYVX -> Y: ~209 us
UYVX -> UV: ~57 us

1920x1080 -> 1280x720, After:
RGBA -> RGBA (rescale): ~268 us
RGBA -> Y: ~210 us
RGBA -> UV: ~58 us
2019-07-22 01:12:35 -07:00
jpark37
e5b004fd48 libobs: Remove YUV transformation on CPU
This code path does not appear to be used. Breakpoint-inspected all four
output formats I420/I444/NV12/RGB, and they are all behaving as they
should.
2019-07-22 01:12:01 -07:00
jpark37
3ea98b8b0d libobs: Improve timing of unbuffered deinterlacing
There are devices like the GV-USB2 that produce frames with smmoth
timestamps at an uneven pace, which causes OBS to stutter because the
unbuffered path is designed to aggressively operate on the latest frame.

We can make the unbuffered path work by making two adjustments:

- Don't discard the current frame until it has elapsed.
- Don't skip frames in the queue until they have elapsed.

The buffered path still has problems with deinterlacing GV-USB2 output,
but the unbuffered path is better anyway.

Testing:

GV-USB2, Unbuffered: Stuttering is gone!
GV-USB2, Buffered: No regression (still broken).
SC-512N1-L/DVI, Unbuffered: No regression (still works).
SC-512N1-L/DVI, Buffered: No regression (still works).
2019-07-20 21:00:59 -07:00
Jim
262a8c62bc
Merge pull request #1981 from jpark37/optimize-backdrop
libobs: UI: Remove DrawBackdrop() to save fullscreen pass
2019-07-20 17:09:08 -07:00
Jim
3f7d4fe1f5
Merge pull request #1975 from jpark37/area-upscale-shader
libobs: obs-filters: Area upscale shader
2019-07-20 17:06:41 -07:00
Jim
ffcfe4c9d9
Merge pull request #1951 from jpark37/audio-buffering
Fix audio buffering for devices like GV-USB2
2019-07-20 17:05:27 -07:00
jpark37
3456ed0644 libobs: UI: Remove DrawBackdrop() to save fullscreen pass
It's a waste of GPU time to do two fullscreen passes to render final mix
previews. Use blend states to simulate the black background of
DrawBackdrop() for the following situations:

- Main preview window (Studio Mode off)
- Studio Mode: Program

This does not effect:

- Studio Mode: Preview (still uses DrawBackdrop)
- Fullscreen Projector (uses GPU clear to black)
- Windowed Projector (uses GPU clear to black)

intel GPA, SetStablePowerState, Intel HD Graphics 530, 1920x1080

Before:
DrawBackdrop: ~529 us
main texture: ~367 us (Cheaper than drawing a black quad?)

After:
[DrawBackdrop optimized away]
main texture: ~383 us
2019-07-18 19:58:29 -07:00
jpark37
85cc7c84bc libobs: obs-filters: Area upscale shader
Add a separate shader for area upscaling to take advantage of bilinear
filtering. Iterating over texels is unnecessary in the upscale case
because a target pixel can only overlap 1 or 2 texels in X and Y
directions. When only overlapping one texel, adjust UVs to sample texel
center to avoid filtering.

Also add "base_dimension" uniform to avoid unnecessary division.

Intel HD Graphics 530, 644x478 -> 1323x1080: ~836 us -> ~232 us
2019-07-17 21:11:18 -07:00
jp9000
d4e236dd03 libobs: Fix formatting 2019-07-13 19:01:48 -07:00
Colin Edwards
c64d82530d
Merge pull request #1960 from Xaymar/patch-get_defaults2
libobs: Call both get_defaults and get_defaults2
2019-07-13 20:40:20 -05:00
Colin Edwards
4ec072075d
Merge pull request #1958 from DDRBoxman/format
Apply clang-format to objective c code
2019-07-12 21:43:55 -05:00
Michael Fabian 'Xaymar' Dirks
3f6bbe2d49 libobs: Call both get_defaults and get_defaults2
Unlike get_properties, there is not reason to not call get_defaults if it is
given in addition to get_defaults2. Additonally this fixes the bug with
'init_encoder' which would only ever call get_defaults, resulting in broken
encoders if those used get_defaults2.
2019-07-13 00:49:18 +02:00
jp9000
bda28b242c libobs: Fix formatting 2019-07-12 11:48:41 -07:00
Jim
36c8090492
Merge pull request #1952 from obsproject/pause
Add the ability to pause and unpause recordings
2019-07-11 19:56:41 -07:00
Colin Edwards
ad85a9fa25 Apply clang-format to objective c code 2019-07-09 13:39:13 -05:00
wang-bin
5b6ee6e66b libobs: Clear module variable in case module reloaded
Closes obsproject/obs-studio#1957
2019-07-09 08:37:43 -07:00
Kurt Kartaltepe
d940b9e580 libobs-opengl: Add GS_RGBX format 2019-07-08 20:27:13 -07:00
jp9000
153fa6337f libobs: Implement pausing of outputs
This implements pausing of outputs.  To accomplish this, raw audio/video
data is halted to the encoders or raw output.  Pausing is as precisely
timed as possible according to the timing of the obs_output_pause call,
and audio data will be spliced down to the exact audio sample in
accordance to that timing at the start/end marks.

Outputs that support this (outputs used for recording) can set the
OBS_OUTPUT_CAN_PAUSE capability flag.
2019-07-07 16:38:22 -07:00
jp9000
85ca1b6918 libobs: Correct raw output starting audio data
If the audio subsystem was buffered to any extent, the audio of a raw
output would start off at a negative offset, requiring each raw output
to implement a "prepare_audio" function (as seen in the FFmpeg output)
in order to ensure proper synchronization with video.  This did not
apply to encoded outputs because it was already being performed by the
obs-encoder code.
2019-07-07 16:38:21 -07:00
jp9000
70ecbcd5d4 libobs: Add obs_get_frame_interval_ns
Returns the current video frame interval between frames, in nanoseconds.
2019-07-07 16:38:21 -07:00
James Park
da87f08da4 libobs: Buffer-smoothing enhancements
If an audio source does not provide enough data at a steady pace, the
timestamp update does not happen, and buffering increases until it
maxes out. To counteract this, update the timestamp anyway.

Another issue for decoupled audio sources is that timing is not
adjusted for divergence from system time. Making this adjustment is
better for timing stability.

5+ hours of stable audio without any buffering on my GV-USB2 where it
used to add 21ms every 5 mintues or so.

Fixes https://obsproject.com/mantis/view.php?id=1269
2019-07-05 09:13:18 -07:00
jpark37
2ef25ceb85 libobs: Fix format selection
Fix ternary test to use BGRX render targets for YUV to RGB
conversions. The previous behavior may have been fine though since
the shaders fill the alpha channel with 1.0 anyway.
2019-06-27 08:57:41 -05:00
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
Jimi Huotari
ab67b39257
cmake: Install 'libobs.pc' under the correct 'libdir'
In 'libobs/CMakeLists.txt', use '${CMAKE_INSTALL_LIBDIR}' instead of
'${CMAKE_INSTALL_PREFIX}/lib', as the latter results into 'libobs.pc'
being installed under '/lib' when '/lib64' would be more appropriate.

In 'libobs/libobs.pc.in', use '@CMAKE_INSTALL_FULL_LIBDIR@' for
'libdir', '@CMAKE_INSTALL_FULL_INCLUDEDIR@' for 'includedir',
and '@CMAKE_INSTALL_PREFIX@' for 'prefix'.

Gentoo-Bug: https://bugs.gentoo.org/644538
2019-06-21 21:27:53 +03:00
James Park
aa22b61e3e libobs: Full-screen triangle format conversions
The cache coherency of rasterization for full-screen passes is better
using an oversized triangle that is clipped rather than two triangles.
Traversal order of rasterization is GPU-specific, but will almost
certainly be better using an undivided primitive.

A smaller benefit is that quads along the diagonal are not evaluated
multiple times, but that's minor in comparison.

Redo format shaders to bypass vertex buffer, and input layout. Add
global shader bool "obs_glsl_compile" to make API-specific decisions,
i.e. handle upside-down UVs. gl_ortho is not needed for format
conversion because the vertex shader does not use ViewProj anymore.

This can be applied to more situations, but start small first.

Testbed full screen passes, Intel HD Graphics 530:
RGBA -> UYVX: 467 -> 439 us, ~6% savings
UYVX -> uv: 295 -> 239 us, ~19% savings
2019-06-18 22:29:07 -07:00
Jim
6a795d52ea
Merge pull request #1894 from Rosuav/lock-unlock-event
libobs/UI: Implement an item_locked event
2019-06-18 20:31:26 -07:00
Jim
ab70bff4b3
Merge pull request #1913 from jpark37/area-shader-optimization
libobs: Area-resampling shader optimizations
2019-06-17 20:40:25 -07:00
Jim
fafda14963
Merge pull request #1906 from jpark37/bgr-three
libobs: linux-v412: obs-ffmpeg: Add packed BGR3 video support
2019-06-15 16:40:44 -07:00
Jim
914fffe137
Merge pull request #1889 from jpark37/warm-render-targets
libobs: Remove unnecessary frame pipelining
2019-06-15 16:13:03 -07:00
Chris Angelico
2fe641b8a4 libobs, UI: Implement item_locked event
Similar to item_visible, this event fires whenever a scene item is
locked or unlocked. This allows the UI and libobs to remain in sync
regarding scene elements' statuses.
2019-06-15 16:09:10 -07:00
Jim
dd607b422f
Merge pull request #1881 from jpark37/lowres-fair-sampling
libobs: Improve low-resolution bilinear sampling
2019-06-15 16:03:02 -07:00
jp9000
02e523c125 libobs: Update version to 23.2.1 2019-06-13 22:28:10 -07:00
James Park
e72eb39e47 libobs: Disable blending when converting sources
This fixes the issue where limited-range RGB sources were being
composited with dirty render targets.
2019-06-12 22:23:51 -07:00
jp9000
d5708d656e libobs: Fix null pointer dereference 2019-06-11 16:26:09 -07:00
jp9000
0d4d7f617c libobs: Update version to 23.2.0 2019-06-10 22:10:21 -07:00
James Park
9f66b90d99 libobs: Area-resampling shader optimizations
Switch for loop to do/while because we know the condition is always
true for the first loop.

Replace int math with float math to play nicely with more GPUs.

Add variables imagesize/targetsize to avoid redundant reciprocals.

Intel GPA results: 1166 -> 836 us
2019-06-03 23:11:23 -07:00
James Park
614025742b libobs: linux-v412: obs-ffmpeg: Add packed BGR3 video support
Someone mentioned this format preserves the most quality for a
particular capture card using V4L2.
2019-05-30 06:05:53 -07:00
James Park
8d6ed988e6 libobs: Remove unnecessary frame pipelining
Remove three instances of unnecessary double-buffering. They are not
needed to avoid stalls, and cause increased memory traffic when
measured on Intel HD 530, presumably because texture data will remain
in cache if sampled immediately after write.

(Note: GPU timings from Intel GPA are volatile.)

NV12, 3 Draws:
RGBA -> UYVX: 628 us -> 543 us
UYVX -> Y: 522 us -> 507 us
UYVX -> UV: 315 us -> 187 us
Total, Duration: 1594 us -> 1153 us
Total, GTI Read Throughput: 25.2 MB -> 15.9 MB
2019-05-24 01:03:21 -07:00
jp9000
3699209ce4 libobs: Pair encoders only when output actually starts
Normally, paired encoders are unpaired when they stop.  However, if the
pairing occurs before the encoders actually start, and the encoders
never actually end up starting, they are never unpaired, and that
pairing stays with them until the next time an output is started up
again.  That in turn can cause an output that uses one of the encoders
but not the other to not function correctly, and neither properly
"start" nor stop because the data is queued continually in the
interleaved packet array.

For example, let's say there are two outputs, two video encoders, and
one audio encoder.  This can be reproduced by using advanced output mode
and making the two outputs use separate video encoders while sharing
track 1's audio encoder.  If you start up the stream output first and it
fails to fully connect for whatever reason (bad server, bad stream key,
etc), then you start up the recording output, the recording output will
appear to be running, but will not stop when you hit "stop recording".
It will stay perpetually on "stopping recording" and will get stuck that
way.  This is because when the streaming output started, the streaming
output would initially pair video encoder A with audio encoder A before
the encoders actually fully started up (as the encoders do not fully
start up until a connection is successfully made), and when the
recording output starts up after that disconnection, audio encoder A
will wait for video encoder A rather than video encoder B because that
pairing was never actually cleared.

So, instead of pairing encoders when the output starts, wait until the
encoders themselves are being started and then pair the encoders at that
point in time.  This ensures that the encoders start up and will clear
their pairing when no longer in use.
2019-05-22 00:37:12 -07:00
James Park
ab8e895b12 libobs: Remove unreachable YUV decode paths
A previous refactoring to make DrawMatrix unnecessary has left behind
unreachable YUV conversions. Even if this code was somehow reachable,
DrawMatrix for YUV -> RGB doesn't exist anymore, so they would render
incorrectly anyway.
2019-05-19 21:27:18 -07:00
James Park
0c5cb83bf4 libobs: Remove saturate from RGB -> YUV conversion
Incoming texture is UNORM, so the value must already be saturated.
2019-05-18 22:10:42 -07:00
jp9000
973d31b8c2 libobs: Fix lockup when an encode call fails
(This commit also modifies the UI, obs-ffmpeg, and obs-output modules)

Fixes a long-time regression where the program would lock up if an
encode call fails.  Shuts down all outputs associated with the failing
encoder and displays an error message to the user.

Ideally, it would be best if a more detailed error could be displayed to
the user about the nature of the error, though the primary problem is
the encoder errors are typically not something the user would be able to
understand.  The current message is a bit of a generic error message;
improvement is welcome.

Another suggestion is to try to have the encoder restart seamlessly,
though it would take a significant amount of work to be able to make it
do something like that properly, and it sort of assumes that encoder
failures are sporadic, which may not necessarily be the case with some
hardware encoders on some systems.  It may be better just to use another
encoder in that case.  For now, seamless restart is ruled out.
2019-05-17 01:51:12 -07:00
James Park
fede4fb784 libobs: Improve low-resolution bilinear sampling
The issue with the current bilinear_lowres_scale effect is that it
samples adjacent texels, disregarding the texel-to-pixel ratio. If the
ratio is large, this can lead to aliasing. This change provides a fair
set of texture samples across the entire pixel.

The 8-sample pattern used here comes from Direct3D.
2019-05-13 23:54:14 -07:00
VodBox
52235ba86d libobs: Add transition and showing counter functions
This commit adds a function to forcefully stop a transition, and to
increment/decrement the showing counter for a source with the MAIN_VIEW
type.

These functions are needed for the transition previews to work as
intended.
2019-05-12 21:13:21 -07:00
Jim
e4aca036ca
Merge pull request #1877 from jpark37/qt-on-graphics-thread
libobs: UI: Remove Qt usage from graphics thread
2019-05-10 01:15:09 -07:00
James Park
5471e74cbe libobs: UI: Remove Qt usage from graphics thread
This fixes Xcode warning about detecting UI usage from another thread.
2019-05-09 23:30:37 -07:00
James Park
f03b4dc965 libobs: Restore casts to fix Clang warnings
Clang doesn't like it if you convert T** to const T* const* without
casting even though it should be safe. Might be a C language thing.
2019-05-09 21:59:38 -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
Clayton Groeneveld
03c9d930da UI: Change volume to dB in adv audio properties 2019-05-08 16:41:17 -07:00
James Park
4afdf70fd5 libobs: Fix crashes from wrong types 2019-05-02 19:09:34 -07:00
Clayton Groeneveld
8789b3469b libobs: Add ability to set spinbox property suffix 2019-05-02 08:54:14 -07:00
mntone
a66ad7eb63 libobs: Use RTLD_FIRST when loading libraries on macOS
Ensures that functions loaded by `os_dlsym()` come only from the
specified library that was loaded with `os_dlopen()` rather than the set
of libraries loaded by the specified library.
2019-04-27 11:56:53 -07:00
jp9000
0e8fe8bbbc libobs/util: Add function to get executable path 2019-04-26 13:24:30 -07:00
James Park
a86710ec5b libobs: Support limited color range for RGB/Y800 sources
libobs: Add support for limited to full color range conversions when
using RGB or Y800 formats, and move RGB converison for Y800 formats to
the GPU.

decklink: Stop hiding color space/range properties for RGB formats, and
remove "YUV" from "YUV Color Space" and "YUV Color Range".

win-dshow: Remove "YUV" from "YUV Color Space" and "YUV Color Range".

UI: Remove "YUV" from "YUV Color Space" and "YUV Color Range".
2019-04-25 15:13:05 -07:00
jp9000
8d125dc01d libobs: Add better default source color range handling
Fixes handling of the `obs_source_frame::full_range` member variable,
which is often set to false by default by many plugins even when using
RGB, which would cause RGB to be marked as "partial range".  This change
is crucial for when partial range RBG support is implemented.

Adds `obs_source_frame2` structure that replaces the `full_range` member
variable with a `range` variable, which uses the `video_range_type` enum
to allow handling default range values.  This member variable treats
VIDEO_RANGE_DEFAULT as full range if the format is RGB, and partial
range if the format is YUV.

Also adds `obs_source_output_video2` and `obs_source_preload_video2`
functions which use the `obs_source_frame2` structure instead of the
`obs_source_frame` structure.

When using the original `obs_source_frame`, `obs_source_output_video`,
and `obs_source_preload_video` functions, RGB will always be full range
by default for backward compatibility purposes.
2019-04-25 15:12:08 -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
1856f40e2a
Merge pull request #1836 from jpark37/rotated-line-fix
libobs: UI: Fix rotated line scale
2019-04-20 02:34:45 -07:00
James Park
e01fcae133 libobs: UI: Fix rotated line scale
The line drawing functions previously assumed the upper-left 3x3 for
box_transform only held scale. The matrix can also hold rotation, so
pass in scale separately.

Fixes https://obsproject.com/mantis/view.php?id=1442
2019-04-19 06:35:42 -07:00
Richard Stanway
f52d8bddcc libobs: Allow Win32 pipes to pass STDERR for logging of errors 2019-04-19 05:45:38 -07:00
Michael Fabian 'Xaymar' Dirks
6b6ea575ff libobs: Add property groups
Property groups allow multiple properties to be combined into a single
visual group and thus can be used to reduce visual clutter and improve
user experience by giving additional context to a property. The name of
a child of a group is not affected by the group and thus all property
names must still be unique.

A new parent field has been added to obs_properties_t to ease the
tracking of existing properties. That way properties inside a group will
also be able to verify that they have a unique name.
2019-04-18 06:37:36 -07:00
Jim
49d178d593
Merge pull request #1830 from jpark37/bilinear-lowres-gl-fix
libobs: Fix shader for GLSL
2019-04-14 19:16:34 -07:00
James Park
f66625bf1e libobs: Fix shader for GLSL
vec4 to vec3 truncation fix.
2019-04-14 14:15:48 -07:00
Colin Edwards
7dacd58aab
Merge pull request #1795 from cg2121/f-keys-linux
libobs: Add support for F25-F35 hotkeys on Linux
2019-04-14 10:48:46 -07:00
Jim
88d439b587
Merge pull request #1754 from Xaymar/feature-remove-properties
libobs: Add function to remove properties
2019-04-14 05:15:10 -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
827f45acfd
Merge pull request #1672 from derrod/captions-no-throttling
libobs: Add minimum display duration to caption data
2019-04-14 04:19:07 -07:00
Jim
b2bc1e159b
Merge pull request #1589 from caffeinetv/minor-improvements
Minor improvements
2019-04-14 03:43:05 -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
James Park
69c215345a libobs: Simplify YUV conversion
Currently several shaders need "DrawMatrix" techniques to support the
possibility that the input texture is a "YUV" format. Also, "DrawMatrix"
is overloaded for translation in both directions when it is written for
RGB to "YUV" only.

A cleaner solution is to handle "YUV" to RGB up-front as part of format
conversion, and ensure only RGB inputs reach the other shaders. This is
necessary to someday perform correct scale filtering without the cost of
redundant "YUV" conversions per texture tap.

A necessary prerequisite for this is to add conversion support for
VIDEO_FORMAT_I444, and that is now in place. There was already a hack in
place to cover VIDEO_FORMAT_Y800. All other "YUV" formats already have
conversion functions.

"DrawMatrix" has been removed from shaders that only supported "YUV" to
RGB conversions. It still exists in shaders that perform RGB to "YUV"
conversions, and the implementations have been sanitized accordingly.
2019-04-11 23:00:03 -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
21f4dd63d4 libobs: UI: Use graphics debug markers
Add D3D/GL debug markers to make RenderDoc captures easier to tranverse.

Also add obs_source_get_name_no_null() to avoid boilerplate for safe
string formatting.

Closes obsproject/obs-studio#1799
2019-04-08 02:05:37 -07: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
a3e5344cce libobs: Fix move assignment operator for ComPtr
We can't compare addresses of ComPtr for self-reference directly because
the address-of operator is overloaded, causing a compiler error. This
fix more or less matches the WRL implementation.
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
Jim
a0ead6f974
Merge pull request #1800 from cg2121/add-pragma-once
UI, libobs, text-freetype2: Add missing pragma once in header files
2019-04-06 23:40:43 -07:00
Michael Fabian 'Xaymar' Dirks
9bb276feab libobs: Add function to remove properties
Allows removing a property from a properties list in get_properties or
modified callback to enable dynamic property generation. The behavior
is undefined if the UI properties list is not refreshed by returning
true from the modified callback.
2019-04-06 15:33:46 +02:00
Jim
9eb01a1229
Merge pull request #1808 from jpark37/area-filter-gl-flip
libobs: Fix and simplify Area scale filter
2019-04-04 18:19:02 -07:00
James Park
c4819678c9 libobs: Fix and simplify Area scale filter
It appears there's a projection flip that is applied in some situations,
like the preview pane in studio mode, and the shader math fails when
it's active causing the output color to be zero. This fixes the math for
GLSL (with a tiny redundancy penalty to HLSL), and cleans up some
unnecessary code along the way.

Use abs() to avoid zero area in case the OpenGL projection flip is
active. Also simplify the math, and remove the unnecessary sampler
state.
2019-04-04 08:39:54 -07:00
jp9000
7ef4e10c89 libobs: Update version to 23.1.0 2019-04-04 06:46:51 -07:00
Clayton Groeneveld
d1be93ae69 UI, libobs, text-freetype2: Add missing pragma once in header files 2019-04-01 02:48:28 -05:00
Jim
2d442452b7
Merge pull request #1796 from cg2121/fix-hotkeys-not-showing
UI: Fix issue where space/esc hotkeys would be blank
2019-03-31 20:44:04 -07:00
Clayton Groeneveld
e321005b02 UI: Fix issue where space/esc hotkeys would be blank
This also modifies libobs.

This only happened on Linux.

Fixes https://obsproject.com/mantis/view.php?id=1018
2019-03-31 05:10:02 -05:00
Clayton Groeneveld
9930b294b9 libobs: Add support for F25-F35 hotkeys on Linux
Fixes https://obsproject.com/mantis/view.php?id=1257
2019-03-31 03:41:16 -05: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
jp9000
b1f04a47cf libobs: Change internal version to 23.0.3 (temporarily)
While performing a release candidate, it is important to use an actual
version before the actual release candidate version so that the
auto-updater will know to update to 23.1.0
2019-03-28 16:44:07 -07:00
jp9000
11c0d6e976 libobs: Update version to 23.1.0 2019-03-26 22:05:52 -07:00
Jim
7066055cf3
Merge pull request #1761 from jpark37/gl-fixes
libobs: Fix invalid max_anisotropy value
2019-03-26 14:14:06 -07:00
James Park
746820e35a libobs: Fix Area scale filter for GLSL
Remove const qualifiers because they are syntax errors for GLSL when
used like in C.
2019-03-23 13:16:50 -07:00
jp9000
70b8f0aa65 libobs: Fix ABI break
OBS_EFFECT_AREA from 7d811499e was inserted in the middle of the enum,
which breaks ABI for any binaries that use
OBS_EFFECT_PREMULTIPLIED_ALPHA or OBS_EFFECT_BILINEAR_LOWRES.
2019-03-22 03:46:42 -07:00