bloc97 / Anime4K

A High-Quality Real Time Upscaler for Anime Video
https://bloc97.github.io/Anime4K/
MIT License
17.98k stars 1.34k forks source link

Prime Offload & experimental v4.1 SRGAN UUL Shaders doesn't work : [vo/gpu/opengl] after creating texture: OpenGL error INVALID_VALUE #175

Closed PowerPixel closed 2 years ago

PowerPixel commented 2 years ago

Describe the bug While trying to use the command described in this commit, the video playback slowdowns before these error are logged into the console :

 (+) Video --vid=1 (h264 656x480 29.970fps)
 (+) Audio --aid=1 (aac 2ch 44100Hz)
     Subs  --sid=1 --slang=deDE 'ass' (null) (external)
     Subs  --sid=2 --slang=frFR 'ass' (null) (external)
AO: [pulse] 44100Hz stereo 2ch float
VO: [gpu] 656x480 => 661x480 yuv420p
AV: 00:00:02 / 00:24:58 (0%) A-V:  0.016 DS: 4.050/6 Dropped: 18 Cache: 75s/15MB
# Here I use the command in the commit mentionned in the issue
[vo/gpu/opengl] after creating texture: OpenGL error INVALID_VALUE.
[vo/gpu/opengl] after creating texture: OpenGL error INVALID_VALUE.
[vo/gpu/opengl] after creating texture: OpenGL error INVALID_VALUE.
[vo/gpu/opengl] after creating texture: OpenGL error INVALID_VALUE.
[vo/gpu/opengl] after creating texture: OpenGL error INVALID_VALUE.
[vo/gpu/opengl] after creating texture: OpenGL error INVALID_VALUE.

No upscaling seems to be applied past this point.

To Reproduce Steps to reproduce the behavior:

  1. Add this line to the ~/.config/mpv/input.conf file :
    CTRL+7 no-osd change-list glsl-shaders set "~~/shaders/Anime4K_Restore_GAN_UUL.glsl:~~/shaders/Anime4K_Upscale_GAN_x4_UUL.glsl:~~/shaders/Anime4K_Restore_CNN_Soft_M.glsl:~~/shaders/Anime4K_Upscale_CNN_x2_M.glsl"; show-text "Anime4K Low Res upscale"
  2. Launch mpv with the following command : __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia mpv https://beta.crunchyroll.com/watch/G6752MM4R/untitled
  3. Press CTRL + 7 to enable the experimental shaders.

Expected behavior It should apply the shaders without crashing.

Screenshots image

Desktop (please complete the following information):

Additional context I am running mpv on a laptop, using PRIME render offload (which is the official Nvidia OPTIMUS alternative for Linux). Please note that I cannot reproduce the issue without using prime OFFLOAD (with mpv https://beta.crunchyroll.com/watch/G6752MM4R/untitled)

bloc97 commented 2 years ago

Looking at the error logs, it's probably something went wrong with the texture sizes, this error is very common when OpenGL tries to initialize absurd texture sizes unsupported by normal consumer GPUs, like 10000x10000.

Thanks for reporting this bug, but I don't think I can fix anything in the shaders, as this seems to be a bug either in the drivers or PRIME?

PowerPixel commented 2 years ago

Looking at the error logs, it's probably something went wrong with the texture sizes, this error is very common when OpenGL tries to initialize absurd texture sizes unsupported by normal consumer GPUs, like 10000x10000.

Thanks for reporting this bug, but I don't think I can fix anything in the shaders, as this seems to be a bug either in the drivers or PRIME?

Hello there !

Thanks for taking the time to answer my bug report. Yeah, I suspect it might be a bug with PRIME Offload or the drivers, although I'm wondering if the problem couldn't come from MPV or GLSL side (sending wrong sizes to the GPU or whatever it does, I'm unfortunately not very knowledgeable when it comes to the graphics side of things :sweat_smile:). Therefore, I'm gonna try to file in a bug for OpenGL before reporting the bug to NVidia.

Thanks again for this wonderful project, and have a nice week !