summaryrefslogtreecommitdiffstats
path: root/video/out/gpu/shader_cache.c
Commit message (Collapse)AuthorAgeFilesLines
* vo_gpu: vulkan: omit needless #defineNiklas Haas2017-12-251-5/+0
|
* vo_gpu: invalidate fbotex before drawingNiklas Haas2017-12-251-1/+2
| | | | | Don't discard the OSD or pass_draw_to_screen passes though. Could be faster on some hardware.
* msg: reinterpret a bunch of message levelsNiklas Haas2017-12-151-12/+3
| | | | | | | | | | | | | | | | | | | | | | I've decided that MP_TRACE means “noisy spam per frame”, whereas MP_DBG just means “more verbose debugging messages than MSGL_V”. Basically, MSGL_DBG shouldn't create spam per frame like it currently does, and MSGL_V should make sense to the end-user and provide mostly additional informational output. MP_DBG is basically what I want to make the new default for --log-file, so the cut-off point for MP_DBG is if we probably want to know if for debugging purposes but the user most likely doesn't care about on the terminal. Also, the debug callbacks for libass and ffmpeg got bumped in their verbosity levels slightly, because being external components they're a bit less relevant to mpv debugging, and a bit too over-eager in what they consider to be relevant information. I exclusively used the "try it on my machine and remove messages from MSGL_* until it does what I want it to" approach of refactoring, so YMMV.
* vo_gpu: export the GLSL format qualifier for ra_formatJames Ross-Gowan2017-11-071-14/+8
| | | | | | | | | | | | | | | Backported from @haasn's change to libplacebo, except in the current RA, there's nothing to indicate an ra_format can be bound as a storage image, so there's no way to force all of these formats to have a glsl_format. Instead, the layout qualifier will be removed if glsl_format is NULL. This is needed for the upcoming ra_d3d11 backend. In Direct3D 11, while loading float values from unorm images often works as expected, it's technically undefined behaviour, and in Windows 10, it will cause the debug layer to spam the log with error messages. Also, apparently in GLSL, the format name must match the image's format exactly (but in Direct3D, it just has to have the same component type.)
* vo_gpu: add namespace query mechanismJames Ross-Gowan2017-11-071-5/+1
| | | | | | Backported from @haasn's change to libplacebo. More flexible than the previous "shared || non-shared" distinction. The extra flexibility is needed for Direct3D 11, but it also doesn't hurt code-wise.
* vo_gpu: force layout std430 for PCsNiklas Haas2017-09-291-1/+1
| | | | | | | | Seems to be fixed upstream in the nvidia driver, so it's probably a good idea to 1. force the layout and 2. remove the warning, as it now actually works. Users with older drivers would run into errors, but they can still use shaderc as a replacement. (And it's not like the old status quo was any better)
* vo_gpu: make the vertex attribs dynamicNiklas Haas2017-09-281-35/+26
| | | | | | | | | | | | | | | | This has several advantages: 1. no more redundant texcoords when we don't need them 2. no more arbitrary limit on how many textures we can bind 3. (that extends to user shaders as well) 4. no more arbitrary limits on tscale radius To realize this, the VAO was moved from a hacky stateful approach (gl_sc_set_vertex_attribs) - which always bothered me since it was required for compute shaders as well even though they ignored it - to be a proper parameter of gl_sc_dispatch_draw, and internally plumbed into gl_sc_generate, which will make a (properly mangled) deep copy into params.vertex_attribs.
* vo_gpu: explicitly label storage image formatsNiklas Haas2017-09-261-1/+22
| | | | | | | | | | | | This is apparently required to get storage images working on windows/vulkan, and probably good practice either way. Not entirely sure if it's the best idea to be always storing the value as 32-bit float, but it should hardly matter in practice (since we're only writing one sample per thread). (Leaving them implicit requires the shaderStorageImageWriteWithoutFormat feature to be enabled, which the windows nvidia vulkan driver doesn't support, at least not for a GTX 670)
* vo_gpu: attempt to avoid UBOs for dynamic variablesNiklas Haas2017-09-261-2/+22
| | | | | | | | | This makes the radeon driver shut up about frequently updating STATIC_DRAW UBOs (--opengl-debug), and also reduces the amount of synchronization necessary for vulkan uniform buffers. Also add some extra debugging/tracing code paths. I went with a flags-based approach in case we ever want to extend this.
* vo_gpu: vulkan: add support for push constantsNiklas Haas2017-09-261-25/+88
| | | | Can in theory avoid updating the uniform buffer every frame
* vo_gpu: fix possible segfault on shader miscompileNiklas Haas2017-09-231-5/+6
| | | | | Iterations after the first time will fail to realize that the pass was never created. This function's logic and control flow is so annoying...
* vo_gpu: handle texture initialization errors gracefullyNiklas Haas2017-09-231-4/+2
| | | | | | | | | | Tested by making the ra_tex_resize function always fail (apart from the initial FBO check). This required a few changes: 1. reset shaders on failed dispatch 2. reset cleanup binds on failed dispatch 3. fall back to initializing the struct image to 1x1 on failure 4. handle output_fbo_valid gracefully
* vo_gpu: fix possible segfault in shader_cache.cNiklas Haas2017-09-211-1/+3
| | | | | If shader compilation fails in an unexpected way, it can end up calling renderpass_run on an invalid pass, since current_shader is never cleared.
* vo_opengl: refactor into vo_gpuNiklas Haas2017-09-211-0/+954
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.