0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 13:08:50 +02:00
Commit Graph

236 Commits

Author SHA1 Message Date
Zachary Lund
543acf8477 Modified debug proc to possibly be more appropriate 2014-07-11 01:36:42 -05:00
BtbN
a79ff06420 Fix gl_debug_proc function for unexpected parameters 2014-07-10 14:36:16 +02: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
f025cd6f87 GL: Mark unused 'device' parameter for flush 2014-06-25 22:24:26 -07:00
jp9000
caf8ca9ba8 Remove 'shader' param from shader param functions 2014-06-25 19:50:08 -07:00
jp9000
27010a2f56 Add a 'flush' command to graphics subsystem
...I'm actually concerned that I went a bit overkill trying to prevent
backwards compatibility issues with this abstraction design, because
this is a large number of files that have to be modified just to add a
single graphics subsystem export.  Someone's going to strangle me, and
when you know that someone might strangle you, that means that you did
something wrong.  We'll have to look in to simplifying this in the
future without killing backward compatibility safety.
2014-06-25 19:32:34 -07:00
jp9000
8aa49cc9ad Remove unused graphics subsystem functions
These functions were mostly related to being able to set true fullscreen
mode -- however, this has no place for our purposes, and these functions
were just sitting empty and unused, so they should be removed.

Besides, fullscreen mode only applies to the windows operating system.
2014-06-25 01:54:32 -07:00
jp9000
f4e7a893c5 Remove 'rebuild' variable from vertexbuffer_flush
This variable is currently somewhat pointless, I was originally going to
use it to tell the graphics subsystem to completely rebuild the internal
vertex buffers, but it would be bad/inefficient to allow that
functionality.
2014-06-25 01:54:32 -07:00
jp9000
1c2a0524b7 Change graphics subsystem to 4x4 matrices
4x4 matrices aren't as optimal, but are much more sensible to handle
when you want to do more advanced stuff like scaling, skewing, or
inversion.
2014-06-14 23:17:04 -07:00
jp9000
cec11d624a OpenGL: Don't call glGetAttribLocation on outputs
Previously we were using glGetAttribLocation on all inputs/outputs and
then just discarding if it was returned -1.  However, we have a boolean
value of 'input' in gl_parser_attrib, so there's no need to be doing
this and discarding potentially useful error handling information.
2014-06-07 19:33:41 -07:00
jp9000
3ce70778f9 OpenGL: Don't name VS inputs as 'geom' inputs.
Geometry shaders come after vertex shaders, not before.
2014-06-07 19:31:57 -07:00
jp9000
efaafd7cb4 OpenGL: Fix erroneous handling of BGRX
BGRX was being treated as "BGR input" with "RGBA storage", where it
should have been "BGRA input" with "RGB storage".  So the input for the
texture was expecting 24 bits of packed BGR rather than 32bit BGRX
pixels, and was internally storing it with alpha available.
2014-06-07 15:30:05 -07:00
jp9000
b64900e630 Graphics: Comment out parsed shader logging 2014-05-18 17:37:30 -07:00
fryshorts
944c2dc9f7 Destroy swapchain before removing the window info
This fixes an issue reported by valgrind where cleaning up the
swapchain fails because the window info is destroyed before.
2014-05-16 20:32:30 +02:00
Thomas McGrew
59328d86ce Added a version to the X11 GL context request
This enables the application to start on Intel graphics under Mesa 10.2
2014-05-12 02:31:15 -04:00
Palana
cfc3f2590e Update OSX dependencies for cmake generators other than ninja/make 2014-05-08 14:31:43 +02:00
Palana
824ff961d0 Enable GL vertex attribute normalization
Fixes GL vertex color attributes
2014-05-02 00:37:32 +02:00
jp9000
5e2d283b9c GL/D3D11: Add scissor support 2014-05-01 11:26:17 -07:00
jp9000
d9d0d87431 libobs-opengl: Fix some code formatting issues 2014-04-24 21:10:07 -07:00
Lioncash
96031f2392 Fix a possible null pointer dereference 2014-04-21 21:28:40 -04:00
Palana
12f0877ebc Remove destroyed sampler states from the current samplers list 2014-04-19 05:25:21 +02:00
Palana
b0237fd581 Use high resolution GL surface when available 2014-04-16 22:39:20 +02:00
Jim
2fc810fd09 Merge pull request #65 from BtbN/glad
Move from glLoadGen to GLAD
2014-04-16 12:51:32 -07:00
BtbN
e50201cad1 Move from glLoadGen to GLAD 2014-04-15 22:19:40 +02:00
jp9000
0bec267e40 OpenGL: Fix swizzle code again for alpha textures
My prior code was incorrect;  I mixed up the two parameters, the
GL_TEXTURE_SWIZZLE_* parameter specifies the target channel, and the
value itself specifies the source channel.,  If that makes sense.
2014-04-15 12:19:20 -07:00
jp9000
51d338430f Only do the alpha swizzle on alpha textures
Avoids problems if swizzles are used elsewhere (like in the newer X11
plugins)
2014-04-15 04:23:55 -07:00
jp9000
bc33b09ba9 Revert OpenGL swizzle change
Was wrong to use the swizzle -- it was an incorrect assumption on my
part that this could work in the first place (despite working on
windows)
2014-04-12 23:57:40 -07:00
jp9000
0e9b13fcf9 Fix style errors (please don't make me do this) 2014-04-12 11:21:47 -07:00
BtbN
0f9c6e5503 Create sub window for rendering, to avoid visual mismatch issues 2014-04-12 16:24:38 +02:00
BtbN
97c94b183a Add copy_texture_region function 2014-04-12 12:45:18 +02:00
Timo R
b9f0da026e Move opengl loader into a seperate static library, so plugins can use it 2014-04-12 12:45:18 +02:00
jp9000
362e008b87 OpenGL: Use texture swizzle for BGRA/BGR/A8
On some operating systems, with specific drivers it seems that BGR/BGRA
isn't properly treated as such in certain cases.  This fix will
hopefully force the formats to be treated as BGR/BGRA when actually
rendering, which should get around the implementation-specific issue.
2014-04-11 13:14:20 -07:00
Zachary Lund
92f253d65f More extensions, less bugs 2014-04-06 16:21:19 -05:00
Zachary Lund
1dd3917745 Added GLX_NV_copy_image extension, updated tools 2014-04-05 13:49:19 -05:00
Zachary Lund
baa57d4c39 Merge branch 'master' of https://github.com/jp9000/obs-studio 2014-04-03 20:12:26 -05:00
Zachary Lund
e5b90accb9 Removed no longer valid comment 2014-04-03 19:24:03 -05:00
Zachary Lund
b4d2146861 This commit contains more than I intended. Read below for more info.
1) Fixed the preview window. It now correctly displays the source.
2) The GLX backend now correctly uses the devices current swap.
3) We now set device->cur_swap to a default so we don't have to check it in every function.
4) Minor syntactical cleanups and perhaps some messiness added.
2014-04-03 19:21:24 -05:00
Palana
c2abb80c9a Use bzalloc instead of bmalloc+memset 2014-04-04 02:00:10 +02:00
Palana
61cf2faad3 Delete per window GL context for Cocoa and just swap the view instead
This unfortunately re-introduces undesirable rendering behaviour for
slow renderers (e.g. first gen Intel HD graphics/Apple software
renderer) when the property window is open, but fixes property window
preview rendering for sufficiently fast renderers
2014-04-04 02:00:08 +02:00
Zachary Lund
ee9ff9cfb9 Use Qt provided display with GLX functions for consistency.
Remove unneeded assignment from previous code.
2014-04-03 17:36:01 -05:00
BtbN
a31e938c2b Fix getting the X11 display with the Qt ui 2014-04-03 23:41:22 +02:00
BtbN
acab80cbef Fixup libobs-opengl CMakeLists 2014-04-01 21:30:52 +02:00
jp9000
263f940806 Fix CMakeLists.txt for each project (my fault) 2014-03-29 17:29:02 -07:00
jp9000
b2885480fa Minor fix to GL texture cleanup
Don't clear any data if it's a dummy texture.
2014-03-29 17:23:31 -07:00
jp9000
0a86e8fb3f Add dummy GL texture flag & direct object access
- Add dummy GL texture support to allow libobs texture references to be
   created for GL without

 - Add a texture_getobj function to allow the retrieval of the
   context-specific object, such as the D3D texture pointer, or the
   OpenGL texture object handle.

 - Also cleaned up the export stuff.  I realized it was all totally
   superfluous.  Kind of a dumb moment, but nice to clean it up
   regardless.
2014-03-29 17:19:31 -07:00
Palana
f8b90a5c8f Add per window GL context for Cocoa libobs-opengl implementation
This fixes some problems with multiple swap chains (e.g. flickering
between the render views)
2014-03-24 17:42:45 +01:00
jp9000
2b4e381c3b Change a reference variable to be volatile long
Removed some warnings associated with it, was the wrong variable type.
2014-03-16 20:08:12 -07:00
jp9000
154e0c59e1 Use atomic functions where appropriate
Also, rename atomic functions to be consistent with the rest of the
platform/threading functions, and move atomic functions to threading*
files rather than platform* files
2014-03-16 18:26:46 -07:00
jp9000
fd37d9e9a8 Implement encoder interface (still preliminary)
- Implement OBS encoder interface.  It was previously incomplete, but
   now is reaching some level of completion, though probably should
   still be considered preliminary.

   I had originally implemented it so that encoders only have a 'reset'
   function to reset their parameters, but I felt that having both a
   'start' and 'stop' function would be useful.

   Encoders are now assigned to a specific video/audio media output each
   rather than implicitely assigned to the main obs video/audio
   contexts.  This allows separate encoder contexts that aren't
   necessarily assigned to the main video/audio context (which is useful
   for things such as recording specific sources).  Will probably have
   to do this for regular obs outputs as well.

   When creating an encoder, you must now explicitely state whether that
   encoder is an audio or video encoder.

   Audio and video can optionally be automatically converted depending
   on what the encoder specifies.

   When something 'attaches' to an encoder, the first attachment starts
   the encoder, and the encoder automatically attaches to the media
   output context associated with it.  Subsequent attachments won't have
   the same effect, they will just start receiving the same encoder data
   when the next keyframe plays (along with SEI if any).  When detaching
   from the encoder, the last detachment will fully stop the encoder and
   detach the encoder from the media output context associated with the
   encoder.

   SEI must actually be exported separately; because new encoder
   attachments may not always be at the beginning of the stream, the
   first keyframe they get must have that SEI data in it.  If the
   encoder has SEI data, it needs only add one small function to simply
   query that SEI data, and then that data will be handled automatically
   by libobs for all subsequent encoder attachments.

 - Implement x264 encoder plugin, move x264 files to separate plugin to
   separate necessary dependencies.

 - Change video/audio frame output structures to not use const
   qualifiers to prevent issues with non-const function usage elsewhere.
   This was an issue when writing the x264 encoder, as the x264 encoder
   expects non-const frame data.

   Change stagesurf_map to return a non-const data type to prevent this
   as well.

 - Change full range parameter of video scaler to be an enum rather than
   boolean
