Closed Bug 1631156 Opened 4 years ago Closed 4 years ago

glsl-to-cxx doesn't properly convert non-bool types to bools and vice-versa

Categories

(Core :: Graphics: WebRender, defect)

defect

Tracking

()

RESOLVED FIXED
mozilla77
Tracking Status
firefox77 --- fixed

People

(Reporter: lsalzman, Assigned: lsalzman)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Clang's OpenCL vectors (and also GCC) represent boolean true as an all-1 pattern, which when converted to int or float becomes -1. Likewise, converting an int or float to our "Bool" type gets converted to the value 1, since the type is functionally equivalent to I32...

To fix this, we need to convert to bool via a !=0 comparison, and when converting from bool to something else, we need to mask it with &1 to get the expected value GLSL would produce...

How did you find this problem? Is there a test failure that corresponds?

The text/subpixel- wrench reftests fail because they use a "mask *= float(all(...))" statement that is casting a bool to a float for clipping purposes. It was converting the bool to a -1 value, causing all sorts of havoc, but mainly the text showing up as invalid colored junk. The patch should fix it all nicely now.

Pushed by lsalzman@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/5d233bc9aa65
make glsl-to-cxx generate proper bit patterns for bools. r=jrmuizel
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla77
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: