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.
Once a window is invalid gl-x11::get_window_geometry will return 0
so just check if the returned geometry is a valid pointer before
trying to get its width/height.
(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.
This commit logs the OpenGL version on all operating systems and brings
the OpenGL subsystem's initialization logging more in line with the
D3D11 logging to make logs more uniform.
The xcb message queue is not currently emptied. If errors are generated
by any void requests the message queue will simply fill up and messages
will never be deleted.
Due to a (currently unknown) other problem this happens for me, and
results in OBS using up all memory with a queue that will never be
emptied.
Here we add a poll loop that will empty the xcb message queue and
discard the messages. While this means that errors are still not
handled, OBS wont end up crashing either.
Closesjp9000/obs-studio#675
This is supposed to assign -1 to the sampler_id to indicate that no
sampler need be assigned for the texture, but instead it was leaving the
variable with uninitialized data, resulting in a crash when used.
To be able to use index buffers, they must also be bound to a vertex
array object along with the vertex buffers.
Ideally, if there are multiple index buffers for a vertex buffer,
separate VAOs should be created for each combination.
(Jim) The documentation for glXChooseFBConfig states that the last value
of the visual attributes array must be 'None'. Fixes potential
initialization issues with certain drivers.
Closesjp9000/obs-studio#486
(Non-compiling commit: windowless-context branch)
In the land of X11, life is suffering.
Suffering aside, X11 is capable of a hardware-accelerated windowless
context by using a GLXPbuffer in conjunction with glXMakeContextCurrent.
(Non-compiling commit: windowless-context branch)
On windows, you can just create a hidden window as the "main" opengl
window to get the equivalent of a windowless context. You might be able
to do it without a window, but honestly it's more trouble than it's
worth.
(Non-compiling commit: windowless-context branch)
On cocoa, windowless contexts appear to be no problem. You just don't
set a view or just clear the view.
glFlush is somewhat implementation-specific; on OSX for example, it is
additionally used to draw to a view. However, we're already using the
Objective-C function flushBuffer, which apparently calls glFlush
internally anyway to draw to views. That means that we're superfluously
calling glFlush most of the time if there's an active swap chain. So
instead, only call glFlush when there are no active swap chains on OSX.
This allows the ability to separate the blend states of color and alpha.
The default blend state has also changed so that alpha is always added
together to ensure that the destination image always gets an alpha value
that is actually usable after the operation (for render targets).
Old default state:
color source: GS_BLEND_SRCALPHA, color dest: GS_BLEND_INVSRCALPHA
alpha source: GS_BLEND_SRCALPHA, alpha dest: GS_BLEND_INVSRCALPHA
New default state:
color source: GS_BLEND_SRCALPHA, color dest: GS_BLEND_INVSRCALPHA
alpha source: GS_BLEND_ONE, alpha dest: GS_BLEND_ONE
If a render target was switched from one to another and then back
consecutively, the texture would not get reattached at the last point
due to the fact that the cur_render_target variable of the FBO storage
structure would already be set to that texture, and then it would never
get reattached because it thought it was already using that render
target.
So to fix this, any time a render target legitimately changes from one
to another, it sets the cur_render_target and cur_zstencil_buffer
variables of the FBO structure to null.
I encountered a scenario where effects might reference shader parameters
that may not potentially exist, this isn't particularly a bad thing that
needs to return failure. It just needs to gracefully ignore it.
When render targets are used, they output to the render target inverted
due to the way that opengl works. This fixes that issue by inverting
the projection matrix so that it renders the image upside down and
inverting the front face from counterclockwise to clockwise.
Since we rely on the dynamic linker to find the library for us via
dlopen(), we need to have DL_OPENGL be .so.N, not the full library
filename, as ldconfig doesn't cache the full filename
Use of TARGET_SONAME_FILE requires the library to be marked as SHARED,
not MODULE
This closes pull request #370
On mac and windows, the libraries are always meant to be portable,
therefore the naming convention does not need to change for each
revision. For linux this makes sense; windows and mac not so much.
Because libobs-opengl is a public library, it's customary to have SONAME
embedded in the library file. Also remove the prefix override and
remove the prefixing "lib" from the output name. This also requires us
to pass the library file name to dlopen invocations.