From 424bdcbf96481b9ee8980e5aa7b558f5608f9441 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 10 Jan 2022 17:05:57 +0900 Subject: [PATCH] [gamecode] Implement the scale instructions Both float 2,3,4 vectors and double 2,3,4 vectors (1 would be just a copy of the mul instructions). This completes the currently planned instructions. Now for testing. --- libs/gamecode/pr_exec.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/libs/gamecode/pr_exec.c b/libs/gamecode/pr_exec.c index 684205b80..fda0763d9 100644 --- a/libs/gamecode/pr_exec.c +++ b/libs/gamecode/pr_exec.c @@ -3313,12 +3313,28 @@ pr_exec_ruamoko (progs_t *pr, int exitdepth) case OP_SWIZZLE_F: OPC(ivec4) = pr_swizzle_f (OPA(ivec4), st->b); break; - //FIXME scale ops + case OP_SCALE_F_2: + OPC(vec2) = OPA(vec2) * OPB(float); + break; + case OP_SCALE_F_3: + VectorScale (&OPA(float), OPB(float), &OPC(float)); + break; + case OP_SCALE_F_4: + OPC(vec4) = OPA(vec4) * OPB(float); + break; OP_cmp_T (LT, U, long, lvec2, lvec4, <, ulong, ulvec2, ulvec4); case OP_SWIZZLE_D: OPC(lvec4) = pr_swizzle_d (OPA(lvec4), st->b); break; - //FIXME scale ops + case OP_SCALE_D_2: + OPC(dvec2) = OPA(dvec2) * OPB(double); + break; + case OP_SCALE_D_3: + VectorScale (&OPA(double), OPB(double), &OPC(double)); + break; + case OP_SCALE_D_4: + OPC(dvec4) = OPA(dvec4) * OPB(double); + break; // 1 1010 OP_cmp_T (GT, u, int, ivec2, ivec4, >, uint, uivec2, uivec4); // spare