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

VideoCommon: Fix D3D shader compilation warnings #10819

Merged

Conversation

Dentomologist
Copy link
Contributor

Fix Direct3D shader warnings X3571 (negative pow() base), X4000 (potentially uninitialized variables), and X3557 (forced unrolling of single-iteration loop).

These warnings appear in both Direct3D 11 and 12. They all appear in Twilight Princess with Hybrid Ubershaders, though other games and settings probably trigger them as well.

Fixes most of 10578; I've been unable to trigger warning X3578 (Output value 'ocol1' is not completely initialized, see also 9994) and so suspect it's been fixed in the meantime, but I haven't bisected it.

Add abs() to fix "pow(f, e) will not work for negative f, use abs(f) or
conditionally handle negative values if you expect them".
Initialize alpha_A and alpha_B. They were previously only initialized in
cases where they were used, but D3D isn't able to figure that out.
Fix warning "loop only executes for 1 iteration(s), forcing loop to
unroll" when vertex_in == 1
Copy link
Contributor

@iwubcode iwubcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Untested, code LGTM.

@JMC47 JMC47 merged commit fac6689 into dolphin-emu:master Jul 8, 2022
11 checks passed
@Dentomologist Dentomologist deleted the fix_shader_compilation_warnings branch July 8, 2022 22:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants