summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/shader_cache.c
Commit message (Collapse)AuthorAgeFilesLines
* vo_opengl: refactor into vo_gpuNiklas Haas2017-09-211-955/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is done in several steps: 1. refactor MPGLContext -> struct ra_ctx 2. move GL-specific stuff in vo_opengl into opengl/context.c 3. generalize context creation to support other APIs, and add --gpu-api 4. rename all of the --opengl- options that are no longer opengl-specific 5. move all of the stuff from opengl/* that isn't GL-specific into gpu/ (note: opengl/gl_utils.h became opengl/utils.h) 6. rename vo_opengl to vo_gpu 7. to handle window screenshots, the short-term approach was to just add it to ra_swchain_fns. Long term (and for vulkan) this has to be moved to ra itself (and vo_gpu altered to compensate), but this was a stop-gap measure to prevent this commit from getting too big 8. move ra->fns->flush to ra_gl_ctx instead 9. some other minor changes that I've probably already forgotten Note: This is one half of a major refactor, the other half of which is provided by rossy's following commit. This commit enables support for all linux platforms, while his version enables support for all non-linux platforms. Note 2: vo_opengl_cb.c also re-uses ra_gl_ctx so it benefits from the --opengl- options like --opengl-early-flush, --opengl-finish etc. Should be a strict superset of the old functionality. Disclaimer: Since I have no way of compiling mpv on all platforms, some of these ports were done blindly. Specifically, the blind ports included context_mali_fbdev.c and context_rpi.c. Since they're both based on egl_helpers, the port should have gone smoothly without any major changes required. But if somebody complains about a compile error on those platforms (assuming anybody actually uses them), you know where to complain.
* vo_opengl: always initialize uniforms on first useNiklas Haas2017-09-121-1/+3
| | | | | | Even if the contents are entirely zero. In the current code, these entries were left uninitialized. (Which always worked for nvidia - but randomly blew up for AMD)
* vo_opengl: generalize UBO packing/handlingNiklas Haas2017-09-121-63/+46
| | | | | | This is simultaneously generalized into two directions: 1. Support more sc_uniform types (needed for SC_UNIFORM_TYPE_PUSHC) 2. Support more flexible packing (needed for both PUSHC and ra_d3d11)
* vo_opengl: fix out-of-bounds read in update_uniformNiklas Haas2017-09-111-2/+1
| | | | | | | | | | Since the addition of UBOs, the assumption that the uniform index corresponds to the pass->params.inputs index is no longer true. Also, there's no reason it would even need this - since the `input` is also available directly in sc_uniform. I have no idea how I've been using this code for as long as I have without any segfaults until earlier today.
* vo_opengl: add support for vulkan GLSL dialectNiklas Haas2017-09-041-9/+26
| | | | | | | | | | Redefining texture1D / texture3D seems to be illegal, they are already built-in macros or something. So just use tex1D and tex3D instead. Additionally, GL_KHR_vulkan_glsl requires using explicit vertex locations and bindings, so make some changes to facilitate this. (It also requires explicitly setting location=0 for the color attachment output)
* vo_opengl: fix the renderpass target format at creation timeNiklas Haas2017-08-271-3/+13
| | | | Required for vulkan.
* vo_opengl: use UBOs where supported/requiredNiklas Haas2017-08-271-13/+164
| | | | | | | | | | | | This also introduces RA_CAP_GLOBAL_UNIFORM. If this is not set, UBOs *must* be used for non-bindings. Currently the cap is ignored though, and the shader_cache *always* generates UBO-using code where it can. Could be made an option in principle. Only enabled for drivers new enough to support explicit UBO offsets, just in case... No change to performance, which is probably what we expect.
* vo_opengl: add support for UBOsNiklas Haas2017-08-271-0/+5
| | | | | Not actually used by anything yet, but straightforward enough to add to the RA API for starters.
* vo_opengl: refactor shader_cache bindingNiklas Haas2017-08-271-9/+18
| | | | | There's no reason to be needlessly wasteful with our binding points here. Just add a CAP for it.
* vo_opengl: generalize ra_buf to support other buffer objectsNiklas Haas2017-08-071-8/+9
| | | | | This allows us to integrate PBOs and SSBOs into the same abstraction, with the potential to easily add UBOs if the need arises.
* vo_opengl: drop ra_gl.h from shader_cache.cNiklas Haas2017-08-061-5/+2
| | | | | | Since the GL *gl is no longer needed for the timers, we can get rid of the sc->gl dependency. This requires moving a utility function (which is not GL-specific anyway) out of gl_utils.h and into utils.h
* vo_opengl: move timers to struct raNiklas Haas2017-08-061-22/+22
| | | | | | | In order to prevent code duplication and keep the ra abstraction as small as possible, `ra` only implements the actual timer queries, it does not do pooling/averaging of the results. This is instead moved to a ra-neutral struct timer_pool in utils.c.
* vo_opengl: move shader handling to rawm42017-08-051-490/+319
| | | | | | | | | | | | | Now all GL-specifics of shader compilation are abstracted through ra. Of course we still have everything hardcoded to GLSL - that isn't going to change. Some things will probably change later - in particular, the way we pass uniforms and textures to the shader. Currently, there is a confusing mismatch between "primitive" uniforms like floats, and others like textures. Also, SSBOs are not abstracted yet.
* vo_opengl: split utils.c/hwm42017-08-051-0/+952
Actually GL-specific parts go into gl_utils.c/h, the shader cache (gl_sc*) into shader_cache.c/h. No semantic changes of any kind, except that the VAO helper is made public again as part of gl_utils.c (all while the goal for gl_utils.c itself is to be included by GL-specific code).