Commit graph

302 commits

Author SHA1 Message Date
Jim 04e6a39de9
Merge pull request #2551 from jpark37/cube-lut-enhance
Implement CUBE LUT domain properly, tetrahedral interpolation for 3D LUTs
2020-05-20 18:09:56 -07:00
jp9000 7993179466 cmake: Add cmake folders 2020-05-13 06:52:37 -07:00
jpark37 0a296bb12f libobs-opengl: Lock Mac parent context during present
Parent context lock keeps GL commands serialized.

Fixes race that causes crash when resizing multiview.
2020-05-02 12:00:11 -07:00
Colin Edwards d795905138
Merge pull request #2749 from jpark37/gl-viewport-flip
libobs-opengl: Fix viewport flip
2020-04-19 15:56:17 -05:00
jpark37 44ebde553d libobs-opengl: Fix viewport flip
Flip viewport in coordination with update_viewproj_matrix.
2020-04-18 22:13:03 -07:00
Colin Edwards 55e2985026
Merge pull request #1944 from WizardCM/windows-rc-definition
CMake: Build Windows modules with file descriptors
2020-04-18 18:27:22 -05:00
jp9000 2a318d915f libobs-opengl: Fix atan2 HLSL->GLSL transpile 2020-04-07 23:59:14 -07:00
jp9000 6ca52db8ce libobs-opengl: Add sincos to HLSL->GLSL transpile 2020-04-07 23:59:14 -07:00
jpark37 ff2b07c032 libobs-opengl: Support 3D texelFetch 2020-03-23 20:38:43 -07:00
jpark37 1733705070 libobs-opengl: Fix Mac VAO created without context 2020-02-24 22:08:28 -08:00
Jim d75245f017
Merge pull request #2264 from jpark37/mac-context-share
Fix OpenGL thread-safety on Mac to use latest Xcode
2020-02-05 14:33:27 -08:00
jpark37 50c53e3c39 libobs-opengl: Fix missing GL_HALF_FLOAT usages 2020-01-12 20:02:24 -08:00
jpark37 882687934c libobs-opengl: Fix volume texture leak 2020-01-04 01:28:16 -08:00
jpark37 846be2063c libobs-opengl: Don't allow volume render targets
Unlikely to be necessary. Disable for simplicity.
2020-01-01 12:39:53 -08:00
jpark37 9f330050ef libobs-opengl: OpenGL thread-safety on Mac
Attempt to fix threading issues that cause OBS to force-crash when
compiled with latest Xcode. There are two places where the new SDK
introduces a force-crash because operations are not happening on the
main thread: when we modify the context view to switch swap chains, and
when we resize a swap chain.

Instead of using just one context for all rendering, we create an
additional context for each swap chain, set each view once on
initialization, and switch contexts only in present to blit the final
framebuffer. This is an extra copy, but it's pretty hairy to optimize
away, and it's not worth potential regressions just to speed up Mac.

For resizing, we schedule the update code to run on the main thread from
the render thread. Ideally, we wouldn't have to round trip the logic
from main thread to graphics thread and back, but I don't think we want
to hack up the interface for this, especially since OpenGL will give way
to Metal soon enough.
2019-12-26 01:45:48 -08:00
jpark37 8f6984e345 libobs: Add support for volume textures
Also fix some mip calculations along the way.
2019-12-15 14:38:26 -08:00
Jim 3e01fdf3e5
Merge pull request #2116 from jpark37/begin-frame
libobs: Add gs_begin_frame for duplicators
2019-10-15 22:23:34 -07:00
Matt Gajownik 51be039cf8 CMake: Build Windows modules with file descriptors 2019-10-15 21:34:12 +11:00
Jim 09c7ec487b
Merge pull request #2064 from jpark37/bgra-swap-chain
D3D swap chain enhancements
2019-10-12 20:54:33 -07:00
jpark37 ade65df2aa libobs: Add gs_begin_frame for duplicators
We really shouldn't be resetting duplicator state as part of gs_flush.
gs_begin_scene is not ideal because it is called twice per frame, and
only after duplicators have been ticked. Even though it makes no
user-facing difference, it makes more logical sense to reset at the top
of the frame than the bottom.
2019-10-10 21:06:01 -07:00
jpark37 6eca70a529 libobs-opengl: Require OpenGL 3.3 instead of 3.2
There don't appear to be any GPUs that support 3.2, but not 3.3. GLSL
330 maps to HLSL Shader Model 4, so this will theoretically make shaders
programs less likely to diverge, particularly for behavior around NaNs.
2019-09-12 21:28:26 -07:00
jpark37 2ae9d6f683 libobs-opengl: Support BGRA swap chains on Windows 2019-09-05 23:34:23 -07:00
jp9000 bf41fd5a6b libobs: Add graphics API to get graphics object pointer 2019-08-29 12:43:10 -07:00
Jim 021defd962
Merge pull request #2036 from jpark37/gl-warnings
libobs-opengl: Fix Clang warnings
2019-08-17 12:11:46 -07:00
jpark37 2af98bf483 libobs-opengl: Fix Clang warnings 2019-08-17 11:02:03 -07:00
jpark37 a6af549155 libobs-opengl: Redundant cast 2019-08-17 08:48:28 -07:00
jpark37 4aaef353d4 libobs-opengl: Fix gl_error_to_str
Tweaked function to address some issues: compiler warnings, skipped
entries, and type safety.
2019-08-12 08:05:38 -07:00
Kurt Kartaltepe 9bc39c7617 libobs-opengl: Fix DUMMY textures left bound 2019-08-11 19:40:24 -07:00
Kurt Kartaltepe 491b6ec035 Revert "libobs-opengl: Add GS_RGBX format"
This reverts commit d940b9e580.
2019-08-11 18:30:28 -07:00
Jim 0546d18855
Merge pull request #1934 from kkartaltepe/alpha-linux
linux-capture: Correct XCompCap glxFBConfigs alpha check
2019-08-11 05:00:35 -07:00
jpark37 0e12d8189c libobs: Add GPU timestamp query support
This change only wraps the functionality. I have rough code to exercise
the the query functionality, but that part is not really clean enough to
submit.
2019-07-27 13:31:07 -07:00
jpark37 2f286b81d9 libobs: Default sampler sometimes unset for GL
When mixing sampling with raw loads in a shader, ending a shader with a
load would case the default sampler to become unset for OpenGL. Instead,
initialize with no sampler, and only set if there is a sampler.
2019-07-25 21:54:23 -07:00
jpark37 a7ac33488c libobs-opengl: Remove unused VERTEXID code
I think this was leftover from an abandoned approach.
2019-07-23 08:33:49 -07:00
jpark37 df59046050 libobs-opengl: Support gl_FragCoord and cull unused interpolants 2019-07-23 08:31:57 -07:00
jpark37 ce9e4dd4d2 libobs-opengl: Fix GS_R8G8 values 2019-07-23 08:29:54 -07:00
jpark37 b90ce6944f libobs-opengl: Fix glGetError() infinite loop
glGetError() returns GL_INVALID_OPERATION during OBS shutdown when GL is
used on Windows. This change gives up after eight errors.

This could be avoided by stopping the graphics thread before window
destruction, but the shutdown code looks like it could be tricky to
reorder.
2019-07-15 09:13:14 -07:00
Colin Edwards ad85a9fa25 Apply clang-format to objective c code 2019-07-09 13:39:13 -05:00
Kurt Kartaltepe 499e648fff libobs-opengl: Fix GS_GL_DUMMY textures creation
Previously these textures were left in an incomplete state rendering
them usuable for most texturing operations.
2019-07-08 20:27:18 -07:00
Kurt Kartaltepe d940b9e580 libobs-opengl: Add GS_RGBX format 2019-07-08 20:27:13 -07:00
Kurt Kartaltepe 16752c4bb4 libobs-opengl: Add error enum to string function 2019-07-08 20:27:08 -07:00
jpark37 b8e5cf3a95 libobs-opengl: Empty VAO
Use an empty VAO for shaders that generate their own vertices.
2019-06-24 23:13:04 -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
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
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
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
Shaolin 64d0da1533 libobs-opengl: Clear some conversion and uncaught switch cases warnings 2019-03-29 06:22:14 -03:00
James Park 5fe128a047 libobs-opengl: Fix bad log string 2019-03-19 09:17:15 -07:00
Colin Edwards d7d5d6b87d libobs-opengl: Log shader compiler errors 2019-02-24 12:32:28 -06:00
Alex Anderson 4eac034814 libobs-opengl: Add int2-4 support
Closes obsproject/obs-studio#1506
2018-09-28 13:59:49 -07:00