Commit graph

248 commits

Author SHA1 Message Date
Jan Beich c082c4a74d libobs/graphics: Enable DMABUF on FreeBSD and DragonFly
Required under Wayland (wlrobs) on FreeBSD and DragonFly. DMABUF was
already partially exposed after c50c625555.
2023-01-24 11:50:13 -05:00
tytan652 cf5c68b773 UI,libobs,libobs-opengl,obs-ffmpeg: Remove unneeded cast in switches
Those casts were usually used to workaround switch warnings.

Also adds default to OBS frontend event switches that had this
workaround.
2023-01-16 11:52:26 +01:00
jpark37 2a76ffaf02 libobs/graphics: Precompute more accurate matrix
This is generated with .NET BigInteger fractions, and late divide.
2022-10-05 08:36:29 -07:00
Norihiro Kamae 33e6ad3cc9 libobs: Remove unnecessary UTF characters 2022-08-13 00:49:17 -07:00
jpark37 4fe6803fe4 libobs: Prevent D3D11 projectors from tearing
Some users stream projectors, so don't let them tear. Use the waitable
object to check the flip queue, and only flip if there's space.

Metal and Vulkan can probably perform similar flip throttling once OBS
starts using them.
2022-08-06 16:16:20 -07:00
tytan652 17ba8359e4 deps,libobs,plugins: Fix discarded-qualifiers warnings with FFmpeg 5 2022-07-22 08:50:36 -04:00
tytan652 348cf1b872 libobs: Remove unused parameters 2022-07-20 08:21:20 +02:00
PatTheMav ff7f756886 libobs: Explicitly mark variables as unused 2022-07-10 09:59:55 +10:00
Kurt Kartaltepe d78b27961c libobs-opengl: Add create_texture_from_pixmap for EGL
create_texture_from_pixmap is only implemented for X11/EGL where it will
bind the provided X11 pixmap to a texture with glEGLImageTargetTexture2DOES
2022-05-15 09:08:53 -03:00
jpark37 4af20cf080 libobs/graphics: Add color space and WIC support
Only add support for PQ and CCCS JXR images, e.g. Xbox Series X, and
Xbox Game Bar screenshots on Windows.
2022-05-08 15:25:01 -07:00
PatTheMav d0d0fe00d8 libobs: Fix compiler warnings 2022-05-04 12:09:04 -04:00
VodBox 6d0e61d40a libobs: Orient images based on EXIF metadata 2022-05-04 01:58:40 -07:00
jpark37 06111d5b10 libobs: Add high-precision sRGB support 2022-04-08 17:19:23 -07:00
wangshaohui db8145e8a2 obs-ffmpeg, win-dshow, deps/media-playback: Use recommended API for AVCodecContext 2022-04-07 01:59:30 -07:00
wangshaohui 1ec70ddf2b libobs: Fix image source not loading upper case file extensions 2022-04-07 01:58:13 -07:00
jpark37 eccde48926 libobs/graphics: Add gs_is_monitor_hdr
Only Windows is implemented for now. Mac/Linux return false for now.
2022-03-23 22:35:26 -07:00
jpark37 abddfead2f libobs/graphics: Add color space support 2022-03-23 22:35:26 -07:00
jpark37 fee3703f40 libobs/graphics, libobs-d3d11: Add P010 support 2022-03-20 17:22:13 -07:00
jpark37 16637baf88 libobs/graphics: Add gs_texrender_get_format 2022-03-08 12:56:35 -08:00
obiwac c50c625555 libobs/graphics: gs_query_dmabuf_* on FreeBSD too 2022-02-26 15:36:08 -08:00
jpark37 59ab9c98fb libobs/graphics: Fix gs_get_format_bpp
Was missing case for GS_RGBA16F.
2022-01-29 18:51:34 -05:00
jpark37 63db2265dc libobs, libobs-d3d11, libobs-opengl: Add GS_RG16
This format will be useful for P010 chroma in the future.
2022-01-29 15:12:00 -08:00
columbarius 4cda05f270 libobs/graphics: Add Linux-only gs_query_dmabuf_* functions
When sharing DMA-BUFs it is required the announce the underlying
hardware capabilities via supported modifiers.

Add new device_query_dmabuf_capabilities vfunc to gs_exports and connect it
to the egl implementation stubs in the supported render platforms. Add a new
public method gs_query_dmabuf_capabilities() that calls the vfunc above.

Add new device_query_dmabuf_modifiers vfunc to gs_exports and connect it
to the egl implementation in the supported render platforms. Add a new
public method gs_query_dmabuf_modifiers() that calls the vfunc above.
2021-12-22 14:27:53 -03:00
jw0z96 33a6d2a5fd libobs: Expose blending operation types 2021-12-20 09:06:38 -08:00
VodBox c8e417057a libobs, libobs-d3d11: Add support for NT Handle shared textures
Adds support for using shared textures that were made with the
D3D11_RESOURCE_MISC_SHARED_NTHANDLE flag.

