// --------------------------------------------------------------------------- // Project: NintendoWare // File: lyt_PaneShader.vsh // // Copyright (C)2009-2010 Nintendo Co., Ltd. All rights reserved. // // These coded instructions, statements, and computer programs contain // proprietary information of Nintendo of America Inc. and/or Nintendo // Company Ltd., and are protected by Federal copyright law. They may // not be disclosed to third parties or copied or duplicated in any form, // in whole or in part, without the prior written consent of Nintendo. // // $Revision: 17413 $ // --------------------------------------------------------------------------- // Input registers map #pragma bind_symbol(aVertexIndex, v0, v0) // Constant values #pragma bind_symbol(uProjection, c0, c3) #pragma bind_symbol(uModelView, c4, c6) #pragma bind_symbol(uTransform, c7, c7) #pragma bind_symbol(uTexMtx0, c8, c9) #pragma bind_symbol(uTexMtx1, c10, c11) #pragma bind_symbol(uTexMtx2, c12, c13) #pragma bind_symbol(uColor, c14, c14) #pragma bind_symbol(uFrameSpec, c15, c15) #pragma bind_symbol(uVertexColor, c16, c19) #pragma bind_symbol(uVertexTexCoord0, c20, c23) #pragma bind_symbol(uVertexTexCoord1, c24, c27) #pragma bind_symbol(uVertexTexCoord2, c28, c31) #pragma bind_symbol(uRcpTexSize0, c32, c32) // Output registers map #pragma output_map(position, o0) #pragma output_map(color, o1) #pragma output_map(texture0, o2.xy) #pragma output_map(texture1, o3.xy) #pragma output_map(texture2, o4.xy) #define aVertexIndex v0 #define uProjection c0 #define uModelView c4 #define uTransform c7 #define uTexMtx0 c8 #define uTexMtx1 c10 #define uTexMtx2 c12 #define uColor c14 #define uFrameSpec c15 #define uVertexColor c16 #define uVertexTexCoord0 c20 #define uVertexTexCoord1 c24 #define uVertexTexCoord2 c28 #define uRcpTexSize0 c32 #define vPosition o0 #define vColor o1 #define vTexCoord0 o2 #define vTexCoord1 o3 #define vTexCoord2 o4 #define CONST c95 def CONST, 0.0, 0.5, 1.0, 255 #define CONST_0 CONST.x #define CONST_1_2 CONST.y #define CONST_1 CONST.z #define CONST_255 CONST.w #define CONST_0_0_0_1 CONST.xxxz #define CONST2 c94 def CONST2, 1, -1, 0, 2 #define CMP_EQ 0 #define CMP_NE 1 #define CMP_LT 2 #define CMP_LE 3 #define CMP_GT 4 #define CMP_GE 5 #define ifc_0_or_1(c0, c1) ifc c0, c1, 0 #define ifc_0_and_1(c0, c1) ifc c0, c1, 1 #define ifc_0(c0) ifc c0, 0, 2 #define ifc_1(c1) ifc 0, c1, 3 #define aPosition r0 #define aColor r1 #define aTexCoord0 r2 #define aTexCoord1 r3 #define aTexCoord2 r4 #define aFrameSpec r5 #define aTexScale r6 #define tmp0 r15 #define tmp1 r14 main: // aPosition = [ aVertexIndex.x, - aVertexIndex.y, 0, 1 ] mul aPosition, aVertexIndex, CONST2.xyzz mov aPosition.zw, CONST2.zzzx // if (IsConstVertex(uFrameSpec)) { // aTexCoord[0,1,2] = [ aVertex.x, aVertex.y, 0, 1 ] // aColor = 255 // } else { // i = 1 * aVertex.x + 2 * aVertex.y // aTexCoord[0,1,2] = uVertexTexCoord[0,1,2][i] // aColor = uVertexColor[i] // } mov aFrameSpec, uFrameSpec mul aFrameSpec.xy, aFrameSpec.x, CONST_1_2 flr aFrameSpec.x, aFrameSpec cmp CMP_GT, CMP_GT, aFrameSpec.y, aFrameSpec.x ifc_0(1) mov aTexCoord0, aVertexIndex mov aTexCoord0.zw, CONST2.zzzx mov aTexCoord1, aTexCoord0 mov aTexCoord2, aTexCoord0 mov aColor, CONST_255 else dp3 tmp0, aVertexIndex, CONST2.xwz mova a0.xy, tmp0 mov aTexCoord0, uVertexTexCoord0[a0.x] mov aTexCoord1, uVertexTexCoord1[a0.x] mov aTexCoord2, uVertexTexCoord2[a0.x] mov aColor, uVertexColor[a0.x] endif // POSITION TRANSFORM mov tmp0, uTransform mad aPosition.xy, aPosition.xy, tmp0.xy, tmp0.zw dp4 tmp0.x, aPosition, uModelView[0] dp4 tmp0.y, aPosition, uModelView[1] dp4 tmp0.z, aPosition, uModelView[2] mov tmp0.w, aPosition.w m4x4 vPosition, tmp0, uProjection // GLOBAL COLOR mul vColor, aColor, uColor // TEXCOORD0 FRAME TRANSFORM // if (IsFrame(uFrameSpec)) { mul aFrameSpec.xy, aFrameSpec.x, CONST_1_2 flr aFrameSpec.x, aFrameSpec cmp CMP_GT, CMP_GT, aFrameSpec.y, aFrameSpec.x ifc_0(1) // texSize = uFrameSpec.zw // if (IsSwap(uFrameSpec)) { // aTexScale = polySize * uRcpTexSize0.yx // } else { // aTexScale = polySize * uRcpTexSize0.xy // } mul aFrameSpec.xy, aFrameSpec.x, CONST_1_2 flr aFrameSpec.x, aFrameSpec mov tmp1, aFrameSpec cmp CMP_GT, CMP_GT, aFrameSpec.y, aFrameSpec.x mov aTexScale, uTransform ifc_0(1) mul aTexScale, aTexScale, uRcpTexSize0.yx else mul aTexScale, aTexScale, uRcpTexSize0.xy endif // aTexCoord[0,1,2] *= texScale mul aTexCoord0.xy, aTexCoord0, aTexScale mul aTexCoord1.xy, aTexCoord1, aTexScale mul aTexCoord2.xy, aTexCoord2, aTexScale // if (IsRight(uFrameSpec)) { // aTexCoord[0,1,2].x += 1 - texScale.x // } mul aFrameSpec.xy, aFrameSpec.x, CONST_1_2 flr aFrameSpec.x, aFrameSpec cmp CMP_GT, CMP_GT, aFrameSpec.y, aFrameSpec.x add aTexScale, CONST_1, -aTexScale ifc_0(1) add aTexCoord0.x, aTexCoord0, aTexScale add aTexCoord1.x, aTexCoord1, aTexScale add aTexCoord2.x, aTexCoord2, aTexScale endif // if (IsBottom(uFrameSpec)) { // aTexCoord[0,1,2].y += 1 - texScale.y // } mul aFrameSpec.xy, aFrameSpec.x, CONST_1_2 flr aFrameSpec.x, aFrameSpec cmp CMP_GT, CMP_GT, aFrameSpec.y, aFrameSpec.x ifc_0(1) add aTexCoord0.y, aTexCoord0, aTexScale add aTexCoord1.y, aTexCoord1, aTexScale add aTexCoord2.y, aTexCoord2, aTexScale endif // if (IsHorizontalFlip(uFrameSpec)) { // aTexCoord[0,1,2].x = 1 - aTexCoord[0,1,2].x // } mul aFrameSpec.xy, aFrameSpec.x, CONST_1_2 flr aFrameSpec.x, aFrameSpec cmp CMP_GT, CMP_GT, aFrameSpec.y, aFrameSpec.x ifc_0(1) add aTexCoord0.x, CONST_1, -aTexCoord0 add aTexCoord1.x, CONST_1, -aTexCoord1 add aTexCoord2.x, CONST_1, -aTexCoord2 endif // if (IsVerticalFlip(uFrameSpec)) { // aTexCoord[0,1,2].y = 1 - aTexCoord[0,1,2].y // } mul aFrameSpec.xy, aFrameSpec.x, CONST_1_2 flr aFrameSpec.x, aFrameSpec cmp CMP_GT, CMP_GT, aFrameSpec.y, aFrameSpec.x ifc_0(1) add aTexCoord0.y, CONST_1, -aTexCoord0 add aTexCoord1.y, CONST_1, -aTexCoord1 add aTexCoord2.y, CONST_1, -aTexCoord2 endif // if (IsSwap(uFrameSpec)) { // aTexCoord[0,1,2].xy = aTexCoord[0,1,2].yx // } cmp CMP_GT, CMP_GT, tmp1.y, tmp1.x ifc_0(1) mov aTexCoord0, aTexCoord0.yxzw mov aTexCoord1, aTexCoord1.yxzw mov aTexCoord2, aTexCoord2.yxzw endif nop endif // TEXCOORD TRANSFORM dp4 vTexCoord0.xz, aTexCoord0, uTexMtx0[0] dp4 vTexCoord0.yw, aTexCoord0, uTexMtx0[1] dp4 vTexCoord1.xz, aTexCoord1, uTexMtx1[0] dp4 vTexCoord1.yw, aTexCoord1, uTexMtx1[1] dp4 vTexCoord2.xz, aTexCoord2, uTexMtx2[0] dp4 vTexCoord2.yw, aTexCoord2, uTexMtx2[1] end endmain: