vkd3d-shader: Implement DTOI 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:13 +10:00 committed by Alexandre Julliard
parent 580747b224
commit c61b573d9c
6 changed files with 7 additions and 1 deletions

View File

@ -816,6 +816,7 @@ static const struct vkd3d_sm4_opcode_info opcode_table[] =
{VKD3D_SM5_OP_DDIV, VKD3DSIH_DDIV, "d", "dd"}, {VKD3D_SM5_OP_DDIV, VKD3DSIH_DDIV, "d", "dd"},
{VKD3D_SM5_OP_DFMA, VKD3DSIH_DFMA, "d", "ddd"}, {VKD3D_SM5_OP_DFMA, VKD3DSIH_DFMA, "d", "ddd"},
{VKD3D_SM5_OP_DRCP, VKD3DSIH_DRCP, "d", "d"}, {VKD3D_SM5_OP_DRCP, VKD3DSIH_DRCP, "d", "d"},
{VKD3D_SM5_OP_DTOI, VKD3DSIH_DTOI, "i", "d"},
}; };
static const enum vkd3d_shader_register_type register_type_table[] = static const enum vkd3d_shader_register_type register_type_table[] =

View File

@ -335,6 +335,7 @@ enum vkd3d_sm4_opcode
VKD3D_SM5_OP_DDIV = 0xd2, VKD3D_SM5_OP_DDIV = 0xd2,
VKD3D_SM5_OP_DFMA = 0xd3, VKD3D_SM5_OP_DFMA = 0xd3,
VKD3D_SM5_OP_DRCP = 0xd4, VKD3D_SM5_OP_DRCP = 0xd4,
VKD3D_SM5_OP_DTOI = 0xd6,
}; };
enum vkd3d_sm4_instruction_modifier enum vkd3d_sm4_instruction_modifier

View File

@ -6777,6 +6777,7 @@ static SpvOp vkd3d_dxbc_compiler_map_alu_instruction(const struct vkd3d_shader_i
{VKD3DSIH_DIV, SpvOpFDiv}, {VKD3DSIH_DIV, SpvOpFDiv},
{VKD3DSIH_DMUL, SpvOpFMul}, {VKD3DSIH_DMUL, SpvOpFMul},
{VKD3DSIH_DTOF, SpvOpFConvert}, {VKD3DSIH_DTOF, SpvOpFConvert},
{VKD3DSIH_DTOI, SpvOpConvertFToS},
{VKD3DSIH_FTOD, SpvOpFConvert}, {VKD3DSIH_FTOD, SpvOpFConvert},
{VKD3DSIH_FTOI, SpvOpConvertFToS}, {VKD3DSIH_FTOI, SpvOpConvertFToS},
{VKD3DSIH_FTOU, SpvOpConvertFToU}, {VKD3DSIH_FTOU, SpvOpConvertFToU},
@ -9531,6 +9532,7 @@ int vkd3d_dxbc_compiler_handle_instruction(struct vkd3d_dxbc_compiler *compiler,
case VKD3DSIH_DIV: case VKD3DSIH_DIV:
case VKD3DSIH_DMUL: case VKD3DSIH_DMUL:
case VKD3DSIH_DTOF: case VKD3DSIH_DTOF:
case VKD3DSIH_DTOI:
case VKD3DSIH_FTOD: case VKD3DSIH_FTOD:
case VKD3DSIH_FTOI: case VKD3DSIH_FTOI:
case VKD3DSIH_FTOU: case VKD3DSIH_FTOU:

View File

@ -129,6 +129,7 @@ static const char * const shader_opcode_names[] =
/* VKD3DSIH_DSY_COARSE */ "deriv_rty_coarse", /* VKD3DSIH_DSY_COARSE */ "deriv_rty_coarse",
/* VKD3DSIH_DSY_FINE */ "deriv_rty_fine", /* VKD3DSIH_DSY_FINE */ "deriv_rty_fine",
/* VKD3DSIH_DTOF */ "dtof", /* VKD3DSIH_DTOF */ "dtof",
/* VKD3DSIH_DTOI */ "dtoi",
/* VKD3DSIH_ELSE */ "else", /* VKD3DSIH_ELSE */ "else",
/* VKD3DSIH_EMIT */ "emit", /* VKD3DSIH_EMIT */ "emit",
/* VKD3DSIH_EMIT_STREAM */ "emit_stream", /* VKD3DSIH_EMIT_STREAM */ "emit_stream",

View File

@ -218,6 +218,7 @@ enum vkd3d_shader_opcode
VKD3DSIH_DSY_COARSE, VKD3DSIH_DSY_COARSE,
VKD3DSIH_DSY_FINE, VKD3DSIH_DSY_FINE,
VKD3DSIH_DTOF, VKD3DSIH_DTOF,
VKD3DSIH_DTOI,
VKD3DSIH_ELSE, VKD3DSIH_ELSE,
VKD3DSIH_EMIT, VKD3DSIH_EMIT,
VKD3DSIH_EMIT_STREAM, VKD3DSIH_EMIT_STREAM,

View File

@ -10028,7 +10028,7 @@ static void test_shader_instructions(void)
{&ps_dtou, {.d = {{ INFINITY}}}, {{~0u, 0 }}, true, true}, {&ps_dtou, {.d = {{ INFINITY}}}, {{~0u, 0 }}, true, true},
{&ps_dtou, {.d = {{ -1.0}}}, {{ 0, 1 }}, true, true}, {&ps_dtou, {.d = {{ -1.0}}}, {{ 0, 1 }}, true, true},
{&ps_dtou, {.d = {{ 1.0}}}, {{ 1, 0 }}, true, true}, {&ps_dtou, {.d = {{ 1.0}}}, {{ 1, 0 }}, true, true},
{&ps_dtoi, {.d = {{ 1.0}}}, {.i = {1, -1}}, true, true}, {&ps_dtoi, {.d = {{ 1.0}}}, {.i = {1, -1}}, true},
{&ps_dtof, {.d = {{ 1.5}}}, {.f = {1.5f, -1.5f}}, 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, true},
{&ps_itod, {.u = {{3, INT_MIN}}}, {.d = {3.0, -2147483648.0}}, true, true}, {&ps_itod, {.u = {{3, INT_MIN}}}, {.d = {3.0, -2147483648.0}}, true, true},