This increases the minimum required Windows version to Windows 8 or the
Platform Update for Windows 7. As official support is only for Win 8+
this does not change official support.
2021-11-20 16:34:28 +13:00
jpark37 02d98b26a0 libobs/graphics: Fix vec2 min/max functions 2021-10-10 19:12:45 -07:00
jpark37 3c45ae2e9d libobs, libobs-opengl: Consistent near/far undef 2021-10-10 19:12:45 -07:00
Norihiro Kamae 5e75efd14c libobs: Fix const qualifier mismatch on DARRAY 2021-10-01 12:59:27 +09:00
Norihiro Kamae d65ca911dd libobs: Add casts to da_push_back_array arguments 2021-10-01 12:58:14 +09:00
Tommy Vercetti e1cf7c0e4b libobs: Fix near and far redefinition on MSVC 2021-09-11 15:50:06 -07:00
jpark37 f5b65ec5d3 libobs/graphics: Fix gs_generalize_format warning
warning C26819: Unannotated fallthrough between switch labels (es.78).
2021-09-05 20:35:46 -07:00
jpark37 e6ab8106aa libobs/graphics: Avoid darray recycle
Reset size instead of capacity.
2021-08-15 00:12:14 -07:00
jpark37 da3375d5a4 libobs: Add gs_generalize_format helper 2021-07-11 08:26:29 -07:00
jpark37 c6937eb559 libobs: Assume sRGB instead of linear for 64 bpp
Should fix regression for 16-bit PNGs.
2021-06-01 19:08:07 -07:00
jpark37 abe1cb1425 libobs: Support premultiplying images on load
Add gs_image_alpha_mode enum for requested alpha handling: straight,
premultiplied with SRGB conversion, and just premultiplied. Both
premultiplied settings behave the same if the image is not SRGB, linear
is assumed.

Add gs_image_file3_t to store the alpha mode.

Add srgb.h file with helper functions.

Clean up vec4.h to use helpers, and remove unused functionality.

Update FFmpeg image loader to perform premultiplication on load.
2021-05-11 03:44:02 -07:00
jpark37 5a8842d9f0 libobs: Support 64 bpp images
Useful for loading high-precision alpha channels.
2021-05-05 09:43:34 -07:00
tt2468 7b2b723270 libobs: Return target vec not current when within EPSILON
If current vector is within EPSILON, it would return the current,
when logically the target should be returned instead.
2021-04-13 05:31:00 -07:00
Kurt Kartaltepe 705a47b0e4 libobs, libobs-opengl: add drm format param
This adds the drmbuf format as a parameter separate from the obs texture
format that will be used. drmbuf's may have a variety of formats that we
need to pass correctly to get a usable texture which may correspond to
multi-platform texture formats.
2021-03-29 17:00:31 -03:00
jpark37 c03320cfc2 libobs: Add function to count GPU adapters
Only implemented for D3D11 for now.
2021-03-12 20:59:31 -08:00
Georges Basile Stavracas Neto f7a55f45fd libobs/graphics: Add Linux-only gs_texture_create_from_dmabuf()
DMA-BUF is a widespread Linux buffer sharing mechanism. It is what's
commonly used zero-copy screen sharing by Wayland compositors.

Add a new 'device_texture_create_from_dmabuf' vfunc to gs_exports,
and stub implementations to libobs-opengl. Add a new public method
gs_texture_create_from_dmabuf() that calls this vfunc.
2021-02-13 19:13:54 -03:00
jpark37 2b652cc763 libobs: gs_duplicator_get_monitor_index
Helper function to find DXGI output index of HMONITOR.
2021-01-26 17:11:04 -08:00
jpark37 66259560e0 libobs: Add dormant SRGB format support
GS_RGBA, GS_BGRX, and GS_BGRA now use TYPELESS DXGI formats, so we can
alias them between UNORM and UNORM_SRGB as necessary. GS_RGBA_UNORM,
GS_BGRX_UNORM, and GS_BGRA_UNORM have been added to support straight
UNORM types, which Windows requires for sharing textures from D3D9 and
OpenGL. The D3D path aliases via views, and GL aliases via
GL_EXT_texture_sRGB_decode/GL_FRAMEBUFFER_SRGB.

A significant amount of code has changed in the D3D/GL backends, but the
concepts are simple. On the D3D side, we need separate SRVs and RTVs to
support nonlinear/linear reads and writes. On the GL side, we need to
set the proper GL parameters to emulate the same.

Add gs_enable_framebuffer_srgb/gs_framebuffer_srgb_enabled to set/get
the framebuffer as SRGB or not.

Add gs_linear_srgb_active/gs_set_linear_srgb to instruct sources that
they should render as SRGB. Legacy sources can ignore this setting
without regression.

Update obs_source_draw to use linear SRGB as needed.

Update render_filter_tex to use linear SRGB as needed.

Add gs_effect_set_texture_srgb next to gs_effect_set_texture to set
texture with SRGB view instead.

Add SRGB helpers for vec4 struct.

Create GDI-compatible textures without SRGB support. Doesn't seem to
work with SRGB formats.
2021-01-21 07:42:13 -08:00
ckelsel 9e07c42d74 libobs: Fix gs_duplicator_get_texture function check 2021-01-11 11:16:02 -08:00
PatTheMav 61ea6e0247
libobs: Add texture sharing support for macOS/OpenGL 2020-12-18 17:44:03 +01:00
jpark37 2d547cf669 libobs: Allow wrapping D3D11 object with gs_texture_t
This can be useful for reading from textures provided by middleware.
2020-11-24 14:39:56 -08:00
jpark37 0628c844f8 libobs: Fix FFmpeg deprecation warnings 2020-07-18 18:47:45 -07:00
jpark37 4c2e430c0c libobs: Fix right edge for JPEG images
FFmpeg YUV to RGB conversions require extra destination padding.
2020-06-14 20:00:58 -07:00
jpark37 cd6f56d0ea libobs: Fix potential truncation warnings 2020-05-21 10:02:03 -07:00
tt2468 ba0f8de3a0 libobs: Return target instead of current in calc_torquef
If the previously calculated torque value is too close to 1.0
(but not considered 1.0), it would be impossible for the TBar to
finish its transition since it returned the old value, causing desync.
2020-05-13 22:43:11 -07:00
jp9000 8ecfb405ce Revert "win-capture, libobs: Show names of displays in Display Capture"
This reverts commit 9931f22ff4.
2020-03-19 06:43:57 -07:00