ir_constant_expression: Implement equal/notEqual for booleans.
authorKenneth Graunke <kenneth@whitecape.org>
Wed, 18 Aug 2010 19:06:25 +0000 (12:06 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Wed, 18 Aug 2010 19:08:19 +0000 (12:08 -0700)
Calls to equal(bvec, bvec) or notEqual(bvec, bvec) previously caused an
assertion.  Fixes piglit tests glsl-const-builtin-equal-bool and
glsl-const-builtin-notEqual-bool.

src/glsl/ir_constant_expression.cpp

index 0a924246da1d3d224e28978a48b11be9f32fdf91..54f14d1a5417cfd67c02cedc2f87dde5dc409880 100644 (file)
@@ -904,6 +904,9 @@ ir_call::constant_expression_value()
         case GLSL_TYPE_FLOAT:
            data.b[c] = op[0]->value.f[c] == op[1]->value.f[c];
            break;
+        case GLSL_TYPE_BOOL:
+           data.b[c] = op[0]->value.b[c] == op[1]->value.b[c];
+           break;
         default:
            assert(!"Should not get here.");
         }
@@ -1047,6 +1050,9 @@ ir_call::constant_expression_value()
         case GLSL_TYPE_FLOAT:
            data.b[c] = op[0]->value.f[c] != op[1]->value.f[c];
            break;
+        case GLSL_TYPE_BOOL:
+           data.b[c] = op[0]->value.b[c] != op[1]->value.b[c];
+           break;
         default:
            assert(!"Should not get here.");
         }