1 /*---------------------------------------------------------------------------*
2 Project: NintendoWare
3 File: gfx_GlImplement.cpp
4
5 Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc. All rights reserved.
6
7 These coded instructions, statements, and computer programs contain proprietary
8 information of Nintendo and/or its licensed developers and are protected by
9 national and international copyright laws. They may not be disclosed to third
10 parties or copied or duplicated in any form, in whole or in part, without the
11 prior written consent of Nintendo.
12
13 The content herein is highly confidential and should be handled accordingly.
14
15 $Revision: $
16 *---------------------------------------------------------------------------*/
17 /*------------------------------------------------------------------------------*/
18 /* */
19 /* Copyright (c) 2009, Digital Media Professionals Inc. All rights reserved. */
20 /* */
21 /*------------------------------------------------------------------------------*/
22
23 #include <nw/gfx/gfx_GlImplement.h>
24
25
26 //===============================================================
27 //
28 // WARNING: このヘッダーに含まれるAPIや構造体を直接参照しないでください。
29 //
30 //===============================================================
31
32 namespace nw {
33 namespace gfx {
34 namespace internal {
35
36 //---------------------------------------------------------------------------
37 void
nwgfxAddVramDmaCommand(void * srcaddr,void * dstaddr,GLsizei size)38 nwgfxAddVramDmaCommand(void* srcaddr, void* dstaddr, GLsizei size)
39 {
40 nngxAddVramDmaCommand( srcaddr, dstaddr, size);
41 }
42
43 //---------------------------------------------------------------------------
44 void
nwgfxClear(u32 colorAddr,u32 colorSize,u32 clearColor,u32 colorWidth,u32 depthAddr,u32 depthSize,u32 clearDepth,u32 depthWidth)45 nwgfxClear(
46 u32 colorAddr, u32 colorSize, u32 clearColor, u32 colorWidth,
47 u32 depthAddr, u32 depthSize, u32 clearDepth, u32 depthWidth
48 )
49 {
50 nngxAddMemoryFillCommand(
51 reinterpret_cast<GLvoid*>(colorAddr), colorSize, clearColor, colorWidth,
52 reinterpret_cast<GLvoid*>(depthAddr), depthSize, clearDepth, depthWidth
53 );
54 }
55
56 //---------------------------------------------------------------------------
57 void
GetFrameBufferState(GLuint fboID,u32 * pColorAddr,u32 * pDepthAddr)58 GetFrameBufferState(
59 GLuint fboID,
60 u32* pColorAddr,
61 u32* pDepthAddr
62 )
63 {
64 glBindFramebuffer( GL_FRAMEBUFFER, fboID );
65
66 if ( pColorAddr )
67 {
68 s32 renderID;
69 s32 addr;
70
71 glGetFramebufferAttachmentParameteriv(
72 GL_FRAMEBUFFER,
73 GL_COLOR_ATTACHMENT0,
74 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME,
75 &renderID );
76
77 glBindRenderbuffer(GL_RENDERBUFFER, renderID);
78
79 glGetRenderbufferParameteriv(
80 GL_RENDERBUFFER,
81 GL_RENDERBUFFER_DATA_ADDR_DMP,
82 &addr );
83
84 *pColorAddr = static_cast<u32>(addr);
85 }
86
87 if ( pDepthAddr )
88 {
89 s32 renderID;
90 s32 addr;
91
92 glGetFramebufferAttachmentParameteriv(
93 GL_FRAMEBUFFER,
94 GL_DEPTH_ATTACHMENT,
95 GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME,
96 &renderID );
97
98 glBindRenderbuffer(GL_RENDERBUFFER, renderID);
99
100 glGetRenderbufferParameteriv(
101 GL_RENDERBUFFER,
102 GL_RENDERBUFFER_DATA_ADDR_DMP,
103 &addr );
104
105 *pDepthAddr = static_cast<u32>(addr);
106 }
107 }
108
109 } // namespace internal
110 } // namespace gfx
111 } // namespace nw
112
113
114