2014-03-16 16:21:34 -07:00
jp9000
4f7ab552df Reimplement monitor capture
- Implement windows monitor capture (code is so much cleaner than in
   OBS1).  Will implement duplication capture later

 - Add GDI texture support to d3d11 graphics library

 - Fix precision issue with sleep timing, you have to call
   timeBeginPeriod otherwise windows sleep will be totally erratic.
2014-03-05 10:43:14 -07:00
jp9000
e560a426c5 Give cf_parser functions better naming 2014-03-01 01:25:41 -07:00
jp9000
429195aa6f Fix a warning and an error
Happened because I compiled on windows and it only compiled
windows-specific code.
2014-02-28 20:11:10 -07:00
jp9000
2dbbffe4a2 Make a number of key optimizations
- Changed glMapBuffer to glMapBufferRange to allow invalidation.  Using
   just glMapBuffer alone was causing some unacceptable stalls.

 - Changed dynamic buffers from GL_DYNAMIC_WRITE to GL_STREAM_WRITE
   because I had misunderstood the OpenGL specification

 - Added _OPENGL and _D3D11 builtin preprocessor macros to effects to
   allow special processing if needed

 - Added fmod support to shaders (NOTE: D3D and GL do not function
   identically with negative numbers when using this.  Positive numbers
   however function identically)

 - Created a planar conversion shader that converts from packed YUV to
   planar 420 right on the GPU without any CPU processing.  Reduces
   required GPU download size to approximately 37.5% of its normal rate
   as well.  GPU usage down by 10 entire percentage points despite the
   extra required pass.
2014-02-16 19:28:21 -07:00
jp9000
1570fa75b9 Fix variable placement, not safe with goto usage 2014-02-14 18:23:21 -07:00
jp9000
30af7dc211 Optimize GL staging surface and fix mac issue
Staging surfaces with GL originally copied to a texture and then
downloaded that copied texture, but I realized that there was really no
real need to do that.  Now instead they'll copy directly from the
texture that's given to them rather than copying to a buffer first.

Secondly, hopefully fix the mac issue where the only way to perform an
asynchronous texture download is via FBOs and glReadPixels.  It's a
really dumb issue with macs and the amount of "gotchas" and non-standard
internal GL functionaly on mac is really annoying.
2014-02-14 18:13:25 -07:00
jp9000
8b8217f68e Fix a some more linux/GCC specific warnings 2014-02-14 15:56:01 -07:00
jp9000
966b943d5b Remove majority of warnings
There were a *lot* of warnings, managed to remove most of them.

Also, put warning flags before C_FLAGS and CXX_FLAGS, rather than after,
as -Wall -Wextra was overwriting flags that came before it.
2014-02-14 15:13:36 -07:00
jp9000
b067440f73 Use bzalloc instead of bmalloc then memset
Reduces needless code repetition and still allows for proper memory
alignment.  Cleans up the code a bit.
2014-02-09 12:34:07 -07: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
6c92cf5841 Implement output, improve video/audio subsystems
- Fill in the rest of the FFmpeg test output code for testing so it
   actually properly outputs data.

 - Improve the main video subsystem to be a bit more optimal and
   automatically output I420 or NV12 if needed.

 - Fix audio subsystem insertation and byte calculation.  Now it will
   seamlessly insert new audio data in to the audio stream based upon
   its timestamp value.  (Be extremely cautious when using floating
   point calculations for important things like this, and always round
   your values and check your values)

 - Use 32 byte alignment in case of future optimizations and export a
   function to get the current alignment.

 - Make os_sleepto_ns return true if slept, false if the time has
   already been passed before the call.

 - Fix sinewave output so that it actually properly calculates a middle
   C sinewave.

 - Change the use of row_bytes to linesize (also makes it a bit more
   consistent with FFmpeg's naming as well)
2014-02-09 05:51:06 -07:00
Zachary Lund
4461281a3b Merge branch 'master' of https://github.com/jp9000/obs-studio 2014-02-08 16:02:44 -06:00
Zachary Lund
cd9c4b39d0 We only really require GLX 1.3. Also fixed version check to be more appropriate. 2014-02-08 02:52:55 -06:00
jp9000
3d6d43225f Add planar audio support, improve test output
- Add planar audio support.  FFmpeg and libav use planar audio for many
  encoders, so it was somewhat necessary to add support in libobs
  itself.

- Improve/adjust FFmpeg test output plugin.  The exports were somewhat
  messed up (making me rethink how exports should be done).  Not yet
  functional; it handles video properly, but it still does not handle
  audio properly.

- Improve planar video code.  The planar video code was not properly
  accounting for row sizes for each plane.  Specifying row sizes for
  each plane has now been added.  This will also make it more compatible
  with FFmpeg/libav.

- Fixed a bug where callbacks wouldn't create properly in audio-io and
  video-io code.

- Implement 'blogva' function to allow for va_list usage with libobs
  logging.
2014-02-07 03:03:54 -07:00
Zachary Lund
9a2b662935 Changed version checks... I got most of them wrong. 2014-02-06 17:49:12 -06:00
Zachary Lund
11c40ba6cd Minor adjustment to code. ARB version of debug_output doesn't use GL_DEBUG_OUTPUT 2014-02-06 01:57:14 -06:00
Zachary Lund
72c156f549 Corrected a version check which caused crashes on non-4.3 profiles. 2014-02-06 01:41:55 -06:00
Zachary Lund
fe1adfceec Broke Windows, here's a fix. 2014-02-06 01:29:07 -06:00
Zachary Lund
5c3b56807a Fixed gl-subsystem.c to reflect changes to GL loader API. 2014-02-06 00:25:15 -06:00
Zachary Lund
019d8d83ee Messed with GL loader some more.
I've branched well off of upstream glloadgen since they don't appear to be very active in between GL versions.

1) Changed how the address finder functions are set to be more sane.
2) Added *all* possible extensions. For the lulz.
3) Fixed a retarded bug in IsVersionGEQ.
4) Slapped myself for not seeing IsVersionGEQ bug earlier. Most important change.
2014-02-06 00:20:03 -06:00
jp9000
021d9522ea Eliminate more trailing whitespace from gl-x11.c 2014-02-05 21:33:55 -07:00
jp9000
8219a64958 Remove trailing whitespace from gl-x11.c (OCD) 2014-02-05 21:31:03 -07:00
jp9000
ab4ab95790 Implement output scaling/conversion/downloading
- Implement texture scaling/conversion/downloading for the main view so
  we can finally start getting data to output.

  Also, redesign how it works a bit, it will now properly wait one full
  frame for each step in the process:  rendering the main texture,
  scaling the main texture to an output texture, staging/downloading the
  ouput texture, and then outputting that staged data.  This way, the
  GPU will have more than enough time to fully complete each step.

