On Wed, 11 Aug 2021 at 05:14, Conor McCarthy cmccarthy@codeweavers.com wrote:
+static void vkd3d_dxbc_compiler_emit_double_conversion(struct vkd3d_dxbc_compiler *compiler,
const struct vkd3d_shader_instruction *instruction)
+{
- struct vkd3d_spirv_builder *builder = &compiler->spirv_builder;
- const struct vkd3d_shader_dst_param *dst = instruction->dst;
- const struct vkd3d_shader_src_param *src = instruction->src;
- uint32_t src_id, val_id, type_id;
- SpvOp op;
- switch (instruction->handler_idx)
- {
case VKD3DSIH_FTOD: op = SpvOpFConvert; break;
default:
ERR("Unexpected instruction %#x.\n", instruction->handler_idx);
return;
- }
- src_id = vkd3d_dxbc_compiler_emit_load_src(compiler, src, dst->write_mask);
- type_id = vkd3d_spirv_get_type_id(builder, vkd3d_component_type_from_data_type(dst->reg.data_type),
vkd3d_write_mask_component_count(dst->write_mask));
- val_id = vkd3d_spirv_build_op_trv(builder, &builder->function_stream, op, type_id, &src_id, 1);
- vkd3d_dxbc_compiler_emit_store_dst(compiler, dst, val_id);
+}
This seems suspiciously similar to what vkd3d_dxbc_compiler_emit_alu_instruction() does; any reason we can't use that?