vkd3d-shader: Implement DMOVC instruction.

Based in part on a vkd3d-proton patch by Joshua Ashton.

Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Conor McCarthy 2021-08-11 11:53:02 +10:00 committed by Alexandre Julliard
parent c3363faba2
commit 00752b8fa6
6 changed files with 8 additions and 3 deletions

View File

@ -806,6 +806,7 @@ static const struct vkd3d_sm4_opcode_info opcode_table[] =
{VKD3D_SM5_OP_DLT, VKD3DSIH_DLT, "u", "dd"},
{VKD3D_SM5_OP_DNE, VKD3DSIH_DNE, "u", "dd"},
{VKD3D_SM5_OP_DMOV, VKD3DSIH_DMOV, "d", "d"},
{VKD3D_SM5_OP_DMOVC, VKD3DSIH_DMOVC, "d", "udd"},
{VKD3D_SM5_OP_EVAL_SAMPLE_INDEX, VKD3DSIH_EVAL_SAMPLE_INDEX, "f", "fi"},
{VKD3D_SM5_OP_EVAL_CENTROID, VKD3DSIH_EVAL_CENTROID, "f", "f"},
{VKD3D_SM5_OP_DCL_GS_INSTANCES, VKD3DSIH_DCL_GS_INSTANCES, "", "",

View File

@ -326,6 +326,7 @@ enum vkd3d_sm4_opcode
VKD3D_SM5_OP_DLT = 0xc5,
VKD3D_SM5_OP_DNE = 0xc6,
VKD3D_SM5_OP_DMOV = 0xc7,
VKD3D_SM5_OP_DMOVC = 0xc8,
VKD3D_SM5_OP_EVAL_SAMPLE_INDEX = 0xcc,
VKD3D_SM5_OP_EVAL_CENTROID = 0xcd,
VKD3D_SM5_OP_DCL_GS_INSTANCES = 0xce,

View File

@ -6996,7 +6996,7 @@ static void vkd3d_dxbc_compiler_emit_movc(struct vkd3d_dxbc_compiler *compiler,
src2_id = vkd3d_dxbc_compiler_emit_load_src(compiler, &src[2], dst->write_mask);
component_count = vkd3d_write_mask_component_count(dst->write_mask);
type_id = vkd3d_spirv_get_type_id(builder, VKD3D_SHADER_COMPONENT_FLOAT, component_count);
type_id = vkd3d_dxbc_compiler_get_type_id_for_dst(compiler, dst);
condition_id = vkd3d_dxbc_compiler_emit_int_to_bool(compiler,
VKD3D_SHADER_CONDITIONAL_OP_NZ, component_count, condition_id);
@ -9513,6 +9513,7 @@ int vkd3d_dxbc_compiler_handle_instruction(struct vkd3d_dxbc_compiler *compiler,
case VKD3DSIH_MOV:
vkd3d_dxbc_compiler_emit_mov(compiler, instruction);
break;
case VKD3DSIH_DMOVC:
case VKD3DSIH_MOVC:
vkd3d_dxbc_compiler_emit_movc(compiler, instruction);
break;

View File

@ -113,6 +113,7 @@ static const char * const shader_opcode_names[] =
/* VKD3DSIH_DMAX */ "dmax",
/* VKD3DSIH_DMIN */ "dmin",
/* VKD3DSIH_DMOV */ "dmov",
/* VKD3DSIH_DMOVC */ "dmovc",
/* VKD3DSIH_DMUL */ "dmul",
/* VKD3DSIH_DNE */ "dne",
/* VKD3DSIH_DP2 */ "dp2",

View File

@ -202,6 +202,7 @@ enum vkd3d_shader_opcode
VKD3DSIH_DMAX,
VKD3DSIH_DMIN,
VKD3DSIH_DMOV,
VKD3DSIH_DMOVC,
VKD3DSIH_DMUL,
VKD3DSIH_DNE,
VKD3DSIH_DP2,

View File

@ -9984,8 +9984,8 @@ static void test_shader_instructions(void)
{&ps_dmin_dmax, {.d = {{-1.0, 1.0}}}, {.d = {-1.0, 1.0}}, true},
{&ps_dfma, {.d = {{1.0000002433080226, 2.000000481493771}}},
{.d = {1.0000002433080226 * 2.000000481493771 + 1.0000002433080226}}, true},
{&ps_dmovc, {.d = {{0.5, 0.0}}}, {.d = {4.5, 4.5}}, true, true},
{&ps_dmovc, {.d = {{1.5, 0.0}}}, {.d = {1.5, 0.0}}, true, true},
{&ps_dmovc, {.d = {{0.5, 0.0}}}, {.d = {4.5, 4.5}}, true},
{&ps_dmovc, {.d = {{1.5, 0.0}}}, {.d = {1.5, 0.0}}, true},
{&ps_dmodifier, {.d = {{1.5, 0.0}}}, {.d = {1.5f, 2.5f}}, true},
{&ps_dmodifier, {.d = {{-1.5, 0.0}}}, {.d = {1.5f, 1.5f}}, true},
{&ps_deq, {.d = {{0.0, 0.0}}}, {{0xffffffff}}, true},