aboutsummaryrefslogtreecommitdiff
path: root/plugins/gpulib
diff options
context:
space:
mode:
authornotaz2012-07-19 02:48:02 +0300
committernotaz2012-07-19 02:48:02 +0300
commit00a5d4598d4a79e0041ce958fe65a4c20338b6cc (patch)
tree2cb9ec90678588d542a8fa8715f6b756204a4f02 /plugins/gpulib
parent2daaaae3b2bb131d88ad750d8a74c146f04da62a (diff)
downloadpcsx_rearmed-00a5d4598d4a79e0041ce958fe65a4c20338b6cc.tar.gz
pcsx_rearmed-00a5d4598d4a79e0041ce958fe65a4c20338b6cc.tar.bz2
pcsx_rearmed-00a5d4598d4a79e0041ce958fe65a4c20338b6cc.zip
gpulib: implement rgb888_to_rgb565
and use it for menu
Diffstat (limited to 'plugins/gpulib')
-rw-r--r--plugins/gpulib/cspace.c1
-rw-r--r--plugins/gpulib/cspace.h1
-rw-r--r--plugins/gpulib/cspace_neon.s33
3 files changed, 35 insertions, 0 deletions
diff --git a/plugins/gpulib/cspace.c b/plugins/gpulib/cspace.c
index 408211f..1d5718c 100644
--- a/plugins/gpulib/cspace.c
+++ b/plugins/gpulib/cspace.c
@@ -39,5 +39,6 @@ void bgr888_to_rgb565(void *dst_, const void *src_, int bytes)
}
// TODO?
+void rgb888_to_rgb565(void *dst, const void *src, int bytes) {}
void bgr888_to_rgb888(void *dst, const void *src, int bytes) {}
diff --git a/plugins/gpulib/cspace.h b/plugins/gpulib/cspace.h
index 644143b..8c9bcfa 100644
--- a/plugins/gpulib/cspace.h
+++ b/plugins/gpulib/cspace.h
@@ -6,6 +6,7 @@ extern "C"
void bgr555_to_rgb565(void *dst, const void *src, int bytes);
void bgr888_to_rgb888(void *dst, const void *src, int bytes);
void bgr888_to_rgb565(void *dst, const void *src, int bytes);
+void rgb888_to_rgb565(void *dst, const void *src, int bytes);
#ifdef __cplusplus
}
diff --git a/plugins/gpulib/cspace_neon.s b/plugins/gpulib/cspace_neon.s
index abc0381..b458f06 100644
--- a/plugins/gpulib/cspace_neon.s
+++ b/plugins/gpulib/cspace_neon.s
@@ -129,4 +129,37 @@ bgr888_to_rgb565:
bx lr
+.global rgb888_to_rgb565
+rgb888_to_rgb565:
+ pld [r1]
+ @ r2 /= 48
+ mov r2, r2, lsr #4
+ movw r3, #0x5556
+ movt r3, #0x5555
+ umull r12,r2, r3, r2
+
+ mov r3, #0x07e0
+ vdup.16 q15, r3
+0:
+ pld [r1, #48*3]
+ vld3.8 {d1-d3}, [r1, :64]!
+ vld3.8 {d5-d7}, [r1, :64]!
+
+ vshll.u8 q8, d2, #3 @ g
+ vshll.u8 q9, d6, #3
+ vshr.u8 d2, d1, #3 @ b
+ vshr.u8 d6, d5, #3
+ vzip.8 d2, d3 @ rb
+ vzip.8 d6, d7
+ vbit q1, q8, q15
+ vbit q3, q9, q15
+
+ vstmia r0!, {d2,d3}
+ vstmia r0!, {d6,d7}
+ subs r2, r2, #1
+ bne 0b
+
+ bx lr
+
+
@ vim:filetype=armasm