mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
libs/vkd3d-shader: Translate imul instructions.
This commit is contained in:
parent
b75022df72
commit
87f34094db
@ -2738,6 +2738,33 @@ static void vkd3d_dxbc_compiler_emit_dot(struct vkd3d_dxbc_compiler *compiler,
|
||||
vkd3d_dxbc_compiler_emit_store_dst(compiler, dst, val_id);
|
||||
}
|
||||
|
||||
static void vkd3d_dxbc_compiler_emit_imul(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 type_id, val_id, src0_id, src1_id;
|
||||
unsigned int component_count;
|
||||
|
||||
if (dst[0].reg.type != VKD3DSPR_NULL)
|
||||
FIXME("Extended multiplies not implemented.\n"); /* SpvOpSMulExtended */
|
||||
|
||||
if (dst[1].reg.type == VKD3DSPR_NULL)
|
||||
return;
|
||||
|
||||
component_count = vkd3d_write_mask_component_count(dst[1].write_mask);
|
||||
type_id = vkd3d_spirv_get_type_id(builder,
|
||||
vkd3d_component_type_from_data_type(dst[1].reg.data_type), component_count);
|
||||
|
||||
src0_id = vkd3d_dxbc_compiler_emit_load_src(compiler, &src[0], dst[1].write_mask);
|
||||
src1_id = vkd3d_dxbc_compiler_emit_load_src(compiler, &src[1], dst[1].write_mask);
|
||||
|
||||
val_id = vkd3d_spirv_build_op_imul(builder, type_id, src0_id, src1_id);
|
||||
|
||||
vkd3d_dxbc_compiler_emit_store_dst(compiler, &dst[1], val_id);
|
||||
}
|
||||
|
||||
static void vkd3d_dxbc_compiler_emit_imad(struct vkd3d_dxbc_compiler *compiler,
|
||||
const struct vkd3d_shader_instruction *instruction)
|
||||
{
|
||||
@ -3173,6 +3200,9 @@ void vkd3d_dxbc_compiler_handle_instruction(struct vkd3d_dxbc_compiler *compiler
|
||||
case VKD3DSIH_DP2:
|
||||
vkd3d_dxbc_compiler_emit_dot(compiler, instruction);
|
||||
break;
|
||||
case VKD3DSIH_IMUL:
|
||||
vkd3d_dxbc_compiler_emit_imul(compiler, instruction);
|
||||
break;
|
||||
case VKD3DSIH_IMAD:
|
||||
vkd3d_dxbc_compiler_emit_imad(compiler, instruction);
|
||||
break;
|
||||
|
Loading…
x
Reference in New Issue
Block a user