From 479c404b60ed36d6d2ca359e2965d26a482e3023 Mon Sep 17 00:00:00 2001 From: rogerman Date: Mon, 30 Aug 2021 12:42:48 -0700 Subject: [PATCH] Core: Fix compiling for AltiVec build targets. --- desmume/src/FIFO.cpp | 4 ++-- desmume/src/matrix.h | 6 +++--- .../colorspacehandler/colorspacehandler_AltiVec.cpp | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/desmume/src/FIFO.cpp b/desmume/src/FIFO.cpp index 46e9c94e5..c221495b0 100644 --- a/desmume/src/FIFO.cpp +++ b/desmume/src/FIFO.cpp @@ -503,11 +503,11 @@ void _DISP_FIFOrecv_LineOpaque32_vec(u32 *__restrict dst) if (OUTPUTFORMAT == NDSColorFormat_BGR666_Rev) { - ColorspaceConvert555To6665Opaque_Altivec(fifoColor, dstLo, dstHi); + ColorspaceConvert555To6665Opaque_AltiVec(fifoColor, dstLo, dstHi); } else if (OUTPUTFORMAT == NDSColorFormat_BGR888_Rev) { - ColorspaceConvert555To8888Opaque_Altivec(fifoColor, dstLo, dstHi); + ColorspaceConvert555To8888Opaque_AltiVec(fifoColor, dstLo, dstHi); } vec_st(dstLo, d + 0, dst); diff --git a/desmume/src/matrix.h b/desmume/src/matrix.h index 48d845582..fdc6ba219 100644 --- a/desmume/src/matrix.h +++ b/desmume/src/matrix.h @@ -631,7 +631,7 @@ static void buffer_copy_fast(void *__restrict dst, void *__restrict src) template static void __buffer_copy_or_constant_fast(void *__restrict dst, const void *__restrict src, const T &c_vec) { - MACRODO_N( VECLENGTH / sizeof(v128s8), vec_st(vec_or(vec_ld((X)*sizeof(v128s8),src),c_vec), (X)*sizeof(v128s8), dst) ); + MACRODO_N( VECLENGTH / sizeof(v128s8), vec_st(vec_or(vec_ld((X)*sizeof(v128s8),(T*)src),c_vec), (X)*sizeof(v128s8), dst) ); } template @@ -652,7 +652,7 @@ static void __buffer_copy_or_constant(void *__restrict dst, const void *__restri { for (size_t i = 0; i < vecLength; i+=sizeof(T)) { - vec_st(vec_or(vec_ld(i,src),c_vec), i, dst); + vec_st(vec_or(vec_ld(i,(T*)src),c_vec), i, dst); } break; } @@ -662,7 +662,7 @@ static void __buffer_copy_or_constant(void *__restrict dst, const void *__restri static void buffer_copy_or_constant_s8(void *__restrict dst, const void *__restrict src, const size_t vecLength, const s8 c) { const v128s8 c_vec = {c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c}; - __buffer_copy_or_constant(dst, src, vecLength, c_vec); + __buffer_copy_or_constant(dst, src, vecLength, c_vec); } template diff --git a/desmume/src/utils/colorspacehandler/colorspacehandler_AltiVec.cpp b/desmume/src/utils/colorspacehandler/colorspacehandler_AltiVec.cpp index c5bb48fb1..6c4460f52 100644 --- a/desmume/src/utils/colorspacehandler/colorspacehandler_AltiVec.cpp +++ b/desmume/src/utils/colorspacehandler/colorspacehandler_AltiVec.cpp @@ -1,5 +1,5 @@ /* - Copyright (C) 2016-2019 DeSmuME team + Copyright (C) 2016-2021 DeSmuME team This file is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -46,11 +46,11 @@ FORCEINLINE void ColorspaceConvert555XTo888X_AltiVec(const v128u16 &srcColor, v1 dstLo = vec_unpackl((vector pixel)srcColor); dstLo = vec_or( vec_sl((v128u8)dstLo, ((v128u8){0,3,3,3, 0,3,3,3, 0,3,3,3, 0,3,3,3})), vec_sr((v128u8)dstLo, ((v128u8){0,2,2,2, 0,2,2,2, 0,2,2,2, 0,2,2,2})) ); - dstLo = vec_perm(dstLo, ((v128u8){0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0})), (SWAP_RB) ? ((v128u8){0x11,0x03,0x02,0x01, 0x13,0x07,0x06,0x05, 0x15,0x0B,0x0A,0x09, 0x17,0x0F,0x0E,0x0D}) : ((v128u8){0x11,0x01,0x02,0x03, 0x13,0x05,0x06,0x07, 0x15,0x09,0x0A,0x0B, 0x17,0x0D,0x0E,0x0F})); + dstLo = vec_perm(dstLo, ((v128u8){0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0}), (SWAP_RB) ? ((v128u8){0x11,0x03,0x02,0x01, 0x13,0x07,0x06,0x05, 0x15,0x0B,0x0A,0x09, 0x17,0x0F,0x0E,0x0D}) : ((v128u8){0x11,0x01,0x02,0x03, 0x13,0x05,0x06,0x07, 0x15,0x09,0x0A,0x0B, 0x17,0x0D,0x0E,0x0F})); dstHi = vec_unpackh((vector pixel)srcColor); dstHi = vec_or( vec_sl((v128u8)dstHi, ((v128u8){0,3,3,3, 0,3,3,3, 0,3,3,3, 0,3,3,3})), vec_sr((v128u8)dstHi, ((v128u8){0,2,2,2, 0,2,2,2, 0,2,2,2, 0,2,2,2})) ); - dstHi = vec_perm(dstHi, ((v128u8){0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0})), (SWAP_RB) ? ((v128u8){0x19,0x03,0x02,0x01, 0x1B,0x07,0x06,0x05, 0x1D,0x0B,0x0A,0x09, 0x1F,0x0F,0x0E,0x0D}) : ((v128u8){0x19,0x01,0x02,0x03, 0x1B,0x05,0x06,0x07, 0x1D,0x09,0x0A,0x0B, 0x1F,0x0D,0x0E,0x0F})); + dstHi = vec_perm(dstHi, ((v128u8){0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0}), (SWAP_RB) ? ((v128u8){0x19,0x03,0x02,0x01, 0x1B,0x07,0x06,0x05, 0x1D,0x0B,0x0A,0x09, 0x1F,0x0F,0x0E,0x0D}) : ((v128u8){0x19,0x01,0x02,0x03, 0x1B,0x05,0x06,0x07, 0x1D,0x09,0x0A,0x0B, 0x1F,0x0D,0x0E,0x0F})); } template @@ -76,11 +76,11 @@ FORCEINLINE void ColorspaceConvert555XTo666X_AltiVec(const v128u16 &srcColor, v1 dstLo = vec_unpackl((vector pixel)srcColor); dstLo = vec_or( vec_sl((v128u8)dstLo, ((v128u8){0,1,1,1, 0,1,1,1, 0,1,1,1, 0,1,1,1})), vec_sr((v128u8)dstLo, ((v128u8){0,4,4,4, 0,4,4,4, 0,4,4,4, 0,4,4,4})) ); - dstLo = vec_perm(dstLo, ((v128u8){0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0})), (SWAP_RB) ? ((v128u8){0x11,0x03,0x02,0x01, 0x13,0x07,0x06,0x05, 0x15,0x0B,0x0A,0x09, 0x17,0x0F,0x0E,0x0D}) : ((v128u8){0x11,0x01,0x02,0x03, 0x13,0x05,0x06,0x07, 0x15,0x09,0x0A,0x0B, 0x17,0x0D,0x0E,0x0F})); + dstLo = vec_perm(dstLo, ((v128u8){0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0}), (SWAP_RB) ? ((v128u8){0x11,0x03,0x02,0x01, 0x13,0x07,0x06,0x05, 0x15,0x0B,0x0A,0x09, 0x17,0x0F,0x0E,0x0D}) : ((v128u8){0x11,0x01,0x02,0x03, 0x13,0x05,0x06,0x07, 0x15,0x09,0x0A,0x0B, 0x17,0x0D,0x0E,0x0F})); dstHi = vec_unpackh((vector pixel)srcColor); dstHi = vec_or( vec_sl((v128u8)dstHi, ((v128u8){0,1,1,1, 0,1,1,1, 0,1,1,1, 0,1,1,1})), vec_sr((v128u8)dstHi, ((v128u8){0,4,4,4, 0,4,4,4, 0,4,4,4, 0,4,4,4})) ); - dstHi = vec_perm(dstHi, ((v128u8){0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0})), (SWAP_RB) ? ((v128u8){0x19,0x03,0x02,0x01, 0x1B,0x07,0x06,0x05, 0x1D,0x0B,0x0A,0x09, 0x1F,0x0F,0x0E,0x0D}) : ((v128u8){0x19,0x01,0x02,0x03, 0x1B,0x05,0x06,0x07, 0x1D,0x09,0x0A,0x0B, 0x1F,0x0D,0x0E,0x0F})); + dstHi = vec_perm(dstHi, ((v128u8){0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0}), (SWAP_RB) ? ((v128u8){0x19,0x03,0x02,0x01, 0x1B,0x07,0x06,0x05, 0x1D,0x0B,0x0A,0x09, 0x1F,0x0F,0x0E,0x0D}) : ((v128u8){0x19,0x01,0x02,0x03, 0x1B,0x05,0x06,0x07, 0x1D,0x09,0x0A,0x0B, 0x1F,0x0D,0x0E,0x0F})); } template