| 125 | } |
| 126 | |
| 127 | spv_result_t ValidateConvertIntToF(ValidationState_t& _, |
| 128 | const Instruction* inst, |
| 129 | uint32_t operand_index = 2) { |
| 130 | const spv::Op opcode = inst->opcode(); |
| 131 | const uint32_t result_type = inst->type_id(); |
| 132 | if (!_.IsFloatScalarType(result_type) && !_.IsFloatVectorType(result_type) && |
| 133 | !_.IsFloatCooperativeMatrixType(result_type) && |
| 134 | !_.IsFloatCooperativeVectorNVType(result_type)) |
| 135 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 136 | << "Expected float scalar or vector type as Result Type: " |
| 137 | << spvOpcodeString(opcode); |
| 138 | |
| 139 | const uint32_t input_type = _.GetOperandTypeId(inst, operand_index); |
| 140 | if (!input_type || |
| 141 | (!_.IsIntScalarType(input_type) && !_.IsIntVectorType(input_type) && |
| 142 | !_.IsIntCooperativeMatrixType(input_type) && |
| 143 | !_.IsIntCooperativeVectorNVType(input_type))) |
| 144 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 145 | << "Expected input to be int scalar or vector: " |
| 146 | << spvOpcodeString(opcode); |
| 147 | |
| 148 | if (_.IsCooperativeVectorNVType(result_type) || |
| 149 | _.IsCooperativeVectorNVType(input_type)) { |
| 150 | spv_result_t ret = |
| 151 | _.CooperativeVectorDimensionsMatch(inst, result_type, input_type); |
| 152 | if (ret != SPV_SUCCESS) return ret; |
| 153 | } else if (_.IsCooperativeMatrixType(result_type) || |
| 154 | _.IsCooperativeMatrixType(input_type)) { |
| 155 | spv_result_t ret = |
| 156 | _.CooperativeMatrixShapesMatch(inst, result_type, input_type, true); |
| 157 | if (ret != SPV_SUCCESS) return ret; |
| 158 | } else { |
| 159 | if (_.GetDimension(result_type) != _.GetDimension(input_type)) |
| 160 | return _.diag(SPV_ERROR_INVALID_DATA, inst) |
| 161 | << "Expected input to have the same dimension as Result Type: " |
| 162 | << spvOpcodeString(opcode); |
| 163 | } |
| 164 | |
| 165 | if (auto error = ValidateShaderBitWidth(_, inst)) return error; |
| 166 | |
| 167 | return SPV_SUCCESS; |
| 168 | } |
| 169 | |
| 170 | spv_result_t ValidateUConvert(ValidationState_t& _, const Instruction* inst, |
| 171 | uint32_t operand_index = 2) { |
no test coverage detected