From 92c98ac5fa99ab9ef52e67f0dfc3ea404b0d9a18 Mon Sep 17 00:00:00 2001 From: xsacha Date: Mon, 21 Jun 2010 13:09:25 +0000 Subject: [PATCH] A new update for OpenCL.h. Changes: - Strict casting as required by NVidia. Now NVidia cards should work. - Fixed Alpha CMPR bug. Please tell me if you find any bugs. Current known bug is the 'Press' texture in Paper Mario that is meant to flash rainbow colours appears black. Other than that, everything should work on every videocard. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@5759 8ced0084-cf51-0410-be5f-012b33b47a6e --- Data/User/OpenCL/TextureDecoder.cl | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Data/User/OpenCL/TextureDecoder.cl b/Data/User/OpenCL/TextureDecoder.cl index 2b46761167..04f3fe03d8 100644 --- a/Data/User/OpenCL/TextureDecoder.cl +++ b/Data/User/OpenCL/TextureDecoder.cl @@ -161,23 +161,22 @@ kernel void decodeCMPRBlock(global uchar *dst, colorb565, (uchar2)0xFF); - ushort4 frac2 = (ushort4)(color32.even & (uchar4)0xFF) - (ushort4)(color32.odd & (uchar4)0xFF); + ushort4 frac2 = convert_ushort4(color32.even & (uchar4)0xFF) - convert_ushort4(color32.odd & (uchar4)0xFF); uchar4 frac = convert_uchar4((frac2 * (ushort4)3) / (ushort4)8); ushort4 colorAlpha = upsample((uchar4)0, rhadd(color32.odd, color32.even)); colorAlpha.s3 = 0xFF; ushort4 colorNoAlpha = upsample(color32.odd + frac, color32.even - frac); - ushort4 choice = isgreater(val.s0,val.s2); - uint4 colors = upsample(bitselect(colorNoAlpha, colorAlpha, choice), + uint4 colors = upsample((upsample(val.s0,val.s1) > upsample(val.s2,val.s3))?colorNoAlpha:colorAlpha, upsample(color32.odd, color32.even)); uint16 colorsFull = (uint16)(colors, colors, colors, colors); - vstore16((uchar16)(colorsFull >> unpack(val.s4)), 0, dst); - vstore16((uchar16)(colorsFull >> unpack(val.s5)), 0, dst+=width*4); - vstore16((uchar16)(colorsFull >> unpack(val.s6)), 0, dst+=width*4); - vstore16((uchar16)(colorsFull >> unpack(val.s7)), 0, dst+=width*4); + vstore16(convert_uchar16(colorsFull >> unpack(val.s4)), 0, dst); + vstore16(convert_uchar16(colorsFull >> unpack(val.s5)), 0, dst+=width*4); + vstore16(convert_uchar16(colorsFull >> unpack(val.s6)), 0, dst+=width*4); + vstore16(convert_uchar16(colorsFull >> unpack(val.s7)), 0, dst+=width*4); } kernel void DecodeCMPR(global uchar *dst,