Signed-off-by: Conor McCarthy cmccarthy@codeweavers.com --- libs/vkd3d-shader/dxbc.c | 1 + libs/vkd3d-shader/sm4.h | 1 + libs/vkd3d-shader/spirv.c | 2 ++ libs/vkd3d-shader/trace.c | 1 + libs/vkd3d-shader/vkd3d_shader_private.h | 1 + 5 files changed, 6 insertions(+)
diff --git a/libs/vkd3d-shader/dxbc.c b/libs/vkd3d-shader/dxbc.c index 9da89a4a..584ece93 100644 --- a/libs/vkd3d-shader/dxbc.c +++ b/libs/vkd3d-shader/dxbc.c @@ -798,6 +798,7 @@ static const struct vkd3d_sm4_opcode_info opcode_table[] = {VKD3D_SM5_OP_SYNC, VKD3DSIH_SYNC, "", "", shader_sm5_read_sync}, {VKD3D_SM5_OP_DADD, VKD3DSIH_DADD, "d", "dd"}, + {VKD3D_SM5_OP_DMAX, VKD3DSIH_DMAX, "d", "dd"}, {VKD3D_SM5_OP_DEQ, VKD3DSIH_DEQ, "u", "dd"}, {VKD3D_SM5_OP_DGE, VKD3DSIH_DGE, "u", "dd"}, {VKD3D_SM5_OP_DLT, VKD3DSIH_DLT, "u", "dd"}, diff --git a/libs/vkd3d-shader/sm4.h b/libs/vkd3d-shader/sm4.h index c94a73d4..e4d21467 100644 --- a/libs/vkd3d-shader/sm4.h +++ b/libs/vkd3d-shader/sm4.h @@ -318,6 +318,7 @@ enum vkd3d_sm4_opcode VKD3D_SM5_OP_IMM_ATOMIC_UMIN = 0xbd, VKD3D_SM5_OP_SYNC = 0xbe, VKD3D_SM5_OP_DADD = 0xbf, + VKD3D_SM5_OP_DMAX = 0xc0, VKD3D_SM5_OP_DEQ = 0xc3, VKD3D_SM5_OP_DGE = 0xc4, VKD3D_SM5_OP_DLT = 0xc5, diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 3a1f1969..a94a38a6 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -6843,6 +6843,7 @@ static enum GLSLstd450 vkd3d_dxbc_compiler_map_ext_glsl_instruction( } glsl_insts[] = { + {VKD3DSIH_DMAX, GLSLstd450NMax}, {VKD3DSIH_EXP, GLSLstd450Exp2}, {VKD3DSIH_FIRSTBIT_HI, GLSLstd450FindUMsb}, {VKD3DSIH_FIRSTBIT_LO, GLSLstd450FindILsb}, @@ -9532,6 +9533,7 @@ int vkd3d_dxbc_compiler_handle_instruction(struct vkd3d_dxbc_compiler *compiler, case VKD3DSIH_XOR: vkd3d_dxbc_compiler_emit_alu_instruction(compiler, instruction); break; + case VKD3DSIH_DMAX: case VKD3DSIH_EXP: case VKD3DSIH_FIRSTBIT_HI: case VKD3DSIH_FIRSTBIT_LO: diff --git a/libs/vkd3d-shader/trace.c b/libs/vkd3d-shader/trace.c index d9306d6b..0da29a8f 100644 --- a/libs/vkd3d-shader/trace.c +++ b/libs/vkd3d-shader/trace.c @@ -108,6 +108,7 @@ static const char * const shader_opcode_names[] = /* VKD3DSIH_DGE */ "dge", /* VKD3DSIH_DIV */ "div", /* VKD3DSIH_DLT */ "dlt", + /* VKD3DSIH_DMAX */ "dmax", /* VKD3DSIH_DMOV */ "dmov", /* VKD3DSIH_DNE */ "dne", /* VKD3DSIH_DP2 */ "dp2", diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index 85859e84..f7762ef2 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -197,6 +197,7 @@ enum vkd3d_shader_opcode VKD3DSIH_DGE, VKD3DSIH_DIV, VKD3DSIH_DLT, + VKD3DSIH_DMAX, VKD3DSIH_DMOV, VKD3DSIH_DNE, VKD3DSIH_DP2,
Signed-off-by: Conor McCarthy cmccarthy@codeweavers.com --- libs/vkd3d-shader/dxbc.c | 1 + libs/vkd3d-shader/sm4.h | 1 + libs/vkd3d-shader/spirv.c | 2 ++ libs/vkd3d-shader/trace.c | 1 + libs/vkd3d-shader/vkd3d_shader_private.h | 1 + tests/d3d12.c | 2 +- 6 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/dxbc.c b/libs/vkd3d-shader/dxbc.c index 584ece93..f9be52d3 100644 --- a/libs/vkd3d-shader/dxbc.c +++ b/libs/vkd3d-shader/dxbc.c @@ -799,6 +799,7 @@ static const struct vkd3d_sm4_opcode_info opcode_table[] = shader_sm5_read_sync}, {VKD3D_SM5_OP_DADD, VKD3DSIH_DADD, "d", "dd"}, {VKD3D_SM5_OP_DMAX, VKD3DSIH_DMAX, "d", "dd"}, + {VKD3D_SM5_OP_DMIN, VKD3DSIH_DMIN, "d", "dd"}, {VKD3D_SM5_OP_DEQ, VKD3DSIH_DEQ, "u", "dd"}, {VKD3D_SM5_OP_DGE, VKD3DSIH_DGE, "u", "dd"}, {VKD3D_SM5_OP_DLT, VKD3DSIH_DLT, "u", "dd"}, diff --git a/libs/vkd3d-shader/sm4.h b/libs/vkd3d-shader/sm4.h index e4d21467..c9a389ec 100644 --- a/libs/vkd3d-shader/sm4.h +++ b/libs/vkd3d-shader/sm4.h @@ -319,6 +319,7 @@ enum vkd3d_sm4_opcode VKD3D_SM5_OP_SYNC = 0xbe, VKD3D_SM5_OP_DADD = 0xbf, VKD3D_SM5_OP_DMAX = 0xc0, + VKD3D_SM5_OP_DMIN = 0xc1, VKD3D_SM5_OP_DEQ = 0xc3, VKD3D_SM5_OP_DGE = 0xc4, VKD3D_SM5_OP_DLT = 0xc5, diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index a94a38a6..1b0051e5 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -6844,6 +6844,7 @@ static enum GLSLstd450 vkd3d_dxbc_compiler_map_ext_glsl_instruction( glsl_insts[] = { {VKD3DSIH_DMAX, GLSLstd450NMax}, + {VKD3DSIH_DMIN, GLSLstd450NMin}, {VKD3DSIH_EXP, GLSLstd450Exp2}, {VKD3DSIH_FIRSTBIT_HI, GLSLstd450FindUMsb}, {VKD3DSIH_FIRSTBIT_LO, GLSLstd450FindILsb}, @@ -9534,6 +9535,7 @@ int vkd3d_dxbc_compiler_handle_instruction(struct vkd3d_dxbc_compiler *compiler, vkd3d_dxbc_compiler_emit_alu_instruction(compiler, instruction); break; case VKD3DSIH_DMAX: + case VKD3DSIH_DMIN: case VKD3DSIH_EXP: case VKD3DSIH_FIRSTBIT_HI: case VKD3DSIH_FIRSTBIT_LO: diff --git a/libs/vkd3d-shader/trace.c b/libs/vkd3d-shader/trace.c index 0da29a8f..b0a2298f 100644 --- a/libs/vkd3d-shader/trace.c +++ b/libs/vkd3d-shader/trace.c @@ -109,6 +109,7 @@ static const char * const shader_opcode_names[] = /* VKD3DSIH_DIV */ "div", /* VKD3DSIH_DLT */ "dlt", /* VKD3DSIH_DMAX */ "dmax", + /* VKD3DSIH_DMIN */ "dmin", /* VKD3DSIH_DMOV */ "dmov", /* VKD3DSIH_DNE */ "dne", /* VKD3DSIH_DP2 */ "dp2", diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index f7762ef2..d8a6379c 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -198,6 +198,7 @@ enum vkd3d_shader_opcode VKD3DSIH_DIV, VKD3DSIH_DLT, VKD3DSIH_DMAX, + VKD3DSIH_DMIN, VKD3DSIH_DMOV, VKD3DSIH_DNE, VKD3DSIH_DP2, diff --git a/tests/d3d12.c b/tests/d3d12.c index b2a338d3..12dab502 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -9935,7 +9935,7 @@ static void test_shader_instructions(void)
{&ps_dmov, {.d = {{2.5 + 1.0e-9, -3.5 - 1.0e-9}}}, {.d = {3.5 + 1.0e-9, -2.5 - 1.0e-9}}, true}, {&ps_dadd, {.d = {{2.5, 0.0}}}, {.d = {2.5 + 1.0000002433080226, 2.5 + 2.000000481493771}}, true}, - {&ps_dmin_dmax, {.d = {{-1.0, 1.0}}}, {.d = {-1.0, 1.0}}, true, true}, + {&ps_dmin_dmax, {.d = {{-1.0, 1.0}}}, {.d = {-1.0, 1.0}}, 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_dmodifier, {.d = {{1.5, 0.0}}}, {.d = {1.5f, 2.5f}}, true},
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Conor McCarthy cmccarthy@codeweavers.com --- tests/d3d12.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
diff --git a/tests/d3d12.c b/tests/d3d12.c index 12dab502..9854af30 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -9157,6 +9157,29 @@ static void test_shader_instructions(void) 0x30494653, 0x00000008, 0x00000001, 0x00000000, }; static struct named_shader ps_dmin_dmax = {"dmin_dmax", ps_dmin_dmax_code, sizeof(ps_dmin_dmax_code)}; + static const DWORD ps_dfma_code[] = + { +#if 0 + double2 src0; + + void main(out uint4 dst : SV_Target) + { + asuint(fma(src0.x, src0.y, 1.0000002433080226l), dst.x, dst.y); + dst.zw = 0; + } +#endif + 0x43425844, 0xde5b55c7, 0x2660b48d, 0x52b1761e, 0x50319c4d, 0x00000001, 0x0000012c, 0x00000004, + 0x00000030, 0x00000040, 0x00000074, 0x0000011c, 0x4e475349, 0x00000008, 0x00000000, 0x00000008, + 0x4e47534f, 0x0000002c, 0x00000001, 0x00000008, 0x00000020, 0x00000000, 0x00000000, 0x00000001, + 0x00000000, 0x0000000f, 0x545f5653, 0x65677261, 0xabab0074, 0x58454853, 0x000000a0, 0x00000050, + 0x00000028, 0x0102186a, 0x04000059, 0x00208e46, 0x00000000, 0x00000001, 0x03000065, 0x001020f2, + 0x00000000, 0x02000068, 0x00000001, 0x0e0000d3, 0x00100032, 0x00000000, 0x00208446, 0x00000000, + 0x00000000, 0x00208ee6, 0x00000000, 0x00000000, 0x00005002, 0x41500000, 0x3ff00000, 0x00000000, + 0x00000000, 0x05000036, 0x00102032, 0x00000000, 0x00100046, 0x00000000, 0x08000036, 0x001020c2, + 0x00000000, 0x00004002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x0100003e, 0x30494653, + 0x00000008, 0x00000021, 0x00000000, + }; + static struct named_shader ps_dfma = {"dfma", ps_dfma_code, sizeof(ps_dfma_code)}; static const DWORD ps_dmovc_code[] = { #if 0 @@ -9936,6 +9959,8 @@ static void test_shader_instructions(void) {&ps_dmov, {.d = {{2.5 + 1.0e-9, -3.5 - 1.0e-9}}}, {.d = {3.5 + 1.0e-9, -2.5 - 1.0e-9}}, true}, {&ps_dadd, {.d = {{2.5, 0.0}}}, {.d = {2.5 + 1.0000002433080226, 2.5 + 2.000000481493771}}, true}, {&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, 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_dmodifier, {.d = {{1.5, 0.0}}}, {.d = {1.5f, 2.5f}}, true},
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Conor McCarthy cmccarthy@codeweavers.com --- libs/vkd3d-shader/dxbc.c | 1 + libs/vkd3d-shader/sm4.h | 1 + libs/vkd3d-shader/spirv.c | 2 ++ libs/vkd3d-shader/trace.c | 1 + libs/vkd3d-shader/vkd3d_shader_private.h | 1 + tests/d3d12.c | 2 +- 6 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/libs/vkd3d-shader/dxbc.c b/libs/vkd3d-shader/dxbc.c index f9be52d3..de55d782 100644 --- a/libs/vkd3d-shader/dxbc.c +++ b/libs/vkd3d-shader/dxbc.c @@ -809,6 +809,7 @@ static const struct vkd3d_sm4_opcode_info opcode_table[] = {VKD3D_SM5_OP_EVAL_CENTROID, VKD3DSIH_EVAL_CENTROID, "f", "f"}, {VKD3D_SM5_OP_DCL_GS_INSTANCES, VKD3DSIH_DCL_GS_INSTANCES, "", "", shader_sm4_read_declaration_count}, + {VKD3D_SM5_OP_DFMA, VKD3DSIH_DFMA, "d", "ddd"}, };
static const enum vkd3d_shader_register_type register_type_table[] = diff --git a/libs/vkd3d-shader/sm4.h b/libs/vkd3d-shader/sm4.h index c9a389ec..d9f61898 100644 --- a/libs/vkd3d-shader/sm4.h +++ b/libs/vkd3d-shader/sm4.h @@ -328,6 +328,7 @@ enum vkd3d_sm4_opcode VKD3D_SM5_OP_EVAL_SAMPLE_INDEX = 0xcc, VKD3D_SM5_OP_EVAL_CENTROID = 0xcd, VKD3D_SM5_OP_DCL_GS_INSTANCES = 0xce, + VKD3D_SM5_OP_DFMA = 0xd3, };
enum vkd3d_sm4_instruction_modifier diff --git a/libs/vkd3d-shader/spirv.c b/libs/vkd3d-shader/spirv.c index 1b0051e5..08709e44 100644 --- a/libs/vkd3d-shader/spirv.c +++ b/libs/vkd3d-shader/spirv.c @@ -6843,6 +6843,7 @@ static enum GLSLstd450 vkd3d_dxbc_compiler_map_ext_glsl_instruction( } glsl_insts[] = { + {VKD3DSIH_DFMA, GLSLstd450Fma}, {VKD3DSIH_DMAX, GLSLstd450NMax}, {VKD3DSIH_DMIN, GLSLstd450NMin}, {VKD3DSIH_EXP, GLSLstd450Exp2}, @@ -9534,6 +9535,7 @@ int vkd3d_dxbc_compiler_handle_instruction(struct vkd3d_dxbc_compiler *compiler, case VKD3DSIH_XOR: vkd3d_dxbc_compiler_emit_alu_instruction(compiler, instruction); break; + case VKD3DSIH_DFMA: case VKD3DSIH_DMAX: case VKD3DSIH_DMIN: case VKD3DSIH_EXP: diff --git a/libs/vkd3d-shader/trace.c b/libs/vkd3d-shader/trace.c index b0a2298f..d0aaa0fb 100644 --- a/libs/vkd3d-shader/trace.c +++ b/libs/vkd3d-shader/trace.c @@ -105,6 +105,7 @@ static const char * const shader_opcode_names[] = /* VKD3DSIH_DEFB */ "defb", /* VKD3DSIH_DEFI */ "defi", /* VKD3DSIH_DEQ */ "deq", + /* VKD3DSIH_DFMA */ "dfma", /* VKD3DSIH_DGE */ "dge", /* VKD3DSIH_DIV */ "div", /* VKD3DSIH_DLT */ "dlt", diff --git a/libs/vkd3d-shader/vkd3d_shader_private.h b/libs/vkd3d-shader/vkd3d_shader_private.h index d8a6379c..47ab3f6b 100644 --- a/libs/vkd3d-shader/vkd3d_shader_private.h +++ b/libs/vkd3d-shader/vkd3d_shader_private.h @@ -194,6 +194,7 @@ enum vkd3d_shader_opcode VKD3DSIH_DEFB, VKD3DSIH_DEFI, VKD3DSIH_DEQ, + VKD3DSIH_DFMA, VKD3DSIH_DGE, VKD3DSIH_DIV, VKD3DSIH_DLT, diff --git a/tests/d3d12.c b/tests/d3d12.c index 9854af30..aaf4bfca 100644 --- a/tests/d3d12.c +++ b/tests/d3d12.c @@ -9960,7 +9960,7 @@ static void test_shader_instructions(void) {&ps_dadd, {.d = {{2.5, 0.0}}}, {.d = {2.5 + 1.0000002433080226, 2.5 + 2.000000481493771}}, true}, {&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, true}, + {.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_dmodifier, {.d = {{1.5, 0.0}}}, {.d = {1.5f, 2.5f}}, true},
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com