From 79ddfedbde5d88b1267dcb7e5f1a3239ef7318a4 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Thu, 4 Dec 2025 22:32:49 +0100 Subject: [PATCH] tests/d3dbc: Add some tests for dp2add instructions. These are adapted from Wine's dp2add_ps_test() d3d9 test by Jason Green. --- Makefile.am | 1 + tests/d3dbc/dp2add.shader_test | 35 ++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 tests/d3dbc/dp2add.shader_test diff --git a/Makefile.am b/Makefile.am index 6a4b5ce63..46202358f 100644 --- a/Makefile.am +++ b/Makefile.am @@ -52,6 +52,7 @@ vkd3d_cross_tests = \ tests/hlsl_d3d12 vkd3d_shader_tests = \ + tests/d3dbc/dp2add.shader_test \ tests/d3dbc/lrp.shader_test \ tests/d3dbc/nrm.shader_test \ tests/hlsl/abs.shader_test \ diff --git a/tests/d3dbc/dp2add.shader_test b/tests/d3dbc/dp2add.shader_test new file mode 100644 index 000000000..4a65407ed --- /dev/null +++ b/tests/d3dbc/dp2add.shader_test @@ -0,0 +1,35 @@ +[require] +shader model = 2.0 + +[pixel shader d3dbc-hex] +ffff0200 % ps_2_0 +05000051 a00f0000 3f000000 3f000000 3f800000 00000000 % def c0, 0.5, 0.5, 1.0, 0.0 +02000001 800f0000 a0e40000 % mov r0, c0 +0400005a 80070000 80000000 80000000 80ff0000 % dp2add r0.xyz, r0, r0, r0.w +02000001 80080000 a0aa0000 % mov r0.w, c0.z +02000001 800f0800 80e40000 % mov oC0, r0 +0000ffff % end + +[test] +todo draw quad +probe (320, 240) f32(.5, .5, .5, 1.0) + +% Test the _sat modifier. +% +% dp2add: (-0.5 * -0.5) + (-0.5 * -0.5) + 2.0 = 2.5 +% _sat: -> 1.0 +% add: (1.0 + -0.5) = 0.5 +% +[pixel shader d3dbc-hex] +ffff0200 % ps_2_0 +05000051 a00f0000 bf000000 bf000000 3f800000 40000000 % def c0, -0.5, -0.5, 1.0, 2.0 +02000001 800f0000 a0e40000 % mov r0, c0 +0400005a 80170000 80000000 80000000 80ff0000 % dp2add_sat r0.xyz, r0, r0, r0.w +03000002 80070000 80e40000 a0000000 % add r0.xyz, r0, c0.x +02000001 80080000 a0aa0000 % mov r0.w, c0.z +02000001 800f0800 80e40000 % mov oC0, r0 +0000ffff % end + +[test] +todo draw quad +probe (320, 240) f32(.5, .5, .5, 1.0)