summaryrefslogtreecommitdiffstats
path: root/video/out/gl_utils.h
Commit message (Collapse)AuthorAgeFilesLines
* vo_opengl: refactor shader generation (part 1)wm42015-03-121-4/+35
| | | | | | | | | | | | | | | | | | | The basic idea is to use dynamically generated shaders instead of a single monolithic file + a ton of ifdefs. Instead of having to setup every aspect of it separately (like compiling shaders, setting uniforms, perfoming the actual rendering steps, the GLSL parts), we generate the GLSL on the fly, and perform the rendering at the same time. The GLSL is regenerated every frame, but the actual compiled OpenGL-level shaders are cached, which makes it fast again. Almost all logic can be in a single place. The new code is significantly more flexible, which allows us to improve the code clarity, performance and add more features easily. This commit is incomplete. It drops almost all previous code, and readds only the most important things (some of them actually buggy). The next commit will complete it - it's separate to preserve authorship information.
* vo_opengl: split out a helper for drawing primitiveswm42015-01-291-4/+7
| | | | | | | | Useful if we want to reduce the size of gl_video.c further. To some degree this emulates traditional glDrawArrays() usage. It also leaves a loophole for avoiding a reupload every time by leaving ptr==NULL, although this is unused for now.
* vo_opengl: some minor cleanupswm42015-01-291-0/+2
| | | | | | | | | | | | | | | default_tex_params() and texture_size() are each called only once, so move inline/reimplement them at the caller. image_dw/dh were unused. texture_w/h, image_format, and component_bits were rarely used, and can be replaced. Regroup some other fields. Rename surface_num to surface_idx, because the former sounded like a count, and not an index. Move fbosurface_next() closer to its callers too. Move the DebugMessageCallback() code to gl_utils.c (also simplify it by always setting the callback, instead of only when it changes).
* vo_opengl: move FBO helper to gl_utilswm42015-01-291-0/+14
| | | | | | | | | | | | | This is somewhat messy, because fbotex_init() itself was depending on some gl_video parameters unrelated to FBO creation (like what scaler was in use - what the fuck did this check do in this function?), so this commit does a bit more than moving code around. In particular, the FBO for the separate scaling intermediate step now always uses GL_NEAREST sampling, and all FBOs are destroyed/recreated on renderer reinitialization. This also moves the function matrix_ortho2d() - trivial enough not to put it into a separate commit.
* vo_opengl: create abstraction for VAOswm42015-01-281-0/+23
| | | | | | Handles stupid boilerplate OpenGL requires you to handle. It's the same code as in gl_video.c, although if no VAOs are available, the fallback code rebinds them on every draw call instead of just once.
* vo_opengl: move utility functions from loader to a separate filewm42015-01-281-0/+46
gl_common.c contained the function loader (which is big) and additional utility functions (not so big, but will grow when moving more out of gl_video.c). Just split them. There are no changes other than some modifications to comments.