i965/vec4: Don't lose the force_writemask_all flag during CSE.
[mesa.git] / src / mesa / drivers / dri / i965 / brw_fs_channel_expressions.cpp
index 9fe0ffc107804a3cddb8935f0b9f9ea4a9b42852..933fdde24f923edf4e9376c224186fb1b9f945ce 100644 (file)
  * we do retain the vector types in that case.
  */
 
-extern "C" {
 #include "main/core.h"
 #include "brw_wm.h"
-}
 #include "glsl/ir.h"
 #include "glsl/ir_expression_flattening.h"
 #include "glsl/glsl_types.h"
@@ -75,6 +73,18 @@ channel_expressions_predicate(ir_instruction *ir)
    if (!expr)
       return false;
 
+   switch (expr->operation) {
+      /* these opcodes need to act on the whole vector,
+       * just like texturing.
+       */
+      case ir_unop_interpolate_at_centroid:
+      case ir_binop_interpolate_at_offset:
+      case ir_binop_interpolate_at_sample:
+         return false;
+      default:
+         break;
+   }
+
    for (i = 0; i < expr->get_num_operands(); i++) {
       if (expr->operands[i]->type->is_vector())
         return true;
@@ -153,6 +163,16 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
    if (!found_vector)
       return visit_continue;
 
+   switch (expr->operation) {
+      case ir_unop_interpolate_at_centroid:
+      case ir_binop_interpolate_at_offset:
+      case ir_binop_interpolate_at_sample:
+         return visit_continue;
+
+      default:
+         break;
+   }
+
    /* Store the expression operands in temps so we can use them
     * multiple times.
     */
@@ -215,11 +235,16 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
    case ir_unop_sin_reduced:
    case ir_unop_cos_reduced:
    case ir_unop_dFdx:
+   case ir_unop_dFdx_coarse:
+   case ir_unop_dFdx_fine:
    case ir_unop_dFdy:
+   case ir_unop_dFdy_coarse:
+   case ir_unop_dFdy_fine:
    case ir_unop_bitfield_reverse:
    case ir_unop_bit_count:
    case ir_unop_find_msb:
    case ir_unop_find_lsb:
+   case ir_unop_saturate:
       for (i = 0; i < vector_elements; i++) {
         ir_rvalue *op0 = get_element(op_var[0], i);
 
@@ -414,7 +439,23 @@ ir_channel_expressions_visitor::visit_leave(ir_assignment *ir)
    case ir_unop_unpack_half_2x16_split_x:
    case ir_unop_unpack_half_2x16_split_y:
    case ir_binop_pack_half_2x16_split:
+   case ir_unop_interpolate_at_centroid:
+   case ir_binop_interpolate_at_offset:
+   case ir_binop_interpolate_at_sample:
       unreachable("not reached: expression operates on scalars only");
+
+   case ir_unop_pack_double_2x32:
+   case ir_unop_unpack_double_2x32:
+   case ir_unop_frexp_sig:
+   case ir_unop_frexp_exp:
+   case ir_unop_d2f:
+   case ir_unop_f2d:
+   case ir_unop_d2i:
+   case ir_unop_i2d:
+   case ir_unop_d2u:
+   case ir_unop_u2d:
+   case ir_unop_d2b:
+      unreachable("no fp64 support yet");
    }
 
    ir->remove();