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

Possible incorrect translation of OPCODE_AND #12

Open
TiemoJung opened this issue Jan 31, 2017 · 3 comments
Open

Possible incorrect translation of OPCODE_AND #12

TiemoJung opened this issue Jan 31, 2017 · 3 comments

Comments

@TiemoJung
Copy link

TiemoJung commented Jan 31, 2017

Hi,

it looks like that for GLSL the operation OPCODE_AND may be wrong under certain circumstances.
In the case when it is turned into a mix call. The third parameter, the selector is a boolean but gets cast to an float, this seems to be wrong as the cast seems to trigger undefined behavior when feed to glslang to turn it into spir-v. it should either used directly if the target supports it (glsl 4.5?) or turned into an appropriate vector manually (or don't use mix at all).

@strandborg
Copy link
Contributor

Hi, can you provide a repro hlsl shader that triggers this please?

@TiemoJung
Copy link
Author

Hi,

it looks like that this is probably a driver problem, the resulting spir-v is valid but as it seems the driver has troupe handling a sequence of select (convert bool to float) and mix correctly.

@TiemoJung
Copy link
Author

Either way, it would be an optimization to use the bool directly instead of casting it to float (it results in removal of the mix call if turned into spir-v as example). Not sure since which version the boolean selector is allowed, at least 4.4 allows it.

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

2 participants