Commit Graph

30 Commits (master)

Author SHA1 Message Date
jp9000 8ed8301452 libobs-opengl: Fix border color support on GL textures 2022-01-12 06:35:16 -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 2af98bf483 libobs-opengl: Fix Clang warnings 2019-08-17 11:02:03 -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
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 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
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
Shaolin acd44b525e libobs-opengl: Store FBOs per texture instead of per device
The previous model stored a new FBO per texture width/height/format on
a array in the device struct. This allocated memory was only released
on gs_device_destroy (obs exit).

The new approach stores a FBO on gs_texture and the its info is
destroyed once the texture is deleted.
2018-08-31 19:00:20 -03:00
jp9000 4583dcbd4d libobs-opengl: Make update_buffer data param const 2017-11-27 02:30:49 -08:00
jp9000 7b12133af3 Use uint8_t* instead of void* for texture data
NOTE: In texture_setimage, I had to move variables to the top of the
scope because microsoft's C compiler will give the legacy C90 error of:
'illegal use of this type as an expression'.

To sum it up, microsoft's C compiler is still utter garbage.
2014-06-28 10:12:57 -07:00
jp9000 d9d0d87431 libobs-opengl: Fix some code formatting issues 2014-04-24 21:10:07 -07:00
BtbN 97c94b183a Add copy_texture_region function 2014-04-12 12:45:18 +02:00
jp9000 6ffcd5e74e Implement FBO blit texture copy
This trick uses FBOs to allow for copying textures without the need for
special texture copy functions.
2014-02-09 11:37:22 -07:00
jp9000 8298fa4dc7 With the permission of my fellow contributors, I'm switching obs-studio back to GPL v2+ to prevent issues between this project and the original OBS project, and for personal reasons to avoid legal ambiguity (not political reasons, I admittedly would prefer GPL v3+) 2013-12-02 22:24:38 -07:00
jp9000 dfa2dc6eab fix up the rest of the GL code, add glew to project, add makefiles for opengl, fix makefiles so that it can be built with gcc, update project files to automatically output to the build directory 2013-10-16 23:31:18 -07:00
jp9000 9570f0b8d7 change names, fix some bugs, minor GL/D3D fixes, update tests, fix effect files, output a little more debug information 2013-10-14 12:37:52 -07:00
Peter SZTANOJEV 0301b24ace modernize header guards to #pragma once 2013-10-14 13:21:15 +02:00
jp9000 9577ddcf9b fill in the rest of the GL functions. finally 2013-10-12 20:18:05 -07:00
jp9000 e591256922 add FBOs and render target loading 2013-10-12 16:28:10 -07:00
jp9000 83ddb920a1 finish up shader/sampler/texture/buffer loading/unloading/association 2013-10-12 12:35:38 -07:00
jp9000 3951babc93 add GL index buffers and a few tweaks to the helper functions 2013-10-11 13:00:39 -07:00
jp9000 0a4592a414 finish up GL vertex buffer code 2013-10-11 11:41:36 -07:00
jp9000 85e2fc6b07 add stage surfaces and texture copying 2013-10-10 17:39:56 -07:00
jp9000 c1939de49b added z-stencil buffers to GL and made a GS_MAX_TEXTURES macro 2013-10-10 12:37:03 -07:00
jp9000 3243bfbaa3 rearrange/cleanup GL texture stuff, and fill out GL cubemap texture functions (still need FBOs) 2013-10-05 09:25:12 -07:00
jp9000 5c92f22f0d moved some stuff around to avoid code duplication and finish up gl 2D texture code 2013-10-05 00:34:43 -07:00
jp9000 543d2481f1 move around some graphics stuff and put in copyright comments 2013-10-04 12:13:59 -07:00
jp9000 75262e6e0b update graphics subsystem code to add mipmap support and also add initial GL texture stuff and helper functions 2013-10-04 08:55:33 -07:00