From 5bcac8580df6fc62323136f756a3a6d1e754fe9c Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Sat, 24 Nov 2018 04:25:30 +0100 Subject: [PATCH] spirv: remove --spirv-compiler=nvidia This option has been deprecated upstream for a long time, probably doesn't even work anymore, and won't work moving forwards as we replace the vulkan code by libplacebo wrappers. I haven't removed the option completely yet since in theory we could still add support for e.g. a native glslang wrapper in the future. But most likely the future of this code is deletion. As an aside, fix an issue where the man page didn't mention d3d11. --- DOCS/interface-changes.rst | 3 ++ DOCS/man/options.rst | 13 ++++---- video/out/gpu/spirv.c | 8 ----- video/out/vulkan/spirv_nvidia.c | 54 --------------------------------- wscript | 3 +- wscript_build.py | 1 - 6 files changed, 12 insertions(+), 70 deletions(-) delete mode 100644 video/out/vulkan/spirv_nvidia.c diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index 26f39beba7..cbc9af18f8 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -44,6 +44,9 @@ Interface changes `--linear-downscaling`. This means that `--sigmoid-upscaling` no longer implies linear light downscaling as well, which was confusing. - the built-in `gpu-hq` profile now includes` --linear-downscaling`. + - support for `--spirv-compiler=nvidia` has been removed, leaving `shaderc` + as the only option. The `--spirv-compiler` option itself has been marked + as deprecated, and may be removed in the future. --- mpv 0.29.0 --- - drop --opensles-sample-rate, as --audio-samplerate should be used if desired - drop deprecated --videotoolbox-format, --ff-aid, --ff-vid, --ff-sid, diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst index e8c548d3a7..2aaad5febc 100644 --- a/DOCS/man/options.rst +++ b/DOCS/man/options.rst @@ -4522,18 +4522,19 @@ The following video options are currently all specific to ``--vo=gpu`` and ``--spirv-compiler=`` Controls which compiler is used to translate GLSL to SPIR-V. This is - (currently) only relevant for ``--gpu-api=vulkan``. The possible choices - are: + (currently) only relevant for ``--gpu-api=vulkan`` and `--gpu-api=d3d11`. + The possible choices are currently only: auto Use the first available compiler. (Default) shaderc Use libshaderc, which is an API wrapper around glslang. This is generally the most preferred, if available. - nvidia - Use nvidia's built-in compiler. Only works for nvidia GPUs. Can be - buggy, but also supports some features glslang does not. Only works - with vulkan. + + .. note:: + + This option is deprecated, since there is only one reasonable value. + It may be removed in the future. ``--glsl-shaders=`` Custom GLSL hooks. These are a flexible way to add custom fragment shaders, diff --git a/video/out/gpu/spirv.c b/video/out/gpu/spirv.c index 06d33686d0..ee11d601a3 100644 --- a/video/out/gpu/spirv.c +++ b/video/out/gpu/spirv.c @@ -5,31 +5,23 @@ #include "config.h" extern const struct spirv_compiler_fns spirv_shaderc; -extern const struct spirv_compiler_fns spirv_nvidia_builtin; // in probe-order enum { SPIRV_AUTO = 0, SPIRV_SHADERC, // generally preferred, but not packaged everywhere - SPIRV_NVIDIA, // can be useful for testing, only available on nvidia }; static const struct spirv_compiler_fns *compilers[] = { #if HAVE_SHADERC [SPIRV_SHADERC] = &spirv_shaderc, #endif -#if HAVE_VULKAN - [SPIRV_NVIDIA] = &spirv_nvidia_builtin, -#endif }; static const struct m_opt_choice_alternatives compiler_choices[] = { {"auto", SPIRV_AUTO}, #if HAVE_SHADERC {"shaderc", SPIRV_SHADERC}, -#endif -#if HAVE_VULKAN - {"nvidia", SPIRV_NVIDIA}, #endif {0} }; diff --git a/video/out/vulkan/spirv_nvidia.c b/video/out/vulkan/spirv_nvidia.c deleted file mode 100644 index 6cc43a5619..0000000000 --- a/video/out/vulkan/spirv_nvidia.c +++ /dev/null @@ -1,54 +0,0 @@ -#include "video/out/gpu/spirv.h" - -#include "common.h" -#include "context.h" -#include "utils.h" - -static bool nv_glsl_compile(struct spirv_compiler *spirv, void *tactx, - enum glsl_shader type, const char *glsl, - struct bstr *out_spirv) -{ - // The nvidia extension literally assumes your SPIRV is in fact valid GLSL - *out_spirv = bstr0(glsl); - return true; -} - -static bool nv_glsl_init(struct ra_ctx *ctx) -{ - struct mpvk_ctx *vk = ra_vk_ctx_get(ctx); - if (!vk) - return false; - - struct spirv_compiler *spv = ctx->spirv; - spv->required_ext = VK_NV_GLSL_SHADER_EXTENSION_NAME; - spv->glsl_version = 450; // impossible to query, so hard-code it.. - spv->ra_caps = RA_CAP_NESTED_ARRAY; - - // Make sure the extension is actually available, and fail gracefully - // if it isn't - VkExtensionProperties *props = NULL; - uint32_t extnum = 0; - VK(vkEnumerateDeviceExtensionProperties(vk->physd, NULL, &extnum, NULL)); - props = talloc_array(NULL, VkExtensionProperties, extnum); - VK(vkEnumerateDeviceExtensionProperties(vk->physd, NULL, &extnum, props)); - - bool ret = true; - for (int e = 0; e < extnum; e++) { - if (strncmp(props[e].extensionName, spv->required_ext, - VK_MAX_EXTENSION_NAME_SIZE) == 0) - goto done; - } - -error: - MP_VERBOSE(ctx, "Device doesn't support VK_NV_glsl_shader, skipping..\n"); - ret = false; - -done: - talloc_free(props); - return ret; -} - -const struct spirv_compiler_fns spirv_nvidia_builtin = { - .compile_glsl = nv_glsl_compile, - .init = nv_glsl_init, -}; diff --git a/wscript b/wscript index db49f2f75b..d3d49090c8 100644 --- a/wscript +++ b/wscript @@ -806,7 +806,8 @@ video_output_features = [ "video outputs use --disable-gl.", }, { 'name': '--vulkan', - 'desc': 'Vulkan context support', + 'desc': 'Vulkan context support', + 'deps': 'shaderc', # Lowest version tested, Ubuntu 16.04's 'func': check_pkg_config('vulkan >= 1.0.61'), }, { diff --git a/wscript_build.py b/wscript_build.py index 2b75383e34..7e63f6bdf8 100644 --- a/wscript_build.py +++ b/wscript_build.py @@ -501,7 +501,6 @@ def build(ctx): ( "video/out/vulkan/formats.c", "vulkan" ), ( "video/out/vulkan/malloc.c", "vulkan" ), ( "video/out/vulkan/ra_vk.c", "vulkan" ), - ( "video/out/vulkan/spirv_nvidia.c", "vulkan" ), ( "video/out/vulkan/utils.c", "vulkan" ), ( "video/out/w32_common.c", "win32-desktop" ), ( "video/out/wayland/idle-inhibit-v1.c", "wayland" ),