vkd3d-shader: Implement UTOD instruction.

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-12 12:55:16 +10:00 committed by Alexandre Julliard
parent 3623a99cf6
commit f3c19dfedb
6 changed files with 7 additions and 1 deletions

View File

@ -819,6 +819,7 @@ static const struct vkd3d_sm4_opcode_info opcode_table[] =
{VKD3D_SM5_OP_DTOI, VKD3DSIH_DTOI, "i", "d"},
{VKD3D_SM5_OP_DTOU, VKD3DSIH_DTOU, "u", "d"},
{VKD3D_SM5_OP_ITOD, VKD3DSIH_ITOD, "d", "i"},
{VKD3D_SM5_OP_UTOD, VKD3DSIH_UTOD, "d", "u"},
};
static const enum vkd3d_shader_register_type register_type_table[] =

View File

@ -338,6 +338,7 @@ enum vkd3d_sm4_opcode
VKD3D_SM5_OP_DTOI = 0xd6,
VKD3D_SM5_OP_DTOU = 0xd7,
VKD3D_SM5_OP_ITOD = 0xd8,
VKD3D_SM5_OP_UTOD = 0xd9,
};
enum vkd3d_sm4_instruction_modifier

View File

@ -6792,6 +6792,7 @@ static SpvOp vkd3d_dxbc_compiler_map_alu_instruction(const struct vkd3d_shader_i
{VKD3DSIH_NOT, SpvOpNot},
{VKD3DSIH_OR, SpvOpBitwiseOr},
{VKD3DSIH_USHR, SpvOpShiftRightLogical},
{VKD3DSIH_UTOD, SpvOpConvertUToF},
{VKD3DSIH_UTOF, SpvOpConvertUToF},
{VKD3DSIH_XOR, SpvOpBitwiseXor},
};
@ -9549,6 +9550,7 @@ int vkd3d_dxbc_compiler_handle_instruction(struct vkd3d_dxbc_compiler *compiler,
case VKD3DSIH_NOT:
case VKD3DSIH_OR:
case VKD3DSIH_USHR:
case VKD3DSIH_UTOD:
case VKD3DSIH_UTOF:
case VKD3DSIH_XOR:
vkd3d_dxbc_compiler_emit_alu_instruction(compiler, instruction);

View File

@ -284,6 +284,7 @@ static const char * const shader_opcode_names[] =
/* VKD3DSIH_UMIN */ "umin",
/* VKD3DSIH_UMUL */ "umul",
/* VKD3DSIH_USHR */ "ushr",
/* VKD3DSIH_UTOD */ "utod",
/* VKD3DSIH_UTOF */ "utof",
/* VKD3DSIH_XOR */ "xor",
};

View File

@ -373,6 +373,7 @@ enum vkd3d_shader_opcode
VKD3DSIH_UMIN,
VKD3DSIH_UMUL,
VKD3DSIH_USHR,
VKD3DSIH_UTOD,
VKD3DSIH_UTOF,
VKD3DSIH_XOR,

View File

@ -10030,7 +10030,7 @@ static void test_shader_instructions(void)
{&ps_dtou, {.d = {{ 1.0}}}, {{ 1, 0 }}, true},
{&ps_dtoi, {.d = {{ 1.0}}}, {.i = {1, -1}}, true},
{&ps_dtof, {.d = {{ 1.5}}}, {.f = {1.5f, -1.5f}}, true},
{&ps_utod, {.u = {{3, 0xffffffff}}}, {.d = {3.0, 4294967295.0}}, true, true},
{&ps_utod, {.u = {{3, 0xffffffff}}}, {.d = {3.0, 4294967295.0}}, true},
{&ps_itod, {.u = {{3, INT_MIN}}}, {.d = {3.0, -2147483648.0}}, true},
{&ps_ftod, {.f = {{-2.5f, -2.5f}}}, {.d = {-2.5, 2.5}}, true},
{&ps_dmul, {.d = {{ 1.5, 3.0}}}, {.d = { 4.5, -4.5}}, true},