- Fix a bug with OpenGL plugin's texture staging function.  Was using
  glBindBuffer instead of what should have been used:  glBindTexture.

- Change the naming scheme of the variables in default.effect.  It's now
  named with the idea of just "color matrix" in mind instead of "yuv
  matrix", and instead of DrawRGBToYUV, it's now just DrawMatrix.
2014-02-05 20:36:21 -07:00
BtbN
e53825f1c3 Remove autotools files and update INSTALL file 2014-02-02 22:45:05 +01:00
Zachary Lund
cc44c93fbf Fixed missed boolean check 2014-01-26 01:53:59 -06:00
Zachary Lund
488c90b3d2 Removed mercurial leftovers 2014-01-26 00:53:12 -06:00
Zachary Lund
666f0be14f Merge branch 'alt-ogl-loader' of https://github.com/jp9000/obs-studio into alt-ogl-loader 2014-01-25 23:59:26 -06:00
Zachary Lund
ae17c457a7 Regenerated files 2014-01-25 23:58:43 -06:00
Zachary Lund
f4379d7889 Changed constness on passed argument, updated VC++ project files 2014-01-25 23:23:26 -06:00
Zachary Lund
1c48834cb5 Fixed signedness issue on GLX 2014-01-25 22:27:02 -06:00
Zachary Lund
469f217e6b Removed tools used to generate the GL headers/implementations as we never use them to build 2014-01-25 22:26:55 -06:00
Zachary Lund
001f0b10a4 Fixed Windows goofy macros 2014-01-25 22:26:55 -06:00
Zachary Lund
f33e693a6e Fixed cmake for Windows 2014-01-25 22:26:55 -06:00
Zachary Lund
74ab96a3ad I removed GLEW, added glLoadGen (renamed to GL here), and added implementations for all platforms. Hopefully this goes better than GLAD did. 2014-01-25 22:26:43 -06:00
Zachary Lund
e3299d5662 Added rudimentary support for Qt on Linux 2014-01-24 21:55:10 -06:00
BtbN
45ec80fb7d Full rewrite of all CMakeLists
CMake now works on all platforms
2014-01-24 18:56:32 +01:00
BtbN
8fa309c96e Clean old cmake files 2014-01-24 01:46:36 +01:00
Zachary Lund
bb24591d48 Add copyright and name to files it applies to. 2014-01-11 18:09:48 -06:00
Zachary Lund
78aa456a7b Added comments on why some code is disabled 2014-01-09 21:04:52 -06:00
Zachary Lund
d283f24cbb A few changes concerning wxGTK.
For one, I added a new member gs_window for future use.
The member is "display" which represents our connection to X11.
Ideally, we should use this specific connection to deal with our Window.
For now, it's disabled. Read comment for more information.

Secondly, wxGTK apparently doesn't map our window in some cases.
This causes the window ID passed to be bad and will stop (or segfault)
our program. This might be related to the first commit above.

For now, all this commit does is realize the window manually.
2014-01-09 21:04:52 -06:00
Jim
0b7497d6df Merge pull request #23 from Ceropean/master
Use XGetErrorText() instead of our own table
2014-01-07 20:18:32 -08:00
Zachary Lund
d3dab077cb Another attempt to fix ARB_debug_output, hopefully the last one. 2014-01-07 18:24:04 -06:00
Ján Mlynek
ecadb4faae Use XGetErrorText() instead of our own table
This fixes segfaults when the error code is not in the table
2014-01-07 20:35:19 +01:00
jp9000
bf371437b3 Fixed debug extension check
- Check the actual debug extension instead of checking GL 4.0 support;
   it appears that despite having GL 4.0 support, AMD does not implement
   the standard debug extensions even when the *_CONTEXT_DEBUG_BIT_ARB
   flag is set on the context.

 - Also, fixed a place where spaces where used for indents instead of a
   tab.
2014-01-06 19:02:19 -07:00
jp9000
156009cc0c Fixed debug GL functions on windows (amend)
- Removed the dependency on windows.h for windows.  I feel it's an
   unnecessarily large dependency to have to add to all source files
   when the only thing that's needed to make the windows version compile
   the debug functions is just the __stdcall call convention keyword.

   On top of increasing compile time due to the large number of headers
   it includes from all the windows API headers, it also adds a lot of
   potential name conflicts, as I was getting a number of name conflicts
   for lots of names like near/far, which were used in old legacy 16bit
   windows code.
2014-01-06 17:36:19 -07:00
Zachary Lund
8073b0ecd4 Fixed APIENTRY quirk with GLEW 2014-01-06 17:51:45 -06:00
Zachary Lund
840c1cfd65 I removed GL-specific extension checking to a platform independent file.
I also fixed autoconf to find wxWidgets 2.9 without user intervention
Removed unused code and added more organization
2014-01-05 23:50:32 -06:00
Zachary Lund
4aef1d00d1 Change _DEBUG coverage a bit 2014-01-05 19:55:19 -06:00
Zachary Lund
fee0d9a8f3 Minor style fixup 2014-01-04 01:37:00 -06:00
Zachary Lund
8df5293be1 Added GLX version check and assures context is set to none on failure.
Fixed the location glewExperimental was being set to just before glewInit() (where it should be).
2014-01-04 01:29:37 -06:00
Zachary Lund
ffd80449d3 Added gl_update (does nothing for now).
Fix previous commit..
2014-01-04 00:50:40 -06:00