egl/wayland: add missing newline between functions
[mesa.git] / src / compiler / spirv / vtn_subgroup.c
index 8339b1a4862c131d9855a39b57e8253e3a709aa5..e8c3db79b9dad581dfd1473e4caed4073248f45d 100644 (file)
@@ -88,7 +88,7 @@ vtn_handle_subgroup(struct vtn_builder *b, SpvOp opcode,
       break;
    }
 
-   case SpvOpGroupNonUniformBallot: ++w;
+   case SpvOpGroupNonUniformBallot: ++w; /* fallthrough */
    case SpvOpSubgroupBallotKHR: {
       vtn_fail_if(val->type->type != glsl_vector_type(GLSL_TYPE_UINT, 4),
                   "OpGroupNonUniformBallot must return a uvec4");
@@ -177,14 +177,14 @@ vtn_handle_subgroup(struct vtn_builder *b, SpvOp opcode,
       break;
    }
 
-   case SpvOpGroupNonUniformBroadcastFirst: ++w;
+   case SpvOpGroupNonUniformBroadcastFirst: ++w; /* fallthrough */
    case SpvOpSubgroupFirstInvocationKHR:
       vtn_build_subgroup_instr(b, nir_intrinsic_read_first_invocation,
                                val->ssa, vtn_ssa_value(b, w[3]), NULL, 0, 0);
       break;
 
    case SpvOpGroupNonUniformBroadcast:
-   case SpvOpGroupBroadcast: ++w;
+   case SpvOpGroupBroadcast: ++w; /* fallthrough */
    case SpvOpSubgroupReadInvocationKHR:
       vtn_build_subgroup_instr(b, nir_intrinsic_read_invocation,
                                val->ssa, vtn_ssa_value(b, w[3]),
@@ -213,15 +213,22 @@ vtn_handle_subgroup(struct vtn_builder *b, SpvOp opcode,
       case SpvOpSubgroupAnyKHR:
          op = nir_intrinsic_vote_any;
          break;
+      case SpvOpSubgroupAllEqualKHR:
+         op = nir_intrinsic_vote_ieq;
+         break;
       case SpvOpGroupNonUniformAllEqual:
-      case SpvOpSubgroupAllEqualKHR: {
-         switch (glsl_get_base_type(val->type->type)) {
+         switch (glsl_get_base_type(vtn_ssa_value(b, w[4])->type)) {
          case GLSL_TYPE_FLOAT:
+         case GLSL_TYPE_FLOAT16:
          case GLSL_TYPE_DOUBLE:
             op = nir_intrinsic_vote_feq;
             break;
          case GLSL_TYPE_UINT:
          case GLSL_TYPE_INT:
+         case GLSL_TYPE_UINT8:
+         case GLSL_TYPE_INT8:
+         case GLSL_TYPE_UINT16:
+         case GLSL_TYPE_INT16:
          case GLSL_TYPE_UINT64:
          case GLSL_TYPE_INT64:
          case GLSL_TYPE_BOOL:
@@ -231,7 +238,6 @@ vtn_handle_subgroup(struct vtn_builder *b, SpvOp opcode,
             unreachable("Unhandled type");
          }
          break;
-      }
       default:
          unreachable("Unhandled opcode");
       }
@@ -246,7 +252,8 @@ vtn_handle_subgroup(struct vtn_builder *b, SpvOp opcode,
       }
       nir_intrinsic_instr *intrin =
          nir_intrinsic_instr_create(b->nb.shader, op);
-      intrin->num_components = src0->num_components;
+      if (nir_intrinsic_infos[op].src_components[0] == 0)
+         intrin->num_components = src0->num_components;
       intrin->src[0] = nir_src_for_ssa(src0);
       nir_ssa_dest_init_for_type(&intrin->instr, &intrin->dest,
                                  val->type->type, NULL);