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

347 Commits

Author SHA1 Message Date
jp9000
c9df41c1e2 (API Change) Remove pointers from all typedefs
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.
2014-09-25 21:48:11 -07:00
jp9000
732d24caa1 Remove unused variables 2014-09-19 18:46:25 -07:00
jp9000
3967c6354a Replace ARB_separate_shader_objects extension
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.
2014-09-19 18:23:51 -07:00
jp9000
4654eca6b8 Remove GL shader debug text 2014-08-21 03:04:20 -07:00
jp9000
5780f3f177 (API Change) Improve graphics API consistency
Summary:
- Prefix all graphics subsystem names with gs_ or GS_
- Unsquish funciton names (for example _setfloat to _set_float)
- Changed create functions to be more consistent with the rest of the
  API elsewhere.  For exmaple, instead of
  gs_create_texture/gs_texture_destroy, it's now
  gs_texture_create/gs_texture_destroy
- Renamed gs_stencil_op enum to gs_stencil_op_type

From:                            To:
-----------------------------------------------------------
tvertarray                       gs_tvertarray
vb_data                          gs_vb_data
vbdata_create                    gs_vbdata_create
vbdata_destroy                   gs_vbdata_destroy
shader_param                     gs_shader_param
gs_effect                        gs_effect
effect_technique                 gs_effect_technique
effect_pass                      gs_effect_pass
effect_param                     gs_effect_param
texture_t                        gs_texture_t
stagesurf_t                      gs_stagesurf_t
zstencil_t                       gs_zstencil_t
vertbuffer_t                     gs_vertbuffer_t
indexbuffer_t                    gs_indexbuffer_t
samplerstate_t                   gs_samplerstate_t
swapchain_t                      gs_swapchain_t
texrender_t                      gs_texrender_t
shader_t                         gs_shader_t
sparam_t                         gs_sparam_t
effect_t                         gs_effect_t
technique_t                      gs_technique_t
eparam_t                         gs_eparam_t
device_t                         gs_device_t
graphics_t                       graphics_t
shader_param_type                gs_shader_param_type
SHADER_PARAM_UNKNOWN             GS_SHADER_PARAM_UNKNOWN
SHADER_PARAM_BOOL                GS_SHADER_PARAM_BOOL
SHADER_PARAM_FLOAT               GS_SHADER_PARAM_FLOAT
SHADER_PARAM_INT                 GS_SHADER_PARAM_INT
SHADER_PARAM_STRING              GS_SHADER_PARAM_STRING
SHADER_PARAM_VEC2                GS_SHADER_PARAM_VEC2
SHADER_PARAM_VEC3                GS_SHADER_PARAM_VEC3
SHADER_PARAM_VEC4                GS_SHADER_PARAM_VEC4
SHADER_PARAM_MATRIX4X4           GS_SHADER_PARAM_MATRIX4X4
SHADER_PARAM_TEXTURE             GS_SHADER_PARAM_TEXTURE
shader_param_info                gs_shader_param_info
shader_type                      gs_shader_type
SHADER_VERTEX                    GS_SHADER_VERTEX
SHADER_PIXEL                     GS_SHADER_PIXEL
shader_destroy                   gs_shader_destroy
shader_numparams                 gs_shader_get_num_params
shader_getparambyidx             gs_shader_get_param_by_idx
shader_getparambyname            gs_shader_get_param_by_name
shader_getviewprojmatrix         gs_shader_get_viewproj_matrix
shader_getworldmatrix            gs_shader_get_world_matrix
shader_getparaminfo              gs_shader_get_param_info
shader_setbool                   gs_shader_set_bool
shader_setfloat                  gs_shader_set_float
shader_setint                    gs_shader_set_int
shader_setmatrix3                gs_shader_setmatrix3
shader_setmatrix4                gs_shader_set_matrix4
shader_setvec2                   gs_shader_set_vec2
shader_setvec3                   gs_shader_set_vec3
shader_setvec4                   gs_shader_set_vec4
shader_settexture                gs_shader_set_texture
shader_setval                    gs_shader_set_val
shader_setdefault                gs_shader_set_default
effect_property_type             gs_effect_property_type
EFFECT_NONE                      GS_EFFECT_NONE
EFFECT_BOOL                      GS_EFFECT_BOOL
EFFECT_FLOAT                     GS_EFFECT_FLOAT
EFFECT_COLOR                     GS_EFFECT_COLOR
EFFECT_TEXTURE                   GS_EFFECT_TEXTURE
effect_param_info                gs_effect_param_info
effect_destroy                   gs_effect_destroy
effect_gettechnique              gs_effect_get_technique
technique_begin                  gs_technique_begin
technique_end                    gs_technique_end
technique_beginpass              gs_technique_begin_pass
technique_beginpassbyname        gs_technique_begin_pass_by_name
technique_endpass                gs_technique_end_pass
effect_numparams                 gs_effect_get_num_params
effect_getparambyidx             gs_effect_get_param_by_idx
effect_getparambyname            gs_effect_get_param_by_name
effect_updateparams              gs_effect_update_params
effect_getviewprojmatrix         gs_effect_get_viewproj_matrix
effect_getworldmatrix            gs_effect_get_world_matrix
effect_getparaminfo              gs_effect_get_param_info
effect_setbool                   gs_effect_set_bool
effect_setfloat                  gs_effect_set_float
effect_setint                    gs_effect_set_int
effect_setmatrix4                gs_effect_set_matrix4
effect_setvec2                   gs_effect_set_vec2
effect_setvec3                   gs_effect_set_vec3
effect_setvec4                   gs_effect_set_vec4
effect_settexture                gs_effect_set_texture
effect_setval                    gs_effect_set_val
effect_setdefault                gs_effect_set_default
texrender_create                 gs_texrender_create
texrender_destroy                gs_texrender_destroy
texrender_begin                  gs_texrender_begin
texrender_end                    gs_texrender_end
texrender_reset                  gs_texrender_reset
texrender_gettexture             gs_texrender_get_texture
GS_BUILDMIPMAPS                  GS_BUILD_MIPMAPS
GS_RENDERTARGET                  GS_RENDER_TARGET
gs_device_name                   gs_get_device_name
gs_device_type                   gs_get_device_type
gs_entercontext                  gs_enter_context
gs_leavecontext                  gs_leave_context
gs_getcontext                    gs_get_context
gs_renderstart                   gs_render_start
gs_renderstop                    gs_render_stop
gs_rendersave                    gs_render_save
gs_getinput                      gs_get_input
gs_geteffect                     gs_get_effect
gs_create_effect_from_file       gs_effect_create_from_file
gs_create_effect                 gs_effect_create
gs_create_vertexshader_from_file gs_vertexshader_create_from_file
gs_create_pixelshader_from_file  gs_pixelshader_create_from_file
gs_create_texture_from_file      gs_texture_create_from_file
gs_resetviewport                 gs_reset_viewport
gs_set2dmode                     gs_set_2d_mode
gs_set3dmode                     gs_set_3d_mode
gs_create_swapchain              gs_swapchain_create
gs_getsize                       gs_get_size
gs_getwidth                      gs_get_width
gs_getheight                     gs_get_height
gs_create_texture                gs_texture_create
gs_create_cubetexture            gs_cubetexture_create
gs_create_volumetexture          gs_voltexture_create
gs_create_zstencil               gs_zstencil_create
gs_create_stagesurface           gs_stagesurface_create
gs_create_samplerstate           gs_samplerstate_create
gs_create_vertexshader           gs_vertexshader_create
gs_create_pixelshader            gs_pixelshader_create
gs_create_vertexbuffer           gs_vertexbuffer_create
gs_create_indexbuffer            gs_indexbuffer_create
gs_gettexturetype                gs_get_texture_type
gs_load_defaultsamplerstate      gs_load_default_samplerstate
gs_getvertexshader               gs_get_vertex_shader
gs_getpixelshader                gs_get_pixel_shader
gs_getrendertarget               gs_get_render_target
gs_getzstenciltarget             gs_get_zstencil_target
gs_setrendertarget               gs_set_render_target
gs_setcuberendertarget           gs_set_cube_render_target
gs_beginscene                    gs_begin_scene
gs_draw                          gs_draw
gs_endscene                      gs_end_scene
gs_setcullmode                   gs_set_cull_mode
gs_getcullmode                   gs_get_cull_mode
gs_enable_depthtest              gs_enable_depth_test
gs_enable_stenciltest            gs_enable_stencil_test
gs_enable_stencilwrite           gs_enable_stencil_write
gs_blendfunction                 gs_blend_function
gs_depthfunction                 gs_depth_function
gs_stencilfunction               gs_stencil_function
gs_stencilop                     gs_stencil_op
gs_setviewport                   gs_set_viewport
gs_getviewport                   gs_get_viewport
gs_setscissorrect                gs_set_scissor_rect
gs_create_texture_from_iosurface gs_texture_create_from_iosurface
gs_create_gdi_texture            gs_texture_create_gdi
gs_is_compressed_format          gs_is_compressed_format
gs_num_total_levels              gs_get_total_levels
texture_setimage                 gs_texture_set_image
cubetexture_setimage             gs_cubetexture_set_image
swapchain_destroy                gs_swapchain_destroy
texture_destroy                  gs_texture_destroy
texture_getwidth                 gs_texture_get_width
texture_getheight                gs_texture_get_height
texture_getcolorformat           gs_texture_get_color_format
texture_map                      gs_texture_map
texture_unmap                    gs_texture_unmap
texture_isrect                   gs_texture_is_rect
texture_getobj                   gs_texture_get_obj
cubetexture_destroy              gs_cubetexture_destroy
cubetexture_getsize              gs_cubetexture_get_size
cubetexture_getcolorformat       gs_cubetexture_get_color_format
volumetexture_destroy            gs_voltexture_destroy
volumetexture_getwidth           gs_voltexture_get_width
volumetexture_getheight          gs_voltexture_get_height
volumetexture_getdepth           gs_voltexture_getdepth
volumetexture_getcolorformat     gs_voltexture_get_color_format
stagesurface_destroy             gs_stagesurface_destroy
stagesurface_getwidth            gs_stagesurface_get_width
stagesurface_getheight           gs_stagesurface_get_height
stagesurface_getcolorformat      gs_stagesurface_get_color_format
stagesurface_map                 gs_stagesurface_map
stagesurface_unmap               gs_stagesurface_unmap
zstencil_destroy                 gs_zstencil_destroy
samplerstate_destroy             gs_samplerstate_destroy
vertexbuffer_destroy             gs_vertexbuffer_destroy
vertexbuffer_flush               gs_vertexbuffer_flush
vertexbuffer_getdata             gs_vertexbuffer_get_data
indexbuffer_destroy              gs_indexbuffer_destroy
indexbuffer_flush                gs_indexbuffer_flush
indexbuffer_getdata              gs_indexbuffer_get_data
indexbuffer_numindices           gs_indexbuffer_get_num_indices
indexbuffer_gettype              gs_indexbuffer_get_type
texture_rebind_iosurface         gs_texture_rebind_iosurface
texture_get_dc                   gs_texture_get_dc
texture_release_dc               gs_texture_release_dc
2014-08-09 11:57:38 -07:00
jp9000
9d300685ca (API Change) Unsquish libobs/util
Changed:                      To:
-----------------------------------------------------------
dstr_isempty                  dstr_is_empty
cf_lexer_gettokens            cf_lexer_get_tokens
cf_preprocessor_gettokens     cf_preprocessor_get_tokens
2014-08-09 11:57:37 -07:00
jp9000
778cc2b318 (API Change) obs_reset_video: Use return codes
Changed API functions:
libobs: obs_reset_video

