1 #ifndef _OP_LIGHT_ARM_H_
2 #define _OP_LIGHT_ARM_H_
4 ////////////////////////////////////////////////////////////////////////////////
5 // Extract bgr555 color from Gouraud u32 fixed-pt 8.3:8.3:8.2 rgb triplet
8 // 'gCol' input: rrrrrrrrXXXggggggggXXXbbbbbbbbXX
11 // u16 output: 0bbbbbgggggrrrrr
13 // Where 'r,g,b' are integer bits of colors, 'X' fixed-pt, and '0' zero
14 ////////////////////////////////////////////////////////////////////////////////
15 GPU_INLINE u16 gpuLightingRGBARM(u32 gCol)
17 u16 out = 0x03E0; // don't need the mask after starting to write output
20 asm ("and %[tmp], %[gCol], %[out]\n\t" // tmp holds 0x000000bbbbb00000
21 "and %[out], %[out], %[gCol], lsr #0x0B\n\t" // out holds 0x000000ggggg00000
22 "orr %[tmp], %[out], %[tmp], lsl #0x05\n\t" // tmp holds 0x0bbbbbggggg00000
23 "orr %[out], %[tmp], %[gCol], lsr #0x1B\n\t" // out holds 0x0bbbbbgggggrrrrr
24 : [out] "+&r" (out), [tmp] "=&r" (tmp)
32 GPU_INLINE u16 gpuLightingTXTARM(u16 uSrc, u8 r5, u8 g5, u8 b5)
36 asm ("and %[dg], %[out], %[src] \n\t"
37 "orr %[dg], %[dg], %[g5] \n\t"
38 "and %[db], %[out], %[src], lsr #0x05 \n\t"
39 "ldrb %[dg], [%[lut], %[dg]] \n\t"
40 "and %[out], %[out], %[src], lsl #0x05 \n\t"
41 "orr %[out], %[out], %[r5] \n\t"
42 "orr %[db], %[db], %[b5] \n\t"
43 "ldrb %[out], [%[lut], %[out]] \n\t"
44 "ldrb %[db], [%[lut], %[db]] \n\t"
45 "orr %[out], %[out], %[dg], lsl #0x05 \n\t"
46 "orr %[out], %[out], %[db], lsl #0x0A \n\t"
47 : [out] "=&r" (out), [db] "=&r" (db), [dg] "=&r" (dg)
48 : [r5] "r" (r5), [g5] "r" (g5), [b5] "r" (b5),
49 [lut] "r" (gpu_unai.LightLUT), [src] "r" (uSrc), "0" (out)
54 GPU_INLINE u16 gpuLightingTXTGouraudARM(u16 uSrc, u32 gCol)
56 u16 out = 0x03E0; // don't need the mask after starting to write output
58 asm ("and %[dg], %[out], %[src] \n\t"
59 "and %[gtmp],%[out], %[gCol], lsr #0x0B \n\t"
60 "and %[db], %[out], %[src], lsr #0x05 \n\t"
61 "orr %[dg], %[dg], %[gtmp], lsr #0x05 \n\t"
62 "and %[gtmp],%[out], %[gCol] \n\t"
63 "ldrb %[dg], [%[lut], %[dg]] \n\t"
64 "and %[out], %[out], %[src], lsl #0x05 \n\t"
65 "orr %[out], %[out], %[gCol], lsr #0x1B \n\t"
66 "orr %[db], %[db], %[gtmp], lsr #0x05 \n\t"
67 "ldrb %[out], [%[lut], %[out]] \n\t"
68 "ldrb %[db], [%[lut], %[db]] \n\t"
69 "orr %[out], %[out], %[dg], lsl #0x05 \n\t"
70 "orr %[out], %[out], %[db], lsl #0x0A \n\t"
71 : [out] "=&r" (out), [db] "=&r" (db), [dg] "=&r" (dg),
73 : [gCol] "r" (gCol), [lut] "r" (gpu_unai.LightLUT), "0" (out), [src] "r" (uSrc)
79 #endif //_OP_LIGHT_ARM_H_