| 83 | } |
| 84 | |
| 85 | spv_result_t ValidateConvertFToS(ValidationState_t& _, const Instruction* inst, |
| 86 | uint32_t operand_index = 2) { |
| 87 | const spv::Op opcode = inst->opcode(); |
| 88 | const uint32_t result_type = inst->type_id(); |
| 89 | if (!_.IsIntScalarType(result_type) && !_.IsIntVectorType(result_type) && |
| 90 | !_.IsIntCooperativeMatrixType(result_type) && |
| 91 | !_.IsIntCooperativeVectorNVType(result_type)) |
| 92 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 93 | << "Expected int scalar or vector type as Result Type: " |
| 94 | << spvOpcodeString(opcode); |
| 95 | |
| 96 | const uint32_t input_type = _.GetOperandTypeId(inst, operand_index); |
| 97 | if (!input_type || |
| 98 | (!_.IsFloatScalarType(input_type) && !_.IsFloatVectorType(input_type) && |
| 99 | !_.IsFloatCooperativeMatrixType(input_type) && |
| 100 | !_.IsFloatCooperativeVectorNVType(input_type))) |
| 101 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 102 | << "Expected input to be float scalar or vector: " |
| 103 | << spvOpcodeString(opcode); |
| 104 | |
| 105 | if (_.IsCooperativeVectorNVType(result_type) || |
| 106 | _.IsCooperativeVectorNVType(input_type)) { |
| 107 | spv_result_t ret = |
| 108 | _.CooperativeVectorDimensionsMatch(inst, result_type, input_type); |
| 109 | if (ret != SPV_SUCCESS) return ret; |
| 110 | } else if (_.IsCooperativeMatrixType(result_type) || |
| 111 | _.IsCooperativeMatrixType(input_type)) { |
| 112 | spv_result_t ret = |
| 113 | _.CooperativeMatrixShapesMatch(inst, result_type, input_type, true); |
| 114 | if (ret != SPV_SUCCESS) return ret; |
| 115 | } else { |
| 116 | if (_.GetDimension(result_type) != _.GetDimension(input_type)) |
| 117 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 118 | << "Expected input to have the same dimension as Result Type: " |
| 119 | << spvOpcodeString(opcode); |
| 120 | } |
| 121 | |
| 122 | if (auto error = ValidateShaderBitWidth(_, inst)) return error; |
| 123 | |
| 124 | return SPV_SUCCESS; |
| 125 | } |
| 126 | |
| 127 | spv_result_t ValidateConvertIntToF(ValidationState_t& _, |
| 128 | const Instruction* inst, |
no test coverage detected