libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
9.87k stars 1.78k forks source link

Slang Failed to reflect SPIR-V with CRT-Royale #8049

Open treymerkley opened 5 years ago

treymerkley commented 5 years ago

First and foremost consider this:

Description

When applying any of the CRT-Royale shaders, nothing changes on screen. After looking at the log, it reads:

[INFO] [slang]: Compiling shader "/home/user/.config/retroarch/shaders/shaders_slang/crt/shaders/crt-royale/src/crt-royale-bloom-approx.slang".
[INFO] [slang]: Using render target format R8G8B8A8_SRGB for pass output #0.
[INFO] [slang]: Building pass #0 (N/A)
[INFO] [Vulkan filter chain]: Creating framebuffer 1024 x 1024 (max 1 level(s)).
[ERROR] [slang]: Non-semantic textures not supported yet.
[ERROR] [slang]: Failed to reflect SPIR-V. Resource usage is inconsistent with expectations.
[ERROR] [Vulkan]: Failed to create preset: "/home/user/.config/retroarch/shaders/retroarch-psx.slangp".
[ERROR] [Vulkan]: Failed to create filter chain: "/home/user/.config/retroarch/shaders/retroarch-psx.slangp". Falling back to stock.

Expected behavior

Vulkan to compile and display the shader.

Actual behavior

Something is breaking SPIR-V.

Steps to reproduce the bug

  1. Change to Vulkan and use a Vulkan hardware core (In this case it was Beetle PSX HW).
  2. Turn on any of the CRT-Royale shaders under Slang.

Version/Commit

You can find this information under Information/System Information

Environment information

orbea commented 5 years ago

I can't reproduce this here with an amd rx vega 56 and radv using beetle-psx, genesis gx plus or ppsssp and any of the slang crt royale shaders.

What core are you using? What graphics card do you have? Can you try a nightly version? Can you try updating the slang shaders from the buildbot?

treymerkley commented 5 years ago

Hey, thanks for getting back with me!

EDIT: Looks like the overlay is just a weird quirk of my GPU, disregard.

screenshot from 2019-01-20 10-20-08

orbea commented 5 years ago

I suppose this might be a nvidia vulkan bug, do other slang shaders work at all?

treymerkley commented 5 years ago

Yeah, most texture-focused shaders like xBR and Eagle are fine, and Easymode and Geom work.

orbea commented 5 years ago

I'm not sure I can help, but the errors are here.

https://github.com/libretro/RetroArch/blob/435007326579dd416935c4f82b69344445f28696/gfx/drivers_shader/slang_reflection.cpp#L571

treymerkley commented 5 years ago

That's what I was worried about. The thing is, though, some of the people on the dev team have it working here.

orbea commented 5 years ago

My guess that its the difference in graphics cards or even nvidia driver versions. Looking at the code I guess it would work if Non-semantic textures are supported in RetroArch and those checks are removed, but I don't even know what those are...

You could try removing the errors and checks and see where it blows up or not...

treymerkley commented 5 years ago

I might do that, but it feels a little low level, especially if it's just a matter of using the right config for Royale. I'll see if I can get a hold of Daniel and ask him how he got it working. @twinaphex you know everyone, do you know how I could ask him?

hizzlekizzle commented 5 years ago

The "non-semantic texture" error typically happens when a pass refers to a texture/alias that doesn't exist in the preset.

Do the royale presets work for you with other cores?

inactive123 commented 5 years ago

@Themaister any thoughts here?

ghost commented 5 years ago

last time i had issues with shaders i backed up my config deleted it and tried again t was fine after that.

treymerkley commented 5 years ago

@hizzlekizzle no, but I'd guess that the reason depends on the video driver used. It has the same effect on paraLLEl, and it causes a black screen on SNES9x and Mupen64Plus, although with the latter there's a slowdown at higher passes, so I figure that's a configuration problem rather than a problem with the shader itself.

@grant2258 I just tried with a fresh .cfg but for some reason now I get a black screen when running anything, so I'd have to debug that to debug this.

Themaister commented 5 years ago

Non-semantic texture refers to that a texture has been declared with a name which RA does not understand. Maybe it's referring to a LUT which is not part of the .slangp?

treymerkley commented 5 years ago

Update: Using a fresh config file has no effect.

orbea commented 5 years ago

What option in the fresh config file was giving you a black screen?

treymerkley commented 5 years ago

@oreba it was my problem, not RetroArch; I forgot to set the resources folder, so Beetle didn't have a BIOS to use.

hizzlekizzle commented 5 years ago

And I assume you've tried updating the slang shaders via the online updater?

orbea commented 5 years ago

@hizzlekizzle

  • Can you try updating the slang shaders from the buildbot? Just tried it, also no luck. It's still reporting the same errors. However, now I'm getting this weird thing in the corner. My guess is that it's because I built DEBUG=1 in case you needed a backtrace, but I've never seen it before, even other times I've built debug.

https://github.com/libretro/RetroArch/issues/8049#issuecomment-455880109

treymerkley commented 5 years ago

The error in that also was just a weird thing Nvidia was doing, not anything in the shaders.

hizzlekizzle commented 5 years ago

It seems this error can also come up if any of the parameter pragmas are malformed. Are you sure you the shader files and presets haven't been modified in any way?

orbea commented 5 years ago

Try entirely removing the shaders from your config directory and re-downloading them to be sure.

treymerkley commented 5 years ago

Will do. Is there a specific way I need to use the buildbot? When I try using the webclient it's shockingly slow.

orbea commented 5 years ago

Just mv or rm your old shaders in your config directory and then download them with the online updater.

treymerkley commented 5 years ago

Alright, just deleted everything and downloaded from the updater, and nothing still.

orbea commented 5 years ago

I'm back to suspecting something nvidia related...

treymerkley commented 5 years ago

Is there a way to debug the shaders with GDB?

hizzlekizzle commented 5 years ago

You can try to pinpoint the offending pass/es by changing the number of passes in the preset (e.g., change "shaders = 12" to "shaders = 1" and then try to load the preset). If that works, continue incrementing the number of passes until it breaks.

treymerkley commented 5 years ago

where would I find that at? I couldn't find it in either settings files.

hizzlekizzle commented 5 years ago

it's in the slangp preset, for example: https://github.com/libretro/slang-shaders/blob/master/crt/crt-royale.slangp#L19