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.
The glDebugMessageCallback function will set a callback that will relay
all messages coming from the driver (on supported drivers at least).
For nvidia, sometimes there are a lot of irrelevant messages, which is
nice depending on the type of application you're writing.
I actually at first thought these messages were important, but it turns
out that they're almost always irrelevant and not actually warnings.
Most of the messages at a certain type/severity are mostly for debugging
purposes or minor hints about how to maximize performance, so
unfortunately there ends up being a lot of pointless spam in the debug
output.
The particular performance messages are related to optimizations you can
get via multithreading, and are optimizations you would expect for games
more than for this type of application. They don't really apply for our
use cases most of the time.
High severity messages however are not omitted regardless of message
type.
These messages can be enabled again by simply defining the
SHOW_ALL_GL_MESSAGES macro.
This Fixes a minor flaw with the API where data had to always be mutable
to be usable by the API.
Functions that do not modify the fundamental underlying data of a
structure should be marked as constant, both for safety and to signify
that the parameter is input only and will not be modified by the
function using it.
Typedef pointers are unsafe. If you do:
typedef struct bla *bla_t;
then you cannot use it as a constant, such as: const bla_t, because
that constant will be to the pointer itself rather than to the
underlying data. I admit this was a fundamental mistake that must
be corrected.
All typedefs that were pointer types will now have their pointers
removed from the type itself, and the pointers will be used when they
are actually used as variables/parameters/returns instead.
This does not break ABI though, which is pretty nice.
This replaces the ARB_separate_shader_objects extension with traditional
linked shaders. I was able to get the existing system to use linked
shaders without having to change any libobs graphics API.
This essentially creates a linked list of shader programs with
references to the shaders they link. Before draw, it searches that
linked list for a particular pixel/vertex shader pair, and the linked
program associated with it. If no matching program exists, it creates
the program.