Before, video initialization returned a boolean, but "failed" is too
little information, if it fails due to lack of device capabilities or
bad video device parameters, the front-end needs to know that.

The OBS Basic UI has also been updated to reflect this API change.
2014-07-20 18:25:57 -07:00
jp9000
89a5bdbcf1 Add gs_device_type function
This allows a programatic way of determining the type of graphics module
currently active.
2014-07-20 16:23:03 -07:00
jp9000
a446dd74af Add gs_device_name function
This returns the name of the device, "Direct3D 11" or "OpenGL"
respectively.
2014-07-20 15:31:45 -07:00
jp9000
a27f2fbb3a Fix potentially uninitialized variable warnings 2014-07-12 11:59:46 -07:00
jp9000
f675c8029f Fix 'unused parameter' warnings on windows 2014-07-12 11:59:07 -07:00
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
Zachary Lund
3dc2024c8f Remove enable statements. This should be done in platform-independent code using GLEW. 2014-01-04 00:42:23 -06:00
Zachary Lund
94f88c82cf Added OpenGL debug callback support and context changes.
1. We no longer hardcode a 3.2 profile. It chooses the latest profile that fits out description.
2. I added three tables and macros to help with the offsets compared to the variables to help reading. Read comments for more info.
3. I added glewExperimental being set. What a dumb "feature". It doesn't help anything...
2014-01-03 23:14:35 -06:00
Zachary Lund
9b882768be Fixed memory leak by calling gl_windowinfo_destroy in platform destruction. 2014-01-02 18:35:10 -06:00
Zachary Lund
80b8176e29 GLX implementation and *nix-specific file handling implementation
I added gl-x11 which allows compatibility with X11 (Xlib-based) and GLX.
I also added various functions to handle file finding based on FHS.
Various changes to autotools to both install files correctly and to configure correctly.
2014-01-02 18:20:58 -06:00
Palana
b70df7607c synchronize opengl context access on osx between threads 2013-12-31 18:46:19 +01:00
jp9000
e2a1186269 one of the problems of doing changes for Objective-C on windows is that you can't actually compile your code and test it before commiting, leading to foolish little errors like 'you forgot to put a semicolen at the end of that call' 2013-12-31 03:13:56 -07:00
jp9000
141b22e76e not sure what was on my mind there but I totally got the variable names wrong in that last commit (for NSOpenGLContext update) 2013-12-31 03:12:31 -07:00
jp9000
969a71d716 call NSOpenGLContext 'update' on opengl context on macos when resizing 2013-12-31 03:09:28 -07:00
Palana
683585938c add infrastructure for app bundle target and unmark as advanced 2013-12-30 20:52:44 +01:00
Palana
c536d70379 add support for static system GLEW to cmake 2013-12-30 05:45:19 +01:00
Zachary Lund
5f5404f8cb Fixes issues with autoconf
In particular, it removes any deprecated functionality
wxWidgets only documents their deprecated m4 macros and gives a poor example
Also to note in regard to wxWidgets, I removed any unneeded libraries from the linker line.

