Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video: Fix lens_distortion post process shader not compiling #11851

Merged
merged 1 commit into from Jun 1, 2023

Conversation

Filoppi
Copy link
Contributor

@Filoppi Filoppi commented May 28, 2023

any() failed to build on my machine, but it doesn't seem to be necessary

@Filoppi Filoppi marked this pull request as ready for review May 28, 2023 09:30
@K0bin
Copy link
Contributor

K0bin commented May 28, 2023

Which backend fails to compile that shader?

I'm pretty sure your fix is incorrect.

The GLSL spec says: (emphasis mine)

Any expression whose type evaluates to a Boolean can be used as the conditional expression bool-expression. Vector types are not accepted as the expression to if.

The .f suffix is also not used in GLSL as far as I know.

@iwubcode
Copy link
Contributor

What's the error? If we're having issues with the conversion, we should report to the spirv-cross upstream project. They may want the SPIRV output too though...

@TellowKrinkle
Copy link
Contributor

Just tested with the Metal backend, and it's glslang that's failing on the any, not spirv-cross

bad_ps_Metal_0.txt

I modified the shader a bit, which revealed the real reason why this is invalid:
bad_ps_Metal_0.txt

bvec2 oob = clamp(uv, 0.0, 1.0) != uv;
// ERROR: 0:201: '=' :  cannot convert from ' temp bool' to ' temp 2-component vector of bool'

Apparently comparison of a vec2 returns a bool, not a bvec2
There's an equal function for componentwise comparisons

Which means this fix is correct (though do remove the .f usage, IIRC glsl doesn't technically allow that, and decimals default to floats instead of doubles)

@iwubcode
Copy link
Contributor

Very nice sleuthing @TellowKrinkle !

`any()` failed to build on my machine, but it doesn't seem to be necessary
@AdmiralCurtiss AdmiralCurtiss merged commit 82d27fa into dolphin-emu:master Jun 1, 2023
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
5 participants