<feed xmlns='http://www.w3.org/2005/Atom'>
<title>slang.git/tests/cross-compile/glsl-bool-ops.slang.expected.txt, branch master</title>
<subtitle>Making it easier to work with shaders</subtitle>
<id>https://git.yummers.dev/slang.git/atom?h=master</id>
<link rel='self' href='https://git.yummers.dev/slang.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/'/>
<updated>2020-05-01T15:53:11+00:00</updated>
<entry>
<title>Improve GLSL coverage of boolean binary ops (#1335)</title>
<updated>2020-05-01T15:53:11+00:00</updated>
<author>
<name>Tim Foley</name>
<email>tfoleyNV@users.noreply.github.com</email>
</author>
<published>2020-05-01T15:53:11+00:00</published>
<link rel='alternate' type='text/html' href='https://git.yummers.dev/slang.git/commit/?id=c697fe50db0a74d76c6922ee24eb1f8d87def5f8'/>
<id>urn:sha1:c697fe50db0a74d76c6922ee24eb1f8d87def5f8</id>
<content type='text'>
* Improve GLSL coverage of boolean binary ops

This change ensures that the `&amp;&amp;`, `||`, `&amp;`, `|`, and `^` apply correctly to vectors of `bool` values when targetting GLSL.

Most of the changes are in the GLSL emit path, where the IR instructions for these operators are bottlenecked through a small set of helper routines to cover the different cases. In general:

* The vector variants of the operations are implemented by casting to `uint` vectors, performing bitwise ops, then casting back
* The scalar variants are handled by conveting the bitwise operations to their equivalent logical operator (the one interesting case there is bitwise `^` where the equivalent logical operation on `bool` is `!=`)

This change makes it clear that our IR really shouldn't have distinct opcodes for logical vs. bitwise and/or/xor, and instead should just have a single family of operations where the behavior differs based on the type of the operand. That is already *de facto* the way things work (a user can always write `&amp;`, `|` and `^` and expect them to work on `bool` and vectors of `bool`), so that the GLSL output path has to deal with the overlap. Having two sets of IR ops here actually makes for more code instead of less.

* Fixups: review feedback and test ! operator</content>
</entry>
</feed>