Any warning messages provided by autoconf has been supressed in the most appropriate manner possible.
2013-12-27 16:41:01 -06:00
Palana
d9e1362cce add pixel format check for iosurfaces 2013-12-24 17:07:58 +01:00
Palana
74aa1c466b add osx iosurface opengl integration 2013-12-23 16:35:14 +01:00
Palana
f23bf6b83c restore pre-c99-compatibility 2013-12-22 04:51:11 +01:00
Palana
1dde992990 remove mipmap texture filter from min_filter for rectangle textures 2013-12-22 04:47:18 +01:00
jp9000
0781670ba2 add handling of GL_TEXTURE_RECTANGLE target, and add automatic handling if using it as a sprite 2013-12-20 12:36:38 -07:00
jp9000
f41bb4b7e9 add support for texture_rect texture type in shaders, add new form, clear up a few things in the API 2013-12-20 11:58:09 -07:00
jp9000
aead95f5e3 converted project to vs2013, removed 2010 support (ugh) 2013-12-14 16:01:30 -07:00
jp9000
8dea4d60ef add comment explaining the purpose of that line (because I noticed it was rather vague) 2013-12-13 10:32:05 -07:00
jp9000
61c6defd77 almost lured myself into another null pointer trap, fixed 2013-12-13 10:28:05 -07:00
jp9000
31dd23cb0d fixed potential null pointer bug 2013-12-13 10:24:54 -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
Palana
e230b0e984 updated include paths (CMake+osxtest) and function prototype (osxtest)
fixes compilation with changes from e5c99175c5
2013-11-29 20:58:29 +01:00
jp9000
e5c99175c5 fixed some build issues on non-windows systems 2013-11-26 23:07:27 -07:00
jp9000
409b011a8e cleaned up main internal data structure design, changed to reference counting for sources to ensure safe destruction of source objects from all parts of the system, added some service-related stuff for testing 2013-11-20 15:00:16 -07:00
jp9000
5e33707f6a ensure 80-column max formatting in gl-subsystem.c 2013-11-15 07:10:21 -07:00
jp9000
10e917efee unbind VAO if NULL buffer specified 2013-11-15 07:07:03 -07:00
Palana
41bef32962 removed global VAO from gl-cocoa 2013-11-15 15:03:35 +01:00
jp9000
e778a4c04f added OSX files to automake scripts 2013-11-15 06:40:03 -07:00
jp9000
72a64b3d41 added VAOs to vertex buffers (might need some future tweaking to check whether buffers are already assigned to specific attributes) 2013-11-15 06:34:05 -07:00
jp9000
041f48b566 make code gl-cocoa.m 80 columns for consistency (I'm probably just being OCD, don't mind me, hopefully didn't break anything) 2013-11-14 10:48:48 -07:00
Palana
ec411fe046 added cmake build files 2013-11-14 18:36:46 +01:00
Palana
d7a04aea8c added osx cocoa support files 2013-11-14 18:31:18 +01:00
Palana
26397c7782 allow non-static glew include path 2013-11-14 18:29:37 +01:00
Palana
8880a9e811 check for link status instead of validate status 2013-11-14 18:29:37 +01:00
Palana
ebc78eee9d do not unbind vertex array (GL 3+) 2013-11-14 17:51:38 +01:00
jp9000
f5e41f441e added initial main program and directshow files, finally have a UI functioning 2013-11-07 16:45:03 -07:00
jp9000
37c7db5dbe fixed some bugs and fixed a variable that wasn't declared at the top 2013-11-02 14:44:40 -07:00
Palana
db9f8cc269 restrict max_anisotropy to 1 ≤ max_anisotropy ≤ max_anisotropy_max 2013-11-02 22:24:57 +01:00
jp9000
0b96e65498 fix a function variable name that was shadowing a parameter name 2013-11-02 12:53:25 -07:00
jp9000
8847d11e8e adjust file locations to be more portable 2013-11-01 14:33:00 -07:00
jp9000
676a0bd67d update build system to autotools (finally) 2013-10-29 23:21:40 -07:00
jp9000
ab08c2c3f2 fixed a minor bug in the gl shader parser 2013-10-29 06:01:19 -07:00
jp9000
a43e291577 fill in the texture_setimage function, fill in a few other functions, and change certain names to be a little more consistent 2013-10-25 10:25:28 -07:00
jp9000
bb329b9278 avoid using 'default' for enum switches 2013-10-24 01:29:06 -07:00
jp9000
18834c6a45 some static analysis cleanup 2013-10-17 17:21:42 -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
27a7873066 fix the can_render function and add in view/projection matrix code 2013-10-12 23:53:30 -07: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
aeea0eadc9 added shader attributes and added vertex buffer loading 2013-10-11 20:14:26 -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
1b3b177583 add initial GL vertex buffer code 2013-10-10 23:03:42 -07:00
jp9000
e804a9043d fix GL pixel pack and unpack stuff 2013-10-10 18:50:09 -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
806bf557e5 removed a fairly pointless constant for the time being 2013-10-10 07:46:27 -07:00
jp9000
d67354f53e remove unnecessary projects from glew 2013-10-09 21:37:44 -07:00
jp9000
e159fc4f06 fill in shader parameter functions 2013-10-09 20:34:23 -07:00
jp9000
fda2ee1147 added initial GL shader code 2013-10-09 15:48:16 -07:00
jp9000
c301c9e1ef whoops, added mul and saturate GLSL conversion 2013-10-08 15:18:33 -07:00
jp9000
34357f00fb finish up GLSL conversion stuff and make some minor tweaks to shader parser 2013-10-08 13:36:15 -07:00
jp9000
f9d1a4b9ed added first GLSL code, moved some graphics functions around, and adjusted some existing shader parser code 2013-10-06 18:29:29 -07:00
jp9000
fecb5578e3 woops, make sure that glDeleteBuffers gets a pointer to the pixel unpack buffer 2013-10-05 09:50:12 -07:00
jp9000
5a41589015 clean up pixel unpack buffer for dynamic textures, and add some more error handling code for other GL functions 2013-10-05 09:48:35 -07:00
jp9000
7f59eebea5 and fixed one more little bug 2013-10-05 09:42:04 -07:00
jp9000
f9c2aadf53 remove some more code duplication, fix a string, and remove a potential bug 2013-10-05 09:40:43 -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
jp9000
98a74e211a added a 'default' swap chain 2013-10-03 06:17:43 -07:00
jp9000
df58b3a9b7 made glew compile with static CRT 2013-10-02 23:15:01 -07:00
jp9000
7002821245 added GL subsystem prototypes 2013-10-02 23:14:15 -07:00
jp9000
b3b19d8216 more adjustments/fixes to windows GL initialization code 2013-10-02 23:12:16 -07:00
jp9000
d36b31d58f fix windows opengl initialization 2013-10-02 19:50:33 -07:00
jp9000
3add91aa35 the cleanup code I was going to add isn't necessary in this function, so just make gl_platform_init function return false 2013-10-02 01:02:08 -07:00
jp9000
b97da19828 add GL initialization code for windows (so I can have something to test more easily with) 2013-10-02 00:59:06 -07:00
jp9000
67f5141dc2 add generated extension files to glew 2013-10-02 00:46:16 -07:00
jp9000
b05120ce3b subtree merged in libobs-opengl/glew 2013-10-02 00:40:25 -07:00
jp9000
a2dce06fa8 add initial opengl files and opengl project 2013-10-01 00:29:40 -07:00
jp9000
f255ae1922 first commit 2013-09-30 19:37:13 -07:00