1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: gr_Utility.cpp 4 5 Copyright (C)2010 Nintendo Co., Ltd. All rights reserved. 6 7 These coded instructions, statements, and computer programs contain 8 proprietary information of Nintendo of America Inc. and/or Nintendo 9 Company Ltd., and are protected by Federal copyright law. They may 10 not be disclosed to third parties or copied or duplicated in any form, 11 in whole or in part, without the prior written consent of Nintendo. 12 13 $Rev: 33699 $ 14 *---------------------------------------------------------------------------*/ 15 16 #include <nn/gr/CTR/gr_Utility.h> 17 18 #include <nn/gr/CTR/gr_Shader.h> 19 #include <nn/gr/CTR/gr_Vertex.h> 20 #include <nn/gr/CTR/gr_Fog.h> 21 #include <nn/gr/CTR/gr_FragmentLight.h> 22 #include <nn/gr/CTR/gr_Texture.h> 23 #include <nn/gr/CTR/gr_RenderState.h> 24 25 namespace nn 26 { 27 namespace gr 28 { 29 namespace CTR 30 { 31 32 // ARMコードでコンパイルします 33 #include <nn/hw/ARM/code32.h> 34 35 //-------------------------------------------------------------------------------- CopyMtx34WithHeader(f32 *,const nn::math::MTX34 *,u32)36 asm void CopyMtx34WithHeader( 37 f32* /* dst */, 38 const nn::math::MTX34* /* src */, 39 u32 /* header */ ) 40 { 41 VLDMIA r1!,{s0-s11} 42 STR r2,[r0,#4] 43 VSTR.F32 s0,[r0,#16] 44 VSTR.F32 s1,[r0,#12] 45 VSTR.F32 s2,[r0,#8] 46 VSTR.F32 s3,[r0,#0] 47 VSTR.F32 s4,[r0,#32] 48 VSTR.F32 s5,[r0,#28] 49 VSTR.F32 s6,[r0,#24] 50 VSTR.F32 s7,[r0,#20] 51 VSTR.F32 s8,[r0,#48] 52 VSTR.F32 s9,[r0,#44] 53 VSTR.F32 s10,[r0,#40] 54 VSTR.F32 s11,[r0,#36] 55 BX lr 56 } 57 58 //-------------------------------------------------------------------------------- 59 CopyMtx44WithHeader(f32 *,const nn::math::MTX44 *,u32)60 asm void CopyMtx44WithHeader( 61 f32* /* dst */, 62 const nn::math::MTX44* /* src */, 63 u32 /* header */ ) 64 { 65 VLDMIA r1!,{s0-s15} 66 STR r2,[r0,#4] 67 VSTR.F32 s0,[r0,#16] 68 VSTR.F32 s1,[r0,#12] 69 VSTR.F32 s2,[r0,#8] 70 VSTR.F32 s3,[r0,#0] 71 VSTR.F32 s4,[r0,#32] 72 VSTR.F32 s5,[r0,#28] 73 VSTR.F32 s6,[r0,#24] 74 VSTR.F32 s7,[r0,#20] 75 VSTR.F32 s8,[r0,#48] 76 VSTR.F32 s9,[r0,#44] 77 VSTR.F32 s10,[r0,#40] 78 VSTR.F32 s11,[r0,#36] 79 VSTR.F32 s12,[r0,#64] 80 VSTR.F32 s13,[r0,#60] 81 VSTR.F32 s14,[r0,#56] 82 VSTR.F32 s15,[r0,#52] 83 BX lr 84 } 85 86 // 元の設定に戻します 87 #include <nn/hw/ARM/codereset.h> 88 89 //-------------------------------------------------------------------------------- 90 MakeDisableAllCommand(bit32 * command)91 bit32* MakeDisableAllCommand( bit32* command ) 92 { 93 // Disable Shader 94 command = nn::gr::CTR::Shader::MakeDisableCommand( command ); 95 96 // Disable Vertex 97 command = nn::gr::CTR::Vertex::MakeDisableCommand( command ); 98 99 // Disable Fog/Gas 100 command = nn::gr::CTR::Fog::MakeDisableCommand( command ); 101 102 // Disable FragmentLight 103 command = nn::gr::CTR::FragmentLight::MakeDisableCommand( command ); 104 105 // Disable Texture 106 command = nn::gr::CTR::Texture::MakeDisableCommand( command ); 107 108 // Disable Early depth 0x62[0:0] 109 *command++ = 0x0; 110 *command++ = PICA_CMD_HEADER_SINGLE_BE( PICA_REG_EARLY_DEPTH_TEST1, 0x1 ); 111 // Disable Early depth 0x118[0:0] 112 *command++ = PICA_CMD_HEADER_SINGLE_BE( PICA_REG_EARLY_DEPTH_TEST2, 0x1 ); 113 *command++ = 0x0; 114 115 // Disable Clipping Plane 0x47[0:0] 116 *command++ = 0x0; 117 *command++ = PICA_CMD_HEADER_SINGLE_BE( PICA_REG_FRAGOP_CLIP, 0x1 ); 118 119 // Disable RenderState 120 command = nn::gr::CTR::RenderState::MakeDisableCommand( command ); 121 122 return command; 123 } 124 125 } // namespace CTR 126 } // namespace gr 127 } // namespace nn 128