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

OPCODE_DISCARD unnecessary conversion of test parameter #14

Open
TiemoJung opened this issue Feb 2, 2017 · 2 comments
Open

OPCODE_DISCARD unnecessary conversion of test parameter #14

TiemoJung opened this issue Feb 2, 2017 · 2 comments

Comments

@TiemoJung
Copy link

Hi,

the implementation of the OPCODE_DISCARD translation does forces the test parameter to be an int, but it should be a boolean as with all other compare operations.
As a result it turns

bool b;
if(b){discard;}

into

bool b;
if(int(b) * int(0xFFFFFFFFu)) != 0){discard;}
@arycama
Copy link

arycama commented Sep 25, 2019

Any chance of getting this fixed? It is still an issue in Unity 2019.2. This has a noticeable effect on framerates, and seems like a huge oversight, especially as alpha-testing is already more expensive than usual on mobiles.

(Framerate impact mentioned in this thread)
https://forum.unity.com/threads/editing-compiled-shaders.515350/

@WeakKnight
Copy link

WeakKnight commented Jul 15, 2024

For metal, we can get it fixed by this patch: WeakKnight@c36a